DDC-1458: Issue with tracking entity changes #1830

Closed
opened 2026-01-22 13:27:23 +01:00 by admin · 5 comments
Owner

Originally created by @doctrinebot on GitHub (Oct 28, 2011).

Originally assigned to: @asm89 on GitHub.

Jira issue originally created by user n3b:

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());
Originally created by @doctrinebot on GitHub (Oct 28, 2011). Originally assigned to: @asm89 on GitHub. Jira issue originally created by user n3b: 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()); ```
admin added the Bug label 2026-01-22 13:27:24 +01:00
admin closed this issue 2026-01-22 13:27:28 +01:00
Author
Owner

@doctrinebot commented on GitHub (Nov 8, 2011):

Comment created by @asm89:

Looking into this.

@doctrinebot commented on GitHub (Nov 8, 2011): Comment created by @asm89: Looking into this.
Author
Owner

@doctrinebot commented on GitHub (Nov 9, 2011):

Comment created by @beberlei:

formatting

@doctrinebot commented on GitHub (Nov 9, 2011): Comment created by @beberlei: formatting
Author
Owner

@doctrinebot commented on GitHub (Nov 10, 2011):

Comment created by @asm89:

Fixed in master:
https://github.com/doctrine/doctrine2/pull/187

@doctrinebot commented on GitHub (Nov 10, 2011): Comment created by @asm89: Fixed in master: https://github.com/doctrine/doctrine2/pull/187
Author
Owner

@doctrinebot commented on GitHub (Nov 10, 2011):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Nov 10, 2011): Issue was closed with resolution "Fixed"
Author
Owner

@doctrinebot commented on GitHub (Nov 11, 2011):

Comment created by @beberlei:

Merged into 2.1.x

@doctrinebot commented on GitHub (Nov 11, 2011): Comment created by @beberlei: Merged into 2.1.x
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1830