Executes the command that generates the controller.

@param CrestApps\CodeGenerator\Models\ResourceInput $input
@return $this
196855
protected function createController($input)
    {
        if (!$this->option('without-controller')) {
            $this->call(
                'create:controller',
                [
                    'model-name' => $input->modelName,
                    '--controller-name' => $input->controllerName,
                    '--controller-directory' => $input->controllerDirectory,
                    '--controller-extends' => $input->controllerExtends,
                    '--model-directory' => $input->modelDirectory,
                    '--views-directory' => $input->viewsDirectory,
                    '--resource-file' => $input->resourceFile,
                    '--models-per-page' => $input->perPage,
                    '--routes-prefix' => $input->prefix,
                    '--language-filename' => $input->languageFileName,
                    '--with-form-request' => $input->formRequest,
                    '--without-form-request' => $this->option('without-form-request'),
                    '--form-request-directory' => $input->formRequestDirectory,
                    '--with-auth' => $input->withAuth,
                    '--template-name' => $input->template,
                    '--force' => $input->force,
                ]
            );
        }

        return $this;
    }
29754
protected function getCommandInput()
    {
        $input = new ResourceInput(trim($this->argument('model-name')));
        $input->prefix = trim($this->option('routes-prefix'));
        $input->languageFileName = trim($this->option('language-filename'));
        $input->table = trim($this->option('table-name'));
        $input->viewsDirectory = trim($this->option('views-directory'));
        $input->controllerName = trim($this->option('controller-name')) ?: Helpers::makeControllerName($input->modelName);
        $input->perPage = intval($this->option('models-per-page'));
        $input->resourceFile = trim($this->option('resource-file')) ?: Helpers::makeJsonFileName($input->modelName);
        $input->formRequest = $this->option('with-form-request');
        $input->controllerDirectory = $this->option('controller-directory');
        $input->controllerExtends = $this->option('controller-extends') ?: null;
        $input->withMigration = $this->option('with-migration');
        $input->force = $this->option('force');
        $input->modelDirectory = $this->option('model-directory');
        $input->primaryKey = $this->option('primary-key');
        $input->withSoftDelete = $this->option('with-soft-delete');
        $input->withoutTimeStamps = $this->option('without-timestamps');
        $input->migrationClass = $this->option('migration-class-name');
        $input->connectionName = $this->option('connection-name');
        $input->engineName = $this->option('engine-name');
        $input->template = $this->getTemplateName();
        $input->layoutName = $this->option('layout-name') ?: 'layouts.app';
        $input->tableExists = $this->option('table-exists');
        $input->translationFor = $this->option('translation-for');
        $input->withAuth = $this->option('with-auth');
        $input->formRequestDirectory = $this->option('form-request-directory');

        return $input;
    }
28176
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln('Generating package code...');

        $generator = new PackageGenerator();

        $definitions = new Definitions([
            'core' => 'https://raw.githubusercontent.com/schemaorg/schemaorg/master/data/schema.rdfa',
        ]);

        if (! $input->getOption('local')) {
            $definitions->preload();
        }

        $generator->generate($definitions);

        $output->writeln('Done!');

        return 0;
    }
661556
public function prepare($input)
    {
        $form = $this->buildEmbeddedForm();

        return $form->setOriginal($this->original)->prepare($input);
    }
1188387
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->input = $input;
        $this->output = $output;
        $io = new SymfonyStyle($input, $output);

        $config = $this->getConfigHelper()->load($input);
        $typeMap = TypeMap::fromMetadata(
            $config->getTypeNamespace(),
            $config->getEngine()->getMetadata()->getTypes()
        );

        $generator = new ClassMapGenerator(
            $config->getRuleSet(),
            $config->getClassMapName(),
            $config->getClassMapNamespace()
        );
        $path = $config->getClassMapDestination().DIRECTORY_SEPARATOR.$config->getClassMapName().'.php';
        $this->handleClassmap($generator, $typeMap, $path);

        $io->success('Generated classmap at ' . $path);
    }
857384
public function handle(Input $input, Output $output)
    {
        $controller = $input->getArgument('controller');
        $resource = $input->getOption('resource');
        $is_api = $input->getOption('api');

        try {
            if (!preg_match("/^([A-Z]\w*\/?)*$/", $controller)) throw new \Exception("Error: Invalid controller name. It must be Characters and PascalCase.", 1);

            $pre_controller_path = app_path("Controllers");
            $sub_directories = "";

            if ($is_api)
            {
                $pre_controller_path = app_path("Controllers/Api");
                $sub_directories = "\\Api";
            }

            // have directory
            if (strpos($controller, "/"))
            {
                $explode_controller = explode("/", $controller);

                $controller = array_pop($explode_controller);
                $pre_controller_path .= "/" . implode("/", $explode_controller);
                $sub_directories .= "\\" . implode("\\", $explode_controller);
            }

            $file = "{$pre_controller_path}/{$controller}.php";
            if (file_exists($file)) throw new \Exception("Error: The controller name is already created.", 1);

            $template = $this->getTemplate($sub_directories, $controller, $resource);
            if ($template !== false)
            {
                // create directory if directory not exist
                if (!file_exists($pre_controller_path))
                {
                    mkdir($pre_controller_path, 0755, true);
                }

                // create file
                $file_controller = fopen($pre_controller_path . "/{$controller}.php", "w");
                fwrite($file_controller, $template);
                fclose($file_controller);
            }

            $output->writeln(file_exists($file) ? "Successfully created." : "File is not created.");
        } catch (\Exception $e) {
            $output->writeln($e->getMessage());
        }
    }
1125422
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $helper = $this->getQuestionHelper();

        $question = new ConfirmationQuestion('Do you confirm generation?', true);

        if ($input->isInteractive()) {
            if (!$helper->ask($input, $output, $question)) {
                $output->writeln('<error>Command aborted</error>');

                return 1;
            }
        }

        foreach (array('namespace', 'short-name') as $option) {
            if (null === $input->getOption($option)) {
                throw new \RuntimeException(sprintf('The "%s" option must be provided.', $option));
            }
        }

        $namespace = Validators::validateBundleNamespace($input->getOption('namespace'));
        $bundle = strtr($namespace, array('\\' => ''));
        $bundle = Validators::validateBundleName($bundle);

        $dir = realpath(__DIR__ . '/../../../../../../');
        if (null !== $input->getOption('dir')) {
            $dir = $input->getOption('dir');
        }

        $dir = Validators::validateTargetDir($dir, $bundle, $namespace);

        if (!$this->getContainer()->get('filesystem')->isAbsolutePath($dir)) {
            $dir = getcwd().'/'.$dir;
        }

        $format = 'yml';
        $format = Validators::validateFormat($format);

        $helper->writeSection($output, 'Bundle generation');

        /** @var ComponentGenerator $generator */
        $generator = $this->getGenerator();
        $generator->generate($namespace, $bundle, $dir, $format);

        $output->writeln('Generating the bundle code: <info>OK</info>');

        $errors = array();
        $runner = $helper->getRunner($output, $errors);

        //update parameters.yml file in vendor
        $shortName = $input->getOption('short-name');
        $runner($this->updateParameters($output, $shortName, $dir, $namespace, $bundle));

        $helper->writeGeneratorSummary($output, $errors);
    }
534591
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $container = $this->getApplication()->getContainer();
        $container->configure();

        $classname = $input->getArgument('class');
        $method = $input->getArgument('method');

        if (!$this->confirm($input, $classname, $method)) {
            return;
        }

        $resource = $container->get('locator.resource_manager')->createResource($classname);

        $container->get('code_generator')->generate($resource, 'specification_method', [
            'method' => $method,
            'type' => $this->confirmMethodType($input, $output),
        ]);
    }
99220
protected function execute(Input $input, Output $output)
    {
        $command = $this->container->get($this->serviceId);

        return $command($input, $output);
    }
537063
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $themeName = $input->getArgument('theme');
        $kernel = $this->getContainer()->get('kernel');
        $dir = $kernel->locateResource('@' . $themeName);
        $namespace = $kernel
            ->getBundle($themeName)
            ->getNamespace()
        ;

        // @codeCoverageIgnoreStart
        if (null === $this->templateParser) {
            $this->templateParser = new TemplateParser($this->getContainer()->get('templating.locator'), $this->getContainer()->get('templating.name_parser'));
        }

        if (null === $this->templateGenerator) {
            $this->templateGenerator = new TemplateGenerator();
        }

        if (null === $this->slotsGenerator) {
            $this->slotsGenerator = new SlotsGenerator();
        }

        if (null === $this->extensionGenerator) {
            $this->extensionGenerator = new ExtensionGenerator();
        }
        // @codeCoverageIgnoreEnd

        $parsedTemplates = $this->templateParser->parse($dir . 'Resources/views/Theme', $kernel->getRootDir(), $themeName);
        $this->addOption('template-name', '', InputOption::VALUE_NONE, '');
        $templates = $parsedTemplates["templates"];
        foreach ($templates as $templateAttributes) {
            $templateFileName = $templateAttributes["name"];
            $templateName = basename($templateFileName, '.html.twig');
            $message = $this->templateGenerator->generateTemplate($dir . 'Resources/config/templates', $themeName, $templateName, $templateAttributes["slots"]);
            $output->writeln($message);
        }

        $message = $this->slotsGenerator->generateSlots($dir . 'Resources/config/slots', $themeName, $parsedTemplates["slots"]);
        $output->writeln($message);

        $message = $this->extensionGenerator->generateExtension($namespace, $dir . 'DependencyInjection', $themeName, $templates);
        $output->writeln($message);
    }
51787
public function setHtml($input): self {
        $this->manipulateNodesWithInput($input, function($node, $newNodes) {
            // Remove old contents from the current node.
            $node->contents()->remove();

            // Add new contents in it's place.
            $node->append($newNodes);
        });

        return $this;
    }
1297337
protected function execute(InputInterface $input, OutputInterface $output)
    {
        parent::execute($input, $output);
        
        $builder = new EntityBuilder($this->getConfiguration(), $output);
        
        $output->writeln('<info>Start build application!</info>');
        $builder->generateMetadata();
        $output->writeln('<info>Build models from schema file</info>');
        $builder->generateAllModels();
        $output->writeln('<info>Well done! Application was successfully installed!</info>');
    }
1157482
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln('Start generating...');
        $generated = $this->getFacade()->generateDataProvider();

        if ($output->isVerbose()) {
            foreach ($generated as $provider) {
                $output->writeln($provider . ' generated');
            }
        }
    }
1305164
public function append($input): self {
        $this->manipulateNodesWithInput($input, function($node, $newNodes) {
            foreach ($newNodes as $newNode) {
                $node->appendChild($newNode);
            }
        });

        return $this;
    }
632971
private function setInputAndOutput(InputInterface $input, OutputInterface $output)
    {
        if (is_null($this->assistant)) {
            $this->assistant = new CommandAssistant();
            $this->assistant->setQuestionHelper($this->getQuestionHelper());
            $this->assistant->setKernel($this->getApplication()->getKernel());
        }
        $this->assistant->setOutput($output);
        $this->assistant->setInput($input);
    }
1322371
public function replaceWith($input): self {
        $this->manipulateNodesWithInput($input, function($node, $newNodes) {
            foreach ($newNodes as $newNode) {
                $node->parent()->replaceChild($newNode, $node);
            }
        });

        return $this;
    }
1342093
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $gen = new CodeGenerator(
            Database::getConnection(),
            array('default' => 'PHPCI'),
            array('default' => PHPCI_DIR),
            false
        );

        $gen->generateModels();
        $gen->generateStores();
    }