/**
  * Executes the command.
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // Get metadata informations
     $metadata = $input->getOption('entity');
     $io = new GeneratorStyle($input, $output);
     $io->title('Files generation');
     $this->getContainer()->get('remg_entity_generator_helper')->generateEntity($io, $metadata);
     // Update the database schema
     $this->runSchemaUpdate($input, $output);
 }
 /**
  * Updates the database schema
  * by running the 'doctrine:schema:update' command.
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  */
 public function runSchemaUpdate(InputInterface $input, OutputInterface $output)
 {
     // Dont update the schema if the option "no-schema-update" is provided.
     if ($input->getOption('no-schema-update')) {
         return;
     }
     $io = new GeneratorStyle($input, $output);
     $io->title('Database schema update');
     $io->text('Updating database schema..');
     // Get the doctrine schema update command.
     $command = $this->getApplication()->find('doctrine:schema:update');
     // Dont run the command if the command is not found.
     if (!$command) {
         $output->writeln('<error>Unable to update the database schema (command not found).</error>');
         return;
     }
     // Create new command input arguments.
     $commandInput = new ArrayInput(['command' => 'doctrine:schema:update', '--force' => true, '--quiet' => true]);
     // Execute the command.
     $command->run($commandInput, $output);
 }