Is it possible to access an observed methods arguments in an after[Method]()
plugin? For example, I want to write an after plug in for:
namespace Magento\Some_Core\Model\Example;
class Test {
public function usualMethod(\Magento\Sales\Model\Order $order) {
// get order information and attach to $this
return $this;
}
}
I have my Custom Module's di.xml
set up and my plug in class as:
namespace Vendor\Module\Plugin\Example;
class TestPlugin {
public function afterUsualMethod(\Magento\Some_Core\Model\Example\Test $subject, $return) {
$order = $subject->getArguments(0); // ??
$result->setAdditionalOrderInfo($order->getIAlsoNeedThis());
return $result;
}
}
Is there any way to access the $order
object passed in the original method? I can easily extend the original class and call parent::usualMethod()
but wanted to know if it was possible to use a plugin for this scenario.