public function mapToGoogle(Entity $obj_gds_entity)
    {

        // Base entity with key (partition applied later)
        $obj_rest_entity = (object)[
            'key' => (object)['path' => $this->buildKeyPath($obj_gds_entity)],
            'properties' => (object)[]
        ];

        // Properties
        $arr_field_defs = $this->bestEffortFieldDefs($obj_gds_entity);
        foreach($obj_gds_entity->getData() as $str_field_name => $mix_value) {
            if(isset($arr_field_defs[$str_field_name])) {
                $obj_rest_entity->properties->{$str_field_name} = $this->createPropertyValue($arr_field_defs[$str_field_name], $mix_value);
            } else {
                $arr_dynamic_data = $this->determineDynamicType($mix_value);
                $obj_rest_entity->properties->{$str_field_name} = $this->createPropertyValue(['type' => $arr_dynamic_data['type'], 'index' => true], $arr_dynamic_data['value']);
            }
        }

        return $obj_rest_entity;
    }
public function mapToGoogle(Entity $obj_gds_entity)
    {

        // Base entity with key (partition applied later)
        $obj_rest_entity = (object)[
            'key' => (object)['path' => $this->buildKeyPath($obj_gds_entity)],
            'properties' => (object)[]
        ];

        // Properties
        $arr_field_defs = $this->bestEffortFieldDefs($obj_gds_entity);
        foreach($obj_gds_entity->getData() as $str_field_name => $mix_value) {
            if(isset($arr_field_defs[$str_field_name])) {
                $obj_rest_entity->properties->{$str_field_name} = $this->createPropertyValue($arr_field_defs[$str_field_name], $mix_value);
            } else {
                $arr_dynamic_data = $this->determineDynamicType($mix_value);
                $obj_rest_entity->properties->{$str_field_name} = $this->createPropertyValue(['type' => $arr_dynamic_data['type'], 'index' => true], $arr_dynamic_data['value']);
            }
        }

        return $obj_rest_entity;
    }
public function mapToGoogle ( Entity $ obj_gds_entity ) { // Base entity with key (partition applied later) $ obj_rest_entity = ( object ) [ 'key' => ( object ) [ 'path' => $ this -> buildKeyPath ( $ obj_gds_entity ) ] , 'properties' => ( object ) [ ] ] ; // Properties $ arr_field_defs = $ this -> bestEffortFieldDefs ( $ obj_gds_entity ) ; foreach ( $ obj_gds_entity -> getData ( ) as $ str_field_name => $ mix_value ) { if ( isset ( $ arr_field_defs [ $ str_field_name ] ) ) { $ obj_rest_entity -> properties -> { $ str_field_name } = $ this -> createPropertyValue ( $ arr_field_defs [ $ str_field_name ] , $ mix_value ) ; } else { $ arr_dynamic_data = $ this -> determineDynamicType ( $ mix_value ) ; $ obj_rest_entity -> properties -> { $ str_field_name } = $ this -> createPropertyValue ( [ 'type' => $ arr_dynamic_data [ 'type' ] , 'index' => true ] , $ arr_dynamic_data [ 'value' ] ) ; } } return $ obj_rest_entity ; }
Create a REST representation of a GDS entity

https://cloud.google.com/datastore/reference/rest/v1/Entity

@param Entity $obj_gds_entity
@return \stdClass
Create a REST representation of a GDS entity