sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.11k stars 1.26k forks source link

OneToMany, subclasses, inline editing #3538

Closed Uplink03 closed 6 years ago

Uplink03 commented 8 years ago

I'm doing some work to get subclassed entities (Doctrine ORM inheritance based on discriminator column) working correctly with the one-to-many inline editor. See these forked repositories: https://github.com/Uplink03/SonataDoctrineORMAdminBundle and https://github.com/Uplink03/SonataAdminBundle

It's almost working, but I've hit a wall and I hope somebody (original author?) could help me finish this.

What happens now is that when I use the "add new" drop down that I have added to my fork I end up with wrong rows. Say I have an abstract base class Base and two classes that extend it: Ext1, Ext2. The code can currently save Ext1 and Ext2 instances fine if all the fields (including a hidden field corresponding to the discriminator column), but if the following fails:

  1. Add new, when only saved rows are shown: the subclass of the last element is chosen rather than the one requested.
  2. Add new, after another new row was added: if the new row's subclass is different from the previous row's subclass, the previous row is cleared and its subclass changed to match the new row's requested subclass. All new rows are updated in this fashion when a new row is appended.

I can't figure out the logic of it, and I can't make it do the right thing. Could anybody point me in the right direction?

jordisala1991 commented 6 years ago

Closing in favor of #4519

Seems like the same issue, if it is not ping me to reopen. Im trying to centralize issues

smilesrg commented 8 months ago

@jordisala1991 seems this issue and related are not fixed