[MODM-48] Embedded document changes are ignored if it was empty before Created: 16/Aug/10  Updated: 17/Aug/10  Resolved: 17/Aug/10

Status: Resolved
Project: Doctrine MongoDB ODM
Component/s: Persister
Affects Version/s: None
Fix Version/s: 1.0.0BETA1

Type: Bug Priority: Major
Reporter: Vladimir Razuvaev Assignee: Jonathan H. Wage
Resolution: Fixed Votes: 0
Labels: None


Imaging the object in DB:

  "_id": "4c693f9f0f9d501c0d000000",
  "b": [

Then following code fails to update property "b":

/** @Document(db="tests", collection="tests") */
class a
    /** @Id */
    protected $id;

    /** @EmbedOne(targetDocument="b", cascade="all") */
    protected $b;

    function getId()  {return $this->id;}
    function getB()   {return $this->b;}
    function setB($b) {$this->b = $b;}

/** @EmbeddedDocument */
class b
    /** @String */
    protected $val;
    function setVal($val) {$this->val = $val;}
    function getVal() {return $this->val;}

$a = $dm->loadByID('a', '4c693f9f0f9d501c0d000000');


$a = $dm->loadByID('a', $a->getId());
$c = ('test' === $a->getB()->getVal());

var_dump($c); // expecting "true", but outputs false

Comment by Jonathan H. Wage [ 16/Aug/10 ]

Are you using the most recent version of mongo in git?

Comment by Vladimir Razuvaev [ 16/Aug/10 ]

Yes, just updated to today's version from git - got same results.

Comment by Jonathan H. Wage [ 17/Aug/10 ]

Thanks for the issue!

Fixed by http://github.com/doctrine/mongodb-odm/commit/c57cc9fbf279918edcafd03ab4562ed33b467323

Generated at Wed Nov 25 01:37:24 EST 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.