[DDC-1939] Trying to save ManyToMany relatrionship Created: 23/Jul/12 Updated: 29/Jul/12 Resolved: 29/Jul/12 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.2 |
| Fix Version/s: | 2.2.3, 2.3 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Jeremie Tom tom | Assignee: | Marco Pivetta |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
When i try to save a many to many relationship i have to following error Fatal error: Call to a member function getOwner() on a non-object in Doctrine/ORM/Persisters/ManyToManyPersister.php on line 181 It tries to call getOwner on the following array ($mapping) array(19) { [1] => array(6) { ["name"] => string(3) "uid" ["referencedColumnName"] => string(3) "uid" ["unique"] => bool(false) ["nullable"] => bool(true) ["onDelete"] => NULL ["columnDefinition"] => NULL } } } ["joinTableColumns"] => array(3) { [0] => string(13) "mch_accountid" [1] => string(3) "uid" [2] => string(10) "resourceid" }["relationToTargetKeyColumns"] => array(1) { ["resourceid"] => string(10) "resourceid" }} |
| Comments |
| Comment by Marco Pivetta [ 23/Jul/12 ] |
|
Can you try to replace your cache with an `ArrayCache` and see if the problem may come from there? |
| Comment by Jeremie Tom tom [ 23/Jul/12 ] |
|
I'm already using an ArrayCache for my cache. Also for my bootstrap I'm using this implementation of it : https://github.com/guilhermeblanco/ZendFramework1-Doctrine2. Here is how i interact with the collection. $collection->clear(); ... Later on ... $this->_em->persist($userAccount); |
| Comment by Jeremie Tom tom [ 24/Jul/12 ] |
|
I don't know if it helps but it works if I replace $mapping with $coll on line 181 : $sourceClass = $this->_em->getClassMetadata(get_class($mapping->getOwner())); Replaced by : $sourceClass = $this->_em->getClassMetadata(get_class($coll->getOwner())); |
| Comment by Marco Pivetta [ 24/Jul/12 ] |
|
Looks like code coming from the (removed) AssociationMapping class. The fix seems also to be valid. I'm patching this. |
| Comment by Marco Pivetta [ 24/Jul/12 ] |
|
Nevermind, I don't think this needs a test. It is just something overlooked during a refactoring. Being handled at |
| Comment by Marco Pivetta [ 24/Jul/12 ] |
|
Could you please provide the models anyway? It would be interesting to see why the test suite doesn't cover that part |
| Comment by Jeremie Tom tom [ 24/Jul/12 ] |
|
Ok I attached it. Tell me if you need more informations i didn't upload the full models. But just the parts i thought were relevant. |
| Comment by Benjamin Eberlei [ 29/Jul/12 ] |
|
Fixed and applied to 2.2.3 and 2.3 |