SlideShare a Scribd company logo
1 of 24
Download to read offline
Symfony Dependency Injection
in Practice
(Denis Malavsky, Grossum)
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
SETTING UP THE CONTAINER with Configuration Files
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
TYPES OF INJECTION
• Constructor Injection
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
TYPES OF INJECTION
• Setter Injection
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
TYPES OF INJECTION
• Property Injection
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
INTRODUCTION TO PARAMETERS
• Parameters in Configuration Files
• Array Parameters
• Constants as Parameters
• PHP Keywords in XML
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
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
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
MANAGING CONFIGURATION WITH EXTENSIONS
• Let’s take a look at the code.
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
CREATING A COMPILER PASS
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
CONTROLLING THE PASS ORDERING
• PassConfig::TYPE_BEFORE_OPTIMIZATION
• PassConfig::TYPE_OPTIMIZE
• PassConfig::TYPE_BEFORE_REMOVING
• PassConfig::TYPE_REMOVE
• PassConfig::TYPE_AFTER_REMOVING
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
WORKING WITH TAGGED SERVICES
• Define Services with a custom Tag
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
WORKING WITH TAGGED SERVICES
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
WORKING WITH TAGGED SERVICES
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
WORKING WITH TAGGED SERVICES
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
USING A FACTORY TO CREATE SERVICES
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
USING A FACTORY TO CREATE SERVICES
• Passing Arguments to the Factory Method
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
MANAGING COMMON DEPENDENCIES WITH PARENT SERVICES
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
MANAGING COMMON DEPENDENCIES WITH PARENT SERVICES
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
MANAGING COMMON DEPENDENCIES WITH PARENT SERVICES
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
ADVANCED CONTAINER CONFIGURATION
• Marking Services as public / private
• Aliasing
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
ADVANCED CONTAINER CONFIGURATION
• Requiring Files
• Decorating Services
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
THANKS!
DENIS MALAVSKY
Company: Grossum
Phone: +38 (063) 478-2449
E-mail: dmalavsky@grossum.com
Skype: malavskuy
WWW.GROSSUM.COM SYMFONY CAFÉ KYIV

More Related Content

Similar to Symfony Dependency Injection (DI) in Practice - Denis Malavsky, Grossum

Secure Development on the Salesforce Platform - Part 2
Secure Development on the Salesforce Platform - Part 2Secure Development on the Salesforce Platform - Part 2
Secure Development on the Salesforce Platform - Part 2Salesforce Developers
 
robsable_Enhancing DevOps Practices with CloudWatch APM FINAL.pdf
robsable_Enhancing DevOps Practices with CloudWatch APM FINAL.pdfrobsable_Enhancing DevOps Practices with CloudWatch APM FINAL.pdf
robsable_Enhancing DevOps Practices with CloudWatch APM FINAL.pdfAWS Chicago
 
Cloud Native: Designing Change-tolerant Software
Cloud Native: Designing Change-tolerant SoftwareCloud Native: Designing Change-tolerant Software
Cloud Native: Designing Change-tolerant Softwarecornelia davis
 
AWS Summit Sydney 2014 | Continuous Integration and Deployment Best Practices...
AWS Summit Sydney 2014 | Continuous Integration and Deployment Best Practices...AWS Summit Sydney 2014 | Continuous Integration and Deployment Best Practices...
AWS Summit Sydney 2014 | Continuous Integration and Deployment Best Practices...Amazon Web Services
 
Transforming Software Development
Transforming Software DevelopmentTransforming Software Development
Transforming Software DevelopmentAmazon Web Services
 
Improving Security Agility using DevSecOps
Improving Security Agility using DevSecOpsImproving Security Agility using DevSecOps
Improving Security Agility using DevSecOpsAmazon Web Services
 
Continuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECS Continuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECS Amazon Web Services
 
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)Amazon Web Services
 
Easy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applicationsEasy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applicationsJack-Junjie Cai
 
SRV412 Deep Dive on CICD and Docker
SRV412 Deep Dive on CICD and DockerSRV412 Deep Dive on CICD and Docker
SRV412 Deep Dive on CICD and DockerAmazon Web Services
 
Building security from scratch
Building security from scratchBuilding security from scratch
Building security from scratchRoman Zelenko
 
AWS CodeDeploy: Manage Deployment Complexity
AWS CodeDeploy: Manage Deployment ComplexityAWS CodeDeploy: Manage Deployment Complexity
AWS CodeDeploy: Manage Deployment ComplexityAmazon Web Services
 
Announcing AWS OpsWorks for Chef Automate - January 2017 AWS Online Tech Talks
Announcing AWS OpsWorks for Chef Automate - January 2017 AWS Online Tech TalksAnnouncing AWS OpsWorks for Chef Automate - January 2017 AWS Online Tech Talks
Announcing AWS OpsWorks for Chef Automate - January 2017 AWS Online Tech TalksAmazon Web Services
 
Building a CICD Pipeline for Deploying to Containers
Building a CICD Pipeline for Deploying to ContainersBuilding a CICD Pipeline for Deploying to Containers
Building a CICD Pipeline for Deploying to ContainersAmazon Web Services
 
Pipeline conference 2017 - Breaking down your build: architectural patterns f...
Pipeline conference 2017 - Breaking down your build: architectural patterns f...Pipeline conference 2017 - Breaking down your build: architectural patterns f...
Pipeline conference 2017 - Breaking down your build: architectural patterns f...Abraham Marin-Perez
 

Similar to Symfony Dependency Injection (DI) in Practice - Denis Malavsky, Grossum (20)

Secure Development on the Salesforce Platform - Part 2
Secure Development on the Salesforce Platform - Part 2Secure Development on the Salesforce Platform - Part 2
Secure Development on the Salesforce Platform - Part 2
 
robsable_Enhancing DevOps Practices with CloudWatch APM FINAL.pdf
robsable_Enhancing DevOps Practices with CloudWatch APM FINAL.pdfrobsable_Enhancing DevOps Practices with CloudWatch APM FINAL.pdf
robsable_Enhancing DevOps Practices with CloudWatch APM FINAL.pdf
 
Cloud Native: Designing Change-tolerant Software
Cloud Native: Designing Change-tolerant SoftwareCloud Native: Designing Change-tolerant Software
Cloud Native: Designing Change-tolerant Software
 
AWS Summit Sydney 2014 | Continuous Integration and Deployment Best Practices...
AWS Summit Sydney 2014 | Continuous Integration and Deployment Best Practices...AWS Summit Sydney 2014 | Continuous Integration and Deployment Best Practices...
AWS Summit Sydney 2014 | Continuous Integration and Deployment Best Practices...
 
Intro to ColdBox MVC at Japan CFUG
Intro to ColdBox MVC at Japan CFUGIntro to ColdBox MVC at Japan CFUG
Intro to ColdBox MVC at Japan CFUG
 
Transforming Software Development
Transforming Software DevelopmentTransforming Software Development
Transforming Software Development
 
Improving Security Agility using DevSecOps
Improving Security Agility using DevSecOpsImproving Security Agility using DevSecOps
Improving Security Agility using DevSecOps
 
Continuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECS Continuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECS
 
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
 
Easy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applicationsEasy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applications
 
SRV412 Deep Dive on CICD and Docker
SRV412 Deep Dive on CICD and DockerSRV412 Deep Dive on CICD and Docker
SRV412 Deep Dive on CICD and Docker
 
AWS CodeDeploy
AWS CodeDeployAWS CodeDeploy
AWS CodeDeploy
 
Azure from scratch part 4
Azure from scratch part 4Azure from scratch part 4
Azure from scratch part 4
 
Building security from scratch
Building security from scratchBuilding security from scratch
Building security from scratch
 
AWS CodeDeploy: Manage Deployment Complexity
AWS CodeDeploy: Manage Deployment ComplexityAWS CodeDeploy: Manage Deployment Complexity
AWS CodeDeploy: Manage Deployment Complexity
 
Announcing AWS OpsWorks for Chef Automate - January 2017 AWS Online Tech Talks
Announcing AWS OpsWorks for Chef Automate - January 2017 AWS Online Tech TalksAnnouncing AWS OpsWorks for Chef Automate - January 2017 AWS Online Tech Talks
Announcing AWS OpsWorks for Chef Automate - January 2017 AWS Online Tech Talks
 
ASP.NET MVC Extensibility
ASP.NET MVC ExtensibilityASP.NET MVC Extensibility
ASP.NET MVC Extensibility
 
Building a CICD Pipeline for Deploying to Containers
Building a CICD Pipeline for Deploying to ContainersBuilding a CICD Pipeline for Deploying to Containers
Building a CICD Pipeline for Deploying to Containers
 
Pipeline conference 2017 - Breaking down your build: architectural patterns f...
Pipeline conference 2017 - Breaking down your build: architectural patterns f...Pipeline conference 2017 - Breaking down your build: architectural patterns f...
Pipeline conference 2017 - Breaking down your build: architectural patterns f...
 
Serverless Microservices
Serverless MicroservicesServerless Microservices
Serverless Microservices
 

Recently uploaded

Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 

Recently uploaded (20)

Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 

Symfony Dependency Injection (DI) in Practice - Denis Malavsky, Grossum

  • 1. Symfony Dependency Injection in Practice (Denis Malavsky, Grossum)
  • 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
  • 4. TYPES OF INJECTION • Constructor Injection WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
  • 5. TYPES OF INJECTION • Setter Injection WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
  • 6. TYPES OF INJECTION • Property Injection 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
  • 10. MANAGING CONFIGURATION WITH EXTENSIONS • Let’s take a look at the code. WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
  • 11. CREATING A COMPILER PASS WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
  • 12. CONTROLLING THE PASS ORDERING • PassConfig::TYPE_BEFORE_OPTIMIZATION • PassConfig::TYPE_OPTIMIZE • PassConfig::TYPE_BEFORE_REMOVING • PassConfig::TYPE_REMOVE • PassConfig::TYPE_AFTER_REMOVING WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
  • 13. WORKING WITH TAGGED SERVICES • Define Services with a custom Tag WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
  • 14. WORKING WITH TAGGED SERVICES WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
  • 15. WORKING WITH TAGGED SERVICES WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
  • 16. WORKING WITH TAGGED SERVICES WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
  • 17. USING A FACTORY TO CREATE SERVICES WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
  • 18. USING A FACTORY TO CREATE SERVICES • Passing Arguments to the Factory Method WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
  • 19. MANAGING COMMON DEPENDENCIES WITH PARENT SERVICES WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
  • 20. MANAGING COMMON DEPENDENCIES WITH PARENT SERVICES WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
  • 21. MANAGING COMMON DEPENDENCIES WITH PARENT SERVICES WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
  • 22. ADVANCED CONTAINER CONFIGURATION • Marking Services as public / private • Aliasing WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
  • 23. ADVANCED CONTAINER CONFIGURATION • Requiring Files • Decorating Services WWW.GROSSUM.COM SYMFONY CAFÉ KYIV
  • 24. THANKS! DENIS MALAVSKY Company: Grossum Phone: +38 (063) 478-2449 E-mail: dmalavsky@grossum.com Skype: malavskuy WWW.GROSSUM.COM SYMFONY CAFÉ KYIV