You have configured an event observer to watch the checkout_submit_all_after event using this XML:
What is the required class definition for the event observer?
A.
B.
C.
D.
You have configured an event observer to watch the checkout_submit_all_after event using this XML:
What is the required class definition for the event observer?
A.
B.
C.
D.
Answer:- B
namespace MyCompany\MyModule\Observer;
use Magento\Framework\Event\ObserverInterface;
class MyObserver implements ObserverInterface
{
public function __construct()
{
// Observer initialization code…
// You can use dependency injection to get any class this observer may need.
}
public function execute(\Magento\Framework\Event\Observer $observer)
{
// Observer execution code…
}
}
Answer: B
Correct Answer: B, https://devdocs.magento.com/guides/v2.4/extension-dev-guide/events-and-observers.html