doctrine/mongodb-odm — pull request #932 by kluevandrew (2014-08-28 08:33:19+00:00)
Title: Fix cascade remove for associations.

Option casade={"remove"} does not working on second and deeper level of cascade.
Because in association we are have proxy object which not loaded.
And call of \ReflectionProperty::getValue on this object returns defalt value, not real related documents.
``` php
$relatedDocuments = $class->reflFields[$mapping['fieldName']]->getValue($document);
```
Cascade delete continues without affecting nested objects

This commit fixed this bug.

Mapping Example:

My user class:
``` php
// User.php
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;

/**
* @MongoDB\Document
*/
class User
{
/**
* @var string
*
* @MongoDB\Id
*/
protected $id;

/**
* @var string
*
* @MongoDB\String
*/
protected $username;

/**
* @MongoDB\ReferenceMany(targetDocument="House", mappedBy="user", cascade="remove")
*/
protected $houses;
}
```

My house calss:
``` php
// House.php
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;

/**
* @MongoDB\Document
*/
class House
{
/**
* @var string
*
* @MongoDB\Id
*/
protected $id;

/**
* @var User
*
* @MongoDB\ReferenceOne(targetDocument="User", inversedBy="houese")
*/
protected $user;

/**
* @var Photo[]
*
* @MongoDB\ReferenceMany(targetDocument="House", cascade="remove")
*/
protected $photos;
}
```

My photo calss:
``` php
// Photo.php
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;

/**
* @MongoDB\Document
*/
class Photo
{
/**
* @var string
*
* @MongoDB\Id
*/
protected $id;

/**
* @var string
*
* @MongoDB\String
*/
protected $filename;
}
```

With this mapping when i execute
``` php
$documentManager->remove($someUserDocument);
```
All houses associated with `` $someUserDocument `` will be removed from mongo, but all photos associated with this houses will not be removed