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


PHP BundleInterface::getName方法代码示例

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


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

示例1: generate

 /**
  * Generate Fixture from bundle name, entity name, fixture name and ids
  *
  * @param BundleInterface $bundle
  * @param string          $entity
  * @param string          $name
  * @param array           $ids
  * @param string|null     $connectionName
  */
 public function generate(BundleInterface $bundle, $entity, $name, array $ids, $order, $connectionName = null)
 {
     // configure the bundle (needed if the bundle does not contain any Entities yet)
     $config = $this->registry->getManager($connectionName)->getConfiguration();
     $config->setEntityNamespaces(array_merge(array($bundle->getName() => $bundle->getNamespace() . '\\Entity'), $config->getEntityNamespaces()));
     $fixtureFileName = $this->getFixtureFileName($entity, $name, $ids);
     $entityClass = $this->registry->getAliasNamespace($bundle->getName()) . '\\' . $entity;
     $fixturePath = $bundle->getPath() . '/DataFixtures/ORM/' . $fixtureFileName . '.php';
     $bundleNameSpace = $bundle->getNamespace();
     if (file_exists($fixturePath)) {
         throw new \RuntimeException(sprintf('Fixture "%s" already exists.', $fixtureFileName));
     }
     $class = new ClassMetadataInfo($entityClass);
     $fixtureGenerator = $this->getFixtureGenerator();
     $fixtureGenerator->setFixtureName($fixtureFileName);
     $fixtureGenerator->setBundleNameSpace($bundleNameSpace);
     $fixtureGenerator->setMetadata($class);
     $fixtureGenerator->setFixtureOrder($order);
     /** @var EntityManager $em */
     $em = $this->registry->getManager($connectionName);
     $repo = $em->getRepository($class->rootEntityName);
     if (empty($ids)) {
         $items = $repo->findAll();
     } else {
         $items = $repo->findById($ids);
     }
     $fixtureGenerator->setItems($items);
     $fixtureCode = $fixtureGenerator->generateFixtureClass($class);
     $this->filesystem->mkdir(dirname($fixturePath));
     file_put_contents($fixturePath, $fixtureCode);
 }
开发者ID:GMBN,项目名称:DoctrineFixturesGeneratorBundle,代码行数:40,代码来源:DoctrineFixtureGenerator.php

示例2: generateRestRouting

 public function generateRestRouting(BundleInterface $bundle, $controller)
 {
     $file = $bundle->getPath() . '/Resources/config/routing.rest.yml';
     if (file_exists($file)) {
         $content = file_get_contents($file);
     } elseif (!is_dir($dir = $bundle->getPath() . '/Resources/config')) {
         mkdir($dir);
     }
     $resource = $bundle->getNamespace() . "\\Controller\\" . $controller . 'Controller';
     $name = strtolower(preg_replace('/([A-Z])/', '_\\1', $bundle->getName() . $controller . '_rest'));
     $name_prefix = strtolower(preg_replace('/([A-Z])/', '_\\1', $bundle->getName() . '_api_'));
     if (!isset($content)) {
         $content = '';
     } else {
         $yml = new Yaml();
         $route = $yml->parse($content);
         if (isset($route[$name])) {
             return false;
         }
     }
     $content .= sprintf("\n%s:\n    type: rest\n    resource: %s\n    name_prefix: %s\n", $name, $resource, $name_prefix);
     $flink = fopen($file, 'w');
     if ($flink) {
         $write = fwrite($flink, $content);
         if ($write) {
             fclose($flink);
         } else {
             throw new \RunTimeException(sprintf('We cannot write into file "%s", has that file the correct access level?', $file));
         }
     } else {
         throw new \RunTimeException(sprintf('Problems with generating file "%s", did you gave write access to that directory?', $file));
     }
 }
开发者ID:asiragusa,项目名称:extjs-bundle,代码行数:33,代码来源:RestControllerGenerator.php

示例3: generate

 /**
  * @param BundleInterface $bundle         The bundle
  * @param string          $entity         The entity name
  * @param string          $format         The format
  * @param array           $fields         The fields
  * @param boolean         $withRepository With repository
  * @param string          $prefix         A prefix
  *
  * @throws \RuntimeException
  */
 public function generate(BundleInterface $bundle, $entity, $format, array $fields, $withRepository, $prefix)
 {
     // configure the bundle (needed if the bundle does not contain any Entities yet)
     $config = $this->registry->getManager(null)->getConfiguration();
     $config->setEntityNamespaces(array_merge(array($bundle->getName() => $bundle->getNamespace() . '\\Entity'), $config->getEntityNamespaces()));
     $entityClass = $this->registry->getAliasNamespace($bundle->getName()) . '\\' . $entity;
     $entityPath = $bundle->getPath() . '/Entity/' . str_replace('\\', '/', $entity) . '.php';
     if (file_exists($entityPath)) {
         throw new \RuntimeException(sprintf('Entity "%s" already exists.', $entityClass));
     }
     $class = new ClassMetadataInfo($entityClass);
     if ($withRepository) {
         $entityClass = preg_replace('/\\\\Entity\\\\/', '\\Repository\\', $entityClass, 1);
         $class->customRepositoryClassName = $entityClass . 'Repository';
     }
     foreach ($fields as $field) {
         $class->mapField($field);
     }
     $class->setPrimaryTable(array('name' => $prefix . $this->getTableNameFromEntityName($entity)));
     $entityGenerator = $this->getEntityGenerator();
     $entityCode = $entityGenerator->generateEntityClass($class);
     $mappingPath = $mappingCode = false;
     $this->filesystem->mkdir(dirname($entityPath));
     file_put_contents($entityPath, $entityCode);
     if ($mappingPath) {
         $this->filesystem->mkdir(dirname($mappingPath));
         file_put_contents($mappingPath, $mappingCode);
     }
     if ($withRepository) {
         $path = $bundle->getPath() . str_repeat('/..', substr_count(get_class($bundle), '\\'));
         $this->getRepositoryGenerator()->writeEntityRepositoryClass($class->customRepositoryClassName, $path);
     }
     $this->addGeneratedEntityClassLoader($entityClass, $entityPath);
 }
开发者ID:axelvnk,项目名称:KunstmaanBundlesCMS,代码行数:44,代码来源:DoctrineEntityGenerator.php

示例4: generate

 /**
  * @param  \Symfony\Component\HttpKernel\Bundle\BundleInterface $bundle
  * @param  string                                               $document
  * @param  array                                                $fields
  * @param  Boolean                                              $withRepository
  * @throws \RuntimeException
  */
 public function generate(BundleInterface $bundle, $document, array $fields, $withRepository)
 {
     $config = $this->documentManager->getConfiguration();
     $config->addDocumentNamespace($bundle->getName(), $bundle->getNamespace() . '\\Document');
     $documentClass = $config->getDocumentNamespace($bundle->getName()) . '\\' . $document;
     $documentPath = $bundle->getPath() . '/Document/' . str_replace('\\', '/', $document) . '.php';
     if (file_exists($documentPath)) {
         throw new \RuntimeException(sprintf('Document "%s" already exists.', $documentClass));
     }
     $class = new ClassMetadataInfo($documentClass);
     if ($withRepository) {
         $class->setCustomRepositoryClass($documentClass . 'Repository');
     }
     $class->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
     $class->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
     foreach ($fields as $field) {
         $class->mapField($field);
     }
     $documentGenerator = $this->getDocumentGenerator();
     $documentCode = $documentGenerator->generateDocumentClass($class);
     $this->filesystem->mkdir(dirname($documentPath));
     file_put_contents($documentPath, rtrim($documentCode) . PHP_EOL, LOCK_EX);
     if ($withRepository) {
         $path = $bundle->getPath() . str_repeat('/..', substr_count(get_class($bundle), '\\'));
         $this->getRepositoryGenerator()->writeDocumentRepositoryClass($class->customRepositoryClassName, $path);
     }
 }
开发者ID:anhpha,项目名称:reports,代码行数:34,代码来源:DoctrineDocumentGenerator.php

示例5: getPrefix

 /**
  * Gets the prefix of the asset with the given bundle
  *
  * @param BundleInterface $bundle Bundle to fetch in
  *
  * @throws \InvalidArgumentException
  * @return string Prefix
  */
 public function getPrefix(BundleInterface $bundle)
 {
     if (!is_dir($bundle->getPath() . '/Resources/public')) {
         throw new \InvalidArgumentException(sprintf('Bundle %s does not have Resources/public folder', $bundle->getName()));
     }
     return sprintf('/bundles/%s', preg_replace('/bundle$/', '', strtolower($bundle->getName())));
 }
开发者ID:erdnaxe,项目名称:bibliotheque,代码行数:15,代码来源:WebPathResolver.php

示例6: generate

 public function generate(BundleInterface $bundle, $controller, $routeFormat, $templateFormat, array $actions = array())
 {
     $dir = $bundle->getPath();
     $controllerFile = $dir . '/Controller/' . $controller . 'Controller.php';
     if (file_exists($controllerFile)) {
         throw new \RuntimeException(sprintf('Controller "%s" already exists', $controller));
     }
     // seeRoute
     $bundleShortName = substr($bundle->getName(), strlen('Webobs'), strlen($bundle->getName()) - (strlen('Bundle') + strlen('Webobs')));
     $seeRoute = 'webobs_' . strtolower($bundleShortName) . '_' . strtolower($controller) . '_see';
     $parameters = array('namespace' => $bundle->getNamespace(), 'bundle' => $bundle->getName(), 'format' => array('routing' => $routeFormat, 'templating' => $templateFormat), 'entity' => $controller, 'seeRoute' => $seeRoute);
     foreach ($actions as $i => $action) {
         // get the actioname without the sufix Action (for the template logical name)
         $actions[$i]['basename'] = $action['name'];
         $params = $parameters;
         $params['action'] = $actions[$i];
         // create a template
         $template = $actions[$i]['template'];
         if ('default' == $template) {
             $template = $bundle->getName() . ':' . $controller . ':' . $action['name'] . '.html.' . $templateFormat;
         }
         $this->generateRouting($bundle, $controller, $actions[$i], $routeFormat);
     }
     $parameters['actions'] = $actions;
     $this->renderFile('controller/Controller.php.twig', $controllerFile, $parameters);
     $this->renderFile('controller/ControllerTest.php.twig', $dir . '/Tests/Controller/' . $controller . 'ControllerTest.php', $parameters);
 }
开发者ID:blacksad12,项目名称:oliorga,代码行数:27,代码来源:ControllerGenerator.php

示例7: getBundleMetadata

 /**
  * Gets the metadata of all classes of a bundle.
  *
  * @param BundleInterface $bundle A BundleInterface instance
  *
  * @return ClassMetadataCollection A ClassMetadataCollection instance
  */
 public function getBundleMetadata(BundleInterface $bundle)
 {
     $namespace = $bundle->getNamespace();
     if (!($metadata = $this->getMetadataForNamespace($namespace))) {
         throw new \RuntimeException(sprintf('Bundle "%s" does not contain any mapped entities.', $bundle->getName()));
     }
     $path = $this->getBasePathForClass($bundle->getName(), $bundle->getNamespace(), $bundle->getPath());
     $metadata->setPath($path);
     $metadata->setNamespace($bundle->getNamespace());
     return $metadata;
 }
开发者ID:rfc1483,项目名称:blog,代码行数:18,代码来源:MetadataFactory.php

示例8: generatePagePartEntity

 /**
  * Generate the pagepart entity.
  *
  * @throws \RuntimeException
  */
 private function generatePagePartEntity()
 {
     list($entityCode, $entityPath) = $this->generateEntity($this->bundle, $this->entity, $this->fields, 'PageParts', $this->prefix, 'Kunstmaan\\PagePartBundle\\Entity\\AbstractPagePart');
     // Add some extra functions in the generated entity :s
     $params = array('bundle' => $this->bundle->getName(), 'pagepart' => $this->entity, 'adminType' => '\\' . $this->bundle->getNamespace() . '\\Form\\PageParts\\' . $this->entity . 'AdminType');
     $extraCode = $this->render('/Entity/PageParts/ExtraFunctions.php', $params);
     $pos = strrpos($entityCode, "}");
     $trimmed = substr($entityCode, 0, $pos);
     $entityCode = $trimmed . "\n" . $extraCode . "\n}";
     // Write class to filesystem
     $this->filesystem->mkdir(dirname($entityPath));
     file_put_contents($entityPath, $entityCode);
     $this->assistant->writeLine('Generating entity : <info>OK</info>');
 }
开发者ID:tentwofour,项目名称:KunstmaanGeneratorBundle,代码行数:19,代码来源:PagePartGenerator.php

示例9: generate

 public function generate(BundleInterface $bundle, $entity, $format, array $fields, $withRepository)
 {
     // configure the bundle (needed if the bundle does not contain any Entities yet)
     $config = $this->registry->getManager(null)->getConfiguration();
     $config->setEntityNamespaces(array_merge(array($bundle->getName() => $bundle->getNamespace() . '\\Entity'), $config->getEntityNamespaces()));
     $entityClass = $this->registry->getAliasNamespace($bundle->getName()) . '\\' . $entity;
     $entityPath = $bundle->getPath() . '/Entity/' . str_replace('\\', '/', $entity) . '.php';
     if (file_exists($entityPath)) {
         throw new \RuntimeException(sprintf('Entity "%s" already exists.', $entityClass));
     }
     $class = new ClassMetadataInfo($entityClass);
     $namingArray = Helper\NamingHelper::getNamingArray($bundle);
     $class->table['name'] = $namingArray['vendor'] . '__' . $namingArray['bundle'] . '__' . strtolower($entity);
     if ($withRepository) {
         $class->customRepositoryClassName = $entityClass . 'Repository';
     }
     $class->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
     $class->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
     foreach ($fields as $field) {
         $class->mapField($field);
     }
     $entityGenerator = $this->getEntityGenerator();
     if ('annotation' === $format) {
         $entityGenerator->setGenerateAnnotations(true);
         $entityCode = $entityGenerator->generateEntityClass($class);
         $mappingPath = $mappingCode = false;
     } else {
         $cme = new ClassMetadataExporter();
         $exporter = $cme->getExporter('yml' == $format ? 'yaml' : $format);
         $mappingPath = $bundle->getPath() . '/Resources/config/doctrine/' . str_replace('\\', '.', $entity) . '.orm.' . $format;
         if (file_exists($mappingPath)) {
             throw new \RuntimeException(sprintf('Cannot generate entity when mapping "%s" already exists.', $mappingPath));
         }
         $mappingCode = $exporter->exportClassMetadata($class);
         $entityGenerator->setGenerateAnnotations(false);
         $entityCode = $entityGenerator->generateEntityClass($class);
     }
     $this->filesystem->mkdir(dirname($entityPath));
     file_put_contents($entityPath, $entityCode);
     if ($mappingPath) {
         $this->filesystem->mkdir(dirname($mappingPath));
         file_put_contents($mappingPath, $mappingCode);
     }
     if ($withRepository) {
         $path = $bundle->getPath() . str_repeat('/..', substr_count(get_class($bundle), '\\'));
         $this->getRepositoryGenerator()->writeEntityRepositoryClass($class->customRepositoryClassName, $path);
     }
 }
开发者ID:blacksad12,项目名称:oliorga,代码行数:48,代码来源:DoctrineEntityGenerator.php

示例10: generate

 /**
  * @param BundleInterface $bundle
  * @param string          $module
  * @param string          $entity
  */
 public function generate(BundleInterface $bundle, $module, $entity)
 {
     $parameters = array('namespace' => $bundle->getNamespace(), 'bundle' => $bundle->getName(), 'module' => $module, 'entity' => $entity, 'identifier' => Container::underscore($module), 'bundle_alias' => Container::underscore($bundle->getName()));
     $dir = $bundle->getPath();
     $moduleFile = $dir . '/Module/' . $module . 'Module.php';
     if (file_exists($moduleFile)) {
         throw new \RuntimeException(sprintf('Module "%s" already exists', $module));
     }
     $formExtensionFile = $dir . '/Form/Module/' . $module . 'FormExtension.php';
     if (file_exists($formExtensionFile)) {
         throw new \RuntimeException(sprintf('FormExtension "%s" already exists', $module));
     }
     $this->renderFile('module/Module.php.twig', $moduleFile, $parameters);
     $this->renderFile('module/FormExtension.php.twig', $formExtensionFile, $parameters);
     $this->updateDependencyInjection($bundle, $parameters);
 }
开发者ID:clastic,项目名称:clastic,代码行数:21,代码来源:ModuleGenerator.php

示例11: exportTranslations

 /**
  * Export the translations from a given path
  *
  * @param BundleInterface $bundle
  * @param string          $locale
  * @param string          $outputDir
  * @param bool            $excel
  * @return array
  */
 private function exportTranslations(BundleInterface $bundle, $locale, $outputDir, $excel = false)
 {
     // if the bundle does not have a translation dir, continue to the next one
     $translationPath = sprintf('%s%s', $bundle->getPath(), '/Resources/translations');
     if (!is_dir($translationPath)) {
         return array();
     }
     // create a catalogue, and load the messages
     $catalogue = new MessageCatalogue($locale);
     /** @var \Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader $loader */
     $loader = $this->getContainer()->get('translation.loader');
     $loader->loadMessages($translationPath, $catalogue);
     // export in desired format
     if ($excel) {
         // check if the PHPExcel library is installed
         if (!class_exists('PHPExcel')) {
             throw new \RuntimeException('PHPExcel library is not installed. Please do so if you want to export translations as Excel file.');
         }
         $dumper = new ExcelFileDumper();
     } else {
         $dumper = new CsvFileDumper();
     }
     /** @var DumperInterface $dumper */
     return $dumper->dump($catalogue, array('path' => $outputDir, 'bundleName' => $bundle->getName()));
 }
开发者ID:prezent,项目名称:translation-bundle,代码行数:34,代码来源:TranslationExportCommand.php

示例12:

 function it_locates_resource(PathCheckerInterface $pathChecker, KernelInterface $kernel, BundleInterface $bundle)
 {
     $bundle->getName()->willReturn("Bundle");
     $bundle->getPath()->willReturn("/app/bundle");
     $kernel->getBundle("Bundle", false)->willReturn([$bundle]);
     $pathChecker->processPaths(Argument::type('array'), Argument::type('array'), [])->shouldBeCalled()->willReturn("/app/bundle/resource");
     $this->locateResource("@Bundle/Resources/resource", [])->shouldReturn("/app/bundle/resource");
 }
开发者ID:liverbool,项目名称:dos-theme-bundle,代码行数:8,代码来源:BundleResourceLocatorSpec.php

示例13: declareService

 /**
  * @todo Move into trait or dependency.
  * @param BundleInterface $bundle
  * @param string $entity
  */
 protected function declareService(BundleInterface $bundle, $entity)
 {
     $dir = $bundle->getPath();
     $parts = explode('\\', $entity);
     $entityClass = array_pop($parts);
     $entityNamespace = implode('\\', $parts);
     $namespace = $bundle->getNamespace();
     $bundleName = strtolower($bundle->getName());
     $entityName = strtolower($entity);
     $handlersFile = sprintf("%s/Resources/config/handlers.xml", $dir);
     $handlerClass = sprintf("%s\\Handler\\%sHandler", $namespace, $entityClass);
     $paramKey = sprintf("%s.%s.handler.class", str_replace("bundle", "", $bundleName), $entityName);
     $newId = sprintf("%s.%s.handler", str_replace("bundle", "", $bundleName), $entityName);
     $fileName = sprintf("%s/DependencyInjection/%s.php", $dir, str_replace("Bundle", "Extension", $bundle->getName()));
     if (!is_file($handlersFile)) {
         $this->renderFile("config/services.xml.twig", $handlersFile, []);
     }
     $newXML = simplexml_load_file($handlersFile);
     if (!($parametersTag = $newXML->parameters)) {
         $parametersTag = $newXML->addChild('parameters');
     }
     if (!($servicesTag = $newXML->services)) {
         $servicesTag = $newXML->addChild("services");
     }
     $paramSearch = $newXML->xpath("//*[@key='{$paramKey}']");
     $serviceSearch = $newXML->xpath("//*[@id='{$newId}']");
     if (!$paramSearch) {
         $newParamTag = $parametersTag->addChild("parameter");
         $newParamTag->addAttribute("key", $paramKey);
         $newParamTag[0] = $handlerClass;
     }
     if (!$serviceSearch) {
         $newServiceTag = $servicesTag->addChild("service");
         $newServiceTag->addAttribute("id", $newId);
         $newServiceTag->addAttribute("class", "%" . $paramKey . "%");
         $entityManagerTag = $newServiceTag->addChild("argument");
         $entityManagerTag->addAttribute("type", "service");
         $entityManagerTag->addAttribute("id", "doctrine.orm.entity_manager");
         $newServiceTag->addChild("argument", sprintf("%s\\Entity\\%s%s", $namespace, $entityNamespace, $entityClass));
         $formFactoryTag = $newServiceTag->addChild("argument");
         $formFactoryTag->addAttribute("type", "service");
         $formFactoryTag->addAttribute("id", "form.factory");
     }
     $newXML->saveXML($handlersFile);
     $this->updateDIFile($fileName);
 }
开发者ID:stopfstedt,项目名称:TdnPilotBundle,代码行数:51,代码来源:HandlerGenerator.php

示例14: generate

 /**
  * @param BundleInterface $bundle
  * @param string          $entity
  * @param string          $format
  * @param array           $fields
  *
  * @return EntityGeneratorResult
  *
  * @throws \Doctrine\ORM\Tools\Export\ExportException
  */
 public function generate(BundleInterface $bundle, $entity, $format, array $fields)
 {
     // configure the bundle (needed if the bundle does not contain any Entities yet)
     $config = $this->registry->getManager(null)->getConfiguration();
     $config->setEntityNamespaces(array_merge(array($bundle->getName() => $bundle->getNamespace() . '\\Entity'), $config->getEntityNamespaces()));
     $entityClass = $this->registry->getAliasNamespace($bundle->getName()) . '\\' . $entity;
     $entityPath = $bundle->getPath() . '/Entity/' . str_replace('\\', '/', $entity) . '.php';
     if (file_exists($entityPath)) {
         throw new \RuntimeException(sprintf('Entity "%s" already exists.', $entityClass));
     }
     $class = new ClassMetadataInfo($entityClass);
     $class->customRepositoryClassName = str_replace('\\Entity\\', '\\Repository\\', $entityClass) . 'Repository';
     $class->mapField(array('fieldName' => 'id', 'type' => 'integer', 'id' => true));
     $class->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
     foreach ($fields as $field) {
         $class->mapField($field);
     }
     $entityGenerator = $this->getEntityGenerator();
     if ('annotation' === $format) {
         $entityGenerator->setGenerateAnnotations(true);
         $class->setPrimaryTable(array('name' => Inflector::tableize($entity)));
         $entityCode = $entityGenerator->generateEntityClass($class);
         $mappingPath = $mappingCode = false;
     } else {
         $cme = new ClassMetadataExporter();
         $exporter = $cme->getExporter('yml' == $format ? 'yaml' : $format);
         $mappingPath = $bundle->getPath() . '/Resources/config/doctrine/' . str_replace('\\', '.', $entity) . '.orm.' . $format;
         if (file_exists($mappingPath)) {
             throw new \RuntimeException(sprintf('Cannot generate entity when mapping "%s" already exists.', $mappingPath));
         }
         $mappingCode = $exporter->exportClassMetadata($class);
         $entityGenerator->setGenerateAnnotations(false);
         $entityCode = $entityGenerator->generateEntityClass($class);
     }
     $entityCode = str_replace(array("@var integer\n", "@var boolean\n", "@param integer\n", "@param boolean\n", "@return integer\n", "@return boolean\n"), array("@var int\n", "@var bool\n", "@param int\n", "@param bool\n", "@return int\n", "@return bool\n"), $entityCode);
     $this->filesystem->mkdir(dirname($entityPath));
     file_put_contents($entityPath, $entityCode);
     if ($mappingPath) {
         $this->filesystem->mkdir(dirname($mappingPath));
         file_put_contents($mappingPath, $mappingCode);
     }
     $path = $bundle->getPath() . str_repeat('/..', substr_count(get_class($bundle), '\\'));
     $this->getRepositoryGenerator()->writeEntityRepositoryClass($class->customRepositoryClassName, $path);
     $repositoryPath = $path . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $class->customRepositoryClassName) . '.php';
     return new EntityGeneratorResult($entityPath, $repositoryPath, $mappingPath);
 }
开发者ID:coreight,项目名称:SensioGeneratorBundle,代码行数:56,代码来源:DoctrineEntityGenerator.php

示例15: generate

 /**
  * Generate the fixtures class.
  *
  * @param BundleInterface   $bundle     A bundle object
  * @param BundleInterface   $destBundle The destination bundle object
  * @param string            $entity     The entity relative class name
  * @param ClassMetadataInfo $metadata   The entity class metadata
  * @parma integer           $num        The number of fixtures to generate
  *
  * @throws \RuntimeException
  */
 public function generate(BundleInterface $bundle, BundleInterface $destBundle, $entity, ClassMetadataInfo $metadata, $num = 1)
 {
     $parts = explode('\\', $entity);
     $entityClass = array_pop($parts);
     $dir = $destBundle->getPath() . '/DataFixtures/ORM/';
     $this->filesystem->mkdir($dir);
     $this->renderFile('fixtures/DataFixtures.php.twig', $dir . $entityClass . 'Data.php', array('namespace' => $destBundle->getNamespace(), 'bundle' => $bundle->getName(), 'entity' => $entity, 'entity_class' => $entityClass, 'fields' => $this->getFieldsFromMetadata($metadata), 'num' => $num));
 }
开发者ID:joshuataylor,项目名称:PUGXGeneratorBundle,代码行数:19,代码来源:DoctrineFixturesGenerator.php


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