in symfony we can access many-to-many relations with getter functions which return objects of ArrayCollection type.
for example for getting Alex's students we can call $alex->getStudens()
, then i have access to ale's studens object.
now my question is how i can access alex's students id's in array, for example by calling $alex->getStudentsIds()
it returns {1,5,7,12,..} , which are his students's ids.