[PHPCR-34] replacing a document fails Created: 13/Nov/11 Updated: 22/Feb/12 Resolved: 22/Feb/12 |
|
| Status: | Resolved |
| Project: | Doctrine PHPCR |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | David Buchmann | Assignee: | Jordi Boggiano |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
when we have a saved document and remove that, then add a document at the same path without a flush in between, we get an exception. the reason is that persist already adds the phpcr node, but scheduleRemove does not remove the phpcrnode right away. the fix looks like it should be: but this leads to a problem that is either in jackalope or the phpcr-odm about /functional/user/phpcr:class being not found. 1) Doctrine\Tests\ODM\PHPCR\Functional\BasicCrudTest::testRemoveAndInsert /home/david/liip/symfony-cmf/cmf-sandbox/vendor/symfony-cmf/vendor/doctrine-phpcr-odm/lib/vendor/jackalope/src/Jackalope/Node.php:303 |
| Comments |
| Comment by Lukas Kahwe [ 17/Nov/11 ] |
|
imho this is now fixed. it will throw an \InvalidArgumentException that the document is detached. I have added relevant tests. i have also created a ticket to add something to the persistence interfaces to make it possible to ensure that a node is cleared back to defaults for all fields not being persisted: http://www.doctrine-project.org/jira/browse/DCOM-77 |
| Comment by David Buchmann [ 23/Jan/12 ] |
|
i still have a problem with this. doing if ($old_node = $this->dm->find(null, $path)) { $this->dm->remove($old_node); } $menuitem = new MultilangMenuItem(); $this->dm->persist($menuitem); leads to an exception. but imo i should be able to do this? what if i want to change the type of document at this location? InvalidArgumentException Exception trace: |
| Comment by Lukas Kahwe [ 02/Feb/12 ] |
|
I guess this is related to adding DocumentManager::merge() |
| Comment by Lukas Kahwe [ 22/Feb/12 ] |
|
duplicate of http://www.doctrine-project.org/jira/browse/PHPCR-13 |