예제 #1
0
 public function testQueueListEvent()
 {
     $before = new DateTime();
     $after = new DateTime();
     $state = 1;
     $limit = 5;
     $offset = 3;
     $order = 'DESC';
     $result = new \ArrayIterator(array());
     $list = new QueueListEvent($offset, $limit, $state, $order, $before, $after);
     $list->setResult($result);
     $this->assertEquals($before, $list->getBefore());
     $this->assertEquals($after, $list->getAfter());
     $this->assertEquals($state, $list->getState());
     $this->assertEquals($limit, $list->getLimit());
     $this->assertEquals($offset, $list->getOffset());
     $this->assertEquals($order, $list->getOrder());
     $this->assertEquals($result, $list->getResult());
 }
예제 #2
0
 public function onList(QueueListEvent $event)
 {
     try {
         $query = $this->gateway->selectQuery()->start();
         if ($event->getState() !== null) {
             $query->filterByState($event->getState());
         }
         if ($event->getAfter() instanceof DateTime) {
             $query->filterByAddedAfter($event->getAfter());
         }
         if ($event->getBefore() instanceof DateTime) {
             $query->filterByAddedBefore($event->getBefore());
         }
         if ($event->getLimit() !== null) {
             $query->limit($event->getLimit());
         }
         if ($event->getOffset() !== null) {
             $query->offset($event->getOffset());
         }
         # set the order by the date added
         $query->orderByDateAdded($event->getOrder());
         $event->setResult($query->end()->find());
     } catch (DBALGatewayException $e) {
         throw new LaterJobException($e->getMessage(), 0, $e);
     }
 }
예제 #3
0
 /**
  *  Log events that occur from queue
  *
  *  @access public
  *  @param QueueListEvent $event 
  */
 public function logQueueListEvent(QueueListEvent $event)
 {
     $this->log->info('QueueListEvent:: Running Queue List ', array('limit' => $event->getLimit(), 'offset' => $event->getOffset(), 'before' => $event->getBefore(), 'after' => $event->getAfter(), 'order' => $event->getOrder(), 'state' => $event->getState()));
 }
 /**
  *  Log events that occur from queue
  *
  *  @access public
  *  @param QueueListEvent $event 
  */
 public function logQueueListEvent(QueueListEvent $event)
 {
     $this->output->writeln('QueueListEvent:: Running Queue List ' . json_encode(array('limit' => $event->getLimit(), 'offset' => $event->getOffset(), 'before' => $event->getBefore(), 'after' => $event->getAfter(), 'order' => $event->getOrder(), 'state' => $event->getState())));
 }