Overview

Classes

  • TinyDB
  • TinyDBCommand
  • TinyDBFactory
  • TinyDBModel

Exceptions

  • TinyDBException
  • Overview
  • Class
  • Tree

Class TinyDBFactory

Model factory

Located at tinydb.php
Methods summary
public
# __construct( mixed $db, mixed $model, mixed $pk = null )
public
# getPK( )

PK getter

PK getter

public
# getTable( )

Table getter

Table getter

public
# with( mixed $with )
public
# buildWith( )
public TinyDBModel
# map( array $row )

Map array to model

Map array to model

Parameters

$row
array
$row

Returns

TinyDBModel
public array
# mapModels( array $rows )

Map data rows to model array

Map data rows to model array

Parameters

$rows
array
$rows

Returns

array
public
# create( array $row = array() )

Create a fresh model from array

Create a fresh model from array

Parameters

$row
array
$row
protected array
# buildPKConditions( string|array $pk, mixed $_data )

Build PK condition(multiple pk is also supported)

Build PK condition(multiple pk is also supported)

Parameters

$pk
string|array
$pk
$_data
mixed
$_data

Returns

array
public integer
# count( string|array $conditions = '', array $params = array() )

Count with conditions

Count with conditions

Parameters

$conditions
string|array
$conditions
$params
array
$params

Returns

integer
public integer
# countBy( string $key, mixed $value )

Count by key

Count by key

Parameters

$key
string
$key
$value
mixed
$value

Returns

integer
public
# find( integer $pk )

Find by PK

Find by PK

Parameters

$pk
integer
$id
public
# findAll( )

Find all

Find all

public boolean|TinyDBModel
# findOne( string|array $conditions, array $params = array() )

Find one model with conditions

Find one model with conditions

Parameters

$conditions
string|array
$conditions
$params
array
$params

Returns

boolean|TinyDBModel
public boolean|TinyDBModel
# findOneBy( string $key, mixed $value )

Find one model by key

Find one model by key

Parameters

$key
string
$key
$value
mixed
$value

Returns

boolean|TinyDBModel
public boolean|TinyDBModel
# findByPK( string|array $pk )

Find one model by primary key

Find one model by primary key

Parameters

$pk
string|array
$pk

Returns

boolean|TinyDBModel
public boolean|array
# findMany( string|array $conditions = '', array $params = array(), string|array $orderBy = null, integer $limit = null, integer $offset = null )

Find many models with conditions

Find many models with conditions

Parameters

$conditions
string|array
$conditions
$params
array
$params
$orderBy
string|array
$orderBy
$limit
integer
$limit
$offset
integer
$offset

Returns

boolean|array
public boolean|array
# findManyBy( string $key, mixed $value, string|array $orderBy = null, integer $limit = null, integer $offset = null )

Find many models with by key

Find many models with by key

Parameters

$key
string
$key
$value
mixed
$value
$orderBy
string|array
$orderBy
$limit
integer
$limit
$offset
integer
$offset

Returns

boolean|array
public integer|boolean
# update( array $values, string|array $conditions = '', array $params = array() )

Update table with condition

Update table with condition

Parameters

$values
array
$values
$conditions
string|array
$conditions
$params
array
$params

Returns

integer|boolean
public integer|boolean
# updateBy( string $key, mixed $value, array $values )

Update table by key

Update table by key

Parameters

$key
string
$key
$value
mixed
$value
$values
array
$values

Returns

integer|boolean
public integer|boolean
# updateByPK( string|array $pk, array $values )

Update table by primary key

Update table by primary key

Parameters

$pk
string|array
$pk
$values
array
$values

Returns

integer|boolean
public integer|boolean
# insert( array $values )

Insert

Insert

Parameters

$values
array
$values

Returns

integer|boolean
public integer|boolean
# delete( string|array $conditions = '', array $params = array() )

Delete with condition

Delete with condition

Parameters

$conditions
string|array
$conditioins
$params
array
$params

Returns

integer|boolean
public integer|boolean
# deleteBy( string $key, mixed $value )

Delete by key

Delete by key

Parameters

$key
string
$key
$value
mixed
$value

Returns

integer|boolean
public integer|boolean
# deleteByPK( string|array $pk )

Delete by primary key

Delete by primary key

Parameters

$pk
string|array
$pk

Returns

integer|boolean
public mixed
# __call( string $name, array $arguments )

Override __call magic method to provide many helper methods

Override __call magic method to provide many helper methods

Parameters

$name
string
$name
$arguments
array
$arguments

Returns

mixed
Properties summary
protected mixed $db
#
protected mixed $modelClass
#
protected mixed $table
#
protected mixed $pk
#
protected mixed $with
#
API documentation generated by ApiGen 2.8.0