예제 #1
0
 /**
  * Query for a related resource set or resource set reference pointed by the 
  * given segment descriptor and update the descriptor with the result.
  * 
  * @param SegmentDescriptor &$segment Describes the related resource
  *                                              to query.
  * 
  * @return void
  */
 private function _handleSegmentTargetsToRelatedResource(SegmentDescriptor $segment)
 {
     $projectedProperty = $segment->getProjectedProperty();
     $projectedPropertyKind = $projectedProperty->getKind();
     if ($projectedPropertyKind == ResourcePropertyKind::RESOURCESET_REFERENCE) {
         if ($segment->isSingleResult()) {
             $entityInstance = $this->providers->getResourceFromRelatedResourceSet($segment->getPrevious()->getTargetResourceSetWrapper(), $segment->getPrevious()->getResult(), $segment->getTargetResourceSetWrapper(), $projectedProperty, $segment->getKeyDescriptor());
             $segment->setResult($entityInstance);
         } else {
             $queryResult = $this->providers->getRelatedResourceSet($this->request->queryType, $segment->getPrevious()->getTargetResourceSetWrapper(), $segment->getPrevious()->getResult(), $segment->getTargetResourceSetWrapper(), $segment->getProjectedProperty(), $this->request->getFilterInfo(), null, null, null);
             $segment->setResult($queryResult);
         }
     } else {
         if ($projectedPropertyKind == ResourcePropertyKind::RESOURCE_REFERENCE) {
             $entityInstance = $this->providers->getRelatedResourceReference($segment->getPrevious()->getTargetResourceSetWrapper(), $segment->getPrevious()->getResult(), $segment->getTargetResourceSetWrapper(), $segment->getProjectedProperty());
             $segment->setResult($entityInstance);
         } else {
             //Unexpected state
         }
     }
 }