[FLOW3-general] CONFIGURATION_CREATION_ALLOWED
"Christian Müller (FLOW3 Team)"
christian.mueller at typo3.org
Tue Feb 28 14:06:39 CET 2012
Hi Mattias,
notice that you only set "allowModification..." and not
"allowCreation...", which is what the PropertyMapper complains about.
Probably you create a new "Name" object with your form.
So add:
$this->arguments['account']->getPropertyMappingConfiguration()->allowCreationForSubProperty('party.name');
to your initalizeUpdateAction()
Cheers,
Christian
On 28/02/12 13:37, Mattias Nilsson wrote:
> Hello everybody,
>
> I have a problem based on an edit form for a user based on the TYPO3.Party
> package. I have extended the AccountController in the same way as the
> TYPO3.Blog example, but I get this error message when trying to update a
> user:
>
> *#1297759968: Exception while property mapping at property path
> "party.name":Creation
> of objects not allowed. To enable this, you need to set the
> PropertyMappingConfiguration Value "CONFIGURATION_CREATION_ALLOWED" to TRUE
>
> My controller has this functions:
>
> /**
> * Displays a form for setting a new password and / or username
> *
> * @return string An HTML form for editing the account properties
> */
> public function editAction() {
> $activeTokens = $this->securityContext->getAuthenticationTokens();
> foreach ($activeTokens as $token) {
> if ($token->isAuthenticated()) {
> $account = $token->getAccount();
> $this->view->assign('account', $account);
> break;
> }
> }
> }
>
> /**
> * @return void
> */
> public function initializeUpdateAction() {
>
> $this->arguments['account']->getPropertyMappingConfiguration()->setTargetTypeForSubProperty('party',
> '\TYPO3\Party\Domain\Model\Person');
>
> $this->arguments['account']->getPropertyMappingConfiguration()->allowModificationForSubProperty('party');
>
> $this->arguments['account']->getPropertyMappingConfiguration()->allowModificationForSubProperty('
> party.name');
> }
>
> /**
> * Updates the account properties
> *
> * @param TYPO3\FLOW3\Security\Account $account
> * @param string $password
> * @return void
> */
> public function updateAction(\TYPO3\FLOW3\Security\Account $account,
> $password = '') {
> if ($password != '') {
>
> $account->setCredentialsSource($this->hashService->hashPassword($password));
> }
>
> $this->accountRepository->update($account);
> $this->partyRepository->update($account->getParty());
> $this->addFlashMessage('Your account details have been updated.');
> $this->redirect('index', 'Login');
> }
>
>
> I have really tried to find a solution, is there anybody with the same
> problem?
>
> Thanks in advance
> /Mattias
> *
More information about the FLOW3-general
mailing list