• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Doctrine Php Object Relational Mapper

Doctrine Php Object Relational Mapper



Doctrine 1.0 presentation from Symfony Camp 2008

Doctrine 1.0 presentation from Symfony Camp 2008



Total Views
Views on SlideShare
Embed Views



21 Embeds 651

http://jumanor.blogspot.com 396
http://www.symfolive.com 58
http://www.slideshare.net 47
http://jumanor.blogspot.mx 30
http://www.jwage.com 28
http://jumanor.blogspot.com.es 27
http://jumanor.blogspot.com.ar 22
http://www.jumanor.blogspot.com 11
http://coderwall.com 9
http://jwage.com 6
http://dev.symfony2developer.com 4
http://jumanor.blogspot.pt 2
http://jumanor.blogspot.com.br 2
http://www.linkedin.com 2
http://jumanor.blogspot.se 1
http://theoldreader.com 1
http://www.jumanor.blogspot.com.ar 1
http://jumanor.blogspot.co.uk 1
http://www.jumanor.blogspot.com.es 1
http://webcache.googleusercontent.com 1
http://symfony2developer.com 1



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.


11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • I'm new to Doctrine ORM and I'm fighting a bit with schema definitions (I've been using CakePHP). I found ORM Designer www.orm-designer.com which seems to handle Doctrine very well but is commercial. Are you guys planning to release something similar just for Doctrine?
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    Doctrine Php Object Relational Mapper Doctrine Php Object Relational Mapper Presentation Transcript

    • Doctrine, PHP Object Relational Mapper Doctrine 1 http://www.doctrine-project.org
    • What is Doctrine? ‣ Doctrine is a Object Relational Mapper built to work with PHP 5.2.3 or greater. ‣ Primarily based off of Java Hibernate ‣ Influenced by Ruby on Rails ActiveRecord From WikiPedia: http://en.wikipedia.org/wiki/Object- relational_mapping Doctrine 2 http://www.doctrine-project.org
    • The Layers Doctrine 3 http://www.doctrine-project.org
    • Why should I use it? ‣ Makes difficult problems easy Because jwage said ‣ Saves money so!!! ‣ I like money Doctrine 4 http://www.doctrine-project.org
    • Will it solve world hunger? ‣ No ‣ Will not solve all your problems ‣ Helps more than it hurts Doctrine 5 http://www.doctrine-project.org
    • 1, 2, 3, Let’s go! Doctrine 6 http://www.doctrine-project.org
    • Doctrine 7 http://www.doctrine-project.org
    • Doctrine 8 http://www.doctrine-project.org
    • Doctrine 9 http://www.doctrine-project.org
    • The examples in the next slides use the following models Doctrine 10 http://www.doctrine-project.org
    • Doctrine Query Language A object-oriented SQL-dialect used for retrieving data ‣ DQL makes complex SQL simple ‣ Brings OOP to your database queries ‣ Parsed and converted to SQL for your dbms ‣ DQL parsing is cached Doctrine 11 http://www.doctrine-project.org
    • DQL makes complex SQL simple The DQL: FROM BlogPost p INNER JOIN p.Author a LEFT JOIN p.Tags t The Resulting SQL: SELECT b.id AS b__id, b.title AS b__title, b.body AS b__body, b.author_id AS b__author_id, b.slug AS b__slug, b.created_at AS b__created_at, b.updated_at AS b__updated_at, a.id AS a__id, a.name AS a__name, t.id AS t__id, t.name AS t__name FROM blog_post b INNER JOIN author a ON b.author_id = a.id LEFT JOIN blog_post_tag b2 ON b.id = b2.blog_post_id LEFT JOIN tag t ON t.id = b2.tag_id Special select aliases created so Doctrine can hydrate the data Doctrine 12 http://www.doctrine-project.org
    • Let Doctrine do the work ‣ You don’t need to know how things are related, just that they are. ‣ Uses relationship information to automatically fill in the blanks when building SQL. ‣ Write complex queries very fast and efficiently Doctrine 13 http://www.doctrine-project.org
    • Executing the DQL Query Results Hydrated as Multi-Dimensional Array or Objects Doctrine 14 http://www.doctrine-project.org
    • DBMS Functions ‣ DBMS functions passed through parser to SQL ‣ Any DBMS function can be used ‣ Propel short coming ‣ Can be used in WHERE, HAVING, etc. Doctrine 15 http://www.doctrine-project.org
    • Named Queries ‣ Create named queries ‣ Execute named queries ‣ Retrieve named query objects Doctrine 16 http://www.doctrine-project.org
    • Working with Objects Doctrine 17 http://www.doctrine-project.org
    • Accessors/Mutators ‣ 3 Different Styles ‣ Easy to use Doctrine 18 http://www.doctrine-project.org
    • Overriding ‣ Override accessors and mutators easily ‣ Functions recognized and invoked with normal accessors ‣ Use _get()/_set() to avoid infinite loop Doctrine 19 http://www.doctrine-project.org
    • Hydration Modes ‣ As objects ‣ As php arrays ‣ No hydration Doctrine 20 http://www.doctrine-project.org
    • Array Access Recommended ‣ Works with both record and array hydration methods ‣ Write code to work with objects and switch to array hydration without changing code ‣ Performance ‣ Most familiar Doctrine 21 http://www.doctrine-project.org
    • Simple Relationships ‣ Relations work the way you’d expect it to ‣ Several different relationship types supported ‣ Specify relationships inline Doctrine 22 http://www.doctrine-project.org
    • Working with m2m ‣ Easy to link and unlink ‣ Specify new objects inline ‣ Attach existing objects Doctrine 23 http://www.doctrine-project.org
    • Updating ‣ Retrieve and update ‣ Update with one DQL query ‣ DQL updates don’t issue events/hooks for updating Doctrine 24 http://www.doctrine-project.org
    • Deleting ‣ Retrieve and delete ‣ Delete without retrieving ‣ DQL deletes issue individual queries Doctrine 25 http://www.doctrine-project.org
    • Many2Many ‣ Reference table is used transparently ‣ No need to manually join reference table ‣ Easy to store extra data with reference tables Doctrine 26 http://www.doctrine-project.org
    • Many2Many Example 1 Doctrine 27 http://www.doctrine-project.org
    • Many2Many Example 2 Simplified even more Doctrine 28 http://www.doctrine-project.org
    • Friends List with Equal m2m Doctrine 29 http://www.doctrine-project.org
    • Inspecting SQL of Equal M2M SQL is generated with OR condition so that relationship data is returned on both sides Doctrine 30 http://www.doctrine-project.org
    • Friends/Buddy List Different SQL used so objects which exist on one side, exist automatically on the other Now Fabien and I are friends!! Too easy! Doctrine 31 http://www.doctrine-project.org
    • Plug n’ Play Behaviors ‣ Extract functionality ‣ Code re-usability ‣ Maintenance ‣ Time and money saver ‣ Write your own ‣ Offloads functionality to community Doctrine 32 http://www.doctrine-project.org
    • Core Behaviors ‣ Timestampable ‣ Sluggable ‣ Versionable ‣ I18n ‣ SoftDelete ‣ NestedSet ‣ Geographical Doctrine 33 http://www.doctrine-project.org
    • Real world example Using the Sluggable and Timestampable behaviors for a BlogPost model Doctrine 34 http://www.doctrine-project.org
    • The Create Table SQL Doctrine 35 http://www.doctrine-project.org
    • Behavior In Action Doctrine 36 http://www.doctrine-project.org
    • The Results Set automatically! Updated! Doctrine 37 http://www.doctrine-project.org
    • What Happened? ‣ Columns automatically added ‣ Automatically sets created_at and update_at timestamps on save ‣ Automatic creation of unique, human readable record identifier(slug) FREE SOFTWARE! FREE FUNCTIONALITY! ARE YOU SERIOUS? Doctrine 38 http://www.doctrine-project.org
    • Data Fixtures ‣ Easy to specify m2m data ‣ We did it first, not rails ;) Doctrine 39 http://www.doctrine-project.org
    • Data Fixtures Inline ‣ Specify data fixtures inline ‣ More readable ‣ If a relationship exists, you can populate it inline Doctrine 40 http://www.doctrine-project.org
    • Future ‣ Doctrine 1.1, 1.2.....2.0 ‣ Separate packages for DBAL and ORM ‣ PEAR2: Replace MDB2? Defacto standard for DBAL and ORM in PHP? ‣ Integration with many other libraries: symfony, Zend Framework, Code Igniter, Typo3, etc. Doctrine 41 http://www.doctrine-project.org
    • Doctrine 2.0 ‣ Almost entirely rewritten code base ‣ Decoupling of components ‣ Off-loading of features to community: behaviors, validation, yaml schema files, data fixtures, etc. ‣ Concentrate more on ORM specific functionality Doctrine 42 http://www.doctrine-project.org
    • Want more? ‣ Read More ‣ http://www.doctrine-project.org/documentation/manual/1_0/?one-page#dql- doctrine-query-language ‣ http://www.doctrine-project.org/documentation/manual/1_0/?one-page#migration ‣ http://www.doctrine-project.org/documentation/manual/1_0/?one-page#behaviors ‣ Community - http://www.doctrine-project.org/community ‣ Frequently Asked Questions - http://www.doctrine-project.org/faq ‣ About Doctrine - http://www.doctrine-project.org/about ‣ The Doctrine Blog - http://www.doctrine-project.org/blog ‣ Documentation - http://www.doctrine-project.org/documentation Doctrine 43 http://www.doctrine-project.org
    • THE END! I hope this presentation was helpful and sparked some interest to play with Doctrine! Follow the Doctrine... Doctrine 44 http://www.doctrine-project.org