0
votes

I have an extension in TYPO3 7.6 where one frontend user can be selected in backend (single select). In backend I can select user and in database user-id is correct set. But if I debug datas in frontend, user object is always "null".

I do not know how this can happen, because a few months ago everything worked fine. Maybe I changed somewhere somenthing, but I can not find out, what is wrong. Here some errors:

On detail view controller I need uid of selected user, but I get error:

Call to a member function getUid() on null

On frontend user can add some new data and user-uid is set, but I also get an error:

#1297933823: Object of type TYPO3\CMS\Extbase\Domain\Model\FrontendUser with identity "257" not found.

User with id 257 exists and is not hidden or deleted, because this id is from logged-in user (I get by $GLOBALS['TSFE']->fe_user->user['uid']).

Anybody an idea, what could be wrong?

Here is setup from model:

/**
 * Returns the user
 *
 * @return \TYPO3\CMS\Extbase\Domain\Model\FrontendUser user
 */
public function getUser()
{
    return $this->user;
}

/**
 * Sets the user
 *
 * @param \TYPO3\CMS\Extbase\Domain\Model\FrontendUser $user
 * @return void
 */
public function setUser(\TYPO3\CMS\Extbase\Domain\Model\FrontendUser $user)
{
    $this->user = $user;
}

Thanks for help! Martin

2
Can you add your TCA definition for your field user?StatiX
yes: 'user' => array( 'exclude' => 1, 'label' => 'LLL:EXT:xxx/Resources/Private/Language/locallang_db.xlf:tx_xxx_domain_model_xxx.user', 'config' => array( 'type' => 'select', 'renderType' => 'selectSingle', 'foreign_table' => 'fe_users', 'minitems' => 0, 'maxitems' => 1, ), ),matin
Try to change type to group and add 'internal_type' => 'db',StatiX
If I add this, user is not visible in backend ...?matin

2 Answers

2
votes

I found issue ... another extension was extending feuser and extension was not correct setup.

0
votes

According to the documentation, you should use the type group https://docs.typo3.org/typo3cms/TCAReference/ColumnsConfig/Type/Group.html#type-group.

Your TCA should look like this :

'user' => [
    'label' => 'User',
    'config' => [
        'type' => 'group',
        'internal_type' => 'db',
        'allowed' => 'fe_users',
        'foreign_table' => 'fe_users',
        'minitems' => 0,
        'maxitems' => 1,
    ],
],