public function testPutActionWithNestedEntityRemoved()
{
$mother = new Person();
$mother->name = "Sharon Lemon";
$person = new Person();
$person->name = "Stan Lemon";
$person->mother = $mother;
$this->em->persist($person);
$this->em->flush($person);
$this->em->clear();
$request = $this->makeRequest('PUT', '/person/' . $person->id, json_encode(array('name' => $person->name)));
$this->controller->putAction($request, 'person', $person->id);
$refresh = $this->em->getRepository('Lemon\\RestBundle\\Tests\\Fixtures\\Person')->findOneBy(array('id' => $person->id));
$this->assertNotNull($refresh);
$this->assertEquals($person->id, $refresh->id);
$this->assertEquals($person->name, $refresh->name);
$this->assertNull($refresh->mother);
$refreshMother = $this->em->getRepository('Lemon\\RestBundle\\Tests\\Fixtures\\Person')->findOneBy(array('id' => $mother->id));
$this->assertNotNull($refreshMother, "We removed the relationship, but not the entity");
}