Class favourite_repository.
More...
|
| add (favourite $favourite) |
| Add a favourite to the repository.
|
|
| add_all (array $items) |
| Add a collection of favourites to the repository.
|
|
| count () |
| Return the total number of favourites in this repository.
|
|
| count_by (array $criteria) |
| Return the number of user favourites matching the specified criteria.
|
|
| delete (int $id) |
| Delete a favourite, by id.
|
|
| delete_by (array $criteria) |
| Delete all favourites matching the specified criteria.
|
|
| exists (int $id) |
| Check whether a favourite exists in this repository, based on its id.
|
|
| exists_by (array $criteria) |
| Check whether an item exists in this repository, based on the specified criteria.
|
|
| find (int $id) |
| Find a favourite by id.
|
|
| find_all (int $limitfrom=0, int $limitnum=0) |
| Return all items in this repository, as an array, indexed by id.
|
|
| find_by (array $criteria, int $limitfrom=0, int $limitnum=0) |
| Return all items matching the supplied criteria (a [key => value,..] list).
|
|
| find_favourite (int $userid, string $component, string $itemtype, int $itemid, int $contextid) |
| Find a specific favourite, based on the properties known to identify it.
|
|
| update (favourite $favourite) |
| Update a favourite.
|
|
|
string | $favouritetable = 'favourite' |
| the name of the table which favourites are stored in.
|
|
Class favourite_repository.
This class handles persistence of favourites. Favourites from all areas are supported by this repository.
- Copyright
- 2018 Jake Dallimore jrhda.nosp@m.llim.nosp@m.ore@g.nosp@m.mail.nosp@m..com
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ add()
core_favourites\local\repository\favourite_repository::add |
( |
favourite | $favourite | ) |
|
◆ add_all()
core_favourites\local\repository\favourite_repository::add_all |
( |
array | $items | ) |
|
◆ count()
core_favourites\local\repository\favourite_repository::count |
( |
| ) |
|
◆ count_by()
core_favourites\local\repository\favourite_repository::count_by |
( |
array | $criteria | ) |
|
◆ delete()
core_favourites\local\repository\favourite_repository::delete |
( |
int | $id | ) |
|
◆ delete_by()
core_favourites\local\repository\favourite_repository::delete_by |
( |
array | $criteria | ) |
|
◆ exists()
core_favourites\local\repository\favourite_repository::exists |
( |
int | $id | ) |
|
◆ exists_by()
core_favourites\local\repository\favourite_repository::exists_by |
( |
array | $criteria | ) |
|
◆ find()
core_favourites\local\repository\favourite_repository::find |
( |
int | $id | ) |
|
◆ find_all()
core_favourites\local\repository\favourite_repository::find_all |
( |
int | $limitfrom = 0, |
|
|
int | $limitnum = 0 ) |
Return all items in this repository, as an array, indexed by id.
- Parameters
-
int | $limitfrom | optional pagination control for returning a subset of records, starting at this point. |
int | $limitnum | optional pagination control for returning a subset comprising this many records. |
- Return values
-
array | the list of all favourites stored within this repository. |
- Exceptions
-
Implements core_favourites\local\repository\favourite_repository_interface.
◆ find_by()
core_favourites\local\repository\favourite_repository::find_by |
( |
array | $criteria, |
|
|
int | $limitfrom = 0, |
|
|
int | $limitnum = 0 ) |
Return all items matching the supplied criteria (a [key => value,..] list).
- Parameters
-
array | $criteria | the list of key/value(s) criteria pairs. |
int | $limitfrom | optional pagination control for returning a subset of records, starting at this point. |
int | $limitnum | optional pagination control for returning a subset comprising this many records. |
- Return values
-
array | the list of favourites matching the criteria. |
- Exceptions
-
Implements core_favourites\local\repository\favourite_repository_interface.
◆ find_favourite()
core_favourites\local\repository\favourite_repository::find_favourite |
( |
int | $userid, |
|
|
string | $component, |
|
|
string | $itemtype, |
|
|
int | $itemid, |
|
|
int | $contextid ) |
Find a specific favourite, based on the properties known to identify it.
Used if we don't know its id.
- Parameters
-
int | $userid | the id of the user to which the favourite belongs. |
string | $component | the frankenstyle component name. |
string | $itemtype | the type of the favourited item. |
int | $itemid | the id of the item which was favourited (not the favourite's id). |
int | $contextid | the contextid of the item which was favourited. |
- Return values
-
- Exceptions
-
dml_exception | if any database errors are encountered or if the record could not be found. |
Implements core_favourites\local\repository\favourite_repository_interface.
◆ get_favourite_from_record()
core_favourites\local\repository\favourite_repository::get_favourite_from_record |
( |
\stdClass | $record | ) |
|
|
protected |
Get a favourite object, based on a full record.
- Parameters
-
stdClass | $record | the record we wish to hydrate. |
- Return values
-
favourite | the favourite record. |
◆ get_list_of_favourites_from_records()
core_favourites\local\repository\favourite_repository::get_list_of_favourites_from_records |
( |
array | $records | ) |
|
|
protected |
Get a list of favourite objects, based on a list of records.
- Parameters
-
array | $records | the record we wish to hydrate. |
- Return values
-
array | the list of favourites. |
◆ update()
core_favourites\local\repository\favourite_repository::update |
( |
favourite | $favourite | ) |
|
◆ validate()
core_favourites\local\repository\favourite_repository::validate |
( |
favourite | $favourite | ) |
|
|
protected |
Basic validation, confirming we have the minimum field set needed to save a record to the store.
- Parameters
-
favourite | $favourite | the favourite record to validate. |
- Exceptions
-
The documentation for this class was generated from the following file:
- favourites/classes/local/repository/favourite_repository.php