Beispiel #1
0
 /**
  * Process the $filter option in the request and update request decription.
  * 
  * @return void
  * 
  * @throws ODataException Throws error in the following cases:
  *                          (1) If $filter cannot be applied to the 
  *                              resource targetted by the request uri
  *                          (2) If any error occured while parsing and
  *                              translating the odata $filter expression
  *                              to expression tree
  *                          (3) If any error occured while generating
  *                              php expression from expression tree
  */
 private function _processFilter()
 {
     $filter = $this->_dataService->getHost()->getQueryStringItem(ODataConstants::HTTPQUERY_STRING_FILTER);
     if (!is_null($filter)) {
         $requestTargetKind = $this->_requestDescription->getTargetKind();
         if (!($requestTargetKind == RequestTargetKind::RESOURCE || $requestTargetKind == RequestTargetKind::COMPLEX_OBJECT || $this->_requestDescription->getRequestCountOption() == RequestCountOption::VALUE_ONLY)) {
             ODataException::createBadRequestError(Messages::queryProcessorQueryFilterOptionNotApplicable());
         }
         $resourceType = $this->_requestDescription->getTargetResourceType();
         try {
             $expressionProvider = $this->_dataService->getMetadataQueryProviderWrapper()->getExpressionProvider();
             $internalFilterInfo = ExpressionParser2::parseExpression2($filter, $resourceType, $expressionProvider);
             $this->_requestDescription->setInternalFilterInfo($internalFilterInfo);
         } catch (ODataException $odataException) {
             throw $odataException;
         }
     }
 }