title: Doctrine MongoDB: Embeded documents will not be saved if hydrating data into main document
body: <p>im using the hydrate function of the document manager (zend framework 2 application) for hydrating array data into a document.
  Unfortunately embeded sub documents will not be updated in the databse (but main document will do).</p>
  
  <p>Hydrating of the data is correct, but changes of the sub documents are not "noticed" by Unit-Of-Work.</p>
  
  <p>Example:</p>
  
  <p><strong>Request 1... (creating the document)</strong></p>
  
  <pre><code>$user = new Document\User();
  $user-&gt;setName('administrator');
  
  $address = new Document\UserAddress();
  $address-&gt;setCity('cologne');
  $user-&gt;setAddress($address);
  
  // will insert new document correctly
  $documentManager-&gt;persist($user);
  $documentManager-&gt;flush();
  </code></pre>
  
  <p><strong>Request 2... (updating existing document)</strong></p>
  
  <pre><code>$repository = $this-&gt;documentManager-&gt;getRepository('Document\User');
  
  $user = $repository-&gt;findOneBy(
      array('name' =&gt; 'administrator')
  );
  
  $documentManager-&gt;getHydratorFactory()-&gt;hydrate(
      $user,
      array(
          'name' =&gt; 'administrator',
          'address' =&gt; array(
              'city' =&gt; 'bonn' // change "cologne" to "bonn" 
          )
  )
  // note: "address" array will be correctly hydrated to a "UserAddress" document
  
  
  // this will update the "User" document, but not the embedded "UserAddress" document
  $documentManager-&gt;persist($user);
  $documentManager-&gt;flush();
  </code></pre>
  
  <p>For me a little bit strange, but detaching the sub-document will cause an update</p>
  
  <pre><code>// after detaching sub object the documents will be saved correctly
  // (but this cant be   the way it should be...?)
  $documentManager-&gt;detach($user-&gt;getUserAddress());
  $documentManager-&gt;persist($user);
  $documentManager-&gt;flush();
  </code></pre>
  
  <p>Here are the annotations:</p>
  
  <pre><code>/*
   * @ODM\Document(collection="Users")
   */
  class User
  {
      /**
       * @ODM\EmbedOne(targetDocument="Document\UserAddress")
       */
      protected $address;
  
      //... 
  
  /*
   * @ODM\EmbeddedDocument()
   */
  class UserAddress
  {
      /**
       * @ODM\String
       */
      protected $city; 
  
      // ... 
  </code></pre>
  
  <p>What do i wrong? Or is this a bug? Or...is the hydrate function not for "external" use?
  Hope someone can help me</p>
  
  <p>Regards
  Norman</p>