An expression object to contain values being inserted.
Helps generate SQL with the correct number of placeholders and bind values correctly into the statement.
$_castedExpressions
protected boolean
Whether or not values have been casted to expressions already.
$_columns
protected array
$_query
protected Cake\Database\Query|null
$_values
protected array
Sets the columns to be inserted. If no params are passed, then it returns the currently stored columns.
Gets the query object to be used as the values expression to be evaluated to insert records in the table.
Sets the query object to be used as the values expression to be evaluated to insert records in the table. If no params are passed, then it returns the currently stored query
Sets the query object to be used as the values expression to be evaluated to insert records in the table.
Sets the values to be inserted. If no params are passed, then it returns the currently stored values
__construct( array $columns , Cake\Database\TypeMap $typeMap )
Constructor
$columns
Cake\Database\TypeMap
$typeMap
_columnNames( )
Get the bare column names.
Because column names could be identifier quoted, we need to strip the identifiers off of the columns.
_processExpressions( )
Converts values that need to be casted to expressions
add( array|Cake\Database\Query $data )
Add a row of data to be inserted.
Cake\Database\Query
$data
Array of data to append into the insert, or a query for doing INSERT INTO .. SELECT style commands
Cake\Database\Exception
columns( array|null $cols null )
Sets the columns to be inserted. If no params are passed, then it returns the currently stored columns.
$cols
optional null Cake\Database\Expression\ValuesExpression
getQuery( )
Gets the query object to be used as the values expression to be evaluated to insert records in the table.
Cake\Database\Query
|nullquery( Cake\Database\Query $query null )
Sets the query object to be used as the values expression to be evaluated to insert records in the table. If no params are passed, then it returns the currently stored query
Cake\Database\Query
$query
optional null Cake\Database\Query
|null|Cake\Database\Expression\ValuesExpression
setColumns( array $cols )
Sets the columns to be inserted.
$cols
setQuery( Cake\Database\Query $query )
Sets the query object to be used as the values expression to be evaluated to insert records in the table.
Cake\Database\Query
$query
setValues( array $values )
Sets the values to be inserted.
$values
sql( Cake\Database\ValueBinder $generator )
Convert the values into a SQL string with placeholders.
$generator
Cake\Database\ExpressionInterface::sql()
traverse( callable $visitor )
Traverse the values expression.
This method will also traverse any queries that are to be used in the INSERT values.
$visitor
Cake\Database\ExpressionInterface::traverse()
values( array|null $values null )
Sets the values to be inserted. If no params are passed, then it returns the currently stored values
$values
optional null Cake\Database\Expression\ValuesExpression
_castToExpression( mixed $value , string $type )
Conditionally converts the passed value to an ExpressionInterface object if the type class implements the ExpressionTypeInterface. Otherwise, returns the value unmodified.
$value
$type
_requiresToExpressionCasting( array $types )
Returns an array with the types that require values to be casted to expressions, out of the list of type names passed as parameter.
$types
defaultTypes( array $types null )
Allows setting default types when chaining query
$types
optional null getDefaultTypes( )
Gets default types of current type map.
getTypeMap( )
Returns the existing type map.
Cake\Database\TypeMap
setDefaultTypes( array $types )
Allows setting default types when chaining query.
$types
setTypeMap( array|Cake\Database\TypeMap $typeMap )
Creates a new TypeMap if $typeMap is an array, otherwise exchanges it for the given one.
Cake\Database\TypeMap
$typeMap
typeMap( array|Cake\Database\TypeMap|null $typeMap null )
Creates a new TypeMap if $typeMap is an array, otherwise returns the existing type map or exchanges it for the given one.
Cake\Database\TypeMap
|null $typeMap
optional null protected boolean
Whether or not values have been casted to expressions already.
false
© 2005–2018 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/3.5/class-Cake.Database.Expression.ValuesExpression.html