本文整理汇总了PHP中Sonata\AdminBundle\Route\RouteCollection::has方法的典型用法代码示例。如果您正苦于以下问题:PHP RouteCollection::has方法的具体用法?PHP RouteCollection::has怎么用?PHP RouteCollection::has使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sonata\AdminBundle\Route\RouteCollection
的用法示例。
在下文中一共展示了RouteCollection::has方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testChildCollection
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: getRoute
/**
* 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: hasRoute
/**
* @param string $name
*
* @return bool
*/
public function hasRoute($name)
{
$this->buildRoutes();
return $this->routes->has($name);
}
示例4: configureRoutes
/**
* @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));
}
}
}