本文整理汇总了PHP中Symfony\Component\Config\Loader\LoaderInterface::load方法的典型用法代码示例。如果您正苦于以下问题:PHP LoaderInterface::load方法的具体用法?PHP LoaderInterface::load怎么用?PHP LoaderInterface::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Config\Loader\LoaderInterface
的用法示例。
在下文中一共展示了LoaderInterface::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMetadataFor
/**
* @param string $class
* @return Metadata
*/
public function getMetadataFor($class)
{
if (!array_key_exists($class, $this->metadata)) {
$this->metadata[$class] = $this->loader->load($class);
}
return $this->metadata[$class];
}
示例2: registerContainerConfiguration
/**
* Loads the container configuration.
*
* @param LoaderInterface $loader A LoaderInterface instance
*
* @api
*/
public function registerContainerConfiguration(LoaderInterface $loader)
{
if (null != $this->config) {
$loader->load($this->config);
}
$loader->load(__DIR__ . '/config/default.yml');
}
示例3: registerContainerConfiguration
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->config);
if (PHP_VERSION_ID > 50400) {
$loader->load(__DIR__ . '/config/traits.yml');
}
}
示例4: registerContainerConfiguration
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml');
if (file_exists(__DIR__ . '/config/parameters.yml')) {
$loader->load(__DIR__ . '/config/parameters.yml');
}
}
示例5: onKernelRequest
public function onKernelRequest(GetResponseEvent $event)
{
if (null !== $this->loader) {
// carrega os annotations para criar as rotas dos rests
$this->loader->load('');
}
}
示例6: testLoad
public function testLoad()
{
$this->yamlParser->parse(file_get_contents(__DIR__ . '/../Resources/Yaml/routes.yml'))->willReturn(['user' => ['channel' => 'notification/user/{username}', 'handler' => ['callback' => ['Gos\\Bundle\\PubSubRouterBundle\\Tests\\Model', 'setPushers'], 'args' => ['gos_redis', 'gos_websocket']], 'requirements' => ['username' => ['pattern' => '[a-zA-Z0-9]+', 'wildcard' => true]]], 'application' => ['channel' => 'notification/application/{applicationName}', 'handler' => ['callback' => ['Gos\\Bundle\\PubSubRouterBundle\\Tests\\Model', 'setPushers'], 'args' => ['gos_redis', 'gos_websocket']], 'requirements' => ['applicationName' => ['pattern' => '[a-zA-Z0-9]+', 'wildcard' => true]]]]);
$this->injectYamlParser();
$routeCollection = $this->loader->load('@Resource/routes.yml');
$this->assertEquals(['user' => new Route('notification/user/{username}', ['Gos\\Bundle\\PubSubRouterBundle\\Tests\\Model', 'setPushers'], ['gos_redis', 'gos_websocket'], ['username' => ['pattern' => '[a-zA-Z0-9]+', 'wildcard' => true]]), 'application' => new Route('notification/application/{applicationName}', ['Gos\\Bundle\\PubSubRouterBundle\\Tests\\Model', 'setPushers'], ['gos_redis', 'gos_websocket'], ['applicationName' => ['pattern' => '[a-zA-Z0-9]+', 'wildcard' => true]])], $this->readProperty($routeCollection, 'routes'));
}
示例7: registerContainerConfiguration
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__ . '/config/config_plugin.yml');
foreach ($this->pluginAdapter->getConfigurationFiles() as $file) {
$loader->load($file);
}
}
示例8: registerContainerConfiguration
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml');
$loader->load(__DIR__ . '/config/security.yml');
$loader->load(__DIR__ . '/config/roles.yml');
$loader->load(__DIR__ . '/config/resources.yml');
}
示例9: registerContainerConfiguration
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getRootDir() . '/config/config.yml');
if ($this->isDebug()) {
$loader->load($this->getRootDir() . '/config/config_dbg.yml');
}
}
示例10: registerContainerConfiguration
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(SuluTestBundle::getConfigDir() . '/config.php');
if (class_exists('Sulu\\Bundle\\SearchBundle\\SuluSearchBundle')) {
$loader->load(__DIR__ . '/config/search.yml');
}
}
示例11: build
public function build()
{
$finder = new Finder();
$finder->in($this->path)->files()->name('*.xml')->sortByName();
// Iterate over config files, and add a portal object for each config to the collection
$collection = new WebspaceCollection();
// reset arrays
$this->webspaces = [];
$this->portals = [];
$this->portalInformations = [];
foreach ($finder as $file) {
// add file resource for cache invalidation
$collection->addResource(new FileResource($file->getRealPath()));
/** @var Webspace $webspace */
$webspace = $this->loader->load($file->getRealPath());
$this->webspaces[] = $webspace;
$this->buildPortals($webspace);
}
$environments = array_keys($this->portalInformations);
foreach ($environments as $environment) {
// sort all portal informations by length
uksort($this->portalInformations[$environment], function ($a, $b) {
return strlen($a) < strlen($b);
});
}
$collection->setWebspaces($this->webspaces);
$collection->setPortals($this->portals);
$collection->setPortalInformations($this->portalInformations);
return $collection;
}
示例12: registerContainerConfiguration
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml');
if (null !== $this->devConfig) {
$loader->load($this->devConfig);
}
}
示例13: registerContainerConfiguration
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__ . '/config/' . $this->environment . '.yml');
if (class_exists('Dunglas\\ApiBundle\\DunglasApiBundle')) {
$loader->load(__DIR__ . '/config/dunglas_api.yml');
}
}
示例14: registerContainerConfiguration
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml');
if (is_file($file = __DIR__ . '/config/config_' . $this->getEnvironment() . '_local.yml')) {
$loader->load($file);
}
}
示例15: load
/**
* {@inheritdoc}
*/
public function load($resource, $type = null)
{
if (true === $this->isLoaded) {
throw new \RuntimeException('Do not add the "modera_routing" loader twice');
}
$resources = array();
$items = $this->resourcesProvider->getItems();
foreach ($items as $index => $resource) {
if (!is_array($resource)) {
$resource = array('resource' => $resource);
}
$resource = array_merge(array('order' => 0, 'type' => null), $resource);
$resource['index'] = $index;
$resources[] = $resource;
}
usort($resources, function ($a, $b) {
if ($a['order'] == $b['order']) {
return $a['index'] < $b['index'] ? -1 : 1;
}
return $a['order'] < $b['order'] ? -1 : 1;
});
$collection = new RouteCollection();
foreach ($resources as $item) {
$collection->addCollection($this->rootLoader->load($item['resource'], $item['type']));
}
$this->isLoaded = true;
return $collection;
}