[MODM-46] @AlsoLoad annotation causes exception when used together with Embed/Reference annotations Created: 16/Aug/10  Updated: 17/Aug/10  Resolved: 17/Aug/10

Status: Resolved
Project: Doctrine MongoDB ODM
Component/s: None
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


 Description   

Imagine that there is following object in DB:

{
  "_id": "4c6936bf0f9d50300d000000",
  "c": {
    "tmp": "tmp"
  }
}

And I want to rename property "c" to "b" in my class, using @AlsoLoad together with @EmbedOne

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

    /**
     * @EmbedOne(targetDocument="b")
     * @AlsoLoad("c")
     */
    protected $b;
}

/** @EmbeddedDocument */
class b
{
    protected $tmp = 'tmp';
}

$a = $dm->loadByID('a', '4c6936bf0f9d50300d000000'); // will throw an exception: Property "b" in "a" was already declared, but it must be declared only once


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

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

Generated at Thu Nov 27 22:02:54 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.