/** * 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; }