/** * Adds the operation $operation to the queue * @param string $operation * @return QueueItem */ public static function add( BackgroundOperation $operation ) { $queueItem = new QueueItem( $operation ); try { $queueItem->store(); } catch( ezcPersistentObjectAlreadyPersistentException $e ) { // @todo Add status check throw new AlreadyQueuedException( $queueItem ); } return $queueItem; }
/** * Updates the queue item informations * * @param int $progress The progress, from 0 to 100 * @param string $message The operation message */ protected function updateQueueItem( $progress, $message = '' ) { $this->queueItem->message = $message; $this->queueItem->progress = $progress; $this->queueItem->update(); }