예제 #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->writeSection($output, '[Propel] You are running the command: propel:init:acl');
     if ($input->getOption('verbose')) {
         $this->additionalPhingArgs[] = 'verbose';
     }
     // Generate ACL model
     if (true == ($result = $this->callPhing('om'))) {
         $output->writeln(sprintf('>>  <info>%20s</info>    Generated model classes from <comment>%s</comment>', $this->getApplication()->getKernel()->getBundle('PropelBundle')->getName(), 'acl_schema.xml'));
     } else {
         $this->writeTaskError($output, 'om');
         return 1;
     }
     // Prepare SQL directory
     $sqlDirectory = $this->getSqlDir();
     $filesystem = new Filesystem();
     $filesystem->remove($sqlDirectory);
     $filesystem->mkdir($sqlDirectory);
     if (true == ($result = $this->callPhing('build-sql', array('propel.sql.dir' => $sqlDirectory)))) {
         $this->writeSection($output, '<comment>1</comment> <info>SQL file has been generated.</info>', 'bg=black');
     } else {
         $this->writeTaskError($output, 'build-sql');
         return 2;
     }
     return parent::execute($input, $output);
 }
예제 #2
0
 /**
  * @see Command
  *
  * @throws \InvalidArgumentException When the target directory does not exist
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!$input->getOption('sql')) {
         $modelCommand = new ModelBuildCommand();
         $modelCommand->setApplication($this->getApplication());
         $modelCommand->execute($input, $output);
     }
     if (!$input->getOption('classes')) {
         $sqlCommand = new SqlBuildCommand();
         $sqlCommand->setApplication($this->getApplication());
         $sqlCommand->execute($input, $output);
     }
     if ($input->getOption('insert-sql')) {
         $insertCommand = new SqlInsertCommand();
         $insertCommand->setApplication($this->getApplication());
         // By-pass the '--force' required option
         $this->addOption('force', '', InputOption::VALUE_NONE, '');
         $input->setOption('force', true);
         $insertCommand->execute($input, $output);
     }
 }