PdbDataFormatterInterface
in
A formatter is much like a `PdbDataBinderInterface` instead these are registered globally rather than passed through as data objects.
Formatters are applies after binders.
This is a slightly different behaviour effect compared to the binder interface:
- Binders can bind or format non-object values, whereas formatters cannot.
- Formatters apply to all queries, not just insert/update.
As such, one might observe distinctly different but strikingly similar use-cases.
Table of Contents
Methods
- format() : string
- Format a value before binding.
- getBindingQuery() : string
- Get the SQL snippet for an `INSERT/UPDATE SET` query.
Methods
format()
Format a value before binding.
public
format(object $value) : string
Parameters
- $value : object
Return values
stringgetBindingQuery()
Get the SQL snippet for an `INSERT/UPDATE SET` query.
public
getBindingQuery(Pdb $pdb, string $column) : string
The column value will be a numeric placeholder like ?.
Such as: "column" = ?.
Please note, although the value is properly escaped using prepared statements - the column names are not. The Pdb object is provided for this purpose Pdb::quoteField.
Parameters
- $pdb : Pdb
- $column : string