[DDC-534] Fixed.
This commit is contained in:
parent
39a6c01978
commit
080f737338
@ -2042,9 +2042,15 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
$oid = spl_object_hash($entity);
|
$oid = spl_object_hash($entity);
|
||||||
$class = $this->_em->getClassMetadata(get_class($entity));
|
$class = $this->_em->getClassMetadata(get_class($entity));
|
||||||
|
|
||||||
|
$isAssocField = isset($class->associationMappings[$propertyName]);
|
||||||
|
|
||||||
|
if ( ! $isAssocField && ! isset($class->fieldMappings[$propertyName])) {
|
||||||
|
return; // ignore non-persistent fields
|
||||||
|
}
|
||||||
|
|
||||||
$this->_entityChangeSets[$oid][$propertyName] = array($oldValue, $newValue);
|
$this->_entityChangeSets[$oid][$propertyName] = array($oldValue, $newValue);
|
||||||
|
|
||||||
if (isset($class->associationMappings[$propertyName])) {
|
if ($isAssocField) {
|
||||||
$assoc = $class->associationMappings[$propertyName];
|
$assoc = $class->associationMappings[$propertyName];
|
||||||
if ($assoc->isOneToOne() && $assoc->isOwningSide) {
|
if ($assoc->isOneToOne() && $assoc->isOwningSide) {
|
||||||
$this->_entityUpdates[$oid] = $entity;
|
$this->_entityUpdates[$oid] = $entity;
|
||||||
|
@ -140,6 +140,7 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
$this->assertTrue($this->_unitOfWork->isInIdentityMap($entity));
|
$this->assertTrue($this->_unitOfWork->isInIdentityMap($entity));
|
||||||
|
|
||||||
$entity->setData('newdata');
|
$entity->setData('newdata');
|
||||||
|
$entity->setTransient('newtransientvalue');
|
||||||
|
|
||||||
$this->assertTrue($this->_unitOfWork->isScheduledForUpdate($entity));
|
$this->assertTrue($this->_unitOfWork->isScheduledForUpdate($entity));
|
||||||
|
|
||||||
@ -206,10 +207,19 @@ class NotifyChangedEntity implements \Doctrine\Common\NotifyPropertyChanged
|
|||||||
*/
|
*/
|
||||||
private $data;
|
private $data;
|
||||||
|
|
||||||
|
private $transient; // not persisted
|
||||||
|
|
||||||
public function getId() {
|
public function getId() {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setTransient($value) {
|
||||||
|
if ($value != $this->transient) {
|
||||||
|
$this->_onPropertyChanged('transient', $this->transient, $value);
|
||||||
|
$this->transient = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getData() {
|
public function getData() {
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user