Description
Q | A |
---|---|
Version | 2.0.5 |
Support Question | yes |
Bug Report | for me yes |
Support Question
I have implemented a custom collection for a field that extends from ArrayCollection
class MyCollection extends ArrayCollection
{
public function customFunction()
}
class MyDoc {
/**
* @ReferenceMany(
* collectionClass=MyCollection::class,
* targetDocument=Document::class,
* orphanRemoval=true,
* strategy="atomicSetArray",
* cascade={"persist"}
* )
*/
private $collection = null;
}
The save operation works without problem, however, when trying to load the saved entity, the collection
field loads with ArrayCollection
instead of MyCollection
, this makes calls to MyCollection::customFunction
fail, is this the correct behavior ?, I would expect the collectionClass to be instantiated on save as well as on data fetch
also the generated wrapper persistent class make use of \Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface
which generates a notice
1x: The "Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionInterface" interface is considered internal. It may change without further notice. You should not use it from
PersistentCollections\MyCollectionPersistent`