I have the user object who has manytomany relation with Group entity.
But i want that by default the user should be added to Group Group_User which has id=4 in database.
Now how can i add that in User constructor
How can use query in Entity class
You can pass what you want in your User constructor. You’ll have to pass it from your controller (where your queryManger is available).
In your controller:
In your construct:
When you’ll persist your user entity in the controller, the user and it’s group relation will be directly saved.