Drupal 8 Some generic & Symfony vocabulary How does the DIC work in D8 ? Altering the DIC is easy ! The bad side… Conclusion p.3–6 p.7-13 p.14-23 p.24-27 p.28-30 p.30 @mamoot64 firstname.lastname@example.org
filesystem. Fabian Franz (Fabianx) was assigned on it. Work on: 29 May to 23 August 2015 è File system cache is hard to invalidate on multiple web heads è Reading from the shared network is slow and insecured. è Needs to be synchronized (Ex: module is disabled) !!! EVERYTHING MUST BE DYNAMIC AT RUN-TIME !!!
how to instantiate and configure objects. And to be able to do its job, it needs to knows about the constructor arguments and the relationships between the objects. Fabien Potencier 9 http://fabien.potencier.org/do-you-need-a-dependency-injection-container.html
helps you build Symfony’s service container by configuring it, adding some definitions, creating services etc. Container is a dependency injection container. (from class Description) https://medium.com/manomano-tech/diving-into-symfonys-dependencyinjection-part-1- first-steps-with-the-container-2fad0593c052 12
Based on a PHP array container definition dumped as a performance-optimized machine-readable format. Compatible with the default Symfony DIC è Implements « ContainerInterface » from SF DI Component è Use some useful « Exception » from SF DI Component
needs Compatible with the default Symfony DI ContainerBuilder è Extends « ContainerBuilder » from SF DI Component è Handle specific rules for Drupal 8 è Disable resources tracking è Check strtolower on service ID (set, register, setParamater) è …
boot() method is called from the DrupalKernel() class è Boot needs to initialize the Container with initializeContainer() è Kernel try to get the DIC if the container is injected via setContainer() è If there is no modules updates and if the container doesn’t need to be rebuilt, the Kernel gets the container definition from the cache with getCachedContainerDefinition() è If no Container is available and there is no cache Container Definition, the Kernel needs to compile the Container with compileContainer() and gets the Container Definition with the correct Dumper (default is OptimizedPhpArrayDumper)
Provider are collected, base parameters are set, namespaces are registered, base synthetics services are registered (class_loader, kernel and service_container) and Yaml files are loaded. è If a new container definition is created, the Kernel needs to create a new Container from container definition è Syntethic services are attached to the container with attachSynthetic() è Container is set on Drupal Core class with \Drupal::setContainer($this->container) è Final container is returned
TaggedIteratorArgument Drupal DI is ALWAYS behind Symfony DI (mecanical effect) è Dumper isn’t up to date (escape for % sign by ex.) è Code duplication isn’t up to date (YamlFileLoader, ContainerBuilder methods …) Drupal doesn’t use the full Symfony Component but implements Interface That’s why it is only « compatible » with SF Components Services are always public !