src/POData/Providers/ProvidersWrapper.php
/**
     * Validate the given entity instance.
     * 
     * @param object        $entityInstance Entity instance to validate
     * @param ResourceSet   &$resourceSet   Resource set to which the entity 
     *                                      instance belongs to.
     * @param KeyDescriptor &$keyDescriptor The key descriptor.
     * @param string        $methodName     Method from which this function 
     *                                      invoked.
     *
     * @return void
     * 
     * @throws ODataException
     */
Validate the given entity instance.

@param object        $entityInstance Entity instance to validate
@param ResourceSet   &$resourceSet   Resource set to which the entity
instance belongs to.
@param KeyDescriptor &$keyDescriptor The key descriptor.
@param string        $methodName     Method from which this function
invoked.

@return void


Validate the given entity instance . @param object $entityInstance Entity instance to validate @param ResourceSet &$resourceSet Resource set to which the entity instance belongs to . @param KeyDescriptor &$keyDescriptor The key descriptor . @param string $methodName Method from which this function invoked . @return void
private function _validateEntityInstance($entityInstance, 
        ResourceSet &$resourceSet, 
        KeyDescriptor &$keyDescriptor, 
        $methodName
    ) {
        if (is_null($entityInstance)) {
            throw ODataException::createResourceNotFoundError($resourceSet->getName());
        }
        $entityName = $resourceSet->getResourceType()->getInstanceType()->getName();
        if (!is_object($entityInstance) 
            || !($entityInstance instanceof $entityName)
        ) {
            throw ODataException::createInternalServerError(
                Messages::providersWrapperIDSQPMethodReturnsUnExpectedType(
                    $entityName, 
                    $methodName
                )
            );
        }
        foreach ($keyDescriptor->getValidatedNamedValues() 
            as $keyName => $valueDescription) {
            try {
                $keyProperty = new \ReflectionProperty($entityInstance, $keyName);
                $keyValue = $keyProperty->getValue($entityInstance);
                if (is_null($keyValue)) {
                    throw ODataException::createInternalServerError(
                        Messages::providersWrapperIDSQPMethodReturnsInstanceWithNullKeyProperties($methodName)
                    );
                }
                $convertedValue 
                    = $valueDescription[1]->convert($valueDescription[0]);
                if ($keyValue != $convertedValue) {
                    throw ODataException::createInternalServerError(
                        Messages::providersWrapperIDSQPMethodReturnsInstanceWithNonMatchingKeys($methodName)
                    );
                }
            } catch (\ReflectionException $reflectionException) {
            }
        }
    }
private function _validateEntityInstance ( $ entityInstance , ResourceSet & $ resourceSet , KeyDescriptor & $ keyDescriptor , $ methodName ) { if ( is_null ( $ entityInstance ) ) { throw ODataException :: createResourceNotFoundError ( $ resourceSet -> getName ( ) ) ; } $ entityName = $ resourceSet -> getResourceType ( ) -> getInstanceType ( ) -> getName ( ) ; if ( ! is_object ( $ entityInstance ) || ! ( $ entityInstance instanceof $ entityName ) ) { throw ODataException :: createInternalServerError ( Messages :: providersWrapperIDSQPMethodReturnsUnExpectedType ( $ entityName , $ methodName ) ) ; } foreach ( $ keyDescriptor -> getValidatedNamedValues ( ) as $ keyName => $ valueDescription ) { try { $ keyProperty = new \ ReflectionProperty ( $ entityInstance , $ keyName ) ; $ keyValue = $ keyProperty -> getValue ( $ entityInstance ) ; if ( is_null ( $ keyValue ) ) { throw ODataException :: createInternalServerError ( Messages :: providersWrapperIDSQPMethodReturnsInstanceWithNullKeyProperties ( $ methodName ) ) ; } $ convertedValue = $ valueDescription [ 1 ] -> convert ( $ valueDescription [ 0 ] ) ; if ( $ keyValue != $ convertedValue ) { throw ODataException :: createInternalServerError ( Messages :: providersWrapperIDSQPMethodReturnsInstanceWithNonMatchingKeys ( $ methodName ) ) ; } } catch ( \ ReflectionException $ reflectionException ) { } } }
Validate the given entity instance.
Validate the given entity instance .
//throw ODataException::createInternalServerError( //  Messages::orderByParserFailedToAccessOrInitializeProperty( //      $resourceProperty->getName(), $resourceType->getName() //  ) //);