Doctrine 2 - PhpDay Italy
-
Upload
juozas-kaziukenas -
Category
Technology
-
view
3.962 -
download
1
description
Transcript of Doctrine 2 - PhpDay Italy
![Page 2: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/2.jpg)
Who am I? Juozas Kaziukėnas, Lithuanian
You can call me Joe
3 years in Edinburgh, UK
CEO of Web Species Ltd
Software developer, consultant and evangelist
Conferences speaker
Open source developer for Zend Framework, Doctrine…
More info in http://juokaz.com and twitter @juokaz
![Page 3: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/3.jpg)
Who are you? Doctrine users?
Propel users? (you will be converted!)
Symfony2 users?
Interested in DB’s and PHP?
Interested in PHP news?
![Page 4: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/4.jpg)
Inspired by Hibernate, ActiveRecord etc.
![Page 5: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/5.jpg)
![Page 6: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/6.jpg)
Doctrine 1.X Slow
High memory usage (cyclic references)
Magic! (eg. Behaviors)
Hard to execute raw SQL
Still the best ORM for PHP available today
![Page 7: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/7.jpg)
Root of all problems!
![Page 8: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/8.jpg)
Active Record
![Page 9: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/9.jpg)
Used to be the best ORM available
Stable
Works
Makes development fast, clean and consistent
Used in production
Symfony 1.X
![Page 10: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/10.jpg)
![Page 11: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/11.jpg)
![Page 12: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/12.jpg)
![Page 13: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/13.jpg)
What’s new? Rewritten from scratch (almost)
PHP 5.3
Decoupled components
Simplified API
“Complexified” internals?..
Performance
New hydration
Less magic
Overall cleanup
![Page 14: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/14.jpg)
Based on JSR-317 a.k.a. JPA v2.0
![Page 15: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/15.jpg)
![Page 16: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/16.jpg)
Common Caching
Events
Annotations
Class loaders
… more
![Page 17: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/17.jpg)
Annotations
![Page 18: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/18.jpg)
DBAL Can be used without ORM
Abstraction for MySQL, PgSQL, Oracle, Microsoft SQL, DB2 etc.
PHP types mapping to DB types
Extendable
… more
![Page 19: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/19.jpg)
Connection
![Page 20: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/20.jpg)
ORM Actual ORM component
Uses Common and DBAL
No more ActiveRecord
Entities
Metadata mapping
Entity manager
Query language
Faster, cleaner, clever, extendable
No forcing
![Page 21: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/21.jpg)
Entity
![Page 22: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/22.jpg)
EntityManager
![Page 23: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/23.jpg)
Querying
![Page 24: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/24.jpg)
MongoDB, CauchDB
![Page 25: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/25.jpg)
ODM Abstracts NoSQL databases
Similar Metadata configuration
A lot of functionality from ORM also available in ODM
Querying
EntityManager -> DocumentManager
Driven by OpenSky team, mainly
![Page 26: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/26.jpg)
ODM Querying
![Page 27: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/27.jpg)
![Page 28: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/28.jpg)
Migration Migrating from Doctrine 1 to Doctrine 2
Can be tricky
Migrating:
… models is easy
… application code can require some major refactoring
Do it only if it’s worth it
![Page 29: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/29.jpg)
Finishing Doctrine 2 is out
“The library” for PHP 5.3
Symfony2, Zend Framework 2 etc.
Works well, development is continuing
![Page 30: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/30.jpg)
![Page 31: Doctrine 2 - PhpDay Italy](https://reader034.fdocuments.in/reader034/viewer/2022042813/546b8d93af795962298b4ca8/html5/thumbnails/31.jpg)
Thanks!!! Juozas Kaziukėnas
http://juokaz.com
twitter: @juokaz
Rate this talk at http://joind.in/2990
* Illustrations from http://images.google.com