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