/**
  * {@inheritdoc}
  */
 public function applyDelete(ModelStubInterface $model)
 {
     /* @var $dataGatewayMongo \MongoCollection */
     $dataGatewayMongo = $model->getDataGateway();
     $result = $dataGatewayMongo->remove([]);
     return $this->handleResult($result);
 }
 /**
  * {@inheritdoc}
  */
 public function applyWrite(ModelStubInterface $model, array &$data)
 {
     unset($data['_id']);
     /* @var $dataGatewayMongo \MongoCollection */
     $dataGatewayMongo = $model->getDataGateway();
     $result = $dataGatewayMongo->save($data);
     return $this->handleResult($result);
 }
 /**
  * {@inheritdoc}
  */
 public function applyDelete(ModelStubInterface $model)
 {
     /* @var $client RestClient */
     $client = $model->getDataGateway();
     $client->delete($this->getId());
     switch ($client->getLastResponse()->getStatusCode()) {
         case Response::STATUS_CODE_200:
         case Response::STATUS_CODE_204:
             return 1;
     }
     return null;
 }
 /**
  * {@inheritdoc}
  */
 public function applyDelete(ModelStubInterface $model)
 {
     $result = $model->getDataGateway()->remove(['_id' => $this->extractId($model)], ['justOne' => true] + $this->getMongoOptions());
     return $this->handleResult($result, true);
 }
 /**
  * {@inheritdoc}
  */
 public function apply(ModelStubInterface $model)
 {
     /** @var $dataGateway \MongoCollection */
     $dataGateway = $model->getDataGateway();
     $cursor = $dataGateway->find($this->selectionCriteria, $this->projectionFields);
     if (!empty($this->sortParams)) {
         $cursor->sort($this->sortParams);
     }
     return $cursor->limit($this->limit)->skip($this->offset);
 }
 /**
  * Apply
  * @param ModelStubInterface $model
  * @return mixed
  */
 public function apply(ModelStubInterface $model)
 {
     /* @var $dataGatewayMongo \MongoCollection */
     $dataGatewayMongo = $model->getDataGateway();
     return $dataGatewayMongo->find()->limit($this->limit)->skip($this->offset);
 }
 /**
  * {@inheritdoc}
  */
 public function apply(ModelStubInterface $model)
 {
     /* @var $client RestClient */
     $client = $model->getDataGateway();
     $query = $this->getQuery();
     if ($this->limit) {
         $query[$this->pageSizeParamName] = $this->limit;
     }
     if ($this->page) {
         $query[$this->pageParamName] = $this->page;
     }
     $result = $client->get(null, $query);
     $payloadData = $client->getLastResponseData();
     if (isset($payloadData[$this->pageSizeParamName])) {
         $this->limit = (int) $payloadData[$this->pageSizeParamName];
     }
     $this->updateOffset();
     return $result;
 }
 /**
  * {@inheritdoc}
  */
 public function applyDelete(ModelStubInterface $model)
 {
     return $this->getDocumentStore()->isolatedRemove($model->getDataGateway(), $this->extractId($model), $this->getMongoOptions());
 }