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

setPosition() public method

The url will be the url of the parent plus the supplied name.
public setPosition ( $parent, $name )
    public function setPosition($parent, $name)
    {
        $this->parent = $parent;
        $this->name = $name;
        return $this;
    }

Usage Example

Ejemplo n.º 1
0
 public function testRedirectName()
 {
     $root = $this->getDm()->find(null, self::ROUTE_ROOT);
     $redirect = new RedirectRoute();
     $redirect->setPosition($root, 'redirectName');
     $redirect->setRouteName('symfony_route');
     $redirect->setParameters(array('param' => 7));
     // parameters should be ignored in this case
     $this->getDm()->persist($redirect);
     $this->getDm()->flush();
     $this->getDm()->clear();
     $redirect = $this->getDm()->find(null, self::ROUTE_ROOT . '/redirectName');
     $response = $this->controller->redirectAction($redirect);
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\RedirectResponse', $response);
     $this->assertSame(302, $response->getStatusCode());
     $this->assertSame('http://localhost/symfony_route_test?param=7', $response->getTargetUrl());
 }
All Usage Examples Of Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute::setPosition