Beispiel #1
0
 public function testCreatedAt()
 {
     $cron = new Cron();
     $dateTime = DateTime::dateTime();
     $expected = $dateTime;
     $cron->setCreatedAt($dateTime);
     $actual = $cron->getCreatedAt();
     $this->assertSame($expected, $actual);
 }
Beispiel #2
0
 /**
  * {@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();
 }
Beispiel #3
0
 /**
  * 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);
 }
Beispiel #4
0
 /**
  * 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);
 }