/**
  * {@inheritDoc}
  */
 public function setParentDocument($parent)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setParentDocument', array($parent));
     return parent::setParentDocument($parent);
 }
 /**
  * Leave direct should migrate children.
  */
 public function testLeaveRedirectChildrenMigrations()
 {
     $article1 = new SeoArticle();
     $article1->title = 'Hai';
     $article1->path = '/test/article-1';
     $this->getDm()->persist($article1);
     $this->getDm()->flush();
     // add a child to the route
     $parentRoute = $this->getDm()->find(null, '/test/auto-route/seo-articles/hai');
     $childRoute = new AutoRoute();
     $childRoute->setName('foo');
     $childRoute->setParentDocument($parentRoute);
     $this->getDm()->persist($childRoute);
     $this->getDm()->flush();
     $article1->title = 'Ho';
     $this->getDm()->persist($article1);
     $this->getDm()->flush();
     $originalRoute = $this->getDm()->find(null, '/test/auto-route/seo-articles/hai');
     $this->assertNotNull($originalRoute);
     $this->assertCount(0, $this->getDm()->getChildren($originalRoute));
     $newRoute = $this->getDm()->find(null, '/test/auto-route/seo-articles/ho');
     $this->assertNotNull($newRoute);
     $this->assertCount(1, $this->getDm()->getChildren($newRoute));
 }