I want to make a friendlist using ManyToMany self-referencing. I followed this link and it seemms to be good. But Now, what Action should I have in my controller to : 1- get All myFriends / or all all friend of current user 2- add a firend, using a link such as "Add friend"
thank you for your time and answers
in your link my friends is a doctrine array collection, to get the friends of a user just iterate on it and to add a friend just add a friend onto this collection and save the entity (with the entity manager), maybe you ll need to add a cascade persist on the collection to add a new user as friend.
you have to add some methods like getMyFriends, addFriend and removeFriend
in your controller you have to implement an action with
and in your twig template