Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-870

@Version causes integer fields to return a string

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-BETA4
    • Fix Version/s: 2.0-RC1
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      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.

        Activity

        Hide
        Benjamin Eberlei added a comment -

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

        Show
        Benjamin Eberlei added a comment - Fixed, and a bunch of other issues with versioning that i found while looking at the code.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Timo A. Hummel
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: