public function writeTopLevelPrimitive(QueryResult & $primitiveValue, ResourceProperty & $resourceProperty = null)
    {
        if (null === $resourceProperty) {
            throw new InvalidOperationException('Resource property must not be null');
        }
        $propertyContent = new ODataPropertyContent();

        $odataProperty = new ODataProperty();
        $odataProperty->name = $resourceProperty->getName();
        $iType = $resourceProperty->getInstanceType();
        if (!$iType instanceof IType) {
            throw new InvalidOperationException(get_class($iType));
        }
        $odataProperty->typeName = $iType->getFullTypeName();
        if (null == $primitiveValue->results) {
            $odataProperty->value = null;
        } else {
            $rType = $resourceProperty->getResourceType()->getInstanceType();
            if (!$rType instanceof IType) {
                throw new InvalidOperationException(get_class($rType));
            }
            $odataProperty->value = $this->primitiveToString($rType, $primitiveValue->results);
        }

        $propertyContent->properties[$odataProperty->name] = $odataProperty;

        return $propertyContent;
    }
public function writeTopLevelPrimitive(QueryResult & $primitiveValue, ResourceProperty & $resourceProperty = null)
    {
        if (null === $resourceProperty) {
            throw new InvalidOperationException('Resource property must not be null');
        }
        $propertyContent = new ODataPropertyContent();

        $odataProperty = new ODataProperty();
        $odataProperty->name = $resourceProperty->getName();
        $iType = $resourceProperty->getInstanceType();
        if (!$iType instanceof IType) {
            throw new InvalidOperationException(get_class($iType));
        }
        $odataProperty->typeName = $iType->getFullTypeName();
        if (null == $primitiveValue->results) {
            $odataProperty->value = null;
        } else {
            $rType = $resourceProperty->getResourceType()->getInstanceType();
            if (!$rType instanceof IType) {
                throw new InvalidOperationException(get_class($rType));
            }
            $odataProperty->value = $this->primitiveToString($rType, $primitiveValue->results);
        }

        $propertyContent->properties[$odataProperty->name] = $odataProperty;

        return $propertyContent;
    }
public function writeTopLevelPrimitive ( QueryResult & $ primitiveValue , ResourceProperty & $ resourceProperty = null ) { if ( null === $ resourceProperty ) { throw new InvalidOperationException ( 'Resource property must not be null' ) ; } $ propertyContent = new ODataPropertyContent ( ) ; $ odataProperty = new ODataProperty ( ) ; $ odataProperty -> name = $ resourceProperty -> getName ( ) ; $ iType = $ resourceProperty -> getInstanceType ( ) ; if ( ! $ iType instanceof IType ) { throw new InvalidOperationException ( get_class ( $ iType ) ) ; } $ odataProperty -> typeName = $ iType -> getFullTypeName ( ) ; if ( null == $ primitiveValue -> results ) { $ odataProperty -> value = null ; } else { $ rType = $ resourceProperty -> getResourceType ( ) -> getInstanceType ( ) ; if ( ! $ rType instanceof IType ) { throw new InvalidOperationException ( get_class ( $ rType ) ) ; } $ odataProperty -> value = $ this -> primitiveToString ( $ rType , $ primitiveValue -> results ) ; } $ propertyContent -> properties [ $ odataProperty -> name ] = $ odataProperty ; return $ propertyContent ; }
Write top level primitive value.

@param  QueryResult          &$primitiveValue   The primitive value to be
written
@param  ResourceProperty     &$resourceProperty Resource property describing the
primitive property to be written
@return ODataPropertyContent
Write top level primitive value .