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


PHP Bundle::getNamespace方法代码示例

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


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

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

示例2: generate

 /**
  * @param Bundle          $bundle
  * @param OutputInterface $output
  */
 public function generate(Bundle $bundle, OutputInterface $output)
 {
     // This is needed so the renderFile method will search for the files
     // in the correct location
     $this->setSkeletonDirs(array($this->fullSkeletonDir));
     $parameters = array('namespace' => $bundle->getNamespace(), 'bundle' => $bundle);
     $this->generateBehatTests($bundle, $output, $parameters);
 }
开发者ID:axelvnk,项目名称:KunstmaanBundlesCMS,代码行数:12,代码来源:AdminTestsGenerator.php

示例3: generate

 /**
  * @param Bundle          $bundle     The bundle
  * @param string          $prefix     The prefix
  * @param string          $rootDir    The root directory
  * @param string          $createPage Create data fixtures or not
  * @param OutputInterface $output
  */
 public function generate(Bundle $bundle, $prefix, $rootDir, $createPage, OutputInterface $output)
 {
     $parameters = array('namespace' => $bundle->getNamespace(), 'bundle' => $bundle, 'prefix' => GeneratorUtils::cleanPrefix($prefix));
     $this->generateEntities($bundle, $parameters, $output);
     $this->generateTemplates($bundle, $parameters, $rootDir, $output);
     if ($createPage) {
         $this->generateFixtures($bundle, $parameters, $output);
     }
 }
开发者ID:headonkeyboard,项目名称:KunstmaanBundlesCMS,代码行数:16,代码来源:SearchPageGenerator.php

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

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

示例6: writeMigrationClass

 /**
  * Writes a bundle migration class for a given driver.
  *
  * @param \Symfony\Component\HttpKernel\Bundle\Bundle   $bundle
  * @param string                                        $driverName
  * @param string                                        $version
  * @param array                                         $queries
  */
 public function writeMigrationClass(Bundle $bundle, $driverName, $version, array $queries)
 {
     $targetDir = "{$bundle->getPath()}/Migrations/{$driverName}";
     $class = "Version{$version}";
     $namespace = "{$bundle->getNamespace()}\\Migrations\\{$driverName}";
     $classFile = "{$targetDir}/{$class}.php";
     if (!$this->fileSystem->exists($targetDir)) {
         $this->fileSystem->mkdir($targetDir);
     }
     $content = $this->twigEngine->render('ClarolineMigrationBundle::migration_class.html.twig', array('namespace' => $namespace, 'class' => $class, 'upQueries' => $queries[Generator::QUERIES_UP], 'downQueries' => $queries[Generator::QUERIES_DOWN]));
     $this->fileSystem->touch($classFile);
     file_put_contents($classFile, $content);
 }
开发者ID:Netmisa,项目名称:MigrationBundle,代码行数:21,代码来源:Writer.php

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

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

示例9: generate

 /**
  * @param Bundle          $bundle The bundle
  * @param string          $entity
  * @param string          $prefix The prefix
  * @param bool            $dummydata
  * @param OutputInterface $output
  */
 public function generate(Bundle $bundle, $entity, $prefix, $dummydata, OutputInterface $output)
 {
     $parameters = array('namespace' => $bundle->getNamespace(), 'bundle' => $bundle, 'prefix' => GeneratorUtils::cleanPrefix($prefix), 'entity_class' => $entity);
     $this->generateEntities($bundle, $entity, $parameters, $output);
     $this->generateRepositories($bundle, $entity, $parameters, $output);
     $this->generateForm($bundle, $entity, $parameters, $output);
     $this->generateAdminList($bundle, $entity, $parameters, $output);
     $this->generateController($bundle, $entity, $parameters, $output);
     $this->generatePageTemplateConfigs($bundle, $entity, $parameters, $output);
     $this->generateTemplates($bundle, $entity, $parameters, $output);
     $this->generateRouting($bundle, $entity, $parameters, $output);
     $this->generateMenu($bundle, $entity, $parameters, $output);
     $this->generateServices($bundle, $entity, $parameters, $output);
     if ($dummydata) {
         $this->generateFixtures($bundle, $entity, $parameters, $output);
     }
 }
开发者ID:axelvnk,项目名称:KunstmaanBundlesCMS,代码行数:24,代码来源:ArticleGenerator.php

示例10: generateAdminType

 /**
  * @param Bundle        $bundle     The bundle
  * @param string        $entityName The entity name
  * @param ClassMetadata $metadata   The meta data
  *
  * @throws \RuntimeException
  */
 public function generateAdminType(Bundle $bundle, $entityName, ClassMetadata $metadata)
 {
     $className = sprintf("%sAdminType", $entityName);
     $dirPath = sprintf("%s/Form", $bundle->getPath());
     $classPath = sprintf("%s/%s.php", $dirPath, str_replace('\\', '/', $className));
     if (file_exists($classPath)) {
         throw new \RuntimeException(sprintf('Unable to generate the %s class as it already exists under the %s file', $className, $classPath));
     }
     $this->setSkeletonDirs(array($this->skeletonDir));
     $this->renderFile('/Form/EntityAdminType.php', $classPath, array('namespace' => $bundle->getNamespace(), 'bundle' => $bundle, 'entity_class' => $entityName, 'fields' => $this->getFieldsFromMetadata($metadata)));
 }
开发者ID:axelvnk,项目名称:KunstmaanBundlesCMS,代码行数:18,代码来源:AdminListGenerator.php

示例11: getNamespace

 public function getNamespace()
 {
     return parent::getNamespace();
     // TODO: Change the autogenerated stub
 }
开发者ID:timy-life,项目名称:symfony2-advanced-menus,代码行数:5,代码来源:MCTestBundle.php

示例12: findBasePathForBundle

 /**
  * Transform classname to a path $foundBundle substract it to get the destination
  *
  * @param Bundle $bundle
  * @return string
  */
 protected function findBasePathForBundle($bundle)
 {
     $path = str_replace('\\', '/', $bundle->getNamespace());
     $search = str_replace('\\', '/', $bundle->getPath());
     $destination = str_replace('/' . $path, '', $search, $c);
     if ($c != 1) {
         throw new \RuntimeException(sprintf('Can\'t find base path for bundle (path: "%s", destination: "%s").', $path, $destination));
     }
     return $destination;
 }
开发者ID:Wizkunde,项目名称:DoctrineMongoDBBundle,代码行数:16,代码来源:DoctrineODMCommand.php

示例13: findBasePathForBundle

 /**
  * Transform classname to a path $foundBundle substract it to get the destination
  *
  * @param Bundle $bundle
  * @return string
  */
 protected function findBasePathForBundle($bundle)
 {
     $path = str_replace('\\', '/', $bundle->getNamespace());
     $destination = str_replace('/' . $path, "", $bundle->getPath(), $c);
     if ($c != 1) {
         throw new \RuntimeException("Something went terribly wrong.");
     }
     return $destination;
 }
开发者ID:faridos,项目名称:ServerGroveLiveChat,代码行数:15,代码来源:DoctrineCommand.php

示例14: getNamespace

 /**
  * {@inheritdoc}
  */
 public function getNamespace()
 {
     $namespace = parent::getNamespace();
     return substr($namespace, 0, strrpos($namespace, '\\'));
 }
开发者ID:NiR-,项目名称:rad-fixtures-load,代码行数:8,代码来源:FixturesLoadBundle.php

示例15: getConfiguration

 private function getConfiguration(Bundle $bundle)
 {
     if (isset($this->cacheConfigs[$bundle->getName()])) {
         return $this->cacheConfigs[$bundle->getName()];
     }
     $driverName = $this->connection->getDriver()->getName();
     $migrationsDir = "{$bundle->getPath()}/Migrations/{$driverName}";
     $migrationsName = "{$bundle->getName()} migration";
     $migrationsNamespace = "{$bundle->getNamespace()}\\Migrations\\{$driverName}";
     $migrationsTableName = 'doctrine_' . strtolower($bundle->getName()) . '_versions';
     $config = new Configuration($this->connection);
     $config->setName($migrationsName);
     $config->setMigrationsDirectory($migrationsDir);
     $config->setMigrationsNamespace($migrationsNamespace);
     $config->setMigrationsTableName($migrationsTableName);
     if (is_dir($migrationsDir)) {
         $config->registerMigrationsFromDirectory($migrationsDir);
     }
     $this->cacheConfigs[$bundle->getName()] = $config;
     return $config;
 }
开发者ID:claroline,项目名称:distribution,代码行数:21,代码来源:Migrator.php


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