/** * Get related resource set for a resource * * @param ResourceSet $sourceResourceSet The source resource set * @param mixed $sourceEntity The resource * @param ResourceSet $targetResourceSet The resource set of the navigation * property * @param ResourceProperty $targetProperty The navigation property to be * retrieved * @param InternalFilterInfo $internalFilterInfo An instance of InternalFilterInfo * if the $filter option is submitted * by the client, NULL if no $filter * option present in the client request * @param TODO $select The select information * @param TODO $orderby The orderby information * @param int $top The top count * @param int $skip The skip count * * @return array(Objects)/array() Array of related resource if exists, if no * related resources found returns empty array */ public function getRelatedResourceSet(ResourceSet $sourceResourceSet, $sourceEntity, ResourceSet $targetResourceSet, ResourceProperty $targetProperty, $internalFilterInfo, $select, $orderby, $top, $skip) { $filterOption = null; if ($filterOption !== null) { if ($this->_metadataProvider->mappedDetails !== null) { $filterOption = $this->updateFilterInfo($targetResourceSet, $this->_metadataProvider->mappedDetails, $filterOption); } } if ($this->_isQP2) { $customExpressionAsString = null; if (!is_null($internalFilterInfo)) { $this->assert($internalFilterInfo->isCustomExpression(), '$internalFilterInfo->isCustomExpression()'); $customExpressionAsString = $internalFilterInfo->getExpressionAsString(); } // Library will pass the $select, $roderby, $top, $skip information to IDSQP2 // implementation, IDQP2 can make use of these information to perform optimized // query operations. Library will not perform $orderby, $top, $skip operation // on result set if the IDSQP2::canApplyQueryOptions returns false, Lib assumes // IDSQP2 already performed these operations. $entityInstances = $this->_queryProvider->getRelatedResourceSet($sourceResourceSet, $sourceEntity, $targetResourceSet, $targetProperty, $customExpressionAsString, $select, $orderby, $top, $skip); } else { $entityInstances = $this->_queryProvider->getRelatedResourceSet($sourceResourceSet, $sourceEntity, $targetResourceSet, $targetProperty); } if (!is_array($entityInstances)) { ODataException::createInternalServerError(Messages::metadataQueryProviderWrapperIDSQPMethodReturnsNonArray('IDataServiceQueryProvider::getRelatedResourceSet')); } return $entityInstances; }