private function configureGooglePropertyValue(Value $obj_val, array $arr_field_def, $mix_value)
    {
        // Indexed?
        $bol_index = TRUE;
        if(isset($arr_field_def['index']) && FALSE === $arr_field_def['index']) {
            $bol_index = FALSE;
        }
        $obj_val->setIndexed($bol_index);

        // null checks
        if(null === $mix_value) {
            return;
        }

        // Value
        switch ($arr_field_def['type']) {
            case Schema::PROPERTY_STRING:
                $obj_val->setStringValue((string)$mix_value);
                break;

            case Schema::PROPERTY_INTEGER:
                $obj_val->setIntegerValue((int)$mix_value);
                break;

            case Schema::PROPERTY_DATETIME:
                if($mix_value instanceof \DateTimeInterface) {
                    $obj_dtm = $mix_value;
                } else {
                    $obj_dtm = new \DateTimeImmutable($mix_value);
                }
                $obj_val->setTimestampMicrosecondsValue($obj_dtm->format(self::DATETIME_FORMAT_UU));
                break;

            case Schema::PROPERTY_DOUBLE:
            case Schema::PROPERTY_FLOAT:
            $obj_val->setDoubleValue(floatval($mix_value));
                break;

            case Schema::PROPERTY_BOOLEAN:
                $obj_val->setBooleanValue((bool)$mix_value);
                break;

            case Schema::PROPERTY_GEOPOINT:
                $obj_val->mutableGeoPointValue()->setLatitude($mix_value[0])->setLongitude($mix_value[1]);
                break;

            case Schema::PROPERTY_STRING_LIST:
                $obj_val->clearIndexed(); // Ensure we only index the values, not the list
                foreach ((array)$mix_value as $str) {
                    $obj_val->addListValue()->setStringValue($str)->setIndexed($bol_index);
                }
                break;

            default:
                throw new \RuntimeException('Unable to process field type: ' . $arr_field_def['type']);
        }
    }
private function configureGooglePropertyValue(Value $obj_val, array $arr_field_def, $mix_value)
    {
        // Indexed?
        $bol_index = TRUE;
        if(isset($arr_field_def['index']) && FALSE === $arr_field_def['index']) {
            $bol_index = FALSE;
        }
        $obj_val->setIndexed($bol_index);

        // null checks
        if(null === $mix_value) {
            return;
        }

        // Value
        switch ($arr_field_def['type']) {
            case Schema::PROPERTY_STRING:
                $obj_val->setStringValue((string)$mix_value);
                break;

            case Schema::PROPERTY_INTEGER:
                $obj_val->setIntegerValue((int)$mix_value);
                break;

            case Schema::PROPERTY_DATETIME:
                if($mix_value instanceof \DateTimeInterface) {
                    $obj_dtm = $mix_value;
                } else {
                    $obj_dtm = new \DateTimeImmutable($mix_value);
                }
                $obj_val->setTimestampMicrosecondsValue($obj_dtm->format(self::DATETIME_FORMAT_UU));
                break;

            case Schema::PROPERTY_DOUBLE:
            case Schema::PROPERTY_FLOAT:
            $obj_val->setDoubleValue(floatval($mix_value));
                break;

            case Schema::PROPERTY_BOOLEAN:
                $obj_val->setBooleanValue((bool)$mix_value);
                break;

            case Schema::PROPERTY_GEOPOINT:
                $obj_val->mutableGeoPointValue()->setLatitude($mix_value[0])->setLongitude($mix_value[1]);
                break;

            case Schema::PROPERTY_STRING_LIST:
                $obj_val->clearIndexed(); // Ensure we only index the values, not the list
                foreach ((array)$mix_value as $str) {
                    $obj_val->addListValue()->setStringValue($str)->setIndexed($bol_index);
                }
                break;

            default:
                throw new \RuntimeException('Unable to process field type: ' . $arr_field_def['type']);
        }
    }
private function configureGooglePropertyValue ( Value $ obj_val , array $ arr_field_def , $ mix_value ) { // Indexed? $ bol_index = TRUE ; if ( isset ( $ arr_field_def [ 'index' ] ) && FALSE === $ arr_field_def [ 'index' ] ) { $ bol_index = FALSE ; } $ obj_val -> setIndexed ( $ bol_index ) ; // null checks if ( null === $ mix_value ) { return ; } // Value switch ( $ arr_field_def [ 'type' ] ) { case Schema :: PROPERTY_STRING : $ obj_val -> setStringValue ( ( string ) $ mix_value ) ; break ; case Schema :: PROPERTY_INTEGER : $ obj_val -> setIntegerValue ( ( int ) $ mix_value ) ; break ; case Schema :: PROPERTY_DATETIME : if ( $ mix_value instanceof \ DateTimeInterface ) { $ obj_dtm = $ mix_value ; } else { $ obj_dtm = new \ DateTimeImmutable ( $ mix_value ) ; } $ obj_val -> setTimestampMicrosecondsValue ( $ obj_dtm -> format ( self :: DATETIME_FORMAT_UU ) ) ; break ; case Schema :: PROPERTY_DOUBLE : case Schema :: PROPERTY_FLOAT : $ obj_val -> setDoubleValue ( floatval ( $ mix_value ) ) ; break ; case Schema :: PROPERTY_BOOLEAN : $ obj_val -> setBooleanValue ( ( bool ) $ mix_value ) ; break ; case Schema :: PROPERTY_GEOPOINT : $ obj_val -> mutableGeoPointValue ( ) -> setLatitude ( $ mix_value [ 0 ] ) -> setLongitude ( $ mix_value [ 1 ] ) ; break ; case Schema :: PROPERTY_STRING_LIST : $ obj_val -> clearIndexed ( ) ; // Ensure we only index the values, not the list foreach ( ( array ) $ mix_value as $ str ) { $ obj_val -> addListValue ( ) -> setStringValue ( $ str ) -> setIndexed ( $ bol_index ) ; } break ; default : throw new \ RuntimeException ( 'Unable to process field type: ' . $ arr_field_def [ 'type' ] ) ; } }
Populate a ProtoBuf Property Value from a GDS Entity field definition & value

@todo compare with Google API implementation

@param Value $obj_val
@param array $arr_field_def
@param $mix_value
Populate a ProtoBuf Property Value from a GDS Entity field definition & value