[DDC-1458] Issue with tracking entity changes Created: 28/Oct/11  Updated: 11/Nov/11  Resolved: 10/Nov/11

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.1, 2.1.2
Fix Version/s: 2.2
Security Level: All

Type: Bug Priority: Critical
Reporter: Maxim Assignee: Alexander
Resolution: Fixed Votes: 0
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());


 Comments   
Comment by Alexander [ 08/Nov/11 ]

Looking into this.

Comment by Benjamin Eberlei [ 09/Nov/11 ]

formatting

Comment by Alexander [ 10/Nov/11 ]

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

Comment by Benjamin Eberlei [ 11/Nov/11 ]

Merged into 2.1.x

Generated at Tue Sep 23 16:23:59 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.