[Flow] One-To-One Bidirectional only one site available
Axel Wüstemann
awu at qbus.de
Sat Jan 25 12:21:07 CET 2014
Thank you, it was very easy to implement it this way.
Am 25.01.2014 11:40, schrieb Martin Keck:
> Hi Alex,
>
> afaik you have to set the bidirection manually, meaning you set object 1 on object 2 and vice versa. Example:
>
> // create the objects --> for sure those objects could come from a form or something else
> $scheduledPayment = new \Qbus\Bestdesq\Project\Domain\Model\ScheduledPayment();
> $invoice = new \Qbus\Bestdesq\Project\Domain\Model\Invoice();
>
> // connect the objects to each other
> $invoice->setScheduledPayment($scheduledPayment);
> $scheduledPayment->setInvoice($invoice);
>
> // add one object to its repository
> $this->invoiceRepository->add($invoice);
>
> Another way could be to create an (empty) scheduledPayment of the invoice in the constructor of invoice and establish the connection already when the invoice is created:
>
> public function __construct() {
> $scheduledPayment = new \Qbus\Bestdesq\Project\Domain\Model\ScheduledPayment();
> $scheduledPayment->setInvoice($this);
> $this->setScheduledPayment($scheduledPayment);
> }
>
> The properties of scheduledPayment could then be changed later.
>
> Hope that helps.
>
> Greetings
> Martin
>
More information about the Flow
mailing list