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

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 

Recently uploaded (20)

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 

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