Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute::setParentDocument PHP Method

setParentDocument() public method

Note that this will change the URL this route matches.
public setParentDocument ( object $parent )
$parent object the new parent document
    public function setParentDocument($parent)
    {
        $this->parent = $parent;
        return $this;
    }

Usage Example

 public function load(ObjectManager $manager)
 {
     NodeHelper::createPath($manager->getPhpcrSession(), '/test');
     $root = $manager->find(null, '/test');
     $parent = new Generic();
     $parent->setParent($root);
     $parent->setNodename('routing');
     $manager->persist($parent);
     $route = new Route();
     $route->setParentDocument($parent);
     $route->setName('route-1');
     $manager->persist($route);
     $redirectRoute = new RedirectRoute();
     $redirectRoute->setParentDocument($parent);
     $redirectRoute->setName('redirect-route-1');
     $manager->persist($redirectRoute);
     $manager->flush();
 }