Feature #37446
cascade persist on party to store accounts
| Status: | Rejected | Start date: | 2012-05-23 | |
|---|---|---|---|---|
| Priority: | Could have | Due date: | ||
| Assignee: | Adrian Föder | % Done: | 0% |
|
| Category: | - | |||
| Target version: | - | |||
| Votes: | 0 |
Description
currently,
1 abstract 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
1 abstract 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
Updated by Gerrit Code Review 12 months 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
Updated by Karsten Dambekalns 12 months ago
- Subject changed from persist all on accounts to cascade persist on party to store accounts
Updated by Karsten Dambekalns 12 months ago
- Status changed from Under Review to Rejected
- Assignee set to Adrian Föder