Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Subscribed object is singleton in events by default #4894

Closed
@Simonchik

Description

Bug report

shared - Determines the lifestyle of the class. Default is false.

Steps to reproduce

Open https://devdocs.magento.com/guides/v2.3/extension-dev-guide/events-and-observers.html and check the Subscribing to events section

Expected result

shared - Determines the lifestyle of the class. Default is true.

see \Magento\Framework\Event\Invoker\InvokerDefault::dispatch
...
       if (isset($configuration['shared']) && false === $configuration['shared']) {
            $object = $this->_observerFactory->create($configuration['instance']);
        } else {
            $object = $this->_observerFactory->get($configuration['instance']);
        }
...

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions