Feature #37446
cascade persist on party to store accounts
Status: | Rejected | Start date: | 2012-05-23 | |
---|---|---|---|---|
Priority: | Could have | Due date: | ||
Assigned To: | Adrian Föder | % Done: | 0% |
|
Category: | - | |||
Target version: | - |
Description
currently,
1abstract class AbstractParty {
2
3 /**
4 * @var \Doctrine\Common\Collections\Collection<\TYPO3\FLOW3\Security\Account>
5 * @ORM\OneToMany(mappedBy="party")
6 */
7 protected $accounts;
In very common use cases where a Party is created during a registration process, both the Party and the Account has to be persisted manually using the (injected) repository each.
I suggest to add a cascade=persist to that property, like
1abstract class AbstractParty {
2
3 /**
4 * @var \Doctrine\Common\Collections\Collection<\TYPO3\FLOW3\Security\Account>
5 * @ORM\OneToMany(mappedBy="party", cascade="persist")
6 */
7 protected $accounts;
This would make the following steps be sufficient for a person/party creation:
1$person = new \TYPO3\Party\Domain\Model\Person();
2$person->setPersonName(new \TYPO3\Party\Domain\Model\PersonName('', $firstName, '', $lastName));
3
4$account = $this->accountFactory->createAccountWithPassword($email, $password);
5$person->addAccount($account);
6
7$this->partyRepository->add($person);
...do you agree?
History
#1 Updated by Gerrit Code Review about 3 years ago
- Status changed from New to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/11550
#2 Updated by Karsten Dambekalns about 3 years ago
- Subject changed from persist all on accounts to cascade persist on party to store accounts
#3 Updated by Karsten Dambekalns about 3 years ago
- Status changed from Under Review to Rejected
- Assigned To set to Adrian Föder