Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
|
Class service, providing an single API for interacting with the favourites subsystem, for all favourites of a specific component. More...
Public Member Functions | |
__construct (string $component, favourite_repository_interface $repository) | |
The component_favourite_service constructor. | |
delete_favourites_by_type_and_item (string $itemtype, int $itemid, context $context=null) | |
Delete a collection of favourites by type and item, and optionally for a given context. | |
Protected Attributes | |
int | $component |
$component the frankenstyle component name to which this favourites service is scoped. | |
favourite_repository_interface | $repo |
$repo the favourite repository object. | |
Class service, providing an single API for interacting with the favourites subsystem, for all favourites of a specific component.
This class provides operations which can be applied to favourites within a component, based on type and context identifiers.
All object persistence is delegated to the favourite_repository_interface object.
core_favourites\local\service\component_favourite_service::__construct | ( | string | $component, |
favourite_repository_interface | $repository ) |
The component_favourite_service constructor.
string | $component | The frankenstyle name of the component to which this service operations are scoped. |
core_favourites\local\repository\favourite_repository_interface | $repository | a favourites repository. |
moodle_exception | if the component name is invalid. |
core_favourites\local\service\component_favourite_service::delete_favourites_by_type_and_item | ( | string | $itemtype, |
int | $itemid, | ||
context | $context = null ) |
Delete a collection of favourites by type and item, and optionally for a given context.
E.g. delete all favourites of type 'message_conversations' for the conversation '11' and in the CONTEXT_COURSE context.
string | $itemtype | the type of the favourited items. |
int | $itemid | the id of the item to which the favourites relate |
context | $context | the context of the items which were favourited. |