public function getEntity(Entity $entity)
    {
        $entityProperties = $entity->getProperties();
        $properties       = array();

        foreach ($entityProperties as $name => $property) {
            $edmType    = $property->getEdmType();
            $edmValue   = $property->getValue();

            if (is_null($edmValue)) {
                // No @odata.type JSON property needed for null value
                $properties[$name] = null;
            } else {
                if (is_null($edmType)) {
                    $edmType = EdmType::propertyType($edmValue);
                }

                $value             = EdmType::serializeValue($edmType, $edmValue);
                $properties[$name] = $value;

                if (EdmType::typeRequired($edmType)) {
                    $properties[$name . Resources::JSON_ODATA_TYPE_SUFFIX] = $edmType;
                }
            }
        }

        return json_encode($properties);
    }
public function getEntity(Entity $entity)
    {
        $entityProperties = $entity->getProperties();
        $properties       = array();

        foreach ($entityProperties as $name => $property) {
            $edmType    = $property->getEdmType();
            $edmValue   = $property->getValue();

            if (is_null($edmValue)) {
                // No @odata.type JSON property needed for null value
                $properties[$name] = null;
            } else {
                if (is_null($edmType)) {
                    $edmType = EdmType::propertyType($edmValue);
                }

                $value             = EdmType::serializeValue($edmType, $edmValue);
                $properties[$name] = $value;

                if (EdmType::typeRequired($edmType)) {
                    $properties[$name . Resources::JSON_ODATA_TYPE_SUFFIX] = $edmType;
                }
            }
        }

        return json_encode($properties);
    }
public function getEntity ( Entity $ entity ) { $ entityProperties = $ entity -> getProperties ( ) ; $ properties = array ( ) ; foreach ( $ entityProperties as $ name => $ property ) { $ edmType = $ property -> getEdmType ( ) ; $ edmValue = $ property -> getValue ( ) ; if ( is_null ( $ edmValue ) ) { // No @odata.type JSON property needed for null value $ properties [ $ name ] = null ; } else { if ( is_null ( $ edmType ) ) { $ edmType = EdmType :: propertyType ( $ edmValue ) ; } $ value = EdmType :: serializeValue ( $ edmType , $ edmValue ) ; $ properties [ $ name ] = $ value ; if ( EdmType :: typeRequired ( $ edmType ) ) { $ properties [ $ name . Resources :: JSON_ODATA_TYPE_SUFFIX ] = $ edmType ; } } } return json_encode ( $ properties ) ; }
Constructs JSON representation for entity.

@param Entity $entity The entity instance.

@return string
Constructs JSON representation for entity .