-
Notifications
You must be signed in to change notification settings - Fork 4
PubSub (event model)
Aleksey Ilyin edited this page Feb 22, 2024
·
6 revisions
Since version 2.0, all controllers raise an event when interacting with them.
All events have their own name according to a given pattern: [layer]:[entity]{:[subentity]}:[action], where:
-
layer
- one of:auth
,common
,cup
,plugin
orapi
; - entity - model name;
- subentity - sub model name;
- action - produced action (such as the
list
,add
,edit
,delete
, and otherlogin
,register
,send
,upload
).
Example: api:[entity]:create
, api:[entity]:edit
, plugin:order:payment
, auth:user:logout
, common:user:login
, cup:catalog:attribute:create
, cup:catalog:order:delete
, common:file:upload
, task:mail:send
$this->container->get(\App\Application\PubSub::class)->publish('cup:catalog:category:edit', $category);
In plugin constructor:
$this
->subscribe(
['cup:catalog:data:import', 'cup:catalog:category:add', 'cup:catalog:category:edit', 'cup:catalog:category:delete', 'cup:catalog:product:add', 'cup:catalog:product:edit', 'cup:catalog:product:delete'],
function (mixed $model) {
// some action
}
)
5.0 is Coming soon !!
Information
Usage
For developers