Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.1, 2.1.2
    • Fix Version/s: 2.2
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None
    • Environment:
      linux/ubuntu, nginx, php-cgi, symfony framework

      Description

      Flushing at point #2 has no effect (outputs int(1)), flushing at point #1 works as expected (outputs int(5)).
      this issue comes only when i trying to set boolean value on managed assotiated entity

      upd. same issue with datetime properties

      /**
       * @ORM\Entity
       */
      class TestEntity
      {
          /**
           * @ORM\Id
           * @ORM\Column(type="integer")
           * @ORM\GeneratedValue(strategy="AUTO")
           */
          protected $id;
          /**
           * @ORM\Column(type="integer")
           */
          protected $value;
          /**
           * @ORM\OneToOne(targetEntity="TestAdditionalEntity", inversedBy="entity", orphanRemoval="true", cascade={"persist", "remove"})
           */
          protected $additional;
      }
      
      /**
       * @ORM\Entity
       */
      class TestAdditionalEntity
      {
          /**
           * @ORM\Id
           * @ORM\Column(type="integer")
           * @ORM\GeneratedValue(strategy="AUTO")
           */
          protected $id;
          /**
           * @ORM\OneToOne(targetEntity="TestEntity", mappedBy="additional")
           */
          protected $entity;
          /**
           * @ORM\Column(type="boolean")
           */
          protected $bool;
          
          public function __construct()
          {
              $this->bool = false;
          }
      }
      
      $test = new \TestEntity();
      $test->setValue(1);
      $test->setAdditional(new \TestAdditionalEntity());
      
      $em->persist($test);
      $em->flush();
      $em->clear();
      
      $test = $em->getRepository('Bundle:TestEntity')->find(1);
      $test->setValue(5);
      
      // point #1
      $test->getAdditional()->setBool(true);
      // point #2
      
      $em->flush();
      
      var_dump($test->getValue());
      

        Activity

        Hide
        Benjamin Eberlei added a comment -

        Merged into 2.1.x

        Show
        Benjamin Eberlei added a comment - Merged into 2.1.x
        Hide
        Alexander added a comment -
        Show
        Alexander added a comment - Fixed in master: https://github.com/doctrine/doctrine2/pull/187
        Hide
        Benjamin Eberlei added a comment -

        formatting

        Show
        Benjamin Eberlei added a comment - formatting
        Hide
        Alexander added a comment -

        Looking into this.

        Show
        Alexander added a comment - Looking into this.

          People

          • Assignee:
            Alexander
            Reporter:
            Maxim
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: