[FLOW3-general] Relations of created sub-properties

"Christian Müller (Kitsunet)" christian.mueller at typo3.org
Tue Nov 15 08:39:15 CET 2011


On 15/11/11 01:36, Helmut Hummel wrote:
> Dear FLOW3 experts,
>
> I have a simple many to one relation with two objects, one of them being
> the aggregate root. When I now have a form to create the aggregate root
> object with one association, both objects are created, but the relation
> is lost. In my case the "Artist" is not associated to the concert.
>
>
> Of course I can add
>
> foreach ($newConcert->getArtists() as $artist) {
> $artist->setConcert($newConcert);
> }
>
> to the createAction. But it seems a bit odd to me that this is necessary.
>
> I attached the code I have. What am I missing?
>
>
> Kind regards,
> Helmut
>

Hi Helmut,

what you have to do is to explicitly allow the property mapper to create 
new sub objects in a certain action. That seems to be the biggest 
pitfall for many so far :)

Look into the older thread "Initialize create action for an unknown 
number of properties" there is a code example for this, but I think in 
the PropertyMapper Documentation is also something.

Cheers,
Christian


More information about the FLOW3-general mailing list