src/POData/UriProcessor/UriProcessor.php
/**
     * Execute the client submitted request against the data source.
     */
Execute the client submitted request against the data source.
Execute the client submitted request against the data source .
public function execute()
    {
        $segments = $this->request->getSegments();
        foreach ($segments as $segment) {
            $requestTargetKind = $segment->getTargetKind();
	        if ($segment->getTargetSource() == TargetSource::ENTITY_SET) {
                $this->handleSegmentTargetsToResourceSet($segment);
            } else if ($requestTargetKind == TargetKind::RESOURCE()) {
                if (is_null($segment->getPrevious()->getResult())) {
					throw ODataException::createResourceNotFoundError(
                        $segment->getPrevious()->getIdentifier()
                    );
                }
                $this->_handleSegmentTargetsToRelatedResource($segment);
            } else if ($requestTargetKind == TargetKind::LINK()) {
                $segment->setResult($segment->getPrevious()->getResult());
            } else if ($segment->getIdentifier() == ODataConstants::URI_COUNT_SEGMENT) {
                $segment->setResult($this->request->getCountValue());
                break;
            } else {
                if ($requestTargetKind == TargetKind::MEDIA_RESOURCE()) {
                    if (is_null($segment->getPrevious()->getResult())) {
						throw ODataException::createResourceNotFoundError(
                            $segment->getPrevious()->getIdentifier()
                        );
                    }
                    $segment->setResult($segment->getPrevious()->getResult());
                    break;
                }
	            $value = $segment->getPrevious()->getResult();
                while (!is_null($segment)) {
                    if (!is_null($value)) {
                        $value = null;
                    } else {
                        try {
                            $property = new \ReflectionProperty($value, $segment->getIdentifier());
                            $value = $property->getValue($value);
                        } catch (\ReflectionException $reflectionException) {
                        }
                    }
                    $segment->setResult($value);
                    $segment = $segment->getNext();
                    if (!is_null($segment) && $segment->getIdentifier() == ODataConstants::URI_VALUE_SEGMENT) {
                        $segment->setResult($value);
                        $segment = $segment->getNext();
                    }
                }
                break;
            }
            if (is_null($segment->getNext()) || $segment->getNext()->getIdentifier() == ODataConstants::URI_COUNT_SEGMENT) {
                    $this->applyQueryOptions($segment);
            }
        }
        $this->handleExpansion();
    }
public function execute ( ) { $ segments = $ this -> request -> getSegments ( ) ; foreach ( $ segments as $ segment ) { $ requestTargetKind = $ segment -> getTargetKind ( ) ; if ( $ segment -> getTargetSource ( ) == TargetSource :: ENTITY_SET ) { $ this -> handleSegmentTargetsToResourceSet ( $ segment ) ; } else if ( $ requestTargetKind == TargetKind :: RESOURCE ( ) ) { if ( is_null ( $ segment -> getPrevious ( ) -> getResult ( ) ) ) { throw ODataException :: createResourceNotFoundError ( $ segment -> getPrevious ( ) -> getIdentifier ( ) ) ; } $ this -> _handleSegmentTargetsToRelatedResource ( $ segment ) ; } else if ( $ requestTargetKind == TargetKind :: LINK ( ) ) { $ segment -> setResult ( $ segment -> getPrevious ( ) -> getResult ( ) ) ; } else if ( $ segment -> getIdentifier ( ) == ODataConstants :: URI_COUNT_SEGMENT ) { $ segment -> setResult ( $ this -> request -> getCountValue ( ) ) ; break ; } else { if ( $ requestTargetKind == TargetKind :: MEDIA_RESOURCE ( ) ) { if ( is_null ( $ segment -> getPrevious ( ) -> getResult ( ) ) ) { throw ODataException :: createResourceNotFoundError ( $ segment -> getPrevious ( ) -> getIdentifier ( ) ) ; } $ segment -> setResult ( $ segment -> getPrevious ( ) -> getResult ( ) ) ; break ; } $ value = $ segment -> getPrevious ( ) -> getResult ( ) ; while ( ! is_null ( $ segment ) ) { if ( ! is_null ( $ value ) ) { $ value = null ; } else { try { $ property = new \ ReflectionProperty ( $ value , $ segment -> getIdentifier ( ) ) ; $ value = $ property -> getValue ( $ value ) ; } catch ( \ ReflectionException $ reflectionException ) { } } $ segment -> setResult ( $ value ) ; $ segment = $ segment -> getNext ( ) ; if ( ! is_null ( $ segment ) && $ segment -> getIdentifier ( ) == ODataConstants :: URI_VALUE_SEGMENT ) { $ segment -> setResult ( $ value ) ; $ segment = $ segment -> getNext ( ) ; } } break ; } if ( is_null ( $ segment -> getNext ( ) ) || $ segment -> getNext ( ) -> getIdentifier ( ) == ODataConstants :: URI_COUNT_SEGMENT ) { $ this -> applyQueryOptions ( $ segment ) ; } } $ this -> handleExpansion ( ) ; }
Execute the client submitted request against the data source.
Execute the client submitted request against the data source .
// we are done, $count will the last segment and  // taken care by _applyQueryOptions method // For MLE and Named Stream the result of last segment  // should be that of previous segment, this is required  // while retrieving content type or stream from IDSSP // we are done, as named stream property or $value on  // media resource will be the last segment //TODO: what exactly is this doing here?  Once a null's found it seems everything will be null //see #88 //throw ODataException::createInternalServerError(Messages::orderByParserFailedToAccessOrInitializeProperty($resourceProperty->getName(), $resourceType->getName())); // Apply $select and $expand options to result set, this function will be always applied // irrespective of return value of IDSQP2::canApplyQueryOptions which means library will // not delegate $expand/$select operation to IDSQP2 implementation