Reputation: 35
In a Symfony 2.8 controller, I get a field data with an association inverse side named owners
.
At this point I have $form->get('foo')->getData()->getOwners()->getInitialized === false
.
After that I perform some complex DQL query which can be simplified as :
"SELECT foo, owners
FROM Foo foo
LEFT JOIN foo.owners owners WITH IDENTITY(owners.bar) = 1
"
The important part is that there are several owners pointing on foo, but in the query we return only one of them, which makes subsequent calls to foo->getOwners()
returning only one owner.
I see it as something dangerous because it means that accessing data via a DQL SELECT requests can actually makes you manipulate an association inverse side that is not synchronized with the database. I would not expect a SELECT request to do this kind of things.
Thanks
Upvotes: 0
Views: 47