GDS\Mapper\ProtoBuf::mapToGoogle PHP Method

mapToGoogle() public method

Map from GDS to Google Protocol Buffer
public mapToGoogle ( Entity $obj_gds_entity, google\appengine\datastore\v4\Entity $obj_entity )
$obj_gds_entity GDS\Entity
$obj_entity google\appengine\datastore\v4\Entity
    public function mapToGoogle(Entity $obj_gds_entity, \google\appengine\datastore\v4\Entity $obj_entity)
    {
        // Key
        $this->configureGoogleKey($obj_entity->mutableKey(), $obj_gds_entity);
        // Properties
        $arr_field_defs = $this->obj_schema->getProperties();
        foreach ($obj_gds_entity->getData() as $str_field_name => $mix_value) {
            $obj_prop = $obj_entity->addProperty();
            $obj_prop->setName($str_field_name);
            $obj_val = $obj_prop->mutableValue();
            if (isset($arr_field_defs[$str_field_name])) {
                $this->configureGooglePropertyValue($obj_val, $arr_field_defs[$str_field_name], $mix_value);
            } else {
                $arr_dynamic_data = $this->determineDynamicType($mix_value);
                $this->configureGooglePropertyValue($obj_val, ['type' => $arr_dynamic_data['type'], 'index' => TRUE], $arr_dynamic_data['value']);
            }
        }
    }