Differences Between: [Versions 311 and 402] [Versions 311 and 403]
Contains the favourite_repository class, responsible for CRUD operations for favourites.
Copyright: | 2018 Jake Dallimore <jrhdallimore@gmail.com> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 323 lines (13 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
Class: favourite_repository - X-Ref
Class favourite_repository.get_favourite_from_record(\stdClass $record) X-Ref |
Get a favourite object, based on a full record. param: \stdClass $record the record we wish to hydrate. return: favourite the favourite record. |
get_list_of_favourites_from_records(array $records) X-Ref |
Get a list of favourite objects, based on a list of records. param: array $records the record we wish to hydrate. return: array the list of favourites. |
validate(favourite $favourite) X-Ref |
Basic validation, confirming we have the minimum field set needed to save a record to the store. param: favourite $favourite the favourite record to validate. |
add(favourite $favourite) X-Ref |
Add a favourite to the repository. param: favourite $favourite the favourite to add. return: favourite the favourite which has been stored. |
add_all(array $items) X-Ref |
Add a collection of favourites to the repository. param: array $items the list of favourites to add. return: array the list of favourites which have been stored. |
find(int $id) X-Ref |
Find a favourite by id. param: int $id the id of the favourite. return: favourite the favourite. |
find_all(int $limitfrom = 0, int $limitnum = 0) X-Ref |
Return all items in this repository, as an array, indexed by id. param: int $limitfrom optional pagination control for returning a subset of records, starting at this point. param: int $limitnum optional pagination control for returning a subset comprising this many records. return: array the list of all favourites stored within this repository. |
find_by(array $criteria, int $limitfrom = 0, int $limitnum = 0) X-Ref |
Return all items matching the supplied criteria (a [key => value,..] list). param: array $criteria the list of key/value(s) criteria pairs. param: int $limitfrom optional pagination control for returning a subset of records, starting at this point. param: int $limitnum optional pagination control for returning a subset comprising this many records. return: array the list of favourites matching the criteria. |
find_favourite(int $userid, string $component, string $itemtype, int $itemid, int $contextid) X-Ref |
Find a specific favourite, based on the properties known to identify it. Used if we don't know its id. param: int $userid the id of the user to which the favourite belongs. param: string $component the frankenstyle component name. param: string $itemtype the type of the favourited item. param: int $itemid the id of the item which was favourited (not the favourite's id). param: int $contextid the contextid of the item which was favourited. return: favourite the favourite. |
exists(int $id) X-Ref |
Check whether a favourite exists in this repository, based on its id. param: int $id the id to search for. return: bool true if the favourite exists, false otherwise. |
exists_by(array $criteria) X-Ref |
Check whether an item exists in this repository, based on the specified criteria. param: array $criteria the list of key/value criteria pairs. return: bool true if the favourite exists, false otherwise. |
update(favourite $favourite) X-Ref |
Update a favourite. param: favourite $favourite the favourite to update. return: favourite the updated favourite. |
delete(int $id) X-Ref |
Delete a favourite, by id. param: int $id the id of the favourite to delete. |
delete_by(array $criteria) X-Ref |
Delete all favourites matching the specified criteria. param: array $criteria the list of key/value criteria pairs. |
count() X-Ref |
Return the total number of favourites in this repository. return: int the total number of items. |
count_by(array $criteria) X-Ref |
Return the number of user favourites matching the specified criteria. param: array $criteria the list of key/value criteria pairs. return: int the number of favourites matching the criteria. |