\Cake\DatabaseValueBinder

Value binder class manages list of values bound to conditions.

Summary

Methods
Properties
Constants
bind()
placeholder()
generateManyNamed()
bindings()
reset()
resetCount()
attachTo()
No public properties found
No constants found
No protected methods found
$_bindings
$_bindingsCount
N/A
No private methods found
No private properties found
N/A

Properties

$_bindings

$_bindings : array

Array containing a list of bound values to the conditions on this object. Each array entry is another array structure containing the actual bound value, its type and the placeholder it is bound to.

Type

array

$_bindingsCount

$_bindingsCount : integer

A counter of the number of parameters bound in this expression object

Type

integer

Methods

bind()

bind(string|integer  $param, mixed  $value, string|integer  $type = 'string') : void

Associates a query placeholder to a value and a type

Parameters

string|integer $param

placeholder to be replaced with quoted version of $value

mixed $value

The value to be bound

string|integer $type

the mapped type name, used for casting when sending to database

placeholder()

placeholder(string  $token) : string

Creates a unique placeholder name if the token provided does not start with ":" otherwise, it will return the same string and internally increment the number of placeholders generated by this object.

Parameters

string $token

string from which the placeholder will be derived from, if it starts with a colon, then the same string is returned

Returns

string —

to be used as a placeholder in a query expression

generateManyNamed()

generateManyNamed(array|\Traversable  $values, string  $type = 'string') : array

Creates unique named placeholders for each of the passed values and binds them with the specified type.

Parameters

array|\Traversable $values

The list of values to be bound

string $type

The type with which all values will be bound

Returns

array —

with the placeholders to insert in the query

bindings()

bindings() : array

Returns all values bound to this expression object at this nesting level.

Subexpression bound values will not be returned with this function.

Returns

array

reset()

reset() : void

Clears any bindings that were previously registered

resetCount()

resetCount() : void

Resets the bindings count without clearing previously bound values

attachTo()

attachTo(\Cake\Database\StatementInterface  $statement) : void

Binds all the stored values in this object to the passed statement.

Parameters

\Cake\Database\StatementInterface $statement

The statement to add parameters to.