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


PHP KernelInterface::locateResource方法代码示例

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


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

示例1: open

 /**
  * Get a manipulable image instance.
  *
  * @param string $file the image path
  *
  * @return ImageHandler a manipulable image instance
  */
 public function open($file)
 {
     if (strlen($file) >= 1 && $file[0] == '@') {
         $file = $this->fileLocator instanceof FileLocatorInterface ? $this->fileLocator->locate($file) : $this->fileLocator->locateResource($file);
     }
     return $this->createInstance($file);
 }
开发者ID:codepeak,项目名称:ImageBundle,代码行数:14,代码来源:ImageHandling.php

示例2: setDefaultOptions

 /**
  * {@inheritdoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $configFile = $this->kernel->locateResource('@OroFormBundle/Resources/config/config_icon.yml');
     $config = Yaml::parse($configFile);
     $choices = array_flip($config['oro_icon_select']);
     $resolver->setDefaults(['placeholder' => 'oro.form.choose_value', 'choices' => $choices, 'empty_value' => '', 'configs' => ['placeholder' => 'oro.form.choose_value', 'result_template_twig' => 'OroFormBundle:Autocomplete:icon/result.html.twig', 'selection_template_twig' => 'OroFormBundle:Autocomplete:icon/selection.html.twig']]);
 }
开发者ID:xamin123,项目名称:platform,代码行数:10,代码来源:OroIconType.php

示例3: onPreUp

 /**
  * @param PreMigrationEvent $event
  */
 public function onPreUp(PreMigrationEvent $event)
 {
     if ($event->isTableExist(CreateMigrationTableMigration::MIGRATION_TABLE)) {
         $data = $event->getData(sprintf('select * from %s where id in (select max(id) from %s group by bundle)', CreateMigrationTableMigration::MIGRATION_TABLE, CreateMigrationTableMigration::MIGRATION_TABLE));
         foreach ($data as $val) {
             $event->setLoadedVersion($val['bundle'], $val['version']);
         }
     } else {
         $event->addMigration(new CreateMigrationTableMigration());
         // load MigrationTable initial data for BAP and OroCRM bundles installed before migrations is introduced
         // @todo: this transient solution can be removed in a future
         // when we ensure RC1 and RC2 are updated for all clients
         if ($event->isTableExist('oro_installer_bundle_version')) {
             $oroTableDataConfig = $this->kernel->locateResource('@OroMigrationBundle/EventListener/MigrationTableData/Oro.yml');
             $bundleVersions = Yaml::parse(realpath($oroTableDataConfig));
             $oroCrmTableDataConfig = $this->kernel->locateResource('@OroMigrationBundle/EventListener/MigrationTableData/OroCRM.yml');
             if ($event->isTableExist('orocrm_account')) {
                 $bundleVersions = array_merge($bundleVersions, Yaml::parse(realpath($oroCrmTableDataConfig)));
             }
             foreach ($bundleVersions as $bundleName => $version) {
                 $event->setLoadedVersion($bundleName, $version);
             }
             $event->addMigration(new UpdateBundleVersionMigration($bundleVersions));
             $event->addMigration(new UpdateEntityConfigMigration());
         }
     }
 }
开发者ID:xamin123,项目名称:platform,代码行数:30,代码来源:PreUpMigrationListener.php

示例4: importUnits

 /**
  * Imports units.
  *
  * @return array An array with the keys "skipped" and "imported" which contain the number of units skipped and imported
  * @throws \Exception If an error occured
  */
 public function importUnits()
 {
     $path = $this->kernel->locateResource(self::UNIT_PATH . self::UNIT_DATA);
     $yaml = new Parser();
     $data = $yaml->parse(file_get_contents($path));
     $count = 0;
     $skipped = 0;
     foreach ($data as $unitName => $unitData) {
         $unit = $this->getUnit($unitName);
         if ($unit === null) {
             $unit = new Unit();
             $unit->setName($unitName);
             $unit->setSymbol($unitData["symbol"]);
             if (array_key_exists("prefixes", $unitData)) {
                 if (!is_array($unitData["prefixes"])) {
                     throw new \Exception($unitName . " doesn't contain a prefix list, or the prefix list is not an array.");
                 }
                 foreach ($unitData["prefixes"] as $name) {
                     $prefix = $this->getSiPrefix($name);
                     if ($prefix === null) {
                         throw new \Exception("Unable to find SI Prefix " . $name);
                     }
                     $unit->getPrefixes()->add($prefix);
                 }
             }
             $this->entityManager->persist($unit);
             $this->entityManager->flush();
             $count++;
         } else {
             $skipped++;
         }
     }
     return array("imported" => $count, "skipped" => $skipped);
 }
开发者ID:hephaestus9,项目名称:PartKeepr,代码行数:40,代码来源:UnitSetupService.php

示例5: getConfigurations

 /**
  * @return array
  */
 public function getConfigurations()
 {
     if ($this->configuration !== null) {
         return $this->configuration;
     }
     $bundles = $this->kernel->getBundles();
     $configuration = [];
     foreach ($bundles as $bundle) {
         try {
             $class = get_class($bundle);
             $classParts = explode('\\', $class);
             $bundleName = array_pop($classParts);
             $file = $this->kernel->locateResource(sprintf('@%s/Resources/config/search.yml', $bundleName));
         } catch (\Exception $e) {
             continue;
         }
         $data = $this->parseFile($file);
         if (is_array($data)) {
             foreach ($data as $class => $config) {
                 $configuration[$class] = $config;
             }
         }
     }
     $this->configuration = $configuration;
     return $configuration;
 }
开发者ID:npakai,项目名称:enhavo,代码行数:29,代码来源:MetadataCollector.php

示例6: setFilename

 /**
  * @param string $filename
  * @throws \InvalidArgumentException
  */
 public function setFilename($filename)
 {
     if ($filename && $filename[0] == '@') {
         $filename = $this->kernel->locateResource($filename);
     }
     if (!is_file($filename)) {
         throw new \InvalidArgumentException('Specified file does not exist: ' . $filename);
     }
     $this->filename = $filename;
 }
开发者ID:LearnerNation,项目名称:SamlSPBundle,代码行数:14,代码来源:EntityDescriptorFileProvider.php

示例7: getPrivateKey

 /**
  * @return \XMLSecurityKey
  */
 public function getPrivateKey()
 {
     if (!$this->_key) {
         $filename = $this->keyFile;
         if ($filename[0] == '@') {
             $filename = $this->kernel->locateResource($filename);
         }
         $this->_key = KeyHelper::createPrivateKey($filename, $this->keyPass, true, false);
     }
     return $this->_key;
 }
开发者ID:LearnerNation,项目名称:SamlSPBundle,代码行数:14,代码来源:SPSigningProviderFile.php

示例8: formatTranslationConfig

 /**
  * Format the string config to array config with "file" attribute and translations.
  *
  * @param string|array    $config The config
  * @param KernelInterface $kernel The kernel
  *
  * @return array
  */
 public static function formatTranslationConfig($config, KernelInterface $kernel)
 {
     $config = static::formatConfig($config);
     $config['file'] = $kernel->locateResource($config['file']);
     if (isset($config['translations']) && is_array($config['translations'])) {
         /* @var array $translation */
         foreach ($config['translations'] as &$translation) {
             $translation['file'] = $kernel->locateResource($translation['file']);
         }
     }
     return $config;
 }
开发者ID:sonatra,项目名称:SonatraMailerBundle,代码行数:20,代码来源:ConfigUtil.php

示例9: loadFixtureFiles

 /**
  * Gets all fixtures files
  */
 protected function loadFixtureFiles()
 {
     foreach ($this->bundles as $bundle) {
         $file = '*';
         if (strpos($bundle, '/')) {
             list($bundle, $file) = explode('/', $bundle);
         }
         $path = $this->kernel->locateResource('@' . $bundle);
         $files = glob($path . $this->directory . '/' . $file . '.yml');
         $this->fixture_files = array_unique(array_merge($this->fixture_files, $files));
     }
 }
开发者ID:functionite,项目名称:KhepinYamlFixturesBundle,代码行数:15,代码来源:YamlLoader.php

示例10: getRawData

 /**
  * @param $name
  *
  * @return array
  * @throws \Exception
  */
 private function getRawData($name)
 {
     if (isset($this->presets[$name])) {
         return $this->presets[$name];
     }
     if (false === strpos($name, ':')) {
         throw new \Exception(sprintf('Malformed namespaced configuration name "%s" (expecting "namespace:pagename").', $name));
     }
     list($namespace, $name) = explode(':', $name, 2);
     $path = $this->kernel->locateResource('@' . $namespace . '/Resources/config/pagetemplates/' . $name . '.yml');
     $rawData = Yaml::parse(file_get_contents($path));
     return $rawData;
 }
开发者ID:bakie,项目名称:KunstmaanBundlesCMS,代码行数:19,代码来源:PageTemplateConfigurationParser.php

示例11: createManufacturer

 protected function createManufacturer($manufacturerName, $manufacturerData)
 {
     $manufacturer = new Manufacturer();
     $manufacturer->setName($manufacturerName);
     if (array_key_exists('iclogos', $manufacturerData)) {
         foreach ($manufacturerData['iclogos'] as $icLogo) {
             $manufacturerIcLogo = new ManufacturerICLogo();
             $file = $this->kernel->locateResource(self::MANUFACTURER_PATH . $icLogo);
             $this->uploadedFileService->replaceFromFilesystem($manufacturerIcLogo, new File($file));
             $manufacturer->addIcLogo($manufacturerIcLogo);
         }
     }
     $this->entityManager->persist($manufacturer);
 }
开发者ID:partkeepr,项目名称:PartKeepr,代码行数:14,代码来源:ManufacturerSetupService.php

示例12: let

 /**
  * @param \Symfony\Component\DependencyInjection\ContainerInterface $container_stub
  * @param \Symfony\Component\HttpKernel\KernelInterface $kernel_stub
  */
 function let($container_stub, $kernel_stub)
 {
     $template_path = realpath(__DIR__ . '/../../../../Action/Template/');
     $kernel_stub->locateResource(Argument::any())->willReturn($template_path);
     $container_stub->get(Argument::any())->willReturn($kernel_stub);
     $this->setContainer($container_stub);
 }
开发者ID:artemklv,项目名称:SmirikPropelAdminBundle,代码行数:11,代码来源:ActionManagerSpec.php

示例13: getOriginCover

 /**
  * @param Item $item
  *
  * @return string
  */
 protected function getOriginCover(Item $item)
 {
     if (!$this->origin_dir) {
         $this->origin_dir = $this->kernel->locateResource('@AnimeDbCatalogBundle/Resources/private/images/');
     }
     return $this->origin_dir . $item->getItem()->getCover();
 }
开发者ID:anime-db,项目名称:catalog-bundle,代码行数:12,代码来源:Install.php

示例14: __construct

 public function __construct(SecureRandomInterface $rng, KernelInterface $kernel, array $languages)
 {
     parent::__construct($rng);
     $this->resource = $kernel->locateResource('@TweedeGolfGeneratorBundle/Resources/wordlists');
     $this->setLanguages($languages);
     $this->setSeparator(' ');
 }
开发者ID:tweedegolf,项目名称:generatorbundle,代码行数:7,代码来源:DicewareGenerator.php

示例15: __construct

 public function __construct(EntityManagerInterface $em, KernelInterface $kernel, ContainerInterface $container, VersionAccessor $versionAccessor, $migrationConfigPath)
 {
     $this->em = $em;
     $this->migrations = Yaml::parse($kernel->locateResource($migrationConfigPath));
     $this->container = $container;
     $this->versionAccessor = $versionAccessor;
 }
开发者ID:enhavo,项目名称:enhavo,代码行数:7,代码来源:Migrator.php


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