What's New In Doctrine

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Event

    What's New In Doctrine - Presentation Transcript

    1. #phpday What’s new in Doctrine What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    2. #phpday Doctrine Book What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    3. #phpday First official published Doctrine documentation What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    4. #phpday Doctrine 1.1 What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    5. #phpday Doctrine 2.0 What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    6. #phpday Doctrine 1.1 What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    7. #phpday 1.x Evolution What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    8. #phpday Stability, bugs, features What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    9. #phpday Zero failing test cases What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    10. #phpday Dozens of new test cases adding more code coverage What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    11. #phpday Fine tuned API What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    12. #phpday Improved Hydration Performance What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    13. #phpday Hydrate larger result sets in less time What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    14. #phpday Re-written documentation What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    15. #phpday Misc. Features What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    16. #phpday New configuration options What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    17. #phpday Better custom mutator and accessor support What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    18. #phpday Enhanced fromArray() and synchronizeWithArray() What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    19. #phpday Handles Relationships What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    20. #phpday $userData = array( 'username' => 'jwage', 'password' => 'changeme', 'Groups' => array( array( '_identifier' => 1, ), array( '_identifier' => 2 ), array( 'name' => 'New Group' ) ) ); $user = new User(); $user->fromArray($userData); What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    21. #phpday Generate phpDoc property tags What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    22. #phpday /** * BaseUser * * This class has been auto-generated by the Doctrine ORM Framework * * @property string $username * @property string $password * * @package ##PACKAGE## * @subpackage ##SUBPACKAGE## * @author ##NAME## <##EMAIL##> * @version SVN: $Id: Builder.php 5441 2009-01-30 22:58:43Z jwage $ */ abstract class BaseUser extends Doctrine_Record { public function setTableDefinition() { $this->setTableName('user'); $this->hasColumn('username', 'string', 255, array('type' => 'string', 'length' => '255')); $this->hasColumn('password', 'string', 255, array('type' => 'string', 'length' => '255')); } } What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    23. #phpday Used for IDE autocomplete, etc. What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    24. #phpday Migrations What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    25. #phpday General improvements all around to make things more intuitive What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    26. #phpday Brand New Diff tool What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    27. #phpday Generate migration classes What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    28. #phpday By comparing two Doctrine schemas What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    29. #phpday Automate deployment of database changes What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    30. #phpday From Schema User: columns: username: string(255) password: string(255) What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    31. #phpday To Schema User: columns: username: string(255) password: string(255) email_address: string(255) What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    32. #phpday Generating Changes $from = 'schema/from.yml'; $to = 'schema/to.yml'; $migrationsDir = 'migrations'; $diff = new Doctrine_Migration_Diff($from, $to, $migrationsDir); $changes = $diff->generateChanges(); print_r($changes); Array ( [created_columns] => Array ( [user] => Array ( [email_address] => Array ( [type] => string [length] => 255 ) ) ) ) What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    33. #phpday Generating Classes $from = 'schema/from.yml'; $to = 'schema/to.yml'; $migrationsDir = 'migrations'; $diff = new Doctrine_Migration_Diff($from, $to, $migrationsDir); $diff->generateMigrationClasses(); What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    34. #phpday Generating Classes // migrations/1239913213_version1.php class Version1 extends Doctrine_Migration_Base { public function up() { $this->addColumn('user', 'email_address', 'string', '255', array('email' => '1')); } public function down() { $this->removeColumn('user', 'email_address'); } } What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    35. #phpday Migrating Changes Migrate from version 0 to version 1 $migration = new Doctrine_Migration('migrations'); $migration->migrate(); What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    36. #phpday Migrating up executes up() methods Migrating down executes down() methods What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    37. #phpday Reversing Changes Migrate from version 1 to version 0 $migration = new Doctrine_Migration('migrations'); $migration->migrate(0); What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    38. #phpday New Data Hydration Types What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    39. #phpday Scalar What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    40. #phpday Flat, rectangular result set What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    41. #phpday Faster to execute What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    42. #phpday Harder to work with What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    43. #phpday Can contain duplicate data What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    44. #phpday Like normal SQL result set What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    45. #phpday Scalar Example $q = Doctrine::getTable('User') ->createQuery('u') ->leftJoin('u.Phonenumbers p'); $results = $q->execute(array(), Doctrine::HYDRATE_SCALAR); print_r($results); What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    46. #phpday Scalar Example Array ( [0] => Array ( [u_id] => 1 [u_username] => jwage [u_password] => changeme [u_email_address] => jonwage@gmail.com [p_id] => 1 [p_user_id] => 1 [p_phonenumber] => 16155139185 ) [1] => Array ( [u_id] => 1 [u_username] => jwage [u_password] => changeme [u_email_address] => jonwage@gmail.com [p_id] => 2 [p_user_id] => 1 [p_phonenumber] => 14159925468 ) ) What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    47. #phpday Single Scalar What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    48. #phpday Sub-type of Scalar What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    49. #phpday Returns single scalar value What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    50. #phpday Useful for retrieving single value for aggregate/calculated results What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    51. #phpday Very fast No need to hydrate objects What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    52. #phpday Single Scalar Example $q = Doctrine::getTable('User') ->createQuery('u') ->select('COUNT(p.id) as num_phonenumbers') ->leftJoin('u.Phonenumbers p'); $results = $q->execute(array(), Doctrine::HYDRATE_SINGLE_SCALAR); echo $results; // 2 What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    53. #phpday Doctrine 2.0 What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    54. #phpday PHP 5.3 What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    55. #phpday Performance increases from 5.3 What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    56. #phpday Test suite runs 20% faster What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    57. #phpday And uses 30% less memory What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    58. #phpday Re-Design What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    59. #phpday Simplified the public API What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    60. #phpday Heavily influenced by JPA, Java Hibernate What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    61. #phpday Smaller footprint What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    62. #phpday Un-necessary clutter removed What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    63. #phpday Removed Limitations What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    64. #phpday No need to extend Doctrine 1 Doctrine 2 /** class User extends Doctrine_Record * @DoctrineEntity { * @DoctrineTable(name=\"user\") public function setTableDefinition() */ { class User $this->hasColumn('id', 'integer', null, array( { 'primary' => true, /** 'auto_increment' => true * @DoctrineId )); * @DoctrineColumn(type=\"integer\") * @DoctrineGeneratedValue(strategy=\"auto\") $this->hasColumn('username', 'string', 255); */ } public $id; } /** * @DoctrineColumn(type=\"varchar\", length=255) */ public $username; } What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    65. #phpday No more crazy cyclic references What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    66. #phpday print_r() your objects $user = new User(); $user->username = 'jwage'; print_r($user); User Object ( [id] => [username] => jwage ) What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    67. #phpday Positive effects of removing the base class all around What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    68. #phpday No more shared identity map across connections What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    69. #phpday General Improvements What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    70. #phpday Code de-coupled What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    71. #phpday 3 Main Packages What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    72. #phpday Common What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    73. #phpday DBAL What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    74. #phpday ORM What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    75. #phpday Use Doctrine DBAL separate from the ORM What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    76. #phpday Easier to extend and override things What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    77. #phpday Better support for multiple databases What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    78. #phpday Sequences, schemas and catalogs What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    79. #phpday Simplified connection information $config = new \\Doctrine\\ORM\\Configuration(); $eventManager = new \\Doctrine\\Common\\EventManager(); $connectionOptions = array( 'driver' => 'pdo_sqlite', 'path' => 'database.sqlite' ); $em = \\Doctrine\\ORM\\EntityManager::create($connectionOptions, $config, $eventManager); What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    80. #phpday No more DSN nightmares What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    81. #phpday Connection information specified as arrays What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    82. #phpday Removed old attribute system What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    83. #phpday Replaced with simpler string based system What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    84. #phpday Real Native SQL support What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    85. #phpday Driver Based Meta Data What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    86. #phpday PHP Annotations /** * @DoctrineEntity * @DoctrineTable(name=\"user\") */ class User { /** * @DoctrineId * @DoctrineColumn(type=\"integer\") * @DoctrineGeneratedValue(strategy=\"auto\") */ public $id; /** * @DoctrineColumn(type=\"varchar\", length=255) */ public $username; } What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    87. #phpday PHP Code class User { public $id, $username; } $metadata = new ClassMetadata('User'); $metadata->mapField(array( 'fieldName' => 'id', 'type' => 'integer', 'id' => true )); $metadata->setIdGeneratorType('auto'); $metadata->mapField(array( 'fieldName' => 'username', 'type' => 'varchar', 'length' => 255 )); What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    88. #phpday YAML class User { public $id, $username; } User: properties: id: id: true type: integer idGenerator: auto username: type: varchar length: 255 What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    89. #phpday Write your own driver What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    90. #phpday Cache What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    91. #phpday Query Cache Cache final SQL that is parsed from DQL What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    92. #phpday Metadata Cache Cache the parsing of meta data What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    93. #phpday Result Cache Cache the results of your queries What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    94. #phpday Inheritance Mapping What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    95. #phpday Single Table One table per hierarchy What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    96. #phpday Class Table One table per class What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    97. #phpday Concrete Table One table per concrete class What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    98. #phpday Testing What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    99. #phpday Switched to phpUnit What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    100. #phpday Better mock testing What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    101. #phpday Easy to run tests against multiple DBMS What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    102. #phpday Code de-coupled so it is easier to test What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    103. #phpday New Features What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    104. #phpday New DQL Parser What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    105. #phpday Hand written What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    106. #phpday Recursive-descent parser What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    107. #phpday Constructs AST What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    108. #phpday PHP Class names directly represent DQL language What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    109. #phpday Every DQL feature has a class to handle parsing What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    110. #phpday Easy to maintain Easy to add new features Easy to use What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    111. #phpday Performance? What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    112. #phpday Final SQL can be easily and effectively cached What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    113. #phpday Not practical to parse every time What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    114. #phpday Custom Column Types What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    115. #phpday Add your own data types What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    116. #phpday Types are OOP classes What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    117. #phpday Easy to extend or add new types What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    118. #phpday Extend DQL What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    119. #phpday DQL parser can be extended What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    120. #phpday Add your own DQL functions What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    121. #phpday When? What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    122. #phpday First release in September What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    123. #phpday ALPHA What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    124. #phpday BETA What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    125. #phpday RC What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    126. #phpday Stable - 2010’ ? What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    127. #phpday What is next? What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    128. #phpday Publishing of first Doctrine book What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    129. #phpday Write more documentation What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    130. #phpday Publish more books What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    131. #phpday Doctrine community extension repository Symfony has Plugins and Doctrine has Extensions What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    132. #phpday Default DBAL and ORM in PEAR2? De-facto standard? What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    133. #phpday It is up to you! :) What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    134. #phpday Questions? Jonathan H. Wage jonathan.wage@sensio.com +1 415 992 5468 sensiolabs.com | doctrine-project.org | sympalphp.org | jwage.com You can contact Jonathan about Doctrine and Open-Source or for training, consulting, application development, or business related questions at jonathan.wage@sensio.com What’s new in Doctrine www.doctrine-project.org www.sensiolabs.com
    SlideShare Zeitgeist 2009

    + Jonathan WageJonathan Wage Nominate

    custom

    772 views, 0 favs, 5 embeds more stats

    Presentation on the Doctrine ORM from phpDay 2009 i more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 772
      • 707 on SlideShare
      • 65 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 16
    Most viewed embeds
    • 31 views on http://www.jwage.com
    • 25 views on http://www.doctrine-project.org
    • 6 views on http://www.phpday.it
    • 2 views on http://jwage.com
    • 1 views on http://www.doctrine-project.com

    more

    All embeds
    • 31 views on http://www.jwage.com
    • 25 views on http://www.doctrine-project.org
    • 6 views on http://www.phpday.it
    • 2 views on http://jwage.com
    • 1 views on http://www.doctrine-project.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Groups / Events