Unfortunately, since some parts of Shopware are not sufficiently modular, replace hooks are required in some cases.
Right now, replace hooks are a guarantee for bugs as soon as more than one subscriber replaces the same method. If that happens, the replaced method may get called more often than expected (i.e., every time executeParent() is called by one of the replace hooks). This makes their behavior completely unpredictable.
We should fix this by making replace hooks in Shopware behave like around advice. These are common in other frameworks and have well-defined and useful semantics. In addition to this, their results are exactly the same as replace hooks for the cases where replace hooks work correctly, and work the way one might expect replace hooks to work if they were implemented sanely in all other cases.
Unfortunately, since some parts of Shopware are not sufficiently modular, replace hooks are required in some cases.
Right now, replace hooks are a guarantee for bugs as soon as more than one subscriber replaces the same method. If that happens, the replaced method may get called more often than expected (i.e., every time
executeParent()
is called by one of the replace hooks). This makes their behavior completely unpredictable.We should fix this by making replace hooks in Shopware behave like around advice. These are common in other frameworks and have well-defined and useful semantics. In addition to this, their results are exactly the same as replace hooks for the cases where replace hooks work correctly, and work the way one might expect replace hooks to work if they were implemented sanely in all other cases.