PHP Class Cake\Database\ValueBinder

Datei anzeigen Open project: cakephp/cakephp Class Usage Examples

Protected Properties

Property Type Description
$_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.
$_bindingsCount integer A counter of the number of parameters bound in this expression object

Public Methods

Method Description
attachTo ( Cake\Database\StatementInterface $statement ) : void Binds all the stored values in this object to the passed statement.
bind ( string | integer $param, mixed $value, string | integer $type = 'string' ) : void Associates a query placeholder to a value and a type
bindings ( ) : array Returns all values bound to this expression object at this nesting level.
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.
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.
reset ( ) : void Clears any bindings that were previously registered
resetCount ( ) : void Resets the bindings count without clearing previously bound values

Method Details

attachTo() public method

Binds all the stored values in this object to the passed statement.
public attachTo ( Cake\Database\StatementInterface $statement ) : void
$statement Cake\Database\StatementInterface The statement to add parameters to.
return void

bind() public method

Associates a query placeholder to a value and a type
public bind ( string | integer $param, mixed $value, string | integer $type = 'string' ) : void
$param string | integer placeholder to be replaced with quoted version of $value
$value mixed The value to be bound
$type string | integer the mapped type name, used for casting when sending to database
return void

bindings() public method

Subexpression bound values will not be returned with this function.
public bindings ( ) : array
return array

generateManyNamed() public method

Creates unique named placeholders for each of the passed values and binds them with the specified type.
public generateManyNamed ( array | Traversable $values, string $type = 'string' ) : array
$values array | Traversable The list of values to be bound
$type string The type with which all values will be bound
return array with the placeholders to insert in the query

placeholder() public method

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.
public placeholder ( string $token ) : string
$token string string from which the placeholder will be derived from, if it starts with a colon, then the same string is returned
return string to be used as a placeholder in a query expression

reset() public method

Clears any bindings that were previously registered
public reset ( ) : void
return void

resetCount() public method

Resets the bindings count without clearing previously bound values
public resetCount ( ) : void
return void

Property Details

$_bindings protected_oe property

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.
protected array $_bindings
return array

$_bindingsCount protected_oe property

A counter of the number of parameters bound in this expression object
protected int $_bindingsCount
return integer