diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php index 8120352c7..e10acd9da 100644 --- a/lib/Doctrine/ORM/UnitOfWork.php +++ b/lib/Doctrine/ORM/UnitOfWork.php @@ -902,7 +902,9 @@ class UnitOfWork implements PropertyChangedListener $actualData = array(); foreach ($class->reflFields as $name => $refProp) { - if ( ! $class->isIdentifier($name) || ! $class->isIdGeneratorIdentity()) { + if (( ! $class->isIdentifier($name) || ! $class->isIdGeneratorIdentity()) + && ($name !== $class->versionField) + && ! $class->isCollectionValuedAssociation($name)) { $actualData[$name] = $refProp->getValue($entity); } } @@ -913,9 +915,7 @@ class UnitOfWork implements PropertyChangedListener foreach ($actualData as $propName => $actualValue) { $orgValue = isset($originalData[$propName]) ? $originalData[$propName] : null; - if (is_object($orgValue) && $orgValue !== $actualValue) { - $changeSet[$propName] = array($orgValue, $actualValue); - } else if ($orgValue != $actualValue || ($orgValue === null ^ $actualValue === null)) { + if ($orgValue !== $actualValue) { $changeSet[$propName] = array($orgValue, $actualValue); } } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3033Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3033Test.php index cdc6c7b6c..4cb78d399 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3033Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3033Test.php @@ -20,11 +20,11 @@ class DDC3033Test extends \Doctrine\Tests\OrmFunctionalTestCase )); $user = new DDC3033User(); - $user->title = "Test User"; + $user->name = "Test User"; $this->_em->persist($user); $user2 = new DDC3033User(); - $user2->title = "Test User 2"; + $user2->name = "Test User 2"; $this->_em->persist($user2); $product = new DDC3033Product(); @@ -135,5 +135,5 @@ class DDC3033User * * @Column(name="title", type="string", length=255) */ - public $title; + public $name; }