Class ValueBinder
Value binder class manages list of values bound to conditions.
Property Summary
-
$_bindings protected
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.
-
$_bindingsCount protected
int
A counter of the number of parameters bound in this expression object
Method Summary
-
attachTo() public
Binds all the stored values in this object to the passed statement.
-
bind() public
Associates a query placeholder to a value and a type
-
bindings() public
Returns all values bound to this expression object at this nesting level. Subexpression bound values will not be returned with this function.
-
placeholder() public
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.
-
reset() public
Clears any bindings that were previously registered
-
resetCount() public
Resets the bindings count without clearing previously bound values
Method Detail
attachTo() ¶ public
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.
Returns
void
bind() ¶ public
bind(string|int $param, mixed $value, string|int $type = 'string'): void
Associates a query placeholder to a value and a type
Parameters
-
string|int
$param placeholder to be replaced with quoted version of $value
-
mixed
$value The value to be bound
-
string|int
$type optional the mapped type name, used for casting when sending to database
Returns
void
bindings() ¶ public
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
placeholder() ¶ public
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
resetCount() ¶ public
resetCount(): void
Resets the bindings count without clearing previously bound values
Returns
void
Property Detail
$_bindings ¶ protected
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 ¶ protected
A counter of the number of parameters bound in this expression object
Type
int