コード例 #1
0
ファイル: CronTest.php プロジェクト: dzoke/CmsBundle
 public function testCreatedAt()
 {
     $cron = new Cron();
     $dateTime = DateTime::dateTime();
     $expected = $dateTime;
     $cron->setCreatedAt($dateTime);
     $actual = $cron->getCreatedAt();
     $this->assertSame($expected, $actual);
 }
コード例 #2
0
ファイル: LoadCronData.php プロジェクト: dzoke/CmsBundle
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $sitemapCron = new Cron();
     $sitemapCron->setCommand('presta:sitemaps:dump');
     $sitemapCron->setExpression('7 * * * *');
     $sitemapCron->setPriority(1);
     $sitemapCron->setState(Cron::STATE_PENDING);
     $manager->persist($sitemapCron);
     $manager->flush();
 }
コード例 #3
0
ファイル: CronRunCommand.php プロジェクト: dzoke/CmsBundle
 /**
  * Change the state of the cron
  *
  * @param Cron   $cron
  * @param string $state
  *
  * @return void
  */
 private function changeState(Cron $cron, $state)
 {
     $cron->setState($state);
     $em = $this->getEntityManager();
     $em->persist($cron);
     $em->flush($cron);
 }
コード例 #4
0
ファイル: CronRunCommand.php プロジェクト: Opifer/Cms
 /**
  * Change the state of the cron.
  *
  * @param Cron   $cron
  * @param string $state
  */
 private function changeState(Cron $cron, $state, $lastError = null)
 {
     $cron->setState($state);
     $cron->setLastError($lastError);
     $em = $this->getEntityManager();
     $em->persist($cron);
     $em->flush($cron);
 }