You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As the Member mapping using the phone_number, so when Doctrine tries to manage this relationship, seeing that it's persisting a Member with no Attendee, maps the Atendee join coulumn (the phone_number) to null, instead of what was provided.
Thanks for taking the time to comment on this, much appreciated :)
It's this
We don't support mapping a field to both an association and a scalar value: it has to be one of the two.
That I suspected, but couldn't find explicitly mentioned in the docs. Perhaps Doctrine could error when defining an entity like this if it is truly unsupported?
As far as I can tell, using joined table inheritance would still render me unable to make use of the scalar value if that field is also used for the join. Also, in this example an Attendee may exist, who does not inherit from a Member, so it doesn't seem like joined table inheritance at would work here.
The only solution I can think of would be to join the entities outside of Doctrine's automatic associations.
That I suspected, but couldn't find explicitly mentioned in the docs. Perhaps Doctrine could error when defining an entity like this if it is truly unsupported?
I was trying to use Doctrine to add a layer of sense on a legacy database, and the table structure I'm having trouble with looks like this:
members
attendee
An attendee can but may not always be a member.
So with a Mapping something like:
I'm in trouble because I can't create a Member like so:
As the Member mapping using the phone_number, so when Doctrine tries to manage this relationship, seeing that it's persisting a Member with no Attendee, maps the Atendee join coulumn (the phone_number) to null, instead of what was provided.
It's https://github.com/doctrine/doctrine2/blob/v2.5.6/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php#L669 where the joined entity id is overwriting the specicied id, but I guess this is correct functionality.
Any suggestions on how to map this better to overcome this? I can't change this database.
The text was updated successfully, but these errors were encountered: