[TYPO3-mvc] odd relational issue with attach

Toke Herkild th at t3cms.dk
Mon Feb 20 11:40:13 CET 2012


Den 20-02-2012 11:15, Claus Due skrev:
> Hi Toke,
>
>>   $Amodel->addChild($child);
>>   $child->addParent($Amodel);
>
> This does not look correct. If you have an 1:n and an inversed n:1 you should not perform both of these - doing either one on its own should write all the necessary relations. However, you would not be able to properly read those related object before you persist the object and (I believe is necessary too) reload the $aModel from repository.
>
> --
> Cheers,
> Claus
> http://fedext.net

Hi claus,

So I could get about it with
...
$AModel->addChild($child)
$this->repo->update($Amodel);
...

And skip the ropsitory for child ?

going to perform a few more tests.

Regards,
Toke


More information about the TYPO3-project-typo3v4mvc mailing list