DDC-870: @Version causes integer fields to return a string #5393

Closed
doctrinebot opened this Issue Nov 9, 2010 · 2 comments

2 participants

@doctrinebot

Jira issue originally created by user felicitus:

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:

/****
 * @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;
    }

}
$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.

@doctrinebot

Comment created by @beberlei:

Fixed, and a bunch of other issues with versioning that i found while looking at the code.

@doctrinebot

Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added this to the 2.0-RC1 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment