[2.0] Fixed hardcoded version field access in optimistic locking.
This commit is contained in:
parent
6356886cec
commit
da582e1125
2 changed files with 5 additions and 3 deletions
|
@ -253,7 +253,7 @@ class StandardEntityPersister
|
||||||
$versionField = $this->_class->versionField;
|
$versionField = $this->_class->versionField;
|
||||||
$versionFieldType = $this->_class->getTypeOfField($versionField);
|
$versionFieldType = $this->_class->getTypeOfField($versionField);
|
||||||
$where[$versionField] = Type::getType($versionFieldType)
|
$where[$versionField] = Type::getType($versionFieldType)
|
||||||
->convertToDatabaseValue($entity->version, $this->_platform);
|
->convertToDatabaseValue($this->_class->reflFields[$versionField]->getValue($entity), $this->_platform);
|
||||||
$versionFieldColumnName = $this->_class->getQuotedColumnName($versionField, $this->_platform);
|
$versionFieldColumnName = $this->_class->getQuotedColumnName($versionField, $this->_platform);
|
||||||
if ($versionFieldType == 'integer') {
|
if ($versionFieldType == 'integer') {
|
||||||
$set[] = $versionFieldColumnName . ' = ' . $versionFieldColumnName . ' + 1';
|
$set[] = $versionFieldColumnName . ' = ' . $versionFieldColumnName . ' + 1';
|
||||||
|
|
|
@ -94,7 +94,7 @@ class OptimisticTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||||
$this->_em->persist($test);
|
$this->_em->persist($test);
|
||||||
$this->_em->flush();
|
$this->_em->flush();
|
||||||
|
|
||||||
$this->assertEquals(1, $test->version);
|
$this->assertEquals(1, $test->getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -205,7 +205,9 @@ class OptimisticStandard
|
||||||
/**
|
/**
|
||||||
* @Version @Column(type="integer")
|
* @Version @Column(type="integer")
|
||||||
*/
|
*/
|
||||||
public $version;
|
private $version;
|
||||||
|
|
||||||
|
function getVersion() {return $this->version;}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue