SlideShare a Scribd company logo
1 of 46
Enterprise Persistence Layer for PHP
• Frontend web developer since 1998
• Moved to backend programming in 2002
• Currently employee of MIH – SWAT team
• Committer of many O.S. projects, including
Zend Framework, Symfony and Doctrine
• Enjoys to play Age of Empires
Doctrine is an Object Relational Modeling tool
for PHP, mostly inspired by Hibernate (Java)
and ActiveRecord (Ruby)
• Very active community
• Monthly releases
• Current work branches:
– 1.0 (LTS), 1.1, 1.2 (LTS), 2.0 (LTS)
• Integrates with many different frameworks:
– Zend Framework
– Symfony
– CodeIgniter
– Kohana
– …
• Supports all drivers supported by PDO
• Based on JSR-317 a.k.a. JPA v2.0 (~80%)
• Java…. What?!? #$&*@!
• PHP still lacks of standards
• PHP Standards Group to the rescue!
Challenges
• No need to extend base class
• New Reflection support
• Benchmarks (˜50000 iterations):
– Setter:
• $o->prop set: 0.35872411727905
• $o->setProp: 0.61513090133667 (71% slower)
• $reflProp->setValue: 0.67149507522583 (87% slower)
– Getter:
• $o->prop get: 0.25784397125244
• $o->getProp: 0.46534395217896 (80% slower)
• $reflProp->getValue: 0.64541401863098 (150% slower)
• Optimize hydration of entities
• Garbage Collector – Identity Map
• spl_object_hash
• SplObjectStorage vs. ArrayAccess
• Optimize hydration of Entities
• Benchmarks:
– Doctrine 1.1
• 4.3435637950897 for 5000 records
– Doctrine 2.0
• 1.4314442552312 for 5000 records
• 3.4690098762528 for 10000 records
• Replication support
• Internal mindset change
• No more weird DSN constructions
• No more shared Identity Maps across multiple
connections
• Huge API of public methods
• Lambdas and Closures
• Centralized entry points of methods
• No singleton nightmares!
- I have a problem!
- You can fix it with a singleton.
- Now I have 2 problems…
• RDBMS <-> PHP differences
• Clean separation of Platforms via Dialects
• Separation between DB value and PHP value
• Extendable to user land
• String processing for DQL
• Implemented a LL(*) parser
• Constructs AST nodes
• TreeWalkers to do compilation DQL -> SQL
• Cache support to prevent overhead
• Metadata Mapping
• Extendable mapping drivers
• Should not mess Entities code – VOs
• Cache support to prevent overhead
• Real Native SQL support
• Introduction of ResultsetMapping support
• Allow custom columns to be mapped into VOs
• Specific DBMS SQL supported
• Commit ordering
• True multigraph implementation
• Topological Sorting
• Prevents cycles
• F*cking incredible fast!
Almost 95% of codebase rewritten
Requires PHP 5.3
Simplified public API
Smaller footprint
Un-necessary clutter removed
No more cyclic references
Code heavily decoupled
Extremely extendable
• Three main packages:
– Common
– DBAL
– ORM
– Maybe in the future ODM…
• Anyone interested to contribute?
• Class Loaders
• Annotations support
• Collection
• Cache
• Event System
• Common LL(*) classes
• Class loaders:
– GlobalClassLoader
– IsolatedClassLoader
• Annotations EBNF – Yeah baby!
Annotation ::= "@" AnnotationName ["(" [Values] ")”]
AnnotationName ::= QualifiedName | SimpleName
QualifiedName ::= NameSpacePart "" {NameSpacePart ""}*
SimpleName
NameSpacePart ::= identifier
SimpleName ::= identifier
Values ::= Array | Value {"," Value}*
Value ::= PlainValue | FieldAssignment
PlainValue ::= integer | string | float | boolean |
Array | Annotation
FieldAssignment ::= FieldName "=" PlainValue
FieldName ::= identifier
Array ::= "{" ArrayEntry {"," ArrayEntry}* "}”
ArrayEntry ::= Value | KeyValuePair
KeyValuePair ::= Key "=" PlainValue
Key ::= string | integer
• Use DBAL independent of ORM
• Powerful Database Abstraction Layer
• Always existed, but it wasn’t advertised
• Can be a separate package in the future
• Platforms, Drivers and SchemaManagers
• Nested transactions
• Fully supports:
– Schemas
– Sequences
– Catalogs
• Supports:
– One-to-one
– One-to-many
– Many-to-many
• Multigraph
– Unidirectional
– Bidirectional
• Simplified bootstrap code
• Driver based Metadata
– Annotations
– PHP
– XML
– YAML
– … your own?!
• Working with objects
• Doctrine Query Language
– Similar do HQL or JPQL
– Automatically makes join restrictions
– Supports inheritance natively
– Can be boosted by usage of a Query Cache
– Easily extendable
• Querying
– DQL string
– QueryBuilder object (Criteria)
– Native SQL query
• Directed Acyclic Graphs
• Easily extendable
• Several handy tasks to help development
– Schema-tool
– Generate-proxies
– Convert-mapping
– Run-sql
– Run-dql
Guilherme Blanco
guilhermeblanco gmail com
+55 16 9215.8480
http://www.doctrine-project.org

More Related Content

What's hot

Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and DesktopElizabeth Smith
 
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015Fernando Hamasaki de Amorim
 
PHP 7 Crash Course - php[world] 2015
PHP 7 Crash Course - php[world] 2015PHP 7 Crash Course - php[world] 2015
PHP 7 Crash Course - php[world] 2015Colin O'Dell
 
PHP traits, treat or threat?
PHP traits, treat or threat?PHP traits, treat or threat?
PHP traits, treat or threat?Nick Belhomme
 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckrICh morrow
 
PHP Enums - PHPCon Japan 2021
PHP Enums - PHPCon Japan 2021PHP Enums - PHPCon Japan 2021
PHP Enums - PHPCon Japan 2021Ayesh Karunaratne
 
Diving into HHVM Extensions (PHPNW Conference 2015)
Diving into HHVM Extensions (PHPNW Conference 2015)Diving into HHVM Extensions (PHPNW Conference 2015)
Diving into HHVM Extensions (PHPNW Conference 2015)James Titcumb
 
PHP 8.1 - What's new and changed
PHP 8.1 - What's new and changedPHP 8.1 - What's new and changed
PHP 8.1 - What's new and changedAyesh Karunaratne
 
The Php Life Cycle
The Php Life CycleThe Php Life Cycle
The Php Life CycleXinchen Hui
 
Typed Properties and more: What's coming in PHP 7.4?
Typed Properties and more: What's coming in PHP 7.4?Typed Properties and more: What's coming in PHP 7.4?
Typed Properties and more: What's coming in PHP 7.4?Nikita Popov
 
SPL to the Rescue - Tek 09
SPL to the Rescue - Tek 09SPL to the Rescue - Tek 09
SPL to the Rescue - Tek 09Elizabeth Smith
 
Php on the desktop and php gtk2
Php on the desktop and php gtk2Php on the desktop and php gtk2
Php on the desktop and php gtk2Elizabeth Smith
 
The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5Wim Godden
 
Preparing for the next PHP version (5.6)
Preparing for the next PHP version (5.6)Preparing for the next PHP version (5.6)
Preparing for the next PHP version (5.6)Damien Seguy
 
PHP 良好實踐 (Best Practice)
PHP 良好實踐 (Best Practice)PHP 良好實踐 (Best Practice)
PHP 良好實踐 (Best Practice)Win Yu
 
PHP7 - The New Engine for old good train
PHP7 - The New Engine for old good trainPHP7 - The New Engine for old good train
PHP7 - The New Engine for old good trainXinchen Hui
 
Alfresco the clojure way
Alfresco the clojure wayAlfresco the clojure way
Alfresco the clojure wayCarlo Sciolla
 

What's hot (20)

Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and Desktop
 
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
 
Building Custom PHP Extensions
Building Custom PHP ExtensionsBuilding Custom PHP Extensions
Building Custom PHP Extensions
 
Introduction to Perl
Introduction to PerlIntroduction to Perl
Introduction to Perl
 
PHP 7 Crash Course - php[world] 2015
PHP 7 Crash Course - php[world] 2015PHP 7 Crash Course - php[world] 2015
PHP 7 Crash Course - php[world] 2015
 
PHP traits, treat or threat?
PHP traits, treat or threat?PHP traits, treat or threat?
PHP traits, treat or threat?
 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course Deck
 
PHP Enums - PHPCon Japan 2021
PHP Enums - PHPCon Japan 2021PHP Enums - PHPCon Japan 2021
PHP Enums - PHPCon Japan 2021
 
Diving into HHVM Extensions (PHPNW Conference 2015)
Diving into HHVM Extensions (PHPNW Conference 2015)Diving into HHVM Extensions (PHPNW Conference 2015)
Diving into HHVM Extensions (PHPNW Conference 2015)
 
PHP 8.1 - What's new and changed
PHP 8.1 - What's new and changedPHP 8.1 - What's new and changed
PHP 8.1 - What's new and changed
 
The Php Life Cycle
The Php Life CycleThe Php Life Cycle
The Php Life Cycle
 
Typed Properties and more: What's coming in PHP 7.4?
Typed Properties and more: What's coming in PHP 7.4?Typed Properties and more: What's coming in PHP 7.4?
Typed Properties and more: What's coming in PHP 7.4?
 
SPL to the Rescue - Tek 09
SPL to the Rescue - Tek 09SPL to the Rescue - Tek 09
SPL to the Rescue - Tek 09
 
Php on the desktop and php gtk2
Php on the desktop and php gtk2Php on the desktop and php gtk2
Php on the desktop and php gtk2
 
Spl in the wild
Spl in the wildSpl in the wild
Spl in the wild
 
The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5
 
Preparing for the next PHP version (5.6)
Preparing for the next PHP version (5.6)Preparing for the next PHP version (5.6)
Preparing for the next PHP version (5.6)
 
PHP 良好實踐 (Best Practice)
PHP 良好實踐 (Best Practice)PHP 良好實踐 (Best Practice)
PHP 良好實踐 (Best Practice)
 
PHP7 - The New Engine for old good train
PHP7 - The New Engine for old good trainPHP7 - The New Engine for old good train
PHP7 - The New Engine for old good train
 
Alfresco the clojure way
Alfresco the clojure wayAlfresco the clojure way
Alfresco the clojure way
 

Similar to Doctrine 2.0 Enterprise Persistence Layer for PHP

Typesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayTypesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayLuka Zakrajšek
 
Building DSLs with Scala
Building DSLs with ScalaBuilding DSLs with Scala
Building DSLs with ScalaMohit Jaggi
 
44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...
44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...
44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...44CON
 
Big Data Developers Moscow Meetup 1 - sql on hadoop
Big Data Developers Moscow Meetup 1  - sql on hadoopBig Data Developers Moscow Meetup 1  - sql on hadoop
Big Data Developers Moscow Meetup 1 - sql on hadoopbddmoscow
 
.NET Core: a new .NET Platform
.NET Core: a new .NET Platform.NET Core: a new .NET Platform
.NET Core: a new .NET PlatformAlex Thissen
 
Web Development using Ruby on Rails
Web Development using Ruby on RailsWeb Development using Ruby on Rails
Web Development using Ruby on RailsAvi Kedar
 
Using existing language skillsets to create large-scale, cloud-based analytics
Using existing language skillsets to create large-scale, cloud-based analyticsUsing existing language skillsets to create large-scale, cloud-based analytics
Using existing language skillsets to create large-scale, cloud-based analyticsMicrosoft Tech Community
 
Implementing a JavaScript Engine
Implementing a JavaScript EngineImplementing a JavaScript Engine
Implementing a JavaScript EngineKris Mok
 
Exploiting NoSQL Like Never Before
Exploiting NoSQL Like Never BeforeExploiting NoSQL Like Never Before
Exploiting NoSQL Like Never BeforeFrancis Alexander
 
Impala Architecture presentation
Impala Architecture presentationImpala Architecture presentation
Impala Architecture presentationhadooparchbook
 
Raffaele Rialdi
Raffaele RialdiRaffaele Rialdi
Raffaele RialdiCodeFest
 

Similar to Doctrine 2.0 Enterprise Persistence Layer for PHP (20)

David buksbaum a-briefintroductiontocsharp
David buksbaum a-briefintroductiontocsharpDavid buksbaum a-briefintroductiontocsharp
David buksbaum a-briefintroductiontocsharp
 
Typesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and PlayTypesafe stack - Scala, Akka and Play
Typesafe stack - Scala, Akka and Play
 
Building DSLs with Scala
Building DSLs with ScalaBuilding DSLs with Scala
Building DSLs with Scala
 
Why ruby and rails
Why ruby and railsWhy ruby and rails
Why ruby and rails
 
44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...
44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...
44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...
 
Ipc mysql php
Ipc mysql php Ipc mysql php
Ipc mysql php
 
Big Data Developers Moscow Meetup 1 - sql on hadoop
Big Data Developers Moscow Meetup 1  - sql on hadoopBig Data Developers Moscow Meetup 1  - sql on hadoop
Big Data Developers Moscow Meetup 1 - sql on hadoop
 
.NET Core: a new .NET Platform
.NET Core: a new .NET Platform.NET Core: a new .NET Platform
.NET Core: a new .NET Platform
 
Wider than rails
Wider than railsWider than rails
Wider than rails
 
Web Development using Ruby on Rails
Web Development using Ruby on RailsWeb Development using Ruby on Rails
Web Development using Ruby on Rails
 
Using existing language skillsets to create large-scale, cloud-based analytics
Using existing language skillsets to create large-scale, cloud-based analyticsUsing existing language skillsets to create large-scale, cloud-based analytics
Using existing language skillsets to create large-scale, cloud-based analytics
 
Implementing a JavaScript Engine
Implementing a JavaScript EngineImplementing a JavaScript Engine
Implementing a JavaScript Engine
 
Exploiting NoSQL Like Never Before
Exploiting NoSQL Like Never BeforeExploiting NoSQL Like Never Before
Exploiting NoSQL Like Never Before
 
Impala Architecture presentation
Impala Architecture presentationImpala Architecture presentation
Impala Architecture presentation
 
Raffaele Rialdi
Raffaele RialdiRaffaele Rialdi
Raffaele Rialdi
 
Ow
OwOw
Ow
 
Be faster then rabbits
Be faster then rabbitsBe faster then rabbits
Be faster then rabbits
 
Php
PhpPhp
Php
 
Php
PhpPhp
Php
 
Php
PhpPhp
Php
 

More from Guilherme Blanco

PHP for Adults: Clean Code and Object Calisthenics
PHP for Adults: Clean Code and Object CalisthenicsPHP for Adults: Clean Code and Object Calisthenics
PHP for Adults: Clean Code and Object CalisthenicsGuilherme Blanco
 
PHP para Adultos: Clean Code e Object Calisthenics
PHP para Adultos: Clean Code e Object CalisthenicsPHP para Adultos: Clean Code e Object Calisthenics
PHP para Adultos: Clean Code e Object CalisthenicsGuilherme Blanco
 
ORM dont kill your DB, developers do
ORM dont kill your DB, developers doORM dont kill your DB, developers do
ORM dont kill your DB, developers doGuilherme Blanco
 
Object Calisthenics Applied to PHP
Object Calisthenics Applied to PHPObject Calisthenics Applied to PHP
Object Calisthenics Applied to PHPGuilherme Blanco
 
PHPubSP Object Calisthenics aplicado ao PHP
PHPubSP Object Calisthenics aplicado ao PHPPHPubSP Object Calisthenics aplicado ao PHP
PHPubSP Object Calisthenics aplicado ao PHPGuilherme Blanco
 
IPC2010SE Doctrine2 Enterprise Persistence Layer for PHP
IPC2010SE Doctrine2 Enterprise Persistence Layer for PHPIPC2010SE Doctrine2 Enterprise Persistence Layer for PHP
IPC2010SE Doctrine2 Enterprise Persistence Layer for PHPGuilherme Blanco
 
Doctrine 2.0: A evolução da persistência em PHP
Doctrine 2.0: A evolução da persistência em PHPDoctrine 2.0: A evolução da persistência em PHP
Doctrine 2.0: A evolução da persistência em PHPGuilherme Blanco
 
Desenvolvimento Agil Com Doctrine Orm
Desenvolvimento Agil Com Doctrine OrmDesenvolvimento Agil Com Doctrine Orm
Desenvolvimento Agil Com Doctrine OrmGuilherme Blanco
 

More from Guilherme Blanco (14)

Enterprise php
Enterprise phpEnterprise php
Enterprise php
 
PHP for Adults: Clean Code and Object Calisthenics
PHP for Adults: Clean Code and Object CalisthenicsPHP for Adults: Clean Code and Object Calisthenics
PHP for Adults: Clean Code and Object Calisthenics
 
PHP 7
PHP 7PHP 7
PHP 7
 
PHP para Adultos: Clean Code e Object Calisthenics
PHP para Adultos: Clean Code e Object CalisthenicsPHP para Adultos: Clean Code e Object Calisthenics
PHP para Adultos: Clean Code e Object Calisthenics
 
ORM dont kill your DB, developers do
ORM dont kill your DB, developers doORM dont kill your DB, developers do
ORM dont kill your DB, developers do
 
Object Calisthenics Applied to PHP
Object Calisthenics Applied to PHPObject Calisthenics Applied to PHP
Object Calisthenics Applied to PHP
 
PHPubSP Object Calisthenics aplicado ao PHP
PHPubSP Object Calisthenics aplicado ao PHPPHPubSP Object Calisthenics aplicado ao PHP
PHPubSP Object Calisthenics aplicado ao PHP
 
Javascript para adultos
Javascript para adultosJavascript para adultos
Javascript para adultos
 
Dependency injection
Dependency injectionDependency injection
Dependency injection
 
Doctrine2 Seminário PHP
Doctrine2 Seminário PHPDoctrine2 Seminário PHP
Doctrine2 Seminário PHP
 
IPC2010SE Doctrine2 Enterprise Persistence Layer for PHP
IPC2010SE Doctrine2 Enterprise Persistence Layer for PHPIPC2010SE Doctrine2 Enterprise Persistence Layer for PHP
IPC2010SE Doctrine2 Enterprise Persistence Layer for PHP
 
Doctrine 2.0: A evolução da persistência em PHP
Doctrine 2.0: A evolução da persistência em PHPDoctrine 2.0: A evolução da persistência em PHP
Doctrine 2.0: A evolução da persistência em PHP
 
PHP, Daemons e Multimedia
PHP, Daemons e MultimediaPHP, Daemons e Multimedia
PHP, Daemons e Multimedia
 
Desenvolvimento Agil Com Doctrine Orm
Desenvolvimento Agil Com Doctrine OrmDesenvolvimento Agil Com Doctrine Orm
Desenvolvimento Agil Com Doctrine Orm
 

Recently uploaded

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 

Recently uploaded (20)

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 

Doctrine 2.0 Enterprise Persistence Layer for PHP

  • 2. • Frontend web developer since 1998 • Moved to backend programming in 2002 • Currently employee of MIH – SWAT team • Committer of many O.S. projects, including Zend Framework, Symfony and Doctrine • Enjoys to play Age of Empires
  • 3. Doctrine is an Object Relational Modeling tool for PHP, mostly inspired by Hibernate (Java) and ActiveRecord (Ruby)
  • 4. • Very active community • Monthly releases • Current work branches: – 1.0 (LTS), 1.1, 1.2 (LTS), 2.0 (LTS)
  • 5. • Integrates with many different frameworks: – Zend Framework – Symfony – CodeIgniter – Kohana – … • Supports all drivers supported by PDO
  • 6. • Based on JSR-317 a.k.a. JPA v2.0 (~80%) • Java…. What?!? #$&*@! • PHP still lacks of standards • PHP Standards Group to the rescue!
  • 8. • No need to extend base class • New Reflection support • Benchmarks (˜50000 iterations): – Setter: • $o->prop set: 0.35872411727905 • $o->setProp: 0.61513090133667 (71% slower) • $reflProp->setValue: 0.67149507522583 (87% slower) – Getter: • $o->prop get: 0.25784397125244 • $o->getProp: 0.46534395217896 (80% slower) • $reflProp->getValue: 0.64541401863098 (150% slower)
  • 9. • Optimize hydration of entities • Garbage Collector – Identity Map • spl_object_hash • SplObjectStorage vs. ArrayAccess
  • 10. • Optimize hydration of Entities • Benchmarks: – Doctrine 1.1 • 4.3435637950897 for 5000 records – Doctrine 2.0 • 1.4314442552312 for 5000 records • 3.4690098762528 for 10000 records
  • 11. • Replication support • Internal mindset change • No more weird DSN constructions • No more shared Identity Maps across multiple connections
  • 12. • Huge API of public methods • Lambdas and Closures • Centralized entry points of methods • No singleton nightmares! - I have a problem! - You can fix it with a singleton. - Now I have 2 problems…
  • 13. • RDBMS <-> PHP differences • Clean separation of Platforms via Dialects • Separation between DB value and PHP value • Extendable to user land
  • 14. • String processing for DQL • Implemented a LL(*) parser • Constructs AST nodes • TreeWalkers to do compilation DQL -> SQL • Cache support to prevent overhead
  • 15. • Metadata Mapping • Extendable mapping drivers • Should not mess Entities code – VOs • Cache support to prevent overhead
  • 16. • Real Native SQL support • Introduction of ResultsetMapping support • Allow custom columns to be mapped into VOs • Specific DBMS SQL supported
  • 17. • Commit ordering • True multigraph implementation • Topological Sorting • Prevents cycles • F*cking incredible fast!
  • 18. Almost 95% of codebase rewritten Requires PHP 5.3
  • 20. Un-necessary clutter removed No more cyclic references
  • 22. • Three main packages: – Common – DBAL – ORM – Maybe in the future ODM… • Anyone interested to contribute?
  • 23. • Class Loaders • Annotations support • Collection • Cache • Event System • Common LL(*) classes
  • 24. • Class loaders: – GlobalClassLoader – IsolatedClassLoader
  • 25. • Annotations EBNF – Yeah baby! Annotation ::= "@" AnnotationName ["(" [Values] ")”] AnnotationName ::= QualifiedName | SimpleName QualifiedName ::= NameSpacePart "" {NameSpacePart ""}* SimpleName NameSpacePart ::= identifier SimpleName ::= identifier Values ::= Array | Value {"," Value}* Value ::= PlainValue | FieldAssignment PlainValue ::= integer | string | float | boolean | Array | Annotation FieldAssignment ::= FieldName "=" PlainValue FieldName ::= identifier Array ::= "{" ArrayEntry {"," ArrayEntry}* "}” ArrayEntry ::= Value | KeyValuePair KeyValuePair ::= Key "=" PlainValue Key ::= string | integer
  • 26. • Use DBAL independent of ORM • Powerful Database Abstraction Layer • Always existed, but it wasn’t advertised • Can be a separate package in the future
  • 27. • Platforms, Drivers and SchemaManagers • Nested transactions • Fully supports: – Schemas – Sequences – Catalogs
  • 28.
  • 29.
  • 30. • Supports: – One-to-one – One-to-many – Many-to-many • Multigraph – Unidirectional – Bidirectional
  • 32. • Driver based Metadata – Annotations – PHP – XML – YAML – … your own?!
  • 33.
  • 34.
  • 35.
  • 36.
  • 37. • Working with objects
  • 38. • Doctrine Query Language – Similar do HQL or JPQL – Automatically makes join restrictions – Supports inheritance natively – Can be boosted by usage of a Query Cache – Easily extendable
  • 39. • Querying – DQL string – QueryBuilder object (Criteria) – Native SQL query
  • 40.
  • 41.
  • 42.
  • 43. • Directed Acyclic Graphs • Easily extendable • Several handy tasks to help development – Schema-tool – Generate-proxies – Convert-mapping – Run-sql – Run-dql
  • 44.
  • 45.
  • 46. Guilherme Blanco guilhermeblanco gmail com +55 16 9215.8480 http://www.doctrine-project.org

Editor's Notes

  1. Project started in 2005/2006 by Konsta Currently maintained by Jonathan Wage, Roman Borschel and Guilherme Blanco
  2. Active community: IRC, Mailing List, Cookbook, etc 1.0 LTS (support ends in March 2010) 1.1 (supports ends in November 2009) 1.2 LTS (support ends in March 2011) 2.0 LTS (support ends in March 2011)
  3. Doctrine team follows all functional specs Wants to contribute to PHP Standards Group
  4. Optimize Reflection even more!
  5. Hydration start/end: memory remains almost the same amount (thanks to GC!)
  6. EntityManagers for the rescue! Sharding in the future? Maybe in 2.X!
  7. Dialects reuse methods of Platforms SchemaManagers are responsible for complex tasks (CREATE TABLE, INDEX, UPDATE TABLE, etc)
  8. Top-down recursive descent parser AST class names follows EBNF grammar rules Reuses Platform to support SQL differences
  9. Annotations support is a LL(*) parser too =D
  10. OTHER STUFF!!! CLI Tasks - DAGs to control options dependencies and exclusions TBF! Reverse engineering (DB -> VOs + Mappings) Mapping conversion between drivers Schema Generation Tool (create, drop & update) Proxy Objects (for Lazy-Loading) Event System Centralized Configuration Multi-level Caching support (APC, Memcache, Xcache)
  11. Self referencing, one-to-one, one-to-many, many-to-many Owning side and inverse side. Owning side determines updates to Database
  12. DQL: Looks like SQL, but it isn’t! Supports SELECT, UPDATE and DELETE
  13. Criteria: Fluent vs. Programmatically API