Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: UnitOfWork
-
Labels:None
-
Environment:OS X 10.6.4, PHP 5.3.2, Mongo 1.6.3 (can reproduce on Ubuntu 8.04.4 LTS, CentOS, Win 7, etc)
Description
UnitOfWork incorrectly contains every managed document with embedded documents. All embedded documents are marked as updated. The whole mess will be updated on the next flush, regardless of whether said documents have actually changed.
Branch here: http://github.com/opensky/mongodb-odm/tree/MODM-83
Test case here: http://github.com/opensky/mongodb-odm/commit/af4373b58dd5da0bea5a0f8c4da30dde5ed1f266
Here's what the document changeset looks like in preUpdate and postUpdate:
preUpdate "Doctrine\ODM\MongoDB\Tests\Functional\Ticket\MODM83OtherDocument"
array(1) {
["name"]=>
array(2) {
[0]=>
string(8) "Neighbor"
[1]=>
string(3) "Bob"
}
}
postUpdate "Doctrine\ODM\MongoDB\Tests\Functional\Ticket\MODM83OtherDocument"
array(1) {
["name"]=>
array(2) {
[0]=>
string(8) "Neighbor"
[1]=>
string(3) "Bob"
}
}
preUpdate "Doctrine\ODM\MongoDB\Tests\Functional\Ticket\MODM83TestDocument"
array(1) {
["embedded"]=>
array(2) {
[0]=>
array(1) {
["name"]=>
string(5) "Child"
}
[1]=>
array(2) {
["name"]=>
string(5) "Child"
["originalObject"]=>
object(Doctrine\ODM\MongoDB\Tests\Functional\Ticket\MODM83TestEmbeddedDocument)#86 (1) {
["name"]=>
string(5) "Child"
}
}
}
}
postUpdate "Doctrine\ODM\MongoDB\Tests\Functional\Ticket\MODM83TestDocument"
array(1) {
["embedded"]=>
array(2) {
[0]=>
array(1) {
["name"]=>
string(5) "Child"
}
[1]=>
array(2) {
["name"]=>
string(5) "Child"
["originalObject"]=>
object(Doctrine\ODM\MongoDB\Tests\Functional\Ticket\MODM83TestEmbeddedDocument)#86 (1) {
["name"]=>
string(5) "Child"
}
}
}
}
Fixed here http://github.com/doctrine/mongodb-odm/commit/8bd3aef4055cfded62687d5ad0e762e3f12a473d