-
Notifications
You must be signed in to change notification settings - Fork 9.4k
events.xml event with exclude param #1684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This comes down to not being able to use |
Ok. So i wanted to observer This is how i overcome this issue and am able to use the observer as generic as posible: <?php
namespace Ms\User\Model;
class InvokerPlugin
{
public function beforeDispatch(
\Magento\Framework\Event\Invoker\InvokerDefault $subject,
array $configuration,
\Magento\Framework\Event\Observer $observer
) {
if ($configuration['instance'] !== 'Ms\User\Model\Observer') {
return [$configuration, $observer];
}
$c = $observer->getCollection();
switch (true) {
case $c instanceof \Magento\Store\Model\Resource\Website\Collection:
case $c instanceof \Magento\Store\Model\Resource\Group\Collection:
case $c instanceof \Magento\Store\Model\Resource\Store\Collection:
case $c instanceof \Magento\Store\Model\Resource\Config\Collection\Scoped:
$configuration['disabled'] = true;
return [$configuration, $observer];
break;
}
} Excluding the store related collection because of |
Gues i wasn't the only one with this problem; |
…n to format messages to render as HTML
…s and added jasmine tests
Hi @michal-sk. Thank you for your report.
The fix will be available with the upcoming 2.4.1 release. |
I would like to hook on the event
core_collection_abstract_load_before
. But in my observer i would like to inject the\Magento\Backend\Model\Auth
, so i can get the logged in admin. This gives problems because Somewhere in the injecting process of Auth, we try to inject theStoreManager
which itself again tries to load a collection of stores. This breaks the whole process and means i will have to manually define all the events that useload_before
, but than with theevent_prefix
.Defining an except in the
<event>
tag would result in less work. We could even make it accept a list?Or is maybe something already possible?
The text was updated successfully, but these errors were encountered: