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


PHP EntityGenerator::setAttributeVisibility方法代码示例

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


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

示例1: execute

 /**
  * @see Console\Command\Command
  */
 protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
 {
     $em = $this->getHelper('em')->getEntityManager();
     $cmf = new DisconnectedClassMetadataFactory();
     $cmf->setEntityManager($em);
     $metadatas = $cmf->getAllMetadata();
     $metadatas = MetadataFilter::filter($metadatas, $input->getOption('filter'));
     // Process destination directory
     $destPath = realpath($input->getArgument('dest-path'));
     if (!file_exists($destPath)) {
         throw new \InvalidArgumentException(sprintf("Entities destination directory '<info>%s</info>' does not exist.", $destPath));
     } else {
         if (!is_writable($destPath)) {
             throw new \InvalidArgumentException(sprintf("Entities destination directory '<info>%s</info>' does not have write permissions.", $destPath));
         }
     }
     if (count($metadatas)) {
         // Create EntityGenerator
         $entityGenerator = new EntityGenerator();
         $entityGenerator->setGenerateAnnotations($input->getOption('generate-annotations'));
         $entityGenerator->setGenerateStubMethods($input->getOption('generate-methods'));
         $entityGenerator->setRegenerateEntityIfExists($input->getOption('regenerate-entities'));
         $entityGenerator->setUpdateEntityIfExists($input->getOption('update-entities'));
         $entityGenerator->setNumSpaces($input->getOption('num-spaces'));
         if (($attributeVisibility = $input->getOption('attribute-visibility')) !== null) {
             $entityGenerator->setAttributeVisibility($attributeVisibility);
         }
         if (($extend = $input->getOption('extend')) !== null) {
             $entityGenerator->setClassToExtend($extend);
         }
         foreach ($metadatas as $metadata) {
             $output->write(sprintf('Processing entity "<info>%s</info>"', $metadata->name) . PHP_EOL);
         }
         // Generating Entities
         $entityGenerator->generate($metadatas, $destPath);
         // Outputting information message
         $output->write(PHP_EOL . sprintf('Entity classes generated to "<info>%s</INFO>"', $destPath) . PHP_EOL);
     } else {
         $output->write('No Metadata Classes to process.' . PHP_EOL);
     }
 }
开发者ID:gomestai,项目名称:flextrine,代码行数:44,代码来源:GenerateEntitiesCommand.php


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