當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Loader\YamlFileLoader類代碼示例

本文整理匯總了PHP中Symfony\Component\Routing\Loader\YamlFileLoader的典型用法代碼示例。如果您正苦於以下問題:PHP YamlFileLoader類的具體用法?PHP YamlFileLoader怎麽用?PHP YamlFileLoader使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了YamlFileLoader類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: __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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例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: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->twig = new \Twig_Environment(new \Twig_Loader_Filesystem(array(__DIR__ . '/../../../Resources/views/Elfinder/helper')));
     $this->extension = new FMElfinderTinymceExtension($this->twig);
     $this->twig->addExtension($this->extension);
     $loader = new YamlFileLoader(new FileLocator(__DIR__ . '/../../../Resources/config'));
     $routes = new RouteCollection();
     $collection = $loader->load('routing.yml');
     $routes->addCollection($collection);
     $this->twig->addExtension(new RoutingExtension(new UrlGenerator($routes, new RequestContext())));
 }
開發者ID:bonswouar,項目名稱:FMElfinderBundle,代碼行數:14,代碼來源:FMElfinderTinymceExtensionTest.php

示例15: routing

 protected function routing()
 {
     $routesDir = StringCommon::replaceKeyWords($this->_config["router"]["routes_dir"]);
     $routesFile = $this->_config["router"]["routes_file"];
     $loader = new YamlFileLoader(new FileLocator($routesDir));
     $loader->load($routesFile);
     $context = new RequestContext();
     $context->fromRequest(Request::createFromGlobals());
     //$matcher = new UrlMatcher($collection, $context);
     $router = new Router($loader, $routesFile);
     $this->action($router, $context);
 }
開發者ID:mbabenko21,項目名稱:likedimion-server,代碼行數:12,代碼來源:RoutingBootstrap.php


注:本文中的Symfony\Component\Routing\Loader\YamlFileLoader類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。