Datastore/src/EntityMapper.php
public function objectToRequest(EntityInterface $entity)
    {
        $data = $entity->get();

        $properties = [];
        foreach ($data as $key => $value) {
            $exclude = in_array($key, $entity->excludedProperties());
            $meaning = (isset($entity->meanings()[$key]))
                ? $entity->meanings()[$key]
                : null;

            $properties[$key] = $this->valueObject(
                $value,
                $exclude,
                $meaning
            );
        }

        $key = $entity->key()
            ? $entity->key()->keyObject()
            : null;

        return array_filter([
            'key' => $key,
            'properties' => $properties
        ]);
    }
public function objectToRequest(EntityInterface $entity)
    {
        $data = $entity->get();

        $properties = [];
        foreach ($data as $key => $value) {
            $exclude = in_array($key, $entity->excludedProperties());
            $meaning = (isset($entity->meanings()[$key]))
                ? $entity->meanings()[$key]
                : null;

            $properties[$key] = $this->valueObject(
                $value,
                $exclude,
                $meaning
            );
        }

        $key = $entity->key()
            ? $entity->key()->keyObject()
            : null;

        return array_filter([
            'key' => $key,
            'properties' => $properties
        ]);
    }
public function objectToRequest ( EntityInterface $ entity ) { $ data = $ entity -> get ( ) ; $ properties = [ ] ; foreach ( $ data as $ key => $ value ) { $ exclude = in_array ( $ key , $ entity -> excludedProperties ( ) ) ; $ meaning = ( isset ( $ entity -> meanings ( ) [ $ key ] ) ) ? $ entity -> meanings ( ) [ $ key ] : null ; $ properties [ $ key ] = $ this -> valueObject ( $ value , $ exclude , $ meaning ) ; } $ key = $ entity -> key ( ) ? $ entity -> key ( ) -> keyObject ( ) : null ; return array_filter ( [ 'key' => $ key , 'properties' => $ properties ] ) ; }
Translate an Entity to a datastore representation.

@param EntityInterface $entity The input entity.
@return array A Datastore [Entity](https://cloud.google.com/datastore/reference/rest/v1/Entity)
Translate an Entity to a datastore representation .