protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $entity = Validators::validateEntityName($input->getArgument('entity')); list($bundle, $entity) = $this->parseShortcutNotation($entity); // $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($bundle).'\\'.$entity; // $metadata = $this->getEntityMetadata($entityClass); $bundle = $this->getApplication()->getKernel()->getBundle($bundle); $entityPath = $bundle->getPath() . '/Entity/' . $entity . '.php'; $entityContent = file_get_contents($entityPath); $extension = '\\SKCMS\\CoreBundle\\Form\\EntityType'; if (preg_match('#SKBasePage#', $entityContent)) { $extension = '\\SKCMS\\CoreBundle\\Form\\PageType'; } $dirPath = $bundle->getPath() . '/Form'; $classPath = $dirPath . '/' . str_replace('\\', '/', $entity) . 'Type.php'; $classModifier = $this->getContainer()->get('skcms_core.classmodifier'); $classModifier->addExtends($classPath, $extension); $classModifier->parentBuildForm($classPath); $classModifier->removeLineContaining($classPath, ['slug', 'userCreate', 'userUpdate', 'creationDate', 'updateDate', 'draft', 'position']); $output->writeln($classPath . ' skized'); }
/** * @see Command */ protected function configure() { parent::configure(); $this->setAliases(array('oliorga:generate:form')); }