DatabaseMapperInterface
interface DatabaseMapperInterface implements DataMapperInterface (View source)
The DatabaseMapperInterface class.
Methods
Find records and return data set.
Find records without where conditions and return data set.
Find one record and return a data.
Find column as an array.
Update records by data set. Every data depend on this table's primary key to update itself.
Using one data to update multiple rows, filter by where conditions.
Same as update(), just update one row.
Flush records, will delete all by conditions then recreate new.
Save will auto detect is conditions matched in data or not.
Get table fields.
Get table name.
Get DB adapter.
Details
in DataMapperInterface at line line 37
mixed
find(mixed $conditions = array(), mixed $order = null, integer $start = null, integer $limit = null)
Find records and return data set.
Example:
- $mapper->find(array('id' => 5), 'date', 20, 10);
- $mapper->find(null, 'id', 0, 1);
in DataMapperInterface at line line 53
mixed
findAll(mixed $order = null, integer $start = null, integer $limit = null)
Find records without where conditions and return data set.
Same as $mapper->find(null, 'id', $start, $limit);
in DataMapperInterface at line line 72
mixed
findOne(mixed $conditions = array(), mixed $order = null)
Find one record and return a data.
Same as $mapper->find($conditions, 'id', 0, 1);
in DataMapperInterface at line line 94
mixed
findColumn(string $column, mixed $conditions = array(), mixed $order = null, integer $start = null, integer $limit = null)
Find column as an array.
in DataMapperInterface at line line 103
mixed
create(mixed $dataset)
Create records by data set.
in DataMapperInterface at line line 112
mixed
createOne(mixed $data)
Create one record by data object.
in DataMapperInterface at line line 123
mixed
update(mixed $dataset, array $condFields = null)
Update records by data set. Every data depend on this table's primary key to update itself.
in DataMapperInterface at line line 141
mixed
updateBatch(mixed $data, mixed $conditions = array())
Using one data to update multiple rows, filter by where conditions.
Example:
$mapper->updateAll(new Data(array('published' => 0)), array('date' => '2014-03-02'))
Means we make every records which date is 2014-03-02 unpublished.
in DataMapperInterface at line line 152
mixed
updateOne(mixed $data, array $condFields = null)
Same as update(), just update one row.
in DataMapperInterface at line line 166
mixed
flush(mixed $dataset, mixed $conditions = array())
Flush records, will delete all by conditions then recreate new.
in DataMapperInterface at line line 178
mixed
save(mixed $dataset, array $condFields = null)
Save will auto detect is conditions matched in data or not.
If matched, using update, otherwise we will create it as new record.
in DataMapperInterface at line line 189
mixed
saveOne(mixed $data, array $condFields = null)
Save only one row.
in DataMapperInterface at line line 202
boolean
delete(mixed $conditions)
Delete records by where conditions.
at line line 27
array
getFields(string $table = null)
Get table fields.
at line line 34
string
getTable()
Get table name.
at line line 41
AbstractDatabaseDriver
getDb()
Get DB adapter.
at line line 50
DataMapper
setDb(AbstractDatabaseDriver $db)
Set db adapter.