Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
core_favourites\local\repository\favourite_repository_interface Interface Reference

The favourite_repository interface, defining the basic CRUD operations for favourite type items within core_favourites. More...

Inheritance diagram for core_favourites\local\repository\favourite_repository_interface:
core_favourites\local\repository\favourite_repository

Public Member Functions

 add (favourite $item)
 Add one item to this repository.
 
 add_all (array $items)
 Add all the items in the list to this repository.
 
 count ()
 Return the total number of items in this repository.
 
 count_by (array $criteria)
 Return the number of favourites matching the specified criteria.
 
 delete (int $id)
 Delete an item by id.
 
 delete_by (array $criteria)
 Delete all favourites matching the specified criteria.
 
 exists (int $id)
 Check whether an item 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 an item in this repository based on its id.
 
 find_all (int $limitfrom=0, int $limitnum=0)
 Find all items in this repository.
 
 find_by (array $criteria, int $limitfrom=0, int $limitnum=0)
 Find all items with attributes matching certain values.
 
 find_favourite (int $userid, string $component, string $itemtype, int $itemid, int $contextid)
 Find a single favourite, based on it's unique identifiers.
 
 update (favourite $item)
 Update an item within this repository.
 

Detailed Description

The favourite_repository interface, defining the basic CRUD operations for favourite type items within core_favourites.

Member Function Documentation

◆ add()

core_favourites\local\repository\favourite_repository_interface::add ( favourite $item)

Add one item to this repository.

Parameters
favourite$itemthe item to add.
Return values
favouritethe item which was added.

Implemented in core_favourites\local\repository\favourite_repository.

◆ add_all()

core_favourites\local\repository\favourite_repository_interface::add_all ( array $items)

Add all the items in the list to this repository.

Parameters
array$itemsthe list of items to add.
Return values
arraythe list of items added to this repository.

Implemented in core_favourites\local\repository\favourite_repository.

◆ count()

core_favourites\local\repository\favourite_repository_interface::count ( )

Return the total number of items in this repository.

Return values
intthe total number of items.

Implemented in core_favourites\local\repository\favourite_repository.

◆ count_by()

core_favourites\local\repository\favourite_repository_interface::count_by ( array $criteria)

Return the number of favourites matching the specified criteria.

Parameters
array$criteriathe list of key/value criteria pairs.
Return values
intthe number of favourites matching the criteria.

Implemented in core_favourites\local\repository\favourite_repository.

◆ delete()

core_favourites\local\repository\favourite_repository_interface::delete ( int $id)

Delete an item by id.

Parameters
int$idthe id of the item to delete.
Return values
void

Implemented in core_favourites\local\repository\favourite_repository.

◆ delete_by()

core_favourites\local\repository\favourite_repository_interface::delete_by ( array $criteria)

Delete all favourites matching the specified criteria.

Parameters
array$criteriathe list of key/value criteria pairs.
Return values
void.

Implemented in core_favourites\local\repository\favourite_repository.

◆ exists()

core_favourites\local\repository\favourite_repository_interface::exists ( int $id)

Check whether an item exists in this repository, based on its id.

Parameters
int$idthe id to search for.
Return values
booltrue if the item could be found, false otherwise.

Implemented in core_favourites\local\repository\favourite_repository.

◆ exists_by()

core_favourites\local\repository\favourite_repository_interface::exists_by ( array $criteria)

Check whether an item exists in this repository, based on the specified criteria.

Parameters
array$criteriathe list of key/value criteria pairs.
Return values
booltrue if the favourite exists, false otherwise.

Implemented in core_favourites\local\repository\favourite_repository.

◆ find()

core_favourites\local\repository\favourite_repository_interface::find ( int $id)

Find an item in this repository based on its id.

Parameters
int$idthe id of the item.
Return values
favouritethe item.

Implemented in core_favourites\local\repository\favourite_repository.

◆ find_all()

core_favourites\local\repository\favourite_repository_interface::find_all ( int $limitfrom = 0,
int $limitnum = 0 )

Find all items in this repository.

Parameters
int$limitfromoptional pagination control for returning a subset of records, starting at this point.
int$limitnumoptional pagination control for returning a subset comprising this many records.
Return values
arraylist of all items in this repository.

Implemented in core_favourites\local\repository\favourite_repository.

◆ find_by()

core_favourites\local\repository\favourite_repository_interface::find_by ( array $criteria,
int $limitfrom = 0,
int $limitnum = 0 )

Find all items with attributes matching certain values.

Parameters
array$criteriathe array of attribute/value pairs.
int$limitfromoptional pagination control for returning a subset of records, starting at this point.
int$limitnumoptional pagination control for returning a subset comprising this many records.
Return values
arraythe list of items matching the criteria.

Implemented in core_favourites\local\repository\favourite_repository.

◆ find_favourite()

core_favourites\local\repository\favourite_repository_interface::find_favourite ( int $userid,
string $component,
string $itemtype,
int $itemid,
int $contextid )

Find a single favourite, based on it's unique identifiers.

Parameters
int$useridthe id of the user to which the favourite belongs.
string$componentthe frankenstyle component name.
string$itemtypethe type of the favourited item.
int$itemidthe id of the item which was favourited (not the favourite's id).
int$contextidthe contextid of the item which was favourited.
Return values
favouritethe favourite.

Implemented in core_favourites\local\repository\favourite_repository.

◆ update()

core_favourites\local\repository\favourite_repository_interface::update ( favourite $item)

Update an item within this repository.

Parameters
favourite$itemthe item to update.
Return values
favouritethe updated item.

Implemented in core_favourites\local\repository\favourite_repository.


The documentation for this interface was generated from the following file: