Details
Description
This is the error that i get :
"Argument 1 passed to Doctrine\ORM\UnitOfWork::getCollectionPersister() must be an array, null given, called in /home/vis/projects/CRM/trunk/library/Doctrine/ORM/UnitOfWork.php on line 302 and defined at /home/vis/projects/CRM/trunk/library/Doctrine/ORM/UnitOfWork.php:2149"
This happens when i try to update Entity that have PersistentCollection but when i was creating the entity did not create entities to be attached to it by the PersistentCollection. Later on i called it and and used :
$collectionEntity = $em->getRepository('CollectionEntityName')->findOneBy($data);
$entity = $em->getRepository('EntityName')->findOneBy($entityData);
$entity->getCollection()->add($collectionEntity);
$em->presist();
$em->flush();
Issue Links
- duplicates
-
DDC-767
Updating many-to-many relations
-
After some investigating i did find a solution that seems to work.
In Doctrine\ORM\UnitOfWork;
in the function computeChangeSet()
from line 482
That way i make sure that the owner for the PersistentCollection is set for sure and when it is called in the commit function it does not give errors.
Hope that this solution will work for you.