danslo/magento2-module-protected-interceptors

Allows you to create Magento 2 plugins for protected methods.

Installs: 4 108

Dependents: 0

Suggesters: 0

Security: 0

Stars: 17

Watchers: 2

Forks: 1

Open Issues: 1

Type:magento2-module

1.0.0 2018-03-15 11:01 UTC

This package is auto-updated.

Last update: 2024-12-14 19:53:13 UTC


README

With the addition of interceptors, we have a powerful tool to modify the behavior of almost any component in Magento 2.

The core developers have very good reasons to disallow interception of non-public methods. In an ideal world, we would have small classes with minimal inheritance (composite reuse principle) with easy to modify public interfaces. In practice, we're still often forced to use preferences.

This module modifies the code generator to also generate interceptors for protected methods. That's quite probably a bad thing, and you should not install this at all. But maybe you like to learn a bit more about how interception is implemented in Magento 2 and don't mind breaking things. Then go right ahead :)

Installation

$ composer require danslo/magento2-module-protected-interceptors

License

Copyright 2018 Daniel Sloof

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.