class NullDataMapper extends DataMapper (View source)

The NullDataMapper class.

Methods

__construct()

NullDataMapper constructor.

mixed|DataSet
find(mixed $conditions = array(), mixed $order = null, integer $start = null, integer $limit = null)

Find records and return data set.

mixed|DataSet
findAll(mixed $order = null, integer $start = null, integer $limit = null)

Find records without where conditions and return data set.

mixed|Data
findOne(mixed $conditions = array(), mixed $order = null)

Find one record and return a data.

mixed
findColumn(string $column, mixed $conditions = array(), mixed $order = null, integer $start = null, integer $limit = null)

Find column as an array.

mixed|DataSet
create(mixed $dataset)

Create records by data set.

mixed|Data
createOne(mixed $data)

Create one record by data object.

mixed|DataSet
update(mixed $dataset, array $condFields = null, bool $updateNulls = false)

Update records by data set. Every data depend on this table's primary key to update itself.

mixed|Data
updateOne(mixed $data, array $condFields = null, bool $updateNulls = false)

Same as update(), just update one row.

boolean
updateBatch(mixed $data, mixed $conditions = array())

Using one data to update multiple rows, filter by where conditions.

mixed|DataSet
flush(mixed $dataset, mixed $conditions = array())

Flush records, will delete all by conditions then recreate new.

mixed|DataSet
save(mixed $dataset, array $condFields = null, bool $updateNulls = false)

Save will auto detect is conditions matched in data or not.

mixed|Data
saveOne(mixed $data, array $condFields = null, bool $updateNulls = false)

Save only one row.

boolean
delete(mixed $conditions)

Delete records by where conditions.

Details

at line line 25
__construct()

NullDataMapper constructor.

at line line 51
mixed|DataSet 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);

Parameters

mixed $conditions Where conditions, you can use array or Compare object. Example: - array('id' => 5) => id = 5 - new GteCompare('id', 20) => 'id >= 20' - new Compare('id', '%Flower%', 'LIKE') => 'id LIKE "%Flower%"'
mixed $order Order sort, can ba string, array or object. Example: - id ASC => ORDER BY id ASC - array('catid DESC', 'id') => ORDER BY catid DESC, id
integer $start Limit start number.
integer $limit Limit rows.

Return Value

mixed|DataSet Found rows data set.

at line line 72
mixed|DataSet 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);

Parameters

mixed $order Order sort, can ba string, array or object. Example: - 'id ASC' => ORDER BY id ASC - array('catid DESC', 'id') => ORDER BY catid DESC, id
integer $start Limit start number.
integer $limit Limit rows.

Return Value

mixed|DataSet Found rows data set.

at line line 96
mixed|Data findOne(mixed $conditions = array(), mixed $order = null)

Find one record and return a data.

Same as $mapper->find($conditions, 'id', 0, 1);

Parameters

mixed $conditions Where conditions, you can use array or Compare object. Example: - array('id' => 5) => id = 5 - new GteCompare('id', 20) => 'id >= 20' - new Compare('id', '%Flower%', 'LIKE') => 'id LIKE "%Flower%"'
mixed $order Order sort, can ba string, array or object. Example: - id ASC => ORDER BY id ASC - array('catid DESC', 'id') => ORDER BY catid DESC, id

Return Value

mixed|Data Found row data.

at line line 123
mixed findColumn(string $column, mixed $conditions = array(), mixed $order = null, integer $start = null, integer $limit = null)

Find column as an array.

Parameters

string $column The column we want to select.
mixed $conditions Where conditions, you can use array or Compare object. Example: - array('id' => 5) => id = 5 - new GteCompare('id', 20) => 'id >= 20' - new Compare('id', '%Flower%', 'LIKE') => 'id LIKE "%Flower%"'
mixed $order Order sort, can ba string, array or object. Example: - id ASC => ORDER BY id ASC - array('catid DESC', 'id') => ORDER BY catid DESC, id
integer $start Limit start number.
integer $limit Limit rows.

Return Value

mixed

Exceptions

InvalidArgumentException

at line line 137
mixed|DataSet create(mixed $dataset)

Create records by data set.

Parameters

mixed $dataset The data set contains data we want to store.

Return Value

mixed|DataSet Data set data with inserted id.

Exceptions

UnexpectedValueException
InvalidArgumentException

at line line 152
mixed|Data createOne(mixed $data)

Create one record by data object.

Parameters

mixed $data Send a data in and store.

Return Value

mixed|Data Data with inserted id.

Exceptions

InvalidArgumentException

at line line 169
mixed|DataSet update(mixed $dataset, array $condFields = null, bool $updateNulls = false)

Update records by data set. Every data depend on this table's primary key to update itself.

Parameters

mixed $dataset Data set contain data we want to update.
array $condFields The where condition tell us record exists or not, if not set, will use primary key instead.
bool $updateNulls Update empty fields or not.

Return Value

mixed|DataSet

at line line 186
mixed|Data updateOne(mixed $data, array $condFields = null, bool $updateNulls = false)

Same as update(), just update one row.

Parameters

mixed $data The data we want to update.
array $condFields The where condition tell us record exists or not, if not set, will use primary key instead.
bool $updateNulls Update empty fields or not.

Return Value

mixed|Data

at line line 209
boolean 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.

Parameters

mixed $data The data we want to update to every rows.
mixed $conditions Where conditions, you can use array or Compare object. Example: - array('id' => 5) => id = 5 - new GteCompare('id', 20) => 'id >= 20' - new Compare('id', '%Flower%', 'LIKE') => 'id LIKE "%Flower%"'

Return Value

boolean

Exceptions

InvalidArgumentException

at line line 226
mixed|DataSet flush(mixed $dataset, mixed $conditions = array())

Flush records, will delete all by conditions then recreate new.

Parameters

mixed $dataset Data set contain data we want to update.
mixed $conditions Where conditions, you can use array or Compare object. Example: - array('id' => 5) => id = 5 - new GteCompare('id', 20) => 'id >= 20' - new Compare('id', '%Flower%', 'LIKE') => 'id LIKE "%Flower%"'

Return Value

mixed|DataSet Updated data set.

at line line 244
mixed|DataSet save(mixed $dataset, array $condFields = null, bool $updateNulls = false)

Save will auto detect is conditions matched in data or not.

If matched, using update, otherwise we will create it as new record.

Parameters

mixed $dataset The data set contains data we want to save.
array $condFields The where condition tell us record exists or not, if not set, will use primary key instead.
bool $updateNulls Update empty fields or not.

Return Value

mixed|DataSet Saved data set.

at line line 261
mixed|Data saveOne(mixed $data, array $condFields = null, bool $updateNulls = false)

Save only one row.

Parameters

mixed $data The data we want to save.
array $condFields The where condition tell us record exists or not, if not set, will use primary key instead.
bool $updateNulls Update empty fields or not.

Return Value

mixed|Data Saved data.

at line line 293
boolean delete(mixed $conditions)

Delete records by where conditions.

Parameters

mixed $conditions Where conditions, you can use array or Compare object. Example: - array('id' => 5) => id = 5 - new GteCompare('id', 20) => 'id >= 20' - new Compare('id', '%Flower%', 'LIKE') => 'id LIKE "%Flower%"'

Return Value

boolean Will be always true.