2. WHAT IS DEPENDENCY INJECTION
WWW.GROSSUM.COM
Dependency injection is a software design pattern in which one or more dependencies (or
services) are injected, or passed by reference, into a dependent object (or client) and are
made part of the client's state.
The pattern separates the creation of a client's dependencies from its own behavior, which
allows program designs to be loosely coupled and to follow the dependency inversion and
single responsibility principles.
It directly contrasts with the service locator pattern, which allows clients to know about
the system they use to find dependencies
SYMFONY CAFÉ KYIV
3. SETTING UP THE CONTAINER with Configuration Files
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
7. INTRODUCTION TO PARAMETERS
• Parameters in Configuration Files
• Array Parameters
• Constants as Parameters
• PHP Keywords in XML
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
8. WORKING WITH CONTAINER SERVICE DEFINITIONS
• Getting and Setting Service Definitions:
• Class
WWW.GROSSUM.COM
$container->hasDefinition($serviceId);
$container->getDefinition($serviceId);
$container->findDefinition($serviceId);
$container->setDefinition($id, $definition);
$definition->getClass();
$definition->setClass($class); // Fully qualified class name as string
SYMFONY CAFÉ KYIV
9. WORKING WITH CONTAINER SERVICE DEFINITIONS
• Constructor Arguments
• Method Calls
WWW.GROSSUM.COM
$definition->getArguments();
$definition->getArgument($index);
$definition->addArgument($argument);
$definition->replaceArgument($index, $argument);
$definition->setArguments($arguments);
$definition->getMethodCalls();
$definition->addMethodCall($method, $arguments);
$definition->setMethodCalls($methodCalls);
SYMFONY CAFÉ KYIV