Escapes unquoted columns keys in an associative array

@param array $fieldValues
@return array List of field values with the keys as escaped column names
336182
protected function escapeColumnKeys($fieldValues)
    {
        $out = array();
        foreach ($fieldValues as $field => $value) {
            $out[$this->escapeIdentifier($field)] = $value;
        }
        return $out;
    }
162649
protected function handleSetColumns(array $columns)
    {
        if (empty($columns)) {
            return '';
        }

        $sql = [];

        foreach ($columns as $column) {
            $sql[] = $this->wrap($column['column']) . ' = ' . $this->param($column['value']);
        }

        return ' SET ' . implode(', ', $sql);
    }
570283
private function convertColumnsToRawFields(array $columns) {
        $columnMaps = $this->getModelsMetaData()->getColumnMap($this);
        foreach($columns as $key => $value) {
            if(!array_key_exists($value, $columnMaps)) {
                //Look up in the changed values
                $index = array_search($value, $columnMaps);
                if($index === false) {
                    throw new \InvalidArgumentException('Invalid Column, could not find: ' . $value);
                } else {
                    $columns[$key] = $index;
                }
            }
        }
        return $columns;
    }
1128482
protected function getPropertyValues($propertyValues)
    {
        // If it's not a list of property values
        if (!is_array($propertyValues)) {
            throw new InvalidArgumentException(
                InvalidArgumentException::INVALID_PROPERTY_VALUES_STR,
                InvalidArgumentException::INVALID_PROPERTY_VALUES
            );
        }

        return array_map([$this, 'processPropertyValue'], $propertyValues);
    }
393183
public static function fromAssocArray(array $keyValueOptions, string $valueType = 'string') : ArrayFieldOptions
    {
        $options = [];

        foreach ($keyValueOptions as $value => $label) {
            settype($value, $valueType);
            $options[] = $label instanceof IFieldOption
                    ? $label
                    : new FieldOption($value, $label);
        }

        return new self($options);
    }
1342727
public function values(array $values)
    {
        $this->fieldValues = array();

        $this->fieldsSql   = '?i';
        $this->fieldValues[] = array_keys($values);

        $this->valuesSql   = array();

        foreach ($values as $v) {
            if (is_object($v) and $v instanceof SqlValueInterface) {
                $this->valuesSql[] = $v->getSql();
                $this->fieldValues = array_merge($this->fieldValues, $v->getValues());
            } else {
                $this->valuesSql[]   = '?q';
                $this->fieldValues[] = $v;
            }
        }

        $this->valuesSql = implode(', ', $this->valuesSql);

        return $this;
    }
944093
public function getSanitizedValues(&$values = [])
    {
        array_walk($this->fields, function ($field, $index) use (&$values) {
            if (is_array($field)) {
                return $this->sanitizeConditionalValues($values, $field, $index);
            }

            return $this->sanitizeValues($values[$field->getSlug()], $field);
        });

        return $values;
    }
789778
public function emptyFields($fieldsQuery)
    {
        $result = [];
        $count = 0;
        foreach ($fieldsQuery as $field){
            foreach ($field as $key => $fieldValue){
                if($fieldValue === "[]" || $fieldValue === "\"\"" || $fieldValue === "null" || $fieldValue === "") {
                    $result[$count][$key] = null;
                }else{
                    $result[$count][$key] = $fieldValue;
                }
            }
            $count++;
        }
        return $result;
    }
88334
private function transformPostValues(array $postValues): string
    {
        $body = '';
        foreach ($postValues as $key => $value) {
            $body .= urlencode($key) . '=' . urlencode($value) . '&';
        }

        return $body;
    }
237627
public static function extractUpdateColumns($values)
    {
        $cls = get_called_class();
        $temp_columns = "";
        $escape = Driver::$escape_char;
        foreach ($values as $key => $value) {
            $temp_columns .= "$escape".self::$_mapping[$cls][$key]."$escape=?,";
        }
        return substr($temp_columns, 0, strlen($temp_columns)-1);
    }
992070
public function update($fieldValues)
    {
        $r = 0;
        foreach ($this->queries as $query) {
            $t = $query->update($fieldValues);
            $r += $t;
        }

        return $r;
    }
1354406
public function render(FieldValueInterface $fieldValue)
    {
        $options = $this->getFieldOptionsArray($fieldValue->getField());
        $value = unserialize($fieldValue->getValue());

        $values = [];
        foreach ($value as $valueId) {
            if (!empty($options[$valueId])) {
                $values[] = $options[$valueId];
            }
        }

        return implode(',', $values);
    }
325913
protected function getKeyList($columnName, $keyValue, array $keyList)
    {
        if ($keyValue === true) {
            $tableIndexName = SchemaUtils::generateIndexName($columnName);
            $keyList[$tableIndexName] = array($columnName);
        } else if (is_string($keyValue)) {
            $tableIndexName = SchemaUtils::generateIndexName($keyValue);
            $keyList[$tableIndexName][] = $columnName;
        }

        return $keyList;
    }
243646
public function alterFormValues(array $formValues)
    {
        foreach ($this->getMeta() as $key => $fieldMeta) {
            /** @var \stdClass $fieldMeta */
            if ($fieldMeta->type === 'checkbox') {
                if (isset($formValues[$key])) {
                    $prestaShopName = $fieldMeta->collection . '_' . $key;
                    $formValues[$prestaShopName] = $formValues[$key];
                }
            }
        }
        return $formValues;
    }
39807
protected function formatValues($values) : string {
    if (is_array($values)) {
      return ':' . implode(', :', $values);
    }

    if (is_string($values)) {
      $values = explode(',', $values);

      $values = array_map(function($value) {
        return ':' . trim($value);
      }, $values);

      return implode(', ', $values);
    }
  }
71618
public static function fieldListToValuesString($fields)
    {
        $formattedFields = [];
        foreach ($fields as $field) {
            $fieldWithColonPrefix = ':' . $field;
            $formattedFields[] = $fieldWithColonPrefix;
        }

        return ' value (' . implode(', ', $formattedFields) . ')';
    }
64084
protected function _getFieldToIdMapping(array $keys)
    {
        return $this->_table
            ->find('list', [
                'keyField' => $this->config('fields.key'),
                'valueField' => 'id'
            ])
            ->where([
                'scope' => $this->config('scope'),
                $this->config('fields.key') . ' IN' => $keys
            ])
            ->toArray();
    }