An expression object to contain values being inserted.
Helps generate SQL with the correct number of placeholders and bind values correctly into the statement.
boolWhether values have been casted to expressions already.
arrayList of columns to ensure are part of the insert.
Cake\Database\Query|nullThe Query object to use as a values expression
Cake\Database\TypeMap|nullarrayArray of values to insert.
Constructor
Conditionally converts the passed value to an ExpressionInterface object if the type class implements the ExpressionTypeInterface. Otherwise, returns the value unmodified.
Get the bare column names.
Converts values that need to be casted to expressions
Returns an array with the types that require values to be casted to expressions, out of the list of type names passed as parameter.
Add a row of data to be inserted.
Gets the columns to be inserted.
Gets default types of current type map.
Gets the query object to be used as the values expression to be evaluated to insert records in the table.
Returns the existing type map.
Gets the values to be inserted.
Sets the columns to be inserted.
Overwrite the default type mappings for fields in the implementing object.
Sets the query object to be used as the values expression to be evaluated to insert records in the table.
Creates a new TypeMap if $typeMap is an array, otherwise exchanges it for the given one.
Sets the values to be inserted.
Converts the Node into a SQL string fragment.
Iterates over each part of the expression recursively for every level of the expressions tree and executes the $callback callable passing as first parameter the instance of the expression currently being iterated.
__construct(array $columns, Cake\Database\TypeMap $typeMap)
Constructor
array $columns The list of columns that are going to be part of the values.
Cake\Database\TypeMap $typeMap A dictionary of column -> type names
_castToExpression(mixed $value, string|null $type = null): mixed
Conditionally converts the passed value to an ExpressionInterface object if the type class implements the ExpressionTypeInterface. Otherwise, returns the value unmodified.
mixed $value The value to convert to ExpressionInterface
string|null $type optional The type name
mixed_columnNames(): array
Get the bare column names.
Because column names could be identifier quoted, we need to strip the identifiers off of the columns.
array_processExpressions(): void
Converts values that need to be casted to expressions
void_requiresToExpressionCasting(array $types): array
Returns an array with the types that require values to be casted to expressions, out of the list of type names passed as parameter.
array $types List of type names
arrayadd(Cake\Database\Query|array $values): void
Add a row of data to be inserted.
Cake\Database\Query|array $values Array of data to append into the insert, or a query for doing INSERT INTO .. SELECT style commands
voidCake\Database\Exception\DatabaseExceptiongetColumns(): array
Gets the columns to be inserted.
arraygetDefaultTypes(): array<int|string, string>
Gets default types of current type map.
array<int|string, string>getQuery(): Cake\Database\Query|null
Gets the query object to be used as the values expression to be evaluated to insert records in the table.
Cake\Database\Query|nullgetTypeMap(): Cake\Database\TypeMap
Returns the existing type map.
Cake\Database\TypeMapgetValues(): array
Gets the values to be inserted.
arraysetColumns(array $columns): $this
Sets the columns to be inserted.
array $columns Array with columns to be inserted.
$thissetDefaultTypes(array<int|string, string> $types): $this
Overwrite the default type mappings for fields in the implementing object.
This method is useful if you need to set type mappings that are shared across multiple functions/expressions in a query.
To add a default without overwriting existing ones use getTypeMap()->addDefaults()
array<int|string, string> $types The array of types to set.
$thissetQuery(Cake\Database\Query $query): $this
Sets the query object to be used as the values expression to be evaluated to insert records in the table.
Cake\Database\Query $query The query to set
$thissetTypeMap(Cake\Database\TypeMap|array $typeMap): $this
Creates a new TypeMap if $typeMap is an array, otherwise exchanges it for the given one.
Cake\Database\TypeMap|array $typeMap Creates a TypeMap if array, otherwise sets the given TypeMap
$thissetValues(array $values): $this
Sets the values to be inserted.
array $values Array with values to be inserted.
$thissql(Cake\Database\ValueBinder $binder): string
Converts the Node into a SQL string fragment.
Cake\Database\ValueBinder $binder stringtraverse(Closure $callback): $this
Iterates over each part of the expression recursively for every level of the expressions tree and executes the $callback callable passing as first parameter the instance of the expression currently being iterated.
Closure $callback $thisWhether values have been casted to expressions already.
boolList of columns to ensure are part of the insert.
arrayThe Query object to use as a values expression
Cake\Database\Query|nullCake\Database\TypeMap|nullArray of values to insert.
array
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.Database.Expression.ValuesExpression.html