1

I've extend the table fe_users with an extension in TYPO3.
I've implement a form in the frontend where user can add the own company. And when I tried to update the user object (with the CRUD $repository_user->update($user)) nothing happened.

I've mapped the TCA with the new fields and in the backend the new fields are visible. What can I have forgotten?

No error messages, simply nothing happens.

Nemo
  • 2,441
  • 2
  • 29
  • 63
GoatMachine
  • 127
  • 1
  • 13
  • Where are you call the `UserRepository->update`? Do you have maybe an "exit" or "die" after that? – René Pflamm May 30 '17 at 14:11
  • In the controller. In the updateAction. There is no exit, die or something else. I've added the company to the object (works (output with var_dump to check)) and the userRepository->update($user) ... nothing happen – GoatMachine May 30 '17 at 17:47
  • Is the company a relationship to an other domain model? Is the mapping of TCA for the model in the correct? Or is it only a string field? – René Pflamm May 30 '17 at 17:48
  • Is it possible that the storagePID be a problem? It's another id as the pageid. – GoatMachine May 31 '17 at 05:45
  • In backend everything works (create User, add company...) only in frontend not working – GoatMachine May 31 '17 at 05:46

2 Answers2

1

Try to use the persistent manager to persistent all entities like in this answer: https://stackoverflow.com/a/23077743/2327734

Try also to inject the repository if not yet done so.

David
  • 5,882
  • 3
  • 33
  • 44
René Pflamm
  • 3,273
  • 17
  • 29
0

This answer is related to an extbase-implementation only

The model for your new field might be missing.
You've to create an own model for fe_users, that can extend the existing model resided in typo3/sysext/extbase/Classes/Domain/Model/FrontendUser.php but is usually extended by namespace, so the code would be like this:

<?php
namespace Vendor\Extension\Domain\Model;

class FeUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
{

    /**
     * @var string
     */
    $myNewField = ''; /* in Database: `my_new_field` */

    // optional some more code ...


    /**
     * Sets the myNewField value
     *
     * @param string $myNewField 
     * @api
     */
    public function setMyNewField ($myNewField )
    {
        $this->myNewField = $myNewField;
    }

    /**
     * Returns the myNewField value
     *
     * @return string
     * @api
     */
    public function getMyNewField ()
    {
        return $this->myNewField;
    }

}

If you never chose to extend the existing model, you need to include getter- and setter-functions for all fields that might be somehow concerned in context of your own implementation (for some field-types further functions are required).

If your new field has a connection to another table or even represents a node of an mm-connection the model has to be adjusted accordingly, I just entered a simple example.

David
  • 5,882
  • 3
  • 33
  • 44