Kunstmaan / KunstmaanBundlesStandardEdition

The "Kunstmaan Bundles Standard Edition" distribution
http://bundles.kunstmaan.be
MIT License
89 stars 39 forks source link

Related entity in PagePart is not being related to the PagePart #119

Closed schoren closed 9 years ago

schoren commented 9 years ago

Hello. I'm new with the CMS and I'm trying to figure it out. I'm trying to set a pagepart with related entities. In this case, it's a band page, so i'm creating a pagepart called Members where you can add the members of the band to show in the home page. I've been following this tutorial: http://bundles.kunstmaan.be/news/using-sub-entities-in-pageparts

The form shows OK in the admin, but when I save it, the related entities are created with the member_pp_id field NULLed.

Am I missing something here? Where should I check. I don't see anything different from the tutorial.

Thanks!

bobemoe commented 9 years ago

I am following the same example, and having the exact same issue, have you solved this? Or does anyone know where we should start looking?

bobemoe commented 9 years ago

OK, I've worked it out, looks like we did miss something...

From the sub entities example, check you have the equivalent of line 66 of the ContactPagePart class defined on the addWhatever function of your pagepart. This is where the reverse of the relation is set. I had generated my getter/setters with doctrine:generate:entities, looks like it didn’t add this critical line!

This stack overflow post helped me figure it out: http://stackoverflow.com/questions/15050909/symfony2-unable-to-save-parent-id-in-embedded-object