I have following action:
http://localhost/admin/catalog/product_attribute/edit/attribute_id/135/key/…/
I would like to do some extra things with attribute after saving.
I have created and registered custom plugin in Vendor/Module/Plugin/Model/ResourceModel/Attribute/Save.php
with following content:
class Save
{
/**
* @var Config
*/
protected $config;
/**
* @param Config $config
*/
public function __construct(Config $config, TypeListInterface $typeList)
{
$this->config = $config;
}
/**
*
* @param Attribute $subject
* @param Attribute $result
* @return Attribute $result
*
*/
public function afterSave(Attribute $subject, Attribute $result)
{
# Do something
}
}
I have also added following entry to di.xml
:
<type name="Magento\Catalog\Model\ResourceModel\Attribute">
<plugin name="do_stuff_after_attribute_save" type="Vendor\Module\Plugin\Model\ResourceModel\Attribute\Save" />
</type>
But the plugin seems not to work. Even if I die('somenthing');
or try to log to file, the code is not executed after saving the attribute.
Maybe I am trying to overwrite wrong method?
save
method when there is nosave
method invendor/magento/module-catalog/Model/ResourceModel/Attribute.php
file?