Method |
Description |
|
__construct ( phpDataMapper_Adapter_Interface $adapter, $adapterRead = null ) |
Constructor Method |
|
adapter ( ) |
Get current adapter object |
|
adapterRead ( ) |
Get adapter object that will serve as the 'slave' for reads |
|
all ( array $conditions = [] ) |
Find records with given conditions
If all parameters are empty, find all records |
|
collectionClass ( ) : string |
Get collection class name to use |
|
datasource ( ) |
Get name of the data source |
|
debug ( $entity = null ) |
Prints all executed SQL queries - useful for debugging |
|
delete ( mixed $conditions ) |
Delete items matching given conditions |
|
dropDatasource ( ) |
Drop/delete data source
Destructive and dangerous - drops entire data source and all data |
|
entityClass ( ) : string |
Get entity class name to use |
|
error ( string $field, mixed $msg ) |
Add an error to error messages array |
|
errors ( $msgs = null ) : array |
Get array of error messages |
|
fieldExists ( $field ) |
Check if field exists in defined fields |
|
fields ( ) : array |
Get formatted fields with all neccesary array keys and values. |
|
first ( array $conditions = [] ) |
Find first record matching given conditions |
|
get ( $primaryKeyValue ) |
Load record from primary key |
|
getEntityRelationWithValues ( phpDataMapper_Entity $entity ) |
Replace entity value placeholders on relation definitions
Currently replaces 'entity.[col]' with the column value from the passed entity object |
|
getRelationsFor ( phpDataMapper_Entity $entity ) |
Load defined relations |
|
getResultSet ( $stmt ) |
Get result set for given PDO Statement |
|
hasErrors ( string $field = null ) : boolean |
Check if any errors exist |
|
init ( ) |
Initialization function, run immediately after __construct() so that the constructor is never overridden |
|
insert ( mixed $entity ) |
Insert record |
|
isEmpty ( mixed $value ) : boolean |
Check if a value is empty, excluding 0 (annoying PHP issue) |
|
loadClass ( $className ) |
Attempt to load class file based on phpDataMapper naming conventions |
|
logQuery ( string $sql, array $data = null ) |
Log query |
|
migrate ( ) |
Migrate table structure changes from model to database |
|
primaryKey ( phpDataMapper_Entity $entity ) |
Get value of primary key for given row result |
|
primaryKeyField ( ) |
Get value of primary key for given row result |
|
query ( string $sql, array $binds = [] ) |
Find records with custom SQL query |
|
queryClass ( ) : string |
Get query class name to use |
|
queryCount ( ) : integer |
Get count of all queries that have been executed |
|
relations ( ) |
Get defined relations |
|
save ( mixed $entity ) |
Save record
Will update if primary key found, insert if not
Performs validation automatically before saving record |
|
select ( mixed $fields = "*" ) |
Begin a new database query - get query builder
Acts as a kind of factory to get the current adapter's query builder object |
|
truncateDatasource ( ) |
Truncate data source
Should delete all rows and reset serial/auto_increment keys to 0 |
|
update ( phpDataMapper_Entity $entity ) |
Update given row object |
|
validate ( phpDataMapper_Entity $entity ) |
Run set validation rules on fields |
|