Details
Description
The error is: "The class 'Doctrine\ORM\Persisters\ManyToManyPersister' was not found in the chain configured namespaces"
Replicate by making an entity which has a property which is self referencing; e.g. http://docs.doctrine-project.org/en/latest/reference/association-mapping.html#many-to-many-self-referencing .
For example an Album could be related to any other similar albums. An album entity would have a property 'relatedAlbums' which is an ArrayCollection. Similarly, I could be working on a CMS where any piece of content could be related to any other in order to show a "related content" or "related posts" style list on a web page.
Using Symfony 2.1 and a Symfony Form with FormBuilder make sure to use the 'by_reference' => false to call the setter for the property. In the setter for the property: https://gist.github.com/3879169
A similar question has been asked on StackOverflow: http://stackoverflow.com/questions/12077084/doctrine2-manytomany-self-referencing
Activity
| Field | Original Value | New Value |
|---|---|---|
| Description |
The error is: "The class 'Doctrine\ORM\Persisters\ManyToManyPersister' was not found in the chain configured namespaces"
Replicate by making an entity which has a property which is self referencing; e.g. http://docs.doctrine-project.org/en/latest/reference/association-mapping.html#many-to-many-self-referencing . For example an Album could be related to any other similar albums. An album entity would have a property 'relatedAlbums' which is an ArrayCollection. Similarly, I could be working on a CMS where any piece of content could be related to any other in order to show a "related content" or "related posts" style list on a web page. Using Symfony 2.1 and a Symfony Form with FormBuilder make sure to use the 'by_reference' => false to call the setter for the property. In the setter for the property: /** * @param ArrayCollection $related Related item */ public function setRelated(ArrayCollection $related) { $this->related = $related; foreach ($related as $relation) { if (! $relation->getRelated()->contains($this)) { $relation->addRelation($this); } } } The addRelation($relation) method simply adds the relation to the related property: $this->related[] = $relation; ...and checks to see if the inverse relation needs to be added: if (! $relation->getRelated()->contains($this)) { $relation->addRelation($this); } A similar question has been asked on StackOverflow: http://stackoverflow.com/questions/12077084/doctrine2-manytomany-self-referencing |
The error is: "The class 'Doctrine\ORM\Persisters\ManyToManyPersister' was not found in the chain configured namespaces"
Replicate by making an entity which has a property which is self referencing; e.g. http://docs.doctrine-project.org/en/latest/reference/association-mapping.html#many-to-many-self-referencing . For example an Album could be related to any other similar albums. An album entity would have a property 'relatedAlbums' which is an ArrayCollection. Similarly, I could be working on a CMS where any piece of content could be related to any other in order to show a "related content" or "related posts" style list on a web page. Using Symfony 2.1 and a Symfony Form with FormBuilder make sure to use the 'by_reference' => false to call the setter for the property. In the setter for the property: https://gist.github.com/3879169 A similar question has been asked on StackOverflow: http://stackoverflow.com/questions/12077084/doctrine2-manytomany-self-referencing |
| Comment |
[ I just encountered the same error. I think the problem lies more in the Symfony form component and PHP than Doctrine, but I think the error handling in Doctrine could be a bit more helpful.
The reason this exception is raised, is because 'owner' on the PC is null. Doctrine now tries to retrieve the class of the owner, but because the owner is null, PHP's "get_class" function returns the class where the function was called from. In this case ManyToManyPersister. Of course, no class metadata can be found for this class :) So basically this exception's root cause is that the owner of the PC is null (this is caused by the Symfony Form component). Perhaps Doctrine could check whether owner is null and throw a meaningful exception instead? ] |
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Fix Version/s | 2.3.1 [ 10323 ] | |
| Resolution | Fixed [ 1 ] |
| Resolution | Fixed [ 1 ] | |
| Status | Resolved [ 5 ] | Reopened [ 4 ] |
| Status | Reopened [ 4 ] | Closed [ 6 ] |
| Resolution | Fixed [ 1 ] |
- Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-2074, expand=changesets[-21:-1].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)
I need a stacktrace for this error, i have no clue why this happens and where.