Doctrine child properties lazy loading

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Doctrine child properties lazy loading



I am trying to retrieve entities from database using lazy loading.



Considering the following structure :



User.php


class User

private id;
private groups;



Group.php


class Group

private id;
private users;



With a manyToMany relation between both entities.



When I call find() on my UserRepository, I got as a result a User object with nested Group objects in groups property.



I would like to get an array containing the groups ids in the groups property, instead of a Group collection.



I tried to use fetch="EXTRA_LAZY" on the child entities but that had no effect.



Some help to achieve this would be very appreciated.





Possible duplicate of Get only list of ID's from ManyToMany with Doctrine
– iainn
Aug 10 at 15:49





That lead me to the solution, thank you.
– Reliquat
Aug 13 at 13:22









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard