Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route::setPath PHP Method

setPath() public method

public setPath ( $pattern )
    public function setPath($pattern)
    {
        $len = strlen($this->getStaticPrefix());
        if (strncmp($this->getStaticPrefix(), $pattern, $len)) {
            throw new \InvalidArgumentException('You can not set a pattern for the route document that does not match its repository path. First move it to the correct path.');
        }
        return $this->setVariablePattern(substr($pattern, $len));
    }

Usage Example

Example #1
0
 /**
  * @depends testPersistEmptyOptions
  *
  * @expectedException \InvalidArgumentException
  */
 public function testSetPatternInvalid(Route $route)
 {
     $route->setPath('/impossible');
 }