use Doctrine\Common\Collections\ArrayCollection; $collection = new ArrayCollection([ new Object(), new Object(), new Object(), ]); // Get the collection $objects = $collection->toArray();
use Doctrine\Common\Collections\ArrayCollection; $collection = new ArrayCollection(); // Add an object to the collection $collection->add(new Object());
use Doctrine\Common\Collections\ArrayCollection; $collection = new ArrayCollection([ new Object(), new Object(), new Object(), ]); // Remove the first object from the collection $collection->remove(0);The Doctrine\Common\Collections\Collection interface is part of the Doctrine Common library, which is a set of reusable components used by many Doctrine projects.