protected function getCommand($generator, $input) { $command = new GenerateDoctrineEntityCommand(); $command->setContainer($this->getContainer()); $command->setHelperSet($this->getHelperSet($input)); $command->setGenerator($generator); return $command; }
/** * {@inheritDoc} * * @param InputInterface $input input * @param OutputInterface $output output * * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { // put input here for later use.. $this->input = $input; parent::execute($input, $output); $output->writeln('For the time being you need to fix titles and add descriptions in Resource/config/schema manually'); }
protected function configure() { parent::configure(); $this->setAliases(array('oliorga:generate:entity')); }
protected function execute(InputInterface $input, OutputInterface $output) { $calledClass = get_called_class(); $input->setOption('format', 'annotation'); // $input->setOption('with-repository', true); parent::execute($input, $output); $classModifier = $this->getContainer()->get('skcms_core.classmodifier'); //Direct grabbed from parent function $entity = Validators::validateEntityName($input->getOption('entity')); list($bundle, $entity) = $this->parseShortcutNotation($entity); $bundle = $this->getContainer()->get('kernel')->getBundle($bundle); $entityPath = $bundle->getPath() . '/Entity/' . str_replace('\\', '/', $entity) . '.php'; $classModifier->addExtends($entityPath, $calledClass::CLASS_PARENT); $classModifier->privateToProtected($entityPath); $output->writeln(sprintf('SKize entity : ' . $entity)); // if ($input->getOption('with-repository') == true) // { $repositoryPath = $bundle->getPath() . '/Repository/' . str_replace('\\', '/', $entity) . 'Repository.php'; $output->writeln(sprintf('SKize repository' . $repositoryPath)); $classModifier->addExtends($repositoryPath, $calledClass::REPO_PARENT, true); // } return; //Add to menu configuration $doctrine = $this->getContainer()->get('doctrine'); $namespace = $doctrine->getAliasNamespace(); $questionHelper = $this->getQuestionHelper(); $defaultAnswer = array('yes'); $question = new ConfirmationQuestion($questionHelper->getQuestion('Would you like to add it to the admin menu', $input->getOption('add-to-menu') ? 'yes' : 'no', '?'), $input->getOption('add-to-menu')); $add = $questionHelper->ask($input, $output, $question); if ($add == true) { $defaultAnswer = array(str_replace('\\', '/', $entity)); $question = new Question($questionHelper->getQuestion('Wich beautiful name would you like to give it', $input->getOption('beauty-name')), $input->getOption('beauty-name')); $question->setAutocompleterValues($defaultAnswer); $beautyName = $questionHelper->ask($input, $output, $question); $loader = new \Symfony\Component\Yaml\Yaml(); $config = $loader->parse(__DIR__ . '/../../../../../../app/config/config.yml'); $menus = $config['skcms_admin']['menuGroups']; $possibleAnswers = []; foreach ($menus as $menuName => $menu) { $possibleAnswers[] = $menuName; } $question = new Question($questionHelper->getQuestion('In wich menu would you like to diplay it ? (' . implode(',', $possibleAnswers) . ')', $input->getOption('menu-group')), $input->getOption('menu-group')); $menuNameChoosed = $questionHelper->ask($input, $output, $question); if (array_key_exists($menuNameChoosed, $config['skcms_admin']['menuGroups'])) { } $menuIdChoosed = $config['skcms_admin']['menuGroups'][$menuNameChoosed]['id']; dump($bundle->getContainer()); dump($entity); die; // $entity = // [ // str_replace('\\', '/', $entity)=> // [ // 'name'=> str_replace('\\', '/', $entity), // 'beautyName'=> $beautyName, // 'bundle': $bundle->getName(), // // // class: \BES\CoreBundle\Entity\Page // form: \BES\CoreBundle\Form\PageType // menuGroup: 1 // listProperties: // name: // dataName: 'title' // beautyName: 'Titre' // type: 'string' // ]; } }