示例#1
0
 /**
  * Deletes the link for given message.
  *
  * @param string $message
  *
  * @throws NonExistentMessageInternalException
  */
 public function delete($message)
 {
     $result = $this->connectToStorageInternalWorker->connect()->remove(['message' => $message]);
     if ($result['n'] == 0) {
         throw new NonExistentMessageInternalException($message);
     }
 }
示例#2
0
 /**
  * Picks the link for given message.
  *
  * @param string $message
  *
  * @return array An array with the following keys:
  *               message and info.
  *
  * @throws NonExistentMessageInternalException
  */
 public function pick($message)
 {
     $link = $this->connectToStorageInternalWorker->connect()->findOne(['message' => $message]);
     if (!$link) {
         throw new NonExistentMessageInternalException($message);
     }
     return $link;
 }
示例#3
0
 /**
  * Collects links.
  *
  * @return \Iterator
  */
 public function collect()
 {
     return $this->connectToStorageInternalWorker->connect()->find()->fields(['_id' => 0]);
 }
示例#4
0
 /**
  * Creates a link between given message and given info.
  *
  * @param string $message
  * @param string $info
  * @param string $subscription
  */
 public function create($message, $info, $subscription)
 {
     $this->connectToStorageInternalWorker->connect()->insert(['message' => $message, 'info' => $info, 'subscription' => $subscription]);
 }