Documentation

Observer
in package

Read onlyYes

Registers a method as an event observer.

Compiled at composer dump-autoload into vendor/composer/maho_attributes.php. Run composer dump-autoload after adding, modifying, or removing this attribute. This attribute is repeatable — apply multiple times to listen to different events or areas.

Tags
see
Mage::dispatchEvent()
Attributes
#[Attribute]
\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE

Table of Contents

Properties

$area  : string
$event  : string
$id  : string|null
$replaces  : string|null
$type  : string

Methods

__construct()  : mixed

Properties

$replaces

public string|null $replaces = null

Methods

__construct()

public __construct(string $event[, string $area = 'global' ][, string $type = 'model' ][, string|null $id = null ][, string|null $replaces = null ]) : mixed
Parameters
$event : string

Event name to observe (e.g. 'catalog_product_save_after')

$area : string = 'global'

Area scope: 'global' (default), 'frontend', 'adminhtml', 'crontab', 'install'

$type : string = 'model'

Instantiation type: 'model' (default, new instance per dispatch) or 'singleton' (shared instance)

$id : string|null = null

Observer identifier, auto-generated if omitted. Set explicitly when other code references this observer by id.

$replaces : string|null = null

The id of another observer on the same event/area to disable and replace. Accepts either the explicit id, the class name, or the class alias format (e.g. 'my_observer', 'Mage_Catalog_Model_Observer::myMethod', or 'catalog/observer::myMethod').

On this page

Search results