Details
Description
Here's a small example when using @Version causes the field to return a string and not an integer.
Here's a very simple example:
SimpleTest class
/**
* @Entity
*/
class SimpleTest {
/**
* @Id
* @generatedValue(strategy="AUTO")
* @Column(type="integer")
*/
private $id;
/**
* @Column(type="integer")
* @version
*/
private $version;
/**
* @Column
*/
private $content;
public function setContent ($content) {
$this->content = $content;
}
public function getVersion () {
return $this->version;
}
public function getId () {
return $this->id;
}
}
Invocation
$test = new SimpleTest(); $test->setContent("V1"); $em->persist($test); $em->flush(); if (gettype($test->getVersion()) == "string") { die("Version should be an integer, not a string!"); }
The invocation fails because the version property is suddenly a string and not an integer anymore.
Fixed, and a bunch of other issues with versioning that i found while looking at the code.