public function onPurgeActivity(QueuePurgeActivityEvent $event) { try { # purge jobs that have been completed or failed # before x date $result = $this->gateway->deleteQuery()->start()->filterOccuredBefore($event->getBeforeDate())->end()->delete(); $event->setResult($this->gateway->rowsAffected()); } catch (DBALGatewayException $e) { throw new LaterJobException($e->getMessage(), 0, $e); } }
public function testQueuePurgeActivityEvent() { $before = new DateTime(); $result = true; $purge = new QueuePurgeActivityEvent($before); $purge->setResult($result); $this->assertEquals($result, $purge->getResult()); $this->assertEquals($before, $purge->getBeforeDate()); }
/** * Log events that occur from queue * * @access public * @param QueuePurgeActivityEvent $event */ public function logQueuePurgeActivityEvent(QueuePurgeActivityEvent $event) { $this->log->info('QueuePurgeEvent:: Purge activity record using params', array('before' => $event->getBeforeDate())); }
/** * Log events that occur from queue * * @access public * @param QueuePurgeActivityEvent $event */ public function logQueuePurgeActivityEvent(QueuePurgeActivityEvent $event) { $this->output->writeln('QueuePurgeEvent:: Purge activity record using params ' . json_encode(array('before' => $event->getBeforeDate()))); }