Skip to content

Plugins in \Magento\Framework namespace #27962

Closed
@lbajsarowicz

Description

@lbajsarowicz

Preconditions (*)

One of Magento Architects contacted me in private message blaming me for introducing Plugin to the Core that is not allowed in Magento and couldn't have been done by Magento Employees due to Quality Standards.

namespace Magento\Framework\App\Action\Plugin;
use Magento\Framework\Message\MessageInterface;
class Design

lol.

As I've introduced another 2 plugins and renamed existing one to follow the naming convention, there are 3 plugins in the \Magento\Framework namespace. As the architect wasn't so nice to tell me where outside \Magento\Framework` I should put these plugins, I create issue to satisfy "Quality Standards" of Magento.

The plugins to be moved:
https://github.com/magento/magento2/tree/2.4-develop/lib/internal/Magento/Framework/App/Action/Plugin

Before you continue, please remember that plugins in \Magento\Framework were never allowed!

🤦 🤦‍♂️ 🤦‍♀️ 🤦 🤦‍♂️ 🤦‍♀️ 🤦 🤦‍♂️ 🤦‍♀️ 🤦 🤦‍♂️ 🤦‍♀️

namespace Magento\Framework\Module\Plugin;
use Magento\Framework\Cache\FrontendInterface as FrontendCacheInterface;
use Magento\Framework\Module\DbVersionInfo;
use Magento\Framework\App\FrontController;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Phrase;
/**
* Validation of DB up to date state
*/
class DbStatusValidator

magento2/app/etc/di.xml

Lines 1805 to 1807 in 892dee4

<type name="Magento\Framework\DB\Adapter\AdapterInterface">
<plugin name="execute_commit_callbacks" type="Magento\Framework\Model\ExecuteCommitCallbacks" />
</type>

https://github.com/magento/partners-magento2ee/blob/6d49dacca99f5276f09bbddd50866440f3d3fccc/app/code/Magento/ScalableCheckout/etc/di.xml#L34-L36
<type name="Magento\Framework\MessageQueue\Consumer\Config\CompositeReader">
<plugin name="queueConfigPlugin" type="Magento\Framework\MessageQueue\Config\Consumer\ConfigReaderPlugin" />
</type>
<type name="Magento\Framework\MessageQueue\Publisher\Config\CompositeReader">
<plugin name="queueConfigPlugin" type="Magento\Framework\MessageQueue\Config\Publisher\ConfigReaderPlugin" />
</type>
<type name="Magento\Framework\MessageQueue\Topology\Config\CompositeReader">
<plugin name="queueConfigPlugin" type="Magento\Framework\MessageQueue\Config\Topology\ConfigReaderPlugin" />
</type>

<type name="Magento\Eav\Model\Entity\AbstractEntity">
<plugin name="clean_cache" type="Magento\Framework\App\Cache\FlushCacheByTags" />
</type>

<type name="Magento\Framework\App\Response\Http">
<plugin name="genericHeaderPlugin" type="Magento\Framework\App\Response\HeaderManager"/>
</type>

Steps to reproduce (*)

N/A

Expected result (*)

Magento Framework shouldn't contain any plugins

Actual result (*)

  1. Magento Framework contains plugins, that should be misplaced in different modules, see description

Metadata

Metadata

Assignees

Labels

Component: Framework/AppComponent: Framework/ModuleFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P3May be fixed according to the position in the backlog.Progress: doneReported on 2.4.0Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S3Affects non-critical data or functionality and does not force users to employ a workaround.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions