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


PHP YamlFileLoader::load方法代码示例

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


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

示例1: load

 public function load($resource, $type = null)
 {
     if (true === $this->loaded) {
         throw new \RuntimeException('Do not add this loader twice');
     }
     $collection = new RouteCollection();
     $resource = __DIR__ . '/../Resources/config';
     $locator = new FileLocator($resource);
     $loader = new YamlFileLoader($locator);
     $collection->addCollection($loader->load('routing.yml'));
     $collection->addCollection($loader->load('routing_admin.yml'));
     $this->loaded = true;
     return $collection;
 }
开发者ID:c4d3r,项目名称:mcsuite-application-eyeofender,代码行数:14,代码来源:RouteLoader.php

示例2: boot

 /**
  * Boots the current kernel.
  *
  * @api
  */
 public function boot()
 {
     if (true === $this->booted) {
         return;
     }
     // Setup Routes
     $this->router = new RouteCollection();
     $locator = new FileLocator([$this->get_root_dir() . '/config/']);
     try {
         $loader = new PhpFileLoader($locator);
         $this->router->addCollection($loader->load('routes.php'));
         $loader = new YamlFileLoader($locator);
         $this->router->addCollection($loader->load('routes.yml'));
     } catch (\InvalidArgumentException $e) {
     }
     // Load configuration
     try {
         $this->config = new Configuration();
         $this->config->add_resource($this->get_root_dir() . '/config/');
         $this->config->add_config($this->config->get("config_" . $this->get_environment()));
     } catch (\Exception $e) {
     }
     // init bundles
     $this->initialize_bundles();
     foreach ($this->get_bundles() as $bundle) {
         $bundle->set_application($this);
         $bundle->boot();
     }
     $this->booted = true;
 }
开发者ID:phpwax,项目名称:core,代码行数:35,代码来源:Application.php

示例3: createRouteCollection

 public function createRouteCollection()
 {
     $locator = new FileLocator([__DIR__]);
     $loader = new YamlFileLoader($locator);
     $collection = $loader->load('routing.yml');
     return $collection;
 }
开发者ID:erpk,项目名称:harserver,代码行数:7,代码来源:Bootstrap.php

示例4: runTest

 public function runTest()
 {
     $locator = new FileLocator(array(__DIR__ . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "config"));
     $loader = new YamlFileLoader($locator);
     $routes = $loader->load("routing.yml");
     $validator = new RouteValidator(new UrlMatcher($routes, new RequestContext("/")));
     $validator->validate();
 }
开发者ID:jeanpasqualini-lesson,项目名称:lesson-routing,代码行数:8,代码来源:RoutingYml.php

示例5: getInstance

 /**
  * Get an object instance of UrlGenerator class.
  * 
  * @return UrlGenerator
  */
 public static function getInstance()
 {
     $configDirectory = new YamlFileLoader(new FileLocator(array(__DIR__ . '/../../Resources/config')));
     $captchaRoutes = $configDirectory->load('routing.yml');
     $requestContext = new RequestContext();
     $requestContext->fromRequest(Request::createFromGlobals());
     return new SymfonyUrlGenerator($captchaRoutes, $requestContext);
 }
开发者ID:RubenCox,项目名称:Symfony_Web-Mobile,代码行数:13,代码来源:UrlGenerator.php

示例6: configure

 static function configure($app)
 {
     $app["routes"] = $app->extend("routes", function (RouteCollection $routes, Application $app) {
         $loader = new YamlFileLoader(new FileLocator(__DIR__ . "/../config"));
         $collection = $loader->load("routes.yml");
         $routes->addCollection($collection);
         return $routes;
     });
 }
开发者ID:JoshuaReneDalley,项目名称:php,代码行数:9,代码来源:Routes.php

示例7: initRoutes

 private function initRoutes()
 {
     $this["routes"] = $this->extend("routes", function (RouteCollection $routes, Application $this) {
         $loader = new YamlFileLoader(new FileLocator($this->base . 'etc'));
         $collection = $loader->load('routes.yml');
         $routes->addCollection($collection);
         return $routes;
     });
 }
开发者ID:kirkegaard,项目名称:silex-bootstrap,代码行数:9,代码来源:Application.php

示例8: __construct

 /**
  * @param ControllerResolver $resolver
  */
 public function __construct($resolver)
 {
     // Load routes list
     $locator = new FileLocator([__DIR__]);
     $loader = new YamlFileLoader($locator);
     $this->routes = $loader->load('routes.yml');
     // Set ControllerResolver
     $this->resolver = $resolver;
 }
开发者ID:pavgra,项目名称:2nova-test,代码行数:12,代码来源:Kernel.php

示例9: getRoutes

 /**
  * {@inheritdoc}
  */
 public static function getRoutes()
 {
     $locator = new FileLocator([ROADIZ_ROOT . '/src/Roadiz/CMS/Resources']);
     if (file_exists(ROADIZ_ROOT . '/src/Roadiz/CMS/Resources/assetsRoutes.yml')) {
         $loader = new YamlFileLoader($locator);
         return $loader->load('assetsRoutes.yml');
     }
     return null;
 }
开发者ID:justinpocta,项目名称:roadiz,代码行数:12,代码来源:AssetsController.php

示例10: register

 /**
  * {@inheritDoc}
  */
 public function register(Application $app)
 {
     $app->extend('routes', function (RouteCollection $routes, Application $app) {
         $loader = new YamlFileLoader(new FileLocator(JAZZ_CONFIG_DIR));
         $collection = $loader->load('routing.yml');
         $routes->addCollection($collection);
         return $routes;
     });
 }
开发者ID:broklyngagah,项目名称:jazz,代码行数:12,代码来源:RoutingServiceProvider.php

示例11: configureRoutes

 private function configureRoutes()
 {
     $this['routes'] = $this->extend('routes', function (RouteCollection $routes, Application $app) {
         $loader = new YamlFileLoader(new FileLocator($app->getConfigDir()));
         $collection = $loader->load('routes.yml');
         $routes->addCollection($collection);
         return $routes;
     });
 }
开发者ID:dbiagi,项目名称:grigoros-boilerplate,代码行数:9,代码来源:Application.php

示例12: find

 /**
  * Find a list of controllers
  *
  * @param string $base_path Base path to prepend to file paths
  * @return provider
  */
 public function find($base_path = '')
 {
     $this->routes = new RouteCollection();
     foreach ($this->routing_files as $file_path) {
         $loader = new YamlFileLoader(new FileLocator(phpbb_realpath($base_path)));
         $this->routes->addCollection($loader->load($file_path));
     }
     return $this;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:15,代码来源:provider.php

示例13: parseYmlFile

 protected function parseYmlFile()
 {
     $finder = new Finder();
     $finder->files()->in(__DIR__ . '/../config/routing');
     $locator = new FileLocator(array(__DIR__ . '/../config/routing'));
     $loader = new YamlFileLoader($locator);
     foreach ($finder as $file) {
         $subCollection = $loader->load($file->getRelativePathname());
         $this->routes->addCollection($subCollection);
     }
 }
开发者ID:chenzel,项目名称:custom-framework,代码行数:11,代码来源:Routing.php

示例14: load

 /**
  * Loads a all ApplicationBundles routes.
  *
  * @param string $file The anything
  * @param string $type The resource type
  *
  * @return RouteCollection A RouteCollection instance
  */
 public function load($file, $type = null)
 {
     $collection = new RouteCollection();
     foreach ($this->kernel->getBundle('App', false) as $bundle) {
         if (file_exists($routing = $bundle->getPath() . '/Resources/config/routing.yml')) {
             $collection->addCollection(parent::load($routing));
             $collection->addResource(new FileResource($routing));
         }
     }
     return $collection;
 }
开发者ID:nmariani,项目名称:KnpRadBundle,代码行数:19,代码来源:AppBundleLoader.php

示例15: generateURI

 public static function generateURI($tag, $args = NULL)
 {
     $request = Request::createFromGlobals();
     $locator = new FileLocator(array(__DIR__));
     $loader = new YamlFileLoader($locator);
     $routes = $loader->load('../config/routes.yml');
     $context = new RequestContext($request->getBaseUrl());
     $generator = new UrlGenerator($routes, $context);
     $url = $generator->generate($tag);
     return $url;
 }
开发者ID:nexhero,项目名称:muffin,代码行数:11,代码来源:Yeast.php


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