本文整理汇总了PHP中Sonata\AdminBundle\Route\RouteCollection::get方法的典型用法代码示例。如果您正苦于以下问题:PHP RouteCollection::get方法的具体用法?PHP RouteCollection::get怎么用?PHP RouteCollection::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sonata\AdminBundle\Route\RouteCollection
的用法示例。
在下文中一共展示了RouteCollection::get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRouteControllerService
public function testRouteControllerService()
{
$routeCollection = new RouteCollection('baseCodeRoute', 'baseRouteName', 'baseRoutePattern', 'baseControllerServiceName');
$routeCollection->add('view');
$route = $routeCollection->get('view');
$this->assertEquals('baseControllerServiceName:viewAction', $route->getDefault('_controller'));
$this->assertEquals('baseCodeRoute', $route->getDefault('_sonata_admin'));
$this->assertEquals('baseRouteName_view', $route->getDefault('_sonata_name'));
}
示例2: getRoutingOption
/**
* Gets named option from current route.
*
* @param string $name
*
* @return string|null
*/
protected function getRoutingOption($name)
{
$option = null;
if (!$this->routeCollection instanceof RouteCollection) {
$this->routeCollection = $this->getRoutesCollection();
}
$route = $this->routeCollection->get($this->container->get('request')->get('_route'));
if ($route instanceof Route) {
$option = $route->getOption($name);
}
if (!$option && isset($this->redirectConf[$name])) {
$option = $this->redirectConf[$name]['action'];
}
if (in_array($option, array(self::REDIRECT, self::REDIRECT_WITHOUT_PATH, self::NO_REDIRECT))) {
return $option;
}
return null;
}
示例3: 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);
}
示例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));
}
}
}