PhpToolCase
Api Documentation Version 0.9.2
|
Public Member Functions | |
__construct () | |
Retrives the query builder from the connection manager and table column names. More... | |
reset () | |
Resets previously set values. More... | |
remove ($key) | |
Removes values from fields property. More... | |
toArray () | |
Returns values as an associative array. More... | |
toJson () | |
Returns values as a json array. More... | |
delete () | |
Deletes record in table based on id. More... | |
save () | |
Inserts a new record in table. More... | |
__set ($key, $value) | |
Sets values. More... | |
__get ($key) | |
Retrieves values. More... | |
Static Public Member Functions | |
static | create ($array) |
Sets values based on associative array. More... | |
static | find ($id) |
Retrieves single record from the table based on id. More... | |
static | all () |
Gets all records. More... | |
static | getColumns () |
Retrieves column names from table. More... | |
static | observe ($class=null) |
Adds observers to the class to use event listeners with the queries. More... | |
static | __callStatic ($method, $args) |
Calls shortcut methods for getting / setting single values, or the QueryBuilder methods directly. More... | |
static | lastId () |
Retrieves last inserted id. More... | |
Protected Member Functions | |
_mapFields () | |
Replaces column names with values in the PtcMapper::$_map property. More... | |
Static Protected Member Functions | |
static | _checkColumn ($column) |
Checks if a given column name exists in table. More... | |
static | _fireEvent ($event, $data) |
Fires events if methods are present in observers classes. More... | |
static | _getQB () |
Retrieve the query builder object if present. More... | |
static | _initialize () |
Initializes the class, adding columns and table name to the PtcMapper::$_storage property. More... | |
Protected Attributes | |
$_fields = array( ) | |
Array of created values property. More... | |
Static Protected Attributes | |
static | $_table = null |
Database table property. More... | |
static | $_uniqueKey = 'id' |
Unique row identifier column name. More... | |
static | $_map = array( ) |
Maps column names to fields, if "as" is used. More... | |
static | $_eventClass = '\PtcEvent' |
Event class name property. More... | |
static | $_connectionManager = 'PtcDb' |
Connection Manager class name property. More... | |
static | $_connectionName ='default' |
Connection name to be used property. More... | |
static | $_events |
Possible observer events array. More... | |
static | $_observers = array( ) |
Property that holds the observer classes. More... | |
static | $_storage = array( ) |
Column and table names property. More... | |
__construct | ( | ) |
Retrives the query builder from the connection manager and table column names.
Definition at line 18 of file PtcMapper.php.
|
static |
Calls shortcut methods for getting / setting single values, or the QueryBuilder methods directly.
See Updating Single Values , Retrieving Single Values and Using The Query Builder Directly
string | $method | the method name |
array | $args | an array with arguments for the method |
Definition at line 194 of file PtcMapper.php.
__get | ( | $key | ) |
Retrieves values.
string | $key | the column name |
Definition at line 182 of file PtcMapper.php.
__set | ( | $key, | |
$value | |||
) |
Sets values.
string | $key | the column name |
mixed | $value | the value |
Definition at line 173 of file PtcMapper.php.
|
staticprotected |
Checks if a given column name exists in table.
string | $column | the value to check |
Definition at line 272 of file PtcMapper.php.
|
staticprotected |
Fires events if methods are present in observers classes.
string | $event | the event name stored in the $_observers property |
array | $data | in array with the data to pass to the listeners |
Definition at line 289 of file PtcMapper.php.
|
staticprotected |
Retrieve the query builder object if present.
Definition at line 307 of file PtcMapper.php.
|
staticprotected |
Initializes the class, adding columns and table name to the PtcMapper::$_storage property.
See Adding Options On Initialization
Definition at line 317 of file PtcMapper.php.
|
protected |
Replaces column names with values in the PtcMapper::$_map property.
Definition at line 344 of file PtcMapper.php.
|
static |
Gets all records.
Definition at line 119 of file PtcMapper.php.
|
static |
Sets values based on associative array.
See Adding Records
array | $array | an associative array with values |
Definition at line 41 of file PtcMapper.php.
delete | ( | ) |
Deletes record in table based on id.
See Deleting Records
Definition at line 52 of file PtcMapper.php.
|
static |
Retrieves single record from the table based on id.
See Retrieve Record Based On Id
int | $id | the record id |
Definition at line 106 of file PtcMapper.php.
|
static |
Retrieves column names from table.
Definition at line 131 of file PtcMapper.php.
|
static |
Retrieves last inserted id.
Definition at line 361 of file PtcMapper.php.
|
static |
Adds observers to the class to use event listeners with the queries.
string | $class | the name of the class that will be used as observer |
Definition at line 149 of file PtcMapper.php.
remove | ( | $key | ) |
Removes values from fields property.
string | $key | the table column name |
Definition at line 27 of file PtcMapper.php.
reset | ( | ) |
Resets previously set values.
Definition at line 22 of file PtcMapper.php.
save | ( | ) |
Inserts a new record in table.
See Adding Records and Updating Records
Definition at line 69 of file PtcMapper.php.
toArray | ( | ) |
Returns values as an associative array.
Definition at line 31 of file PtcMapper.php.
toJson | ( | ) |
Returns values as a json array.
Definition at line 35 of file PtcMapper.php.
|
staticprotected |
Connection Manager class name property.
See Specify Connection Manager Class
Definition at line 242 of file PtcMapper.php.
|
staticprotected |
Connection name to be used property.
Definition at line 246 of file PtcMapper.php.
|
staticprotected |
|
staticprotected |
Possible observer events array.
Definition at line 250 of file PtcMapper.php.
|
protected |
Array of created values property.
Definition at line 266 of file PtcMapper.php.
|
staticprotected |
Maps column names to fields, if "as" is used.
Definition at line 234 of file PtcMapper.php.
|
staticprotected |
Property that holds the observer classes.
Definition at line 258 of file PtcMapper.php.
|
staticprotected |
Column and table names property.
Definition at line 262 of file PtcMapper.php.
|
staticprotected |
Database table property.
Definition at line 226 of file PtcMapper.php.
|
staticprotected |
Unique row identifier column name.
Definition at line 230 of file PtcMapper.php.