当前位置: 首页>>代码示例>>PHP>>正文


PHP Route::setOptions方法代码示例

本文整理汇总了PHP中Symfony\Component\Routing\Route::setOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::setOptions方法的具体用法?PHP Route::setOptions怎么用?PHP Route::setOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Routing\Route的用法示例。


在下文中一共展示了Route::setOptions方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processOutbound

 /**
  * {@inheritdoc}
  */
 public function processOutbound($route_name, Route $route, array &$parameters, BubbleableMetadata $bubbleable_metadata = NULL)
 {
     if ($route_name === '<current>') {
         if ($current_route = $this->routeMatch->getRouteObject()) {
             $requirements = $current_route->getRequirements();
             // Setting _method and _schema is deprecated since 2.7. Using
             // setMethods() and setSchemes() are now the recommended ways.
             unset($requirements['_method']);
             unset($requirements['_schema']);
             $route->setRequirements($requirements);
             $route->setPath($current_route->getPath());
             $route->setSchemes($current_route->getSchemes());
             $route->setMethods($current_route->getMethods());
             $route->setOptions($current_route->getOptions());
             $route->setDefaults($current_route->getDefaults());
             $parameters = array_merge($parameters, $this->routeMatch->getRawParameters()->all());
             if ($bubbleable_metadata) {
                 $bubbleable_metadata->addCacheContexts(['route']);
             }
         } else {
             // If we have no current route match available, point to the frontpage.
             $route->setPath('/');
         }
     }
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:28,代码来源:RouteProcessorCurrent.php

示例2: configureRoute

 protected function configureRoute(\Symfony\Component\Routing\Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot)
 {
     // defines the controller
     $route->setDefault('_controller', $class->getName() . '::' . $method->getName());
     // verify the other callbacks
     $options = $annot->getOptions();
     foreach ($options as $prop => &$values) {
         if (!in_array($prop, array('_after_middlewares', '_before_middlewares', '_converters'))) {
             continue;
         }
         if (empty($values)) {
             continue;
         }
         foreach ($values as &$value) {
             if (is_string($value) && $class->hasMethod($value)) {
                 // call static method from class
                 $value = array($class->getName(), $value);
             }
         }
         unset($value);
         // clear reference
     }
     unset($values);
     $route->setOptions($options);
 }
开发者ID:brodaproject,项目名称:broda,代码行数:25,代码来源:AnnotationClassLoader.php

示例3: testOptions

 public function testOptions()
 {
     $route = new Route('/{foo}');
     $route->setOptions(array('foo' => 'bar'));
     $this->assertEquals(array_merge(array('segment_separators' => array('/', '.'), 'text_regex' => '.+?', 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler'), array('foo' => 'bar')), $route->getOptions(), '->setOptions() sets the options');
     $this->assertEquals($route, $route->setOptions(array()), '->setOptions() implements a fluent interface');
 }
开发者ID:nickaggarwal,项目名称:sample-symfony2,代码行数:7,代码来源:RouteTest.php

示例4: processOutbound

 /**
  * {@inheritdoc}
  */
 public function processOutbound($route_name, Route $route, array &$parameters)
 {
     if ($route_name === '<current>' && ($current_route = $this->routeMatch->getRouteObject())) {
         $route->setPath($current_route->getPath());
         $route->setRequirements($current_route->getRequirements());
         $route->setOptions($current_route->getOptions());
         $route->setDefaults($current_route->getDefaults());
         $parameters = array_merge($parameters, $this->routeMatch->getRawParameters()->all());
     }
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:13,代码来源:RouteProcessorCurrent.php

示例5: testOptions

 public function testOptions()
 {
     $route = new Route('/{foo}');
     $route->setOptions(array('foo' => 'bar'));
     $this->assertEquals(array_merge(array('compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler'), array('foo' => 'bar')), $route->getOptions(), '->setOptions() sets the options');
     $this->assertEquals($route, $route->setOptions(array()), '->setOptions() implements a fluent interface');
     $route->setOptions(array('foo' => 'foo'));
     $route->addOptions(array('bar' => 'bar'));
     $this->assertEquals($route, $route->addOptions(array()), '->addOptions() implements a fluent interface');
     $this->assertEquals(array('foo' => 'foo', 'bar' => 'bar', 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler'), $route->getOptions(), '->addDefaults() keep previous defaults');
 }
开发者ID:omusico,项目名称:lafayettehelps.com,代码行数:11,代码来源:RouteTest.php

示例6: processOutbound

 /**
  * {@inheritdoc}
  */
 public function processOutbound($route_name, Route $route, array &$parameters)
 {
     if ($route_name === '<current>') {
         if ($current_route = $this->routeMatch->getRouteObject()) {
             $route->setPath($current_route->getPath());
             $route->setRequirements($current_route->getRequirements());
             $route->setOptions($current_route->getOptions());
             $route->setDefaults($current_route->getDefaults());
             $parameters = array_merge($parameters, $this->routeMatch->getRawParameters()->all());
         } else {
             // If we have no current route match available, point to the frontpage.
             $route->setPath('/');
         }
     }
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:18,代码来源:RouteProcessorCurrent.php

示例7: refreshEntity

 /**
  * Refresh the entity
  *
  * @ORM\PostLoad
  */
 public function refreshEntity()
 {
     parent::setPath($this->path);
     parent::setDefaults($this->defaults);
     parent::setRequirements($this->requirements);
     parent::setOptions($this->options);
     parent::setHost($this->host);
     parent::setMethods($this->methods);
     parent::setSchemes($this->schemes);
 }
开发者ID:geoffreytran,项目名称:zym,代码行数:15,代码来源:Route.php

示例8: __construct

 public function __construct()
 {
     $this->request = Request::createFromGlobals();
     $this->container = Container::getInstance();
     /* Parse params file - Begin */
     $params = $this->parseYamlFile(APP_DIR . DS . 'configs' . DS . 'params.yml');
     $isDev = $params['environment'] === 'development';
     if ($isDev) {
         Debug::enable(E_STRICT);
     }
     date_default_timezone_set($params['timezone']);
     /* Parse params file - End */
     /* Parse routes file - Begin */
     $routes = $this->parseYamlFile(APP_DIR . DS . 'configs' . DS . 'routes.yml');
     $collection = new RouteCollection();
     foreach ($routes as $name => $options) {
         $parts = explode(':', $options['defaults']['_controller']);
         $options['defaults'] = array('_controller' => "{$parts[0]}\\Controllers\\{$parts[1]}Controller::{$parts[2]}Action");
         $route = new Route($options['path']);
         $route->setDefaults($options['defaults']);
         $route->setRequirements(isset($options['requirements']) ? $options['requirements'] : array());
         $route->setOptions(isset($options['options']) ? $options['options'] : array());
         $route->setHost(isset($options['host']) ? $options['host'] : '');
         $route->setSchemes(isset($options['schemes']) ? $options['schemes'] : array());
         $route->setMethods(isset($options['methods']) ? $options['methods'] : array());
         $route->setCondition(isset($options['condition']) ? $options['condition'] : '');
         $collection->add($name, $route);
     }
     $this->container->setParameter('routes', $collection);
     /* Parse routes file - End */
     /* Composer ClassLoader - Begin */
     $composer_loader = new ClassLoader();
     $composer_loader->addPsr4('Application\\Controllers\\', APP_DIR . DS . 'layers' . DS . 'controllers');
     $composer_loader->addPsr4('Application\\Models\\', APP_DIR . DS . 'layers' . DS . 'models');
     $composer_loader->register();
     /* Composer ClassLoader - End */
     /* Set error controller - Begin */
     $namespace = $isDev ? 'Hideks\\Controller\\' : 'Application\\Controllers\\';
     $this->container->setParameter('exception.controller', $namespace . 'ErrorController::exceptionAction');
     /* Set error controller - End */
     /* Assetic configuration setup - Begin */
     $filter_manager = new FilterManager();
     $filter_manager->set('css_min', new CssMinFilter());
     $filter_manager->set('lessphp', new LessphpFilter());
     $filter_manager->set('js_min', new JSMinFilter());
     $asset_factory = new AssetFactory(APP_DIR . DS . 'assets' . DS);
     $asset_factory->setDebug($isDev);
     $asset_factory->setFilterManager($filter_manager);
     $asset_factory->addWorker(new CacheBustingWorker());
     $this->container->setParameter('assetic.factory', $asset_factory);
     /* Assetic configuration setup - End */
     /* Twig configuration setup - Begin */
     $this->container->setParameter('twig.debug', $isDev);
     $this->container->setParameter('twig.cache', $isDev ? false : APP_DIR . DS . 'cache' . DS . 'twig');
     $twig_loader = $this->container->get('twig.loader');
     $twig_loader->addPath(APP_DIR . DS . 'layers' . DS . 'views');
     /* Twig configuration setup - End */
     /* Active Record configuration setup - Begin */
     $active_record = \ActiveRecord\Config::instance();
     $active_record->set_model_directory(APP_DIR . DS . 'layers' . DS . 'models');
     $active_record->set_connections($params['connections']);
     $active_record->set_default_connection($params['environment']);
     /* Active Record configuration setup - End */
 }
开发者ID:hidekscorporation,项目名称:hideksframework2,代码行数:64,代码来源:Application.php


注:本文中的Symfony\Component\Routing\Route::setOptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。