public function testChildCollection()
 {
     $childCollection = new RouteCollection('baseCodeRouteChild', 'baseRouteNameChild', 'baseRoutePatternChild', 'baseControllerNameChild');
     $childCollection->add('view');
     $childCollection->add('create');
     $parentCollection = new RouteCollection('baseCodeRoute', 'baseRouteName', 'baseRoutePattern', 'baseControllerName');
     $parentCollection->add('view');
     $parentCollection->add('edit');
     $parentCollection->addCollection($childCollection);
     $this->assertTrue($parentCollection->has('view'));
     $this->assertTrue($parentCollection->has('edit'));
     $this->assertFalse($parentCollection->has('create'));
     $this->assertFalse($parentCollection->has('baseCodeRouteChild.edit'));
 }
Пример #2
0
    /**
     * Returns the url defined by the $name
     *
     * @param strinf $name
     * @return Route
     */
    public function getRoute($name)
    {
        $this->buildRoutes();

        if (!$this->routes->has($name)) {
            return false;
        }

        return $this->routes->get($name);
    }
Пример #3
0
 /**
  * @param string $name
  *
  * @return bool
  */
 public function hasRoute($name)
 {
     $this->buildRoutes();
     return $this->routes->has($name);
 }
 /**
  * @param RouteCollection $collection
  */
 protected function configureRoutes(RouteCollection $collection)
 {
     foreach (array('edit', 'create', 'delete') as $name) {
         if ($collection->has($name)) {
             $collection->get($name)->addOptions(array('expose' => true));
         }
     }
 }