當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。