protected function execute(InputInterface $input, OutputInterface $output) { try { $classConfig = new ClassConfig(); $classConfig->setNoInterface($input->getOption(self::OPTION_NO_INTERFACES)); $classConfig->setNoPHPUnitClass($input->getOption(self::OPTION_NO_PHPUNIT_CLASSES)); $onlySimulate = $input->getOption(self::OPTION_ONLY_SIMULATE_FILE); $bundleName = $input->getArgument(self::PARAM_BUNDLE_NAME); $fileName = $input->getArgument(self::PARAM_FILE_NAME); $filesManager = $this->getFilesManager(); $structureGenerator = $this->getStructureGenerator(); $fileContent = $filesManager->loadFileContent($bundleName, $fileName); $entitiesData = $structureGenerator->parseToArray($fileContent); $classManagers = $structureGenerator->buildEntitiesClassStructure($entitiesData, $classConfig); $this->checkClassesDuplicate($classManagers); $this->validateClasses($classManagers); $output->writeln('ClassGenerator 1.1.0 by Slawomir Kania and contributors.'); $output->writeln(''); if ($onlySimulate) { $output->writeln(sprintf('<comment>[Generating and updating classes is disabled] Simulation for file: %s, in bundle: %s started. Please wait for summary...</comment>', $fileName, $bundleName)); } else { $output->writeln(sprintf('<info>Start generating classes from config file: %s, in bundle: %s. Please wait...</info>', $fileName, $bundleName)); } $output->writeln(''); $this->processStructures($output, $classManagers, $onlySimulate); $output->writeln('<info>Finished!</info>'); } catch (Exception $ex) { throw new Exception(sprintf('Error occured, message: %s, trace: %s', $ex->getMessage(), $ex->getTraceAsString())); } }
/** * @return ClassManager */ private function initDataFromYamlAndGetSecondClassWithoutInterface() { $classConfig = new ClassConfig(); $classConfig->setNoInterface(true); $this->initDataFromYaml($classConfig); return $this->classManagers[1]; }