[TYPO3-mvc] "Call to a member function attach() on a non-object" when using addUserGroup()
Christian Essl
essl at incert.at
Wed Mar 7 11:18:45 CET 2012
Hi
Extbase is driving me crazy here.... I try to create a new user and add an existing userGroup:
if(!is_object($user))
{
$newUser = new Tx_Kbs_Domain_Model_User();
// set the userData
$userGroupRepository = t3lib_div::makeInstance('Tx_Extbase_Domain_Repository_FrontendUserGroupRepository');
$userGroup = $userGroupRepository->findByUid(3);
$newUser->addUserGroup($userGroup);
$this->userRepository->add($newUser);
}
The groups Record Type is set to "Tx_Extbase_Domain_model_FrontendUserGroup".
Now when I try to attach the UserGroup by "addUserGroup", I get the following error:
Call to a member function attach() on a non-object in /usr/www/users/ltcdwu/typo3/sysext/extbase/Classes/Domain/Model/FrontendUser.php on line 215
What is wrong there? There obviously is a UserGroup with uid 3.
The new Users Record Type is set to the one from my extension. (Not to "Tx_Extbase_Domain_model_FrontendUser) Maybe this is the problem?
More information about the TYPO3-project-typo3v4mvc
mailing list