7. Configuration
☞ Configuration file per sub-system (events.xml, cache.xml)
☞ All xml validated
☞ 3 Stages of configuration loading:
➀ primary (app/etc/*)
➁ global (<ModuleDir>/etc/*)
➂ area (<ModuleDir>/etc/<areaCode>/*)
8. Dependency Injection
class MyClass
{
public function __construct(MagentoFrameworkEventManager $eventManager)
{
$this->eventManager = $eventManager;
}
public function someFunc()
{
// …
$this->eventManager->dispatch(‘some_event’);
// …
}
}
9. Interception
Ability to observe public method calls:
class eventManagerPlugin
{
public function beforeDispatch(EventManager $subject, $eventName, $arguments)
{
$this->log->put(“Event ‘$eventName’ was dispatched“);
}
}
10. Service Contracts
Public API of a module:
namespace MagentoCustomerApi;
interface AccountManagementInterface
{
public function createAccount(CustomerInterface $customer, $password = null);
public function activate($email, $confirmationKey);
public function changePassword($email, $currentPassword, $newPassword);
}