I've took some closer look on the case of collection type hinting. Firstly, the setter is mandatory, so sorry for my previous comment, secondly ONGR collection class is deprecated and not recommended anymore, in stead I changed the type hinting to use Doctrine\Common\Collections\Collection interface, because this includes both Doctrine\Common\Collections\ArrayCollection that is recommended by the ONGR collection deprecation message (see here: https://github.com/ongr-io/ElasticsearchBundle/blob/a2642ee9549f3906f2d22d88479364ccc1a542f9/Collection/Collection.php#L19) and ONGR\ElasticsearchBundle\Result\ObjectIterator that ONGR ES bundle uses when lazy loading the results after search.
However, this is a potential place to pay close attention to in the future, because I contacted the maintainer of the ONGR project and I was informed that this is a known issue in ONGR ES bundle and will be attended to in the comming months.
I've took some closer look on the case of collection type hinting. Firstly, the setter is mandatory, so sorry for my previous comment, secondly ONGR collection class is deprecated and not recommended anymore, in stead I changed the type hinting to use
Doctrine\Common\Collections\Collection
interface, because this includes bothDoctrine\Common\Collections\ArrayCollection
that is recommended by the ONGR collection deprecation message (see here: https://github.com/ongr-io/ElasticsearchBundle/blob/a2642ee9549f3906f2d22d88479364ccc1a542f9/Collection/Collection.php#L19) andONGR\ElasticsearchBundle\Result\ObjectIterator
that ONGR ES bundle uses when lazy loading the results after search. However, this is a potential place to pay close attention to in the future, because I contacted the maintainer of the ONGR project and I was informed that this is a known issue in ONGR ES bundle and will be attended to in the comming months.Closes #95