Esempio n. 1
0
 /**
  * Process the $inlinecount option and update the request description.
  *
  * @return void
  * 
  * @throws ODataException Throws bad request error in the following cases
  *                          (1) If $inlinecount is disabled by the developer
  *                          (2) If both $count and $inlinecount specified
  *                          (3) If $inlinecount value is unknown
  *                          (4) If capability negotiation over version fails
  */
 private function _processCount()
 {
     $inlineCount = $this->_dataService->getHost()->getQueryStringItem(ODataConstants::HTTPQUERY_STRING_INLINECOUNT);
     if (!is_null($inlineCount)) {
         if (!$this->_dataService->getServiceConfiguration()->getAcceptCountRequests()) {
             ODataException::createBadRequestError(Messages::dataServiceConfigurationCountNotAccepted());
         }
         $inlineCount = trim($inlineCount);
         if ($inlineCount === ODataConstants::URI_ROWCOUNT_OFFOPTION) {
             return;
         }
         if ($this->_requestDescription->getRequestCountOption() == RequestCountOption::VALUE_ONLY) {
             ODataException::createBadRequestError(Messages::queryProcessorInlineCountWithValueCount());
         }
         $this->_checkSetQueryApplicable();
         if ($inlineCount === ODataConstants::URI_ROWCOUNT_ALLOPTION) {
             $this->_requestDescription->setRequestCountOption(RequestCountOption::INLINE);
             $this->_requestDescription->raiseMinimumVersionRequirement(2, 0, $this->_dataService);
             $this->_requestDescription->raiseResponseVersion(2, 0, $this->_dataService);
         } else {
             ODataException::createBadRequestError(Messages::queryProcessorInvalidInlineCountOptionError());
         }
     }
 }