Summary
Implements common access to a sql based datastore for CRUD operations on objects attached to the given <code>MappingModel</code>.
Implements common access to a sql based datastore for CRUD operations on objects attached to the given <code>MappingModel</code>.
__construct(\MappingModel $model, \DBQuerier $querier = null)
initialize the dao
\MappingModel | $model | the model on which rely to provides services |
\DBQuerier | $querier | the querier that will be used to interact with the database |
None found |
save(\PropertiesMapInterface $object, $on_duplicate_update_column = '')
Saves <code>$object</code> in the table.
If the object does not exist, it is created, else, just updated
\PropertiesMapInterface | $object | the object to save |
$on_duplicate_update_column |
None found |
update(array $fields, string $where = \DAO::WHERE_ALL, array $parameters = array())
Update all fields in the table to the given value if row match the where clause.
array | $fields | keys are the fields names to update, values, their new value |
string | $where | the part of the query that came just after the from |
array | $parameters | the query vars to inject into the |
None found |
delete(\PropertiesMapInterface $object)
Deletes <code>$object</code> from the table.
If the object does not exist, nothing is done
\PropertiesMapInterface | $object | the object to delete |
None found |
delete_all(string $where = \DAO::WHERE_ALL, array $parameters = array())
Deletes all object matching the where clause from the table.
string | $where | the part of the query that came just after the from |
array | $parameters | the query vars to inject into the |
None found |
count(string $where = \DAO::WHERE_ALL, array $parameters = array())
Count the number of object in the table matching the <code>$where</code> clause
string | $where | the part of the query that came just after the from |
array | $parameters | the query vars to inject into the |
None found |
find_by_id(mixed $id) : \PropertiesMapInterface
retrieves the object with the <code>$id</code> primary identifier
mixed | $id | the object primary identifier (shoudl always be an integer) |
the objet retrieved from the table
None found |
find_all(integer $limit = \DAO::FIND_ALL, integer $offset, array<mixed,\string[mixed]> $order_by = array()) : \QueryResultMapper
retrieves the <code>$limit</code> first objects from the <code>$offset</code> one.
If $order_by
is specified, objects will be sorted in the $way
way
integer | $limit | the maximum number of objets to retrieve |
integer | $offset | the offset from which retrieves objects |
array<mixed,\string[mixed]> | $order_by | the column(s) on which sort will be done.
This parameter is an array with nested associative subarrays for each column:
|
the objects list
None found |
find_by_criteria(string $criteria, \string[string] $parameters = array()) : \QueryResultMapper
retrieves all the objects in the table matching the <code>$criteria</code>
string | $criteria | the part of the query that came just after the from |
\string[string] | $parameters | the query vars to inject into the |
the objects list
None found |
cache_model()
None found |
raw_insert(\PropertiesMapInterface $object, $on_duplicate_update_column = '') : \InjectQueryResult
\PropertiesMapInterface | $object | |
$on_duplicate_update_column |
None found |
raw_update(\PropertiesMapInterface $object, $pk_value) : \InjectQueryResult
\PropertiesMapInterface | $object | |
$pk_value |
None found |
compute_find_by_id_query()
None found |
compute_find_by_criteria_query()
None found |
compute_insert_query( $on_duplicate_update_column = '')
$on_duplicate_update_column |
None found |
compute_update_query()
None found |
add_select_columns( $fields_mapping)
$fields_mapping |
None found |
compute_joins()
None found |
$querier : \DBQuerier
None found |
$model : \MappingModel
None found |
$table : string
None found |
$pk_db_field : string
None found |
$pk_property : string
None found |
$pk_getter : string
None found |
$pk_setter : string
None found |
$fields_mapping : \string[string]
None found |
$delete_query : string
None found |
$insert_query : string
None found |
$update_query : string
None found |
$find_by_id_query : string
None found |
$find_by_criteria_query : string
None found |