コード例 #1
0
 /**
  * Initialize parameters and services used in execute function
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     parent::initialize($input, $output);
     if (true === $this->input->getOption('no-output')) {
         $this->output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
     }
     $this->entityManager = $this->getContainer()->get('doctrine')->getManager($this->getContainer()->getParameter('jmose_command_scheduler.doctrine_manager'));
     /** @var ExecutionRepository $repo */
     $this->executionRepo = $this->getRepository('Execution');
     if (($this->limit = $this->input->getOption('days_limit')) !== false && is_numeric($this->limit) && $this->limit > 0) {
         $limit = strtotime('-' . $this->limit . ' days');
         $this->limit = new \DateTime(date('Y-m-d 00:00:00', $limit));
         $this->action = 'date';
     } else {
         if (($this->limit = $this->input->getOption('date_limit')) !== false && preg_match("/\\d+-\\d+-\\d+ \\d+:\\d+:\\d+/", $this->limit)) {
             $this->limit = new \DateTime($this->limit);
             $this->action = 'date';
         } else {
             if (($this->limit = $this->input->getOption('nr_limit')) !== false && is_numeric($this->limit)) {
                 $this->action = 'number';
             } else {
                 if ($this->input->getOption('truncate') == 'true' && $this->input->getOption('verify') == 'true') {
                     $this->action = 'truncate';
                 }
             }
         }
     }
 }
コード例 #2
0
 /**
  * Initialize parameters and services used in execute function
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     parent::initialize($input, $output);
     $this->lockTimeout = $this->getContainer()->getParameter('jmose_command_scheduler.lock_timeout');
     $this->receiver = $this->getContainer()->getParameter('jmose_command_scheduler.monitor_mail');
     $this->sendMailIfNoError = $this->getContainer()->getParameter('jmose_command_scheduler.send_ok');
     $this->em = $this->getContainer()->get('doctrine')->getManager($this->getContainer()->getParameter('jmose_command_scheduler.doctrine_manager'));
 }