PHP Класс Psecio\Gatekeeper\DataSource\Mysql

Наследование: extends Psecio\Gatekeeper\DataSource
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$db PDO PDO instance

Открытые методы

Метод Описание
__construct ( array $config, PDO $pdo = null ) Create our PDO connection, then call parent
buildPdo ( array $config ) : PDO Build the PDO instance
count ( Modler\Model $model, array $where = [] ) : array Find count of entities by where conditions.
create ( Modler\Model $model ) : boolean Create the record based on the data from the model
delete ( Modler\Model $model ) : boolean Delete a record represented by the model
execute ( string $sql, array $data ) : boolean Execute the request (not a fetch)
fetch ( string $sql, array $data, boolean $single = false ) : array | boolean Fetch the data matching the results of the SQL operation
find ( Modler\Model $model, array $where = [], boolean $multiple = false ) : array Find records matching the "where" data given All "where" options are appended via "and"
getDb ( ) : PDO Get the set PDO instance
getLastError ( ) : string Return the last error for the data source
save ( Modler\Model $model ) : boolean Save the model and its data (either create or update)
setDb ( PDO $db ) Set the PDO instance
setup ( array $data ) : array "Set up" the needed values for the database requests (for binding to queries)
update ( Modler\Model $model ) : boolean Update a record

Описание методов

__construct() публичный Метод

Create our PDO connection, then call parent
public __construct ( array $config, PDO $pdo = null )
$config array Configuration options
$pdo PDO PDO instance

buildPdo() публичный Метод

Build the PDO instance
public buildPdo ( array $config ) : PDO
$config array Configuration options
Результат PDO instance

count() публичный Метод

All where conditions applied with AND
public count ( Modler\Model $model, array $where = [] ) : array
$model Modler\Model Model instance
$where array Data to use in "where" statement
Результат array Fetched data

create() публичный Метод

Create the record based on the data from the model
public create ( Modler\Model $model ) : boolean
$model Modler\Model Model instance
Результат boolean Success/fail of create action

delete() публичный Метод

Delete a record represented by the model
public delete ( Modler\Model $model ) : boolean
$model Modler\Model Model instance
Результат boolean Success/failure of deletion

execute() публичный Метод

Execute the request (not a fetch)
public execute ( string $sql, array $data ) : boolean
$sql string SQL statement to execute
$data array Data to use in execution
Результат boolean Success/fail of the operation

fetch() публичный Метод

Fetch the data matching the results of the SQL operation
public fetch ( string $sql, array $data, boolean $single = false ) : array | boolean
$sql string SQL statement
$data array Data to use in fetch operation
$single boolean Only fetch a single record
Результат array | boolean Fetched data or boolean false on error

find() публичный Метод

Find records matching the "where" data given All "where" options are appended via "and"
public find ( Modler\Model $model, array $where = [], boolean $multiple = false ) : array
$model Modler\Model Model instance
$where array Data to use in "where" statement
$multiple boolean Force return of single/multiple
Результат array Fetched data

getDb() публичный Метод

Get the set PDO instance
public getDb ( ) : PDO
Результат PDO instance

getLastError() публичный Метод

Return the last error for the data source
public getLastError ( ) : string
Результат string Error string

save() публичный Метод

Save the model and its data (either create or update)
public save ( Modler\Model $model ) : boolean
$model Modler\Model Model instance
Результат boolean Success/fail of save action

setDb() публичный Метод

Set the PDO instance
public setDb ( PDO $db )
$db PDO PDO instance

setup() публичный Метод

"Set up" the needed values for the database requests (for binding to queries)
public setup ( array $data ) : array
$data array Data to "set up"
Результат array Set containing the columns and bind values

update() публичный Метод

Update a record
public update ( Modler\Model $model ) : boolean
$model Modler\Model Model instance
Результат boolean Success/fail of operation

Описание свойств

$db защищенное свойство

PDO instance
protected PDO $db
Результат PDO