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

        Maxim created issue -
        Maxim made changes -
        Field Original Value New Value
        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

        /**
         * @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());
        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());
        Alexander made changes -
        Assignee Benjamin Eberlei [ beberlei ] Alexander [ asm89 ]
        Benjamin Eberlei made changes -
        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());
        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

        {code}
        /**
         * @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());
        {code}
        Alexander made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.2-DEV [ 10157 ]
        Resolution Fixed [ 1 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 13130 ] jira-feedback [ 15089 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback [ 15089 ] jira-feedback2 [ 16953 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 16953 ] jira-feedback3 [ 19206 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved: