Magento 2 giving error in plugin beforegetName


I am getting error while using plugin before have any one idea why it is happening? 


Fatal error: Uncaught ArgumentCountError: Too few arguments to function PuneetTestModelPluginName::beforegetName(), 1 passed in /var/www/html/m2/vendor/magento/framework/Interception/Interceptor.php on line 121 and exactly 2 expected in /var/www/html/m2/app/code/Puneet/Test/Model/Plugin/Name.php:15 Stack trace: #0 /var/www/html/m2/vendor/magento/framework/Interception/Interceptor.php(121): PuneetTestModelPluginName->beforegetName(Object(MagentoCatalogModelProductInterceptor)) #1 /var/www/html/m2/vendor/magento/framework/Interception/Interceptor.php(153): MagentoCatalogModelProductInterceptor->MagentoFrameworkInterception{closure}() #2 /var/www/html/m2/generated/code/Magento/Catalog/Model/Product/Interceptor.php(26): MagentoCatalogModelProductInterceptor->___callPlugins('getName', Array, Array) #3 /var/www/html/m2/vendor/magento/module-catalog/Helper/Product/View.php(119): MagentoCatalogModelProductInterceptor->getName() #4 /var/www/html/m2/vendor/magento/module-catalog/Helper/Product/View.php(28 in /var/www/html/m2/app/code/Puneet/Test/Model/Plugin/Name.php on line 15


My class and before method is.

<?php
/*
* Puneet_Test
* Name change
*/
namespace PuneetTestModelPlugin;
class Name {
// public function aftergetName(MagentoCatalogModelProduct $subject, $result){
// return "SS: " . $result;
// }
public function beforegetName(MagentoCatalogModelProduct $subject, $name){
return   $result . "SS";
}
}


Puneet Kumar Magento Developer
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply