Reputation: 313
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
Upvotes: 0
Views: 275
Reputation: 313
I found issue ... another extension was extending feuser and extension was not correct setup.
Upvotes: 2
Reputation: 874
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,
],
],
Upvotes: 0