September 2018
Beginner to intermediate
218 pages
4h 27m
English
Argument injection is done via preference and type definitions within the di.xml.
By performing a lookup for the <preference string across the entire <MAGENTO_DIR> directory's di.xml files, we can see that Magento uses hundreds of preference definitions, spread across the majority of its modules.
Let's take a quick look at one of the __construct method, of the type Magento\Eav\Model\Attribute\Data\AbstractData:
public function __construct( \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Psr\Log\LoggerInterface $logger, \Magento\Framework\Locale\ResolverInterface $localeResolver) { $this->_localeDate = $localeDate; $this->_logger = $logger; $this->_localeResolver = $localeResolver;}
We can find the
Read now
Unlock full access