示例#1
0
 /**
  * Deletes the log for given mobile.
  *
  * @param string $mobile
  *
  * @throws NonExistentMobileInternalException
  */
 public function delete($mobile)
 {
     $result = $this->connectToStorageInternalWorker->connect()->remove(array('mobile' => $mobile));
     if ($result['n'] == 0) {
         throw new NonExistentMobileInternalException();
     }
 }
示例#2
0
 /**
  * Creates a log for given mobile.
  *
  * @param string $mobile
  *
  * @throws ExistentMobileInternalException
  * @throws \MongoCursorException
  */
 public function create($mobile)
 {
     try {
         $this->connectToStorageInternalWorker->connect()->insert(array('mobile' => $mobile));
     } catch (\MongoCursorException $e) {
         if (11000 == $e->getCode()) {
             throw new ExistentMobileInternalException();
         }
         throw $e;
     }
 }
示例#3
0
 /**
  * Collects logs.
  *
  * @return \Iterator
  */
 public function collect()
 {
     return $this->connectToStorageInternalWorker->connect()->find()->fields(['_id' => 0]);
 }