I tried to create a simple plugin (magento 2.4.3-p1) :
But when I run the compiler, I have the following error :
In PluginListGenerator.php line 326: Plugin class Fseb\ModuleA\Plugin\Catalog\Model\Product doesn't exist
Here is the code:
app\code\Fseb\ModuleA\registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Fseb_ModuleA',
__DIR__
);
app\code\Fseb\ModuleA\etc\module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Fseb_ModuleA" setup_version="1.1.0"/>
</config>
app\code\Fseb\ModuleA\etc\frontend\di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<type name="Magento\Catalog\Model\Product">
<plugin name="Fseb_ModuleA" type="Fseb\ModuleA\Plugin\Catalog\Model\Product"/>
</type>
</config>
app\code\Fseb\ModuleA\Plugin\Catalog\Model\Product.php
class Product
{
public function afterGetName(\Magento\Catalog\Model\Product $subject, $result)
{
$title = 'lalalala';
return $title;
}
}
Could you help ?