use Doctrine\Common\Collections\ArrayCollection; $collection = new ArrayCollection();
$object1 = new MyClass(); $object2 = new MyClass(); $collection->add($object1); $collection->add($object2);
$object1 = $collection->get(0); $object2 = $collection->get(1);
$collection->removeElement($object1);Determining the package library for ArrayCollection is quite simple - it is part of the Doctrine Common library. This library provides a common set of functionality that is used across the various Doctrine projects, including libraries for ORM, MongoDB ODM, and more.