I am using doctrine's event listener class to implement logging of the DB events. I am using postUpdate event. I have an embedded document within my mongoDB document. Within the postUpdate event, when I call the $uow->getDocumentChangeSet($entity)
method, I am only getting the changed values in the change set object. e.g.
[0]=>
object(Tyre24\ProductBundle\Document\Translations)#1178 (1) {
["translations":protected]=>
object(Doctrine\ODM\MongoDB\PersistentCollection)#1216 (10) {
["snapshot":"Doctrine\ODM\MongoDB\PersistentCollection":private]=>
array(0) {
}
["coll":"Doctrine\ODM\MongoDB\PersistentCollection":private]=>
object(Doctrine\Common\Collections\ArrayCollection)#1217 (1) {
["_elements":"Doctrine\Common\Collections\ArrayCollection":private]=>
array(1) {
[0]=>
object(Tyre24\ProductBundle\Document\Translation)#1227 (3) {
["key":protected]=>
string(11) "testkey_new"
["language":protected]=>
string(5) "xx_XX"
["value":protected]=>
string(9) "testvalue"
}
}
}
}
}
[1]=>
object(Tyre24\ProductBundle\Document\Translations)#1178 (1) {
["translations":protected]=>
object(Doctrine\ODM\MongoDB\PersistentCollection)#1216 (10) {
["snapshot":"Doctrine\ODM\MongoDB\PersistentCollection":private]=>
array(0) {
}
["coll":"Doctrine\ODM\MongoDB\PersistentCollection":private]=>
object(Doctrine\Common\Collections\ArrayCollection)#1217 (1) {
["_elements":"Doctrine\Common\Collections\ArrayCollection":private]=>
array(1) {
[0]=>
object(Tyre24\ProductBundle\Document\Translation)#1227 (3) {
["key":protected]=>
string(11) "testkey_new"
["language":protected]=>
string(5) "xx_XX"
["value":protected]=>
string(9) "testvalue"
}
}
}
}
}
}
Here the first element of the change set array should reflect the older state of the embedded document, but it always shows the same (new) document in both the array indexes. For documents with no embedded documents, it works fine. Any idea?