PHP 클래스 Psecio\Gatekeeper\DataSource\Mysql

상속: extends Psecio\Gatekeeper\DataSource
파일 보기 프로젝트 열기: psecio/gatekeeper

보호된 프로퍼티들

프로퍼티 타입 설명
$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