1

I want to implement plugin after, before and around concept in my Magento 2 website.

di.xml :

<type name="Magento\Webapi\Model\Soap\Server">
    <plugin name="soap_log" type="training\learning\Model\Webapi\Soap\Server" />
</type>

Magento\Webapi\Model\Soap\Server has a method _checkRequest and it has a string type parameter.

Now i want to get that string type parameter in my _aftercheckrRequest in training\learning\Model\Webapi\Soap\Server class. How can I achieve this ?

1

You can use plugin only for public methods. See docs

1

_aftercheckrRequest method is protected and we cannot use plugin. We can use Plugins only for public and non-static methods. For example we have one public function :public function test(); and plugin:

public function afterTest(\Magento\Webapi\Model\Soap\Server $subject, $result)
{
    // your code
    return $result;
}

Note: test() became afterTest() (capital "T")

1
  • That is OK, but if it is public method then how we can get that method parameters in afterTest() ? – prasad maganti Mar 11 '16 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.