0

I want to know context object list which we can use methods directly from $context object in Observer.

Just like in below URl.

Magento2 – Use Defined Methods from Context Object URL:- https://webkul.com/blog/magento2-use-defined-methods-context/

Please help me if anybody have answer.

0

You can use simple php function get_class_methods to list all methods of object.

get_class_methods($object)
  • I am unable to get use defined methods from context object in observer in by above function in magento2. – user7064432 Feb 5 '19 at 6:42
  • Can we use context in observer in magento2 ? please let me know. – user7064432 Feb 5 '19 at 6:43
  • No, Becuase observer does not inherit, does not extended so it hasn't parent context. You can use the observer's dispatched function class as a subject in execute() – Prince Patel Feb 5 '19 at 7:02

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.