[FLOW3-general] Problem with Partypackage
Regine Rosewich
regine.rosewich at hoellenberg.biz
Thu Aug 9 13:50:17 CEST 2012
Hi Martin,
you have to persist the party object before you can create the account and
add the party-object to the account.
This is the way it is handled in the TYPO3.TYPO3 Package
$user = new \De\Welu\WeluPdm\Domain\Model\User();
$name = new \TYPO3\Party\Domain\Model\PersonName('',
$firstName, '', $lastName, '', $identifier);
$user->setName($name);
$user->getPreferences()->set('context.workspace', 'user-' .
$identifier);
$this->partyRepository->add($user);
$account =
$this->accountFactory->createAccountWithPassword($identifier, $password,
array(<<role>>), <<Provider>>');
$account->setParty($user);
$this->accountRepository->add($account);
Hope it helps.
Regine
> -----Ursprüngliche Nachricht-----
> Von: flow3-general-bounces at lists.typo3.org [mailto:flow3-general-
> bounces at lists.typo3.org] Im Auftrag von Martin
> Gesendet: Donnerstag, 9. August 2012 12:58
> An: flow3-general at lists.typo3.org
> Betreff: [FLOW3-general] Problem with Partypackage
>
> Dear List,
>
> I have massive problems implementing the partypackage.
>
> By now I extended the \TYPO3\Party\Domain\Model\Person(); set the name
> with PersonName()
>
> this is all working until I try to add this Party to the account.
>
> $account = $this->accountFactory->createAccountWithPassword($name,
> $pass, array($defaultRole));
>
> $this->accountRepository->add($account);
>
> $studentName = new \TYPO3\Party\Domain\Model\PersonName('', 'erster',
> 'mitte','letzter');
>
> $student = new \TYPO3\Party\Domain\Model\Person();
> $student->setName($studentName);
> $student->addAccount($account);
> $this->persistenceManager->persistAll();
>
> I will get this Error
> 'A new entity was found through the relationship
> 'TYPO3\FLOW3\Security\Account#party' that was not configured to cascade
> persist operations for entity:
> TYPO3\Party\Domain\Model\Person at 0000000037e9c9080000000061f869ce. To
> solve this issue: Either explicitly call EntityManager#persist() on
> this unknown entity or configure cascade persist this association in
> the mapping for example @ManyToOne(..,cascade={"persist"}). If you
> cannot find out which entity causes the problem implement
> 'TYPO3\Party\Domain\Model\AbstractParty#__toString()' to get a clue. '
>
> But I don't get a clue how to fix that. Even I tried to add Person()
> directly.
>
> Can anyone give me a hint to solve this problem?
>
> Cheers
>
> Martin
>
> _______________________________________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
More information about the FLOW3-general
mailing list