예제 #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 targeted 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->service->getHost()->getQueryStringItem(ODataConstants::HTTPQUERY_STRING_FILTER);
     if (is_null($filter)) {
         return;
     }
     $kind = $this->request->getTargetKind();
     if (!($kind == TargetKind::RESOURCE() || $kind == TargetKind::COMPLEX_OBJECT() || $this->request->queryType == QueryType::COUNT())) {
         throw ODataException::createBadRequestError(Messages::queryProcessorQueryFilterOptionNotApplicable());
     }
     $resourceType = $this->request->getTargetResourceType();
     $expressionProvider = $this->service->getProvidersWrapper()->getExpressionProvider();
     $filterInfo = ExpressionParser2::parseExpression2($filter, $resourceType, $expressionProvider);
     $this->request->setFilterInfo($filterInfo);
 }