lithium\data\source\Database::_createFields()

protected method

Renders the fields part for create queries.

Parameters

  • array $data
  • array $schema

    An array defining the schema of the fields used in the criteria.

  • object $context

    Generally a data\model\Query instance.

Returns

array

Array with fields and values keys which hold SQL fragments of fields an values separated by comma.

Source

	protected function _createFields($data, $schema, $context) {
		$fields = [];
		$values = [];

		foreach ($data as $field => $value) {
			$fields[] = $this->name($field);
			$values[] = $this->value($value, isset($schema[$field]) ? $schema[$field] : []);
		}
		return [
			'fields' => join(', ', $fields),
			'values' => join(', ', $values)
		];
	}