PHP Class FluentPDO, fluentpdo

Exibir arquivo Open project: fpdo/fluentpdo Class Usage Examples

Public Properties

Property Type Description
$convertTypes boolean
$debug boolean | callback

Protected Properties

Property Type Description
$pdo PDO
$structure FluentStructure | null

Public Methods

Method Description
__construct ( PDO $pdo, FluentStructure $structure = null ) FluentPDO constructor.
close ( ) : null Closes the \PDO connection to the database
delete ( string $table, string $primaryKey = null ) : DeleteQuery Create DELETE query
deleteFrom ( string $table, string $primaryKey = null ) : DeleteQuery Create DELETE FROM query
from ( string $table, integer $primaryKey = null ) : SelectQuery Create SELECT query from $table
getPdo ( ) : PDO
getStructure ( ) : FluentStructure
insertInto ( string $table, array $values = [] ) : InsertQuery Create INSERT INTO query
update ( string $table, array | string $set = [], string $primaryKey = null ) : UpdateQuery Create UPDATE query

Method Details

__construct() public method

FluentPDO constructor.
public __construct ( PDO $pdo, FluentStructure $structure = null )
$pdo PDO
$structure FluentStructure

close() public method

Closes the \PDO connection to the database
public close ( ) : null
return null

delete() public method

Create DELETE query
public delete ( string $table, string $primaryKey = null ) : DeleteQuery
$table string
$primaryKey string delete only row by primary key
return DeleteQuery

deleteFrom() public method

Create DELETE FROM query
public deleteFrom ( string $table, string $primaryKey = null ) : DeleteQuery
$table string
$primaryKey string
return DeleteQuery

from() public method

Create SELECT query from $table
public from ( string $table, integer $primaryKey = null ) : SelectQuery
$table string - db table name
$primaryKey integer - return one row by primary key
return SelectQuery

getPdo() public method

public getPdo ( ) : PDO
return PDO

getStructure() public method

public getStructure ( ) : FluentStructure
return FluentStructure

insertInto() public method

Create INSERT INTO query
public insertInto ( string $table, array $values = [] ) : InsertQuery
$table string
$values array - accepts one or multiple rows, @see docs
return InsertQuery

update() public method

Create UPDATE query
public update ( string $table, array | string $set = [], string $primaryKey = null ) : UpdateQuery
$table string
$set array | string
$primaryKey string
return UpdateQuery

Property Details

$convertTypes public_oe property

public bool $convertTypes
return boolean

$debug public_oe property

public bool|callback $debug
return boolean | callback

$pdo protected_oe property

protected PDO $pdo
return PDO

$structure protected_oe property

protected FluentStructure|null $structure
return FluentStructure | null