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


PHP Bundle\Bundle类代码示例

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


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

示例1: add

 /**
  * Add
  * 
  * Add a FrameworkBundle
  * to the collection
  * 
  * @param FrameworkBundle $bundle - the FrameworkBundle to add
  * 
  * @return BundleCollection - the current instance
  */
 public function add(Bundle $bundle)
 {
     if (!$this->has($bundle->getName())) {
         $this->bundles[] = $bundle;
     }
     return $this;
 }
开发者ID:cscfa,项目名称:NavBarBundle,代码行数:17,代码来源:BundleCollection.php

示例2: generateBehatTests

 /**
  * @param Bundle          $bundle
  * @param OutputInterface $output
  * @param array           $parameters
  */
 public function generateBehatTests(Bundle $bundle, OutputInterface $output, array $parameters)
 {
     $dirPath = sprintf("%s/Features", $bundle->getPath());
     $skeletonDir = sprintf("%s/Features", $this->fullSkeletonDir);
     // First copy all the content
     $this->filesystem->mirror($this->fullSkeletonDir, $bundle->getPath());
     // Now render the Context files to replace the namespace etc.
     if ($handle = opendir($skeletonDir . "/Context")) {
         while (false !== ($entry = readdir($handle))) {
             // Check to make sure we skip hidden folders
             // And we render the files ending in .php
             if (substr($entry, 0, 1) != '.' && substr($entry, -strlen(".php")) === ".php") {
                 $this->renderFile("/Features/Context/" . $entry, $dirPath . "/Context/" . $entry, $parameters);
             }
         }
         closedir($handle);
     }
     $featureContext = $dirPath . "/Context/FeatureContext.php";
     if ($this->filesystem->exists($featureContext)) {
         $contents = file_get_contents($featureContext);
         $contents = str_replace('-adminpwd-', $this->container->getParameter('kunstmaan_admin.admin_password'), $contents);
         file_put_contents($featureContext, $contents);
     }
     $output->writeln('Generating Behat Tests : <info>OK</info>');
 }
开发者ID:axelvnk,项目名称:KunstmaanBundlesCMS,代码行数:30,代码来源:AdminTestsGenerator.php

示例3: generateEntityClass

 /**
  * Generate a PHP5 Doctrine 2 entity class from the given ClassMetadataInfo instance
  *
  * @param ClassMetadataInfo     $metadata
  * @param Bundle                $bundle
  * @param string                $entity
  * @param array                 $fields
  * @param bool                  $hasI18n
  * @param bool                  $isTimestampable
  * @param bool                  $isSluggable
  *
  * @return string $code
  */
 public function generateEntityClass(ClassMetadataInfo $metadata, $bundle = null, $entity = null, $fields = array(), $hasI18n = false, $isTimestampable = false, $isSluggable = false)
 {
     $target = sprintf('%s/Entity/%s.php', $bundle->getPath(), $entity);
     $namespace = $this->generateEntityNamespace($metadata);
     $code = str_replace('<spaces>', $this->spaces, $this->generateEntityBody($metadata));
     $bundleName = explode('\\Entity', $metadata->name);
     $routePrefix = strtolower(str_replace('\\', '_', str_replace('Bundle', '', $bundleName[0]))) . '_backend';
     $routeName = $routePrefix . strtolower(str_replace('\\', '_', $bundleName[1]));
     // Track all the translation fields and check if it contains the fieldName 'name'
     // and check if the name field is i18n
     $containNameField = false;
     $nameIsI18n = false;
     foreach ($fields as $field) {
         if ($field['fieldName'] == 'name') {
             $containNameField = true;
             if (substr(strtolower($field['i18n']), 0, 1) == 'y') {
                 $nameIsI18n = true;
             }
         }
     }
     if ($containNameField) {
         $functionName = '$this->getName()';
     } else {
         $functionName = '$this->getEntityName()';
     }
     $this->renderFile('entity/Entity.php.twig', $target, array('namespace' => $namespace, 'route' => $routeName, 'entity' => $entity, 'entity_var' => $this->getEntityVar($entity), 'code' => $code, 'name_function' => $functionName, 'is_timestampable' => $isTimestampable, 'is_sluggable' => $isSluggable, 'sluggable_name' => !$nameIsI18n && $isSluggable, 'has_i18n' => $hasI18n));
 }
开发者ID:pmdc,项目名称:UnifikSystemBundle,代码行数:40,代码来源:EntityGenerator.php

示例4: registerInstallerService

 /**
  * Register an installer service
  *
  * @param BaseBundle $bundleInfos
  * @param string $type Type (install, update or uninstall)
  * @param string $class Class (Install, Update or Uninstall)
  */
 protected function registerInstallerService(BaseBundle $bundleInfos, $type, $class)
 {
     $serviceId = strtolower($bundleInfos->getName()) . '.installer.' . $type;
     $fullyQualifiedClass = $bundleInfos->getNamespace() . '\\Service\\Install\\' . $class;
     $serviceOptions = array('calls' => array(array('setContainer' => array('@service_container'))), 'tags' => array(array('name' => 'bundle.' . $type)));
     $this->registerService($bundleInfos->getName(), $serviceId, $fullyQualifiedClass, $serviceOptions);
 }
开发者ID:kujaff,项目名称:versionsbundle,代码行数:14,代码来源:Generator.php

示例5: addBundle

 public static function addBundle(Bundle $bundle)
 {
     $extension = $bundle->getContainerExtension();
     if ($extension) {
         self::$extensions[] = $extension;
     }
     self::$bundlePaths[] = $bundle->getPath();
 }
开发者ID:bjanish,项目名称:symfonize-zf,代码行数:8,代码来源:Loader.php

示例6: getPackagePrefix

 /**
  * Return the package prefix for a given bundle.
  *
  * @param Bundle $bundle
  * @param string $baseDirectory The base directory to exclude from prefix.
  *
  * @return string
  */
 protected function getPackagePrefix(Bundle $bundle, $baseDirectory = '')
 {
     $parts = explode(DIRECTORY_SEPARATOR, realpath($bundle->getPath()));
     $length = count(explode('\\', $bundle->getNamespace())) * -1;
     $prefix = implode(DIRECTORY_SEPARATOR, array_slice($parts, 0, $length));
     $prefix = ltrim(str_replace($baseDirectory, '', $prefix), DIRECTORY_SEPARATOR);
     if (!empty($prefix)) {
         $prefix = str_replace(DIRECTORY_SEPARATOR, '.', $prefix) . '.';
     }
     return $prefix;
 }
开发者ID:ChazalFlorian,项目名称:enjoyPangolin,代码行数:19,代码来源:AbstractCommand.php

示例7: getBundleMetadata

 /**
  * @param Bundle $bundle
  * @return ClassMetadata[]
  */
 protected function getBundleMetadata(Bundle $bundle)
 {
     $bundleMetadata = [];
     $metadata = $this->em->getMetadataFactory()->getAllMetadata();
     /** @var ClassMetadata $meta */
     foreach ($metadata as $meta) {
         if (strpos($meta->getName(), $bundle->getNamespace()) !== false) {
             $bundleMetadata[] = $meta;
         }
     }
     return $bundleMetadata;
 }
开发者ID:bitecodes,项目名称:factrine-bundle,代码行数:16,代码来源:ConfigGenerator.php

示例8: loadGeneratorsForBundle

 /**
  * Load the generators confirming to default naming rules in the given bundle.
  * @param Bundle $bundle
  */
 private function loadGeneratorsForBundle(Bundle $bundle)
 {
     $dir = "{$bundle->getPath()}/Generator";
     if (is_dir($dir)) {
         $finder = new Finder();
         $finder->files()->name('*Generator.php')->in($dir);
         $prefix = $bundle->getNamespace() . '\\Generator';
         /** @var SplFileInfo $file */
         foreach ($finder as $file) {
             $this->loadGeneratorInBundle($file, $prefix);
         }
     }
 }
开发者ID:tweedegolf,项目名称:generatorbundle,代码行数:17,代码来源:SymfonyGeneratorRegistry.php

示例9: deleteUpperMigrationClasses

 /**
  * Deletes bundle migration classes for a given driver which are above a
  * reference version.
  *
  * @param \Symfony\Component\HttpKernel\Bundle\Bundle   $bundle
  * @param string                                        $driverName
  * @param string                                        $referenceVersion
  * @return array The migration files that were deleted
  */
 public function deleteUpperMigrationClasses(Bundle $bundle, $driverName, $referenceVersion)
 {
     $migrations = new \DirectoryIterator("{$bundle->getPath()}/Migrations/{$driverName}");
     $deletedVersions = array();
     foreach ($migrations as $migration) {
         if (preg_match('#Version(\\d+)\\.php#', $migration->getFilename(), $matches)) {
             if ($matches[1] > $referenceVersion) {
                 $this->fileSystem->remove(array($migration->getPathname()));
                 $deletedVersions[] = $migration->getFilename();
             }
         }
     }
     return $deletedVersions;
 }
开发者ID:Netmisa,项目名称:MigrationBundle,代码行数:23,代码来源:Writer.php

示例10: getBundleTables

 private function getBundleTables(Bundle $bundle, array $metadata)
 {
     $bundleTables = array('tables' => array(), 'joinTables' => array());
     foreach ($metadata as $entityMetadata) {
         if (0 === strpos($entityMetadata->name, $bundle->getNamespace())) {
             $bundleTables[] = $entityMetadata->getTableName();
             foreach ($entityMetadata->associationMappings as $association) {
                 if (isset($association['joinTable']['name'])) {
                     $bundleTables[] = $association['joinTable']['name'];
                 }
             }
         }
     }
     return $bundleTables;
 }
开发者ID:tisseo-deploy,项目名称:MigrationBundle,代码行数:15,代码来源:Generator.php

示例11: build

 public function build(ContainerBuilder $container)
 {
     parent::build($container);
     /** @var \Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension $extension */
     $extension = $container->getExtension('security');
     $extension->addSecurityListenerFactory(new SamlFactory());
 }
开发者ID:eefjevanderharst,项目名称:Stepup-SelfService,代码行数:7,代码来源:SurfnetStepupSelfServiceSelfServiceBundle.php

示例12: build

 /**
  * {@inheritdoc}
  */
 public function build(ContainerBuilder $container)
 {
     parent::build($container);
     $container->addCompilerPass(new DataProviderPass());
     $container->addCompilerPass(new FilterPass());
     $container->addCompilerPass(new DoctrineQueryExtensionPass());
 }
开发者ID:api-platform,项目名称:core,代码行数:10,代码来源:ApiPlatformBundle.php

示例13: build

 /**
  * {@inheritdoc}
  */
 public function build(ContainerBuilder $container)
 {
     parent::build($container);
     $container->addCompilerPass(new AddAccessorCompilerPass());
     $container->addCompilerPass(new AddStrategyCompilerPass());
     $container->addCompilerPass(new AddStepCompilerPass());
 }
开发者ID:Maksold,项目名称:platform,代码行数:10,代码来源:OroEntityMergeBundle.php

示例14: build

 /**
  * @param ContainerBuilder $container
  */
 public function build(ContainerBuilder $container)
 {
     parent::build($container);
     $container->addCompilerPass(new ThemeRepositoryPass());
     $container->addCompilerPass(new ThemeAwareSourcesPass());
     $container->addCompilerPass(new ThemeAwareLoaderDecoratorPass());
 }
开发者ID:benakacha,项目名称:Sylius,代码行数:10,代码来源:SyliusThemeBundle.php

示例15: build

 public function build(ContainerBuilder $container)
 {
     parent::build($container);
     $container->addCompilerPass(new LoadersCompilerPass());
     // Disable create cache directories for now; it's not needed anyway (structure is being created on the run).
     //            ->addCompilerPass(new CreateCacheDirectoriesCompilerPass(), PassConfig::TYPE_AFTER_REMOVING);
 }
开发者ID:jmcclell,项目名称:AvalancheImagineBundle,代码行数:7,代码来源:AvalancheImagineBundle.php


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