Exemplo n.º 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);
     }
 }
Exemplo n.º 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;
 }
Exemplo n.º 3
0
 /**
  * Collects links.
  *
  * @return \Iterator
  */
 public function collect()
 {
     return $this->connectToStorageInternalWorker->connect()->find()->fields(['_id' => 0]);
 }
Exemplo n.º 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]);
 }