DataMapper
- Full name:
\EnvisionPortal\DataMapper - This class implements:
\EnvisionPortal\DataMapperInterface
Methods
fetchBy
Fetches entities from the database based on specified criteria.
public fetchBy(array $selects, array $params = [], array $joins = [], array $where = [], array $order = [], array $group = [], int $limit = null, int $offset = null): array
Parameters:
| Parameter | Type | Description |
|---|---|---|
$selects | array | Table columns to select. |
$params | array | Parameters to substitute into query text. |
$joins | array | Zero or more complete JOIN clauses. E.g.: 'LEFT JOIN messages AS m ON (a.id_msg = m.id_msg)' |
$where | array | Zero or more conditions for the WHERE clause. Conditions will be placed in parentheses and concatenated with AND. If this is left empty, no WHERE clause will be used. |
$order | array | Zero or more conditions for the ORDER BY clause. If this is left empty, no ORDER BY clause will be used. |
$group | array | Zero or more conditions for the GROUP BY clause. If this is left empty, no GROUP BY clause will be used. |
$limit | int | Maximum number of results to retrieve. If this is left empty, all results will be retrieved. |
$offset | int | Offset for LIMIT clause. |
Return Value:
The result as associative array of database rows.
insert
Inserts a new entity into the database.
public insert(\EnvisionPortal\EntityInterface $entity): void
Parameters:
| Parameter | Type | Description |
|---|---|---|
$entity | \EnvisionPortal\EntityInterface | The entity to insert. |
update
Updates an existing entity in the database.
public update(\EnvisionPortal\EntityInterface $entity): void
Parameters:
| Parameter | Type | Description |
|---|---|---|
$entity | \EnvisionPortal\EntityInterface | The entity to update. |
delete
Deletes a entity from the database.
public delete(\EnvisionPortal\EntityInterface $entity): void
Parameters:
| Parameter | Type | Description |
|---|---|---|
$entity | \EnvisionPortal\EntityInterface | The entity to delete. |
deleteMany
Deletes multiple entities from the database.
public deleteMany(array $ids): void
Parameters:
| Parameter | Type | Description |
|---|---|---|
$ids | array | Array of IDs of the entities to delete. |
deleteAll
Deletes all entities from the database.
public deleteAll(\EnvisionPortal\EntityInterface $entity): void
Parameters:
| Parameter | Type | Description |
|---|---|---|
$entity | \EnvisionPortal\EntityInterface |
incrementViews
Increment the view count for a page if not already viewed in the current session.
public incrementViews(\EnvisionPortal\EntityInterface $entity): void
Parameters:
| Parameter | Type | Description |
|---|---|---|
$entity | \EnvisionPortal\EntityInterface |
Automatically generated on 2024-05-12