• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Just Married: Zend Framework and Doctrine
 

Just Married: Zend Framework and Doctrine

on

  • 8,103 views

Zend Framework and Doctrine 1 are bundled in many applications although no formal integration between both existed up to now. This talk shows how we integrated both Doctrines as a possible modelling ...

Zend Framework and Doctrine 1 are bundled in many applications although no formal integration between both existed up to now. This talk shows how we integrated both Doctrines as a possible modelling layer for the latest Zend Framework release and merged together the combined wisdom of both communities. An in-depth preview of Doctrine 2 and ZF integration completes the topic of this talk.

Statistics

Views

Total Views
8,103
Views on SlideShare
8,040
Embed Views
63

Actions

Likes
6
Downloads
148
Comments
0

1 Embed 63

http://www.slideshare.net 63

Accessibility

Categories

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.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Just Married: Zend Framework and Doctrine Just Married: Zend Framework and Doctrine Presentation Transcript

    • Just married: Zend Framework and Doctrine Benjamin Eberlei direkt effekt GmbH IPC Spring 2010 Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 1 / 55
    • About Me Benjamin Eberlei direkt effekt GmBH (digital marketing) Open Source contributor (Zend Framework and Doctrine) Twitter @beberlei Blog: www.whitewashing.de Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 2 / 55
    • And You? Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 3 / 55
    • Model vs Persistence Model = Your code Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 4 / 55
    • Model vs Persistence Persistence = Framework Code Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 5 / 55
    • Model vs Persistence Model = Your code Persistence = Framework Code You can implement the same business logic using any persistence solution out there! Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 6 / 55
    • Zend Framework Persistence Zend Db - Abstraction Layer Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 7 / 55
    • Zend Framework Persistence Zend Db - Abstraction Layer Zend Db Select - SQL Query Object Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 7 / 55
    • Zend Framework Persistence Zend Db - Abstraction Layer Zend Db Select - SQL Query Object Zend Db Table - Table/Row Data Gateway pattern Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 7 / 55
    • Zend Framework Persistence Zend Db - Abstraction Layer Zend Db Select - SQL Query Object Zend Db Table - Table/Row Data Gateway pattern No Object-Relational Mapping Support! Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 7 / 55
    • Doctrine 1 Object-Relational Mapping, Active Record Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 8 / 55
    • Doctrine 1 Object-Relational Mapping, Active Record Doctrine Query Language Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 8 / 55
    • Doctrine 1 Object-Relational Mapping, Active Record Doctrine Query Language Hydrators Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 8 / 55
    • Doctrine 1 Object-Relational Mapping, Active Record Doctrine Query Language Hydrators Database Migrations Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 8 / 55
    • Doctrine Modelling Workflow 1. Setup Doctrine Bootstrap Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 9 / 55
    • Doctrine Modelling Workflow 1. Setup Doctrine Bootstrap 2. Define a YAML Schema Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 9 / 55
    • Doctrine Modelling Workflow 1. Setup Doctrine Bootstrap 2. Define a YAML Schema 3. Generate Model and Table PHP classes Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 9 / 55
    • Doctrine Modelling Workflow 1. Setup Doctrine Bootstrap 2. Define a YAML Schema 3. Generate Model and Table PHP classes 4. Generate Database Schema from Models Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 9 / 55
    • Doctrine Modelling Workflow 1. Setup Doctrine Bootstrap 2. Define a YAML Schema 3. Generate Model and Table PHP classes 4. Generate Database Schema from Models 5. Repeat (2)-(4) for Iterations of your models. Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 9 / 55
    • Doctrine Modelling Workflow 1. Setup Doctrine Bootstrap 2. Define a YAML Schema 3. Generate Model and Table PHP classes 4. Generate Database Schema from Models 5. Repeat (2)-(4) for Iterations of your models. 6. In production, use migrations for schema evolvement. Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 9 / 55
    • A Doctrine Project Layout Non-PEAR Structure Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 10 / 55
    • A Doctrine Project Layout Non-PEAR Structure No Module Prefixes Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 10 / 55
    • A Doctrine Project Layout Non-PEAR Structure No Module Prefixes Autoloading? Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 10 / 55
    • A Doctrine Project Layout Non-PEAR Structure No Module Prefixes Autoloading? Configurable (PEAR).. Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 10 / 55
    • A Doctrine Project Layout Non-PEAR Structure No Module Prefixes Autoloading? Configurable (PEAR).. ..Not enough for ZF! Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 10 / 55
    • Zend Framework Projects Model * in models/ Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 11 / 55
    • Zend Framework Projects Model * in models/ Single Module Project Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 11 / 55
    • Zend Framework Projects Model * in models/ Single Module Project Not PEAR Standard Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 11 / 55
    • Zend Framework Projects Model * in models/ Single Module Project Not PEAR Standard Special Autoloader Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 11 / 55
    • Modular ZF Project Each Module has models/ Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 12 / 55
    • Modular ZF Project Each Module has models/ Again Special Autoloader Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 12 / 55
    • ZF + Doctrine Integration Not a ZF Component Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 13 / 55
    • ZF + Doctrine Integration Not a ZF Component Download: http://github.com/beberlei/zf-doctrine Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 13 / 55
    • ZF + Doctrine Integration Not a ZF Component Download: http://github.com/beberlei/zf-doctrine One Goal: No code-generation Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 13 / 55
    • ZF + Doctrine Integration Not a ZF Component Download: http://github.com/beberlei/zf-doctrine One Goal: No code-generation Includes: 1. Zend Application Resource Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 13 / 55
    • ZF + Doctrine Integration Not a ZF Component Download: http://github.com/beberlei/zf-doctrine One Goal: No code-generation Includes: 1. Zend Application Resource 2. Zend Tool Integration Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 13 / 55
    • ZF + Doctrine Integration Not a ZF Component Download: http://github.com/beberlei/zf-doctrine One Goal: No code-generation Includes: 1. Zend Application Resource 2. Zend Tool Integration 3. Zend Forms from Doctrine Metadata Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 13 / 55
    • ZF + Doctrine Integration Not a ZF Component Download: http://github.com/beberlei/zf-doctrine One Goal: No code-generation Includes: 1. Zend Application Resource 2. Zend Tool Integration 3. Zend Forms from Doctrine Metadata 4. Paginator Adapter Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 13 / 55
    • ZF + Doctrine Integration Not a ZF Component Download: http://github.com/beberlei/zf-doctrine One Goal: No code-generation Includes: 1. Zend Application Resource 2. Zend Tool Integration 3. Zend Forms from Doctrine Metadata 4. Paginator Adapter 5. Model List View Helper Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 13 / 55
    • Zend Application Resource 1. Install using Zend Tool: zf create project forum zf create-project doctrine –dsn=$DSN Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 14 / 55
    • Zend Application Resource 2. Register manually with Zend Application resources . doctrine . connections . default . dsn = " " pluginpaths . Z F D o c t r i n e _ A p p l i c a t i o n _ R e s o u r c e = " ZFDoctrine / Application / Resource " a u toloade r n a m e s p a c e s [] = " Doctrine " a u toloade r n a m e s p a c e s [] = " ZFDoctrine . Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 15 / 55
    • Configuring the Application Resource Configuring Connection DSN resources . doctrine . connections . < name >. dsn Configuring Connection Attributes resources . doctrine . connections . < name >. attributes Configuring Manager Attributes resources . doctrine . manager . attributes Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 16 / 55
    • ZFDoctrine Conventions Both ZF 1 and Doctrine 1 are magic boxes Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 17 / 55
    • ZFDoctrine Conventions Both ZF 1 and Doctrine 1 are magic boxes Enforcing Conventions Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 17 / 55
    • ZFDoctrine Conventions Both ZF 1 and Doctrine 1 are magic boxes Enforcing Conventions Model Classes: $Module Model $Name: 1. Default Model User 2. Default Model Group 3. Forum Model Thread 4. Forum Model Board Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 17 / 55
    • ZFDoctrine Conventions Both ZF 1 and Doctrine 1 are magic boxes Enforcing Conventions Model Classes: $Module Model $Name: 1. Default Model User 2. Default Model Group 3. Forum Model Thread 4. Forum Model Board Define Metadata Attributes refClass, local, model and foreign explicitly Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 17 / 55
    • A Doctrine Project zf create project forum zf create-project doctrine –dsn Creating four essential Doctrine Directories: application/configs/schema application/configs/fixtures application/configs/migrations application/configs/sql Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 18 / 55
    • Example Yaml schema: Forum Put a forum.yml in the schema directory: F o rum_Mod e l _ C a t e g o r y : columns : name : string (50) description : string (99999) Forum_Mode l_Boar d : columns : category_id : integer (10) name : string (100) description : string (5000) relations : Category : class : F o r u m _ Model_Category local : category_id foreign : id Threads : class : Fo ru m_ Model_Thread local : id foreign : board_id Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 19 / 55
    • Generate Models from Yaml zf generate-models-from-yaml doctrine Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 20 / 55
    • Generate Models from Yaml zf generate-models-from-yaml doctrine Generate Table Classes (application.ini) resources . doctrine . generateModels . generateTableClasses = true Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 20 / 55
    • Generate Models Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 21 / 55
    • Generate Models Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 22 / 55
    • Generated Model Classes Records Base Records Tables Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 23 / 55
    • Code Generation? Doctrine creates Models from Yaml files. Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 24 / 55
    • Code Generation? Doctrine creates Models from Yaml files. ...optionally(!) Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 24 / 55
    • Code Generation? Doctrine creates Models from Yaml files. ...optionally(!) You can skip Yaml and directly code the Model (Records and Tables) Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 24 / 55
    • Code Generation? Doctrine creates Models from Yaml files. ...optionally(!) You can skip Yaml and directly code the Model (Records and Tables) Zend Framework Project Support works without Yaml. Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 24 / 55
    • Generated Record: class For u m _ M o de l _ C ategory extends Forum_Model_Base_Category { } Generated Table: class F o r u m _ M o d e l _ C a t e g o r y T a b le extends Doctrine_Table { public static function getInstance () { return Doctrine_Core :: getTable ( ’ F o r u m _ Model_Category ’) ; } } Generated Base Record: Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 25 / 55
    • abstract class F o r u m _ M o d e l _ B a s e _ C a t e g o r y extends Doctrine_Record { public function setTableDefinition () { $this - > setTableName ( ’ forum_categories ’) ; $this - > hasColumn ( ’ name ’ , ’ string ’ , 50 , array ( ’ type ’ = > ’ string ’ , ’ length ’ = > ’ 50 ’ , )); $this - > hasColumn ( ’ description ’ , ’ string ’ , 99999 , array ( ’ type ’ = > ’ string ’ , ’ length ’ = > ’ 99999 ’ , )); } public function setUp () { parent :: setUp () ; $this - > hasMany ( ’ Forum_Model_Board ’ , array ( ’ local ’ = > ’ id ’ , ’ foreign ’ = > ’ category_id ’) ) ; } } Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 26 / 55
    • Generating Database zf build-project doctrine –reload Drop and Create Database Create Tables Load Fixtures Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 27 / 55
    • Migrations Update your Database Schema: zf show-migration doctrine Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 28 / 55
    • Migrations Update your Database Schema: zf show-migration doctrine zf generate-migration doctrine Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 28 / 55
    • Migrations Update your Database Schema: zf show-migration doctrine zf generate-migration doctrine zf execute-migration doctrine Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 28 / 55
    • Forms for Doctrine Models Using Doctrine Metadata for other, non ORM purposes Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 29 / 55
    • Forms for Doctrine Models Using Doctrine Metadata for other, non ORM purposes Configuration of Zend Form instances Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 29 / 55
    • Forms for Doctrine Models Using Doctrine Metadata for other, non ORM purposes Configuration of Zend Form instances Mostly for backend (scaffolding) purposes Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 29 / 55
    • A Simple Form $form = new Z F D o c t r i ne_Fr om_M odel ( array ( ’ model ’ = > ’ F o r um_Model_Category ’ , ’ action ’ = > ’. ’ , ’ method ’ = > ’ post ’ )); Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 30 / 55
    • A Simple Form: Tweaking $form = new Z F D o c t r i ne_Fo rm_M odel ( array ( ’ model ’ = > ’ F o r um_Model_Category ’ , ’ method ’ = > ’ post ’ , ’ action ’ = > $this - > _helper - > url ( ’add - category ’ , ’ admin ’) , ’ fieldLabels ’ = > array ( ’ name ’ = > ’ Name ’ , ’ description ’ = > ’ Description ’ , ), ’ fieldTypes ’ = > array ( ’ description ’ = > ’ textarea ’ , ), )); Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 31 / 55
    • A Simple Form: Tweaking Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 32 / 55
    • A Simple Form: Controller public function add CategoryAction () { $form = $this - > createCategoryForm () ; $request = $this - > getRequest () ; $post = $request - > getPost () ; if ( $request - > isPost () && $form - > isValid ( $post ) ) { $form - > save () ; $this - > _helper - > redirector ( ’ success ’ , ’ admin ’) ; } $this - > view - > form = $form ; } Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 33 / 55
    • A Simple Form: Updating public function e di tCategoryAction () { $categoryId = $this - > _getParam ( ’ id ’) ; $form = $this - > createCategoryForm () ; $request = $this - > getRequest () ; $post = $request - > getPost () ; $table = Doctrine :: getTable ( ’ Forum_Model_Category ’) ; $category = $table - > find ( $categoryId ) ; $form - > setRecord ( $category ) ; if ( $request - > isPost () && $form - > isValid ( $post ) ) { $form - > save () ; $this - > _helper - > redirector ( ’ success ’ , ’ admin ’) ; } $this - > view - > form = $form ; } Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 34 / 55
    • A Simple Form: Action Helper public function add CategoryAction () { $form = $this - > createCategoryForm () ; $this - > _helper - > modelForm ( $form , ’ success ’) ; } public function e di tCategoryAction () { $form = $this - > createCategoryForm () ; $this - > getHelper ( ’ modelForm ’) -> setRecordIdParam ( ’ id ’) -> handleForm ( $form , ’ success ’) ; } Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 35 / 55
    • Advanced Forms: Relations Relations rendered as (multi-)select fields: public function addBoardAction () { $form = new Z F D o ctri ne_Fo rm_M odel ( array ( ’ model ’ = > ’ Forum_Model_Board ’ , )); $this - > _helper - > modelForm ( $form , " success " ) ; } Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 36 / 55
    • Advanced Forms: Relations Relations rendered as (multi-)select fields: public function addBoardAction () { $form = new Z F D o ctri ne_Fo rm_M odel ( array ( ’ model ’ = > ’ Forum_Model_Board ’ , )); $this - > _helper - > modelForm ( $form , " success " ) ; } Control Option Labels: class For u m _ M o del _ C a tegory extends ... { public function __toString () { return $this - > id . " , " . $this - > name ; } } Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 36 / 55
    • Advanced Forms: Relations Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 37 / 55
    • Advanced Forms: Hooks Add Validators and Filters Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 38 / 55
    • Advanced Forms: Hooks Add Validators and Filters Change Decorators Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 38 / 55
    • Advanced Forms: Hooks Add Validators and Filters Change Decorators Use jQuery or Dojo Integration Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 38 / 55
    • Advanced Forms: Hooks Add Validators and Filters Change Decorators Use jQuery or Dojo Integration Hook methods: preGenerate() and postGenerate() Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 38 / 55
    • Advanced Forms: Hooks Adding decorators in preGenerate(): class Forum _Form_T hread extends ZFDo ctrin e_Fo rm_Mo del { protected function _preGenerate () { // called before the form is generated $decorators = array ( ’ FormElements ’ , array ( array ( ’ data ’= > ’ HtmlTag ’) , array ( ’ tag ’= > ’ table ’) ) , ’ Form ’ ); $this - > setDecorators ( $decorators ) ; } } Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 39 / 55
    • Advanced Forms: Hooks jQuery or Dojo Enable a Form: class Forum _Form_T hread extends ZFDo ctrin e_Fo rm_Mo del { protected function _preGenerate () { ZendX_JQuery :: enableForm ( $this ) ; // Zend_Dojo :: enableForm ( $this ) ; } } Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 40 / 55
    • Advanced Forms: Hooks Adding a validator in postGenerate(): class Forum _Form_T hread extends ZFDo ctrin e_Fo rm_Mo del { protected function _postGenerate () { // called after the form is generated $validator = new Z e n d _ V a l i d a t e _ S t r i n g L e n g t h ( array ( ’ min ’ = > 5 , ’ max ’ = > 255) ); $this - > getElement ( ’ title ’) -> addValidator ( $validator ) ; } } Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 41 / 55
    • Paginator Adapter Paginate a Doctrine Query: $query = Doctrine_Query :: create () ; // $query ... $adapter = new Z F D o c t r i n e _ P a g i n a t o r _ A d a p t e r _ D o c t r i n e Q u e r y ( $query ) ; $paginator = new Zend_Paginator ( $adapter ) ; Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 42 / 55
    • Paginator Adapter Paginate a Doctrine Query: $query = Doctrine_Query :: create () ; // $query ... $adapter = new Z F D o c t r i n e _ P a g i n a t o r _ A d a p t e r _ D o c t r i n e Q u e r y ( $query ) ; $paginator = new Zend_Paginator ( $adapter ) ; Paginate a Doctrine Table: $table = Doctrine_Core :: getTable ( ’ MyModel ’) ; $query = $table - > createQuery () ; Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 42 / 55
    • Model List View Helper Creates a paginated list for a model Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 43 / 55
    • Model List View Helper Creates a paginated list for a model Links to CRUD actions Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 43 / 55
    • Model List View Helper Creates a paginated list for a model Links to CRUD actions Reasonable default Look & Feel Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 43 / 55
    • Model List View Helper Creates a paginated list for a model Links to CRUD actions Reasonable default Look & Feel But offers full customization Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 43 / 55
    • Model List View Helper <h1 > Boards </ h1 > <?= $this - > modelList ( ’ Forum_Model_Board ’) ; ? > Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 44 / 55
    • Model List View Helper <h1 > Boards </ h1 > <?= $this - > modelList ( ’ Forum_Model_Board ’) ; ? > <h1 > Boards </ h1 > <?= $this - > modelList ( ’ Forum_Model_Board ’ , array ( ’ editRecordAction ’ = > ’ edit - board ’ , ’ addRecordAction ’ = > ’add - board ’ , ’ fieldLabels ’ = > array ( ’ id ’ = > ’ ID ’ , ’ category_id ’ = > ’ Category ’ , ’ name ’ = > ’ Name ’ , ’ description ’ = > ’ Description ’ , ) )); ?> Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 44 / 55
    • Model List View Helper Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 45 / 55
    • Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 46 / 55
    • Questions? Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 47 / 55
    • Zend Framework 2.0 Currently Conversion to Namespaces Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 48 / 55
    • Zend Framework 2.0 Currently Conversion to Namespaces Specified Goals: 1. Ease the learning curve 2. Make extending the framework trivially simple 3. Simplify 4. Favor the explicit over the magical Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 48 / 55
    • Zend Framework 2.0 Currently Conversion to Namespaces Specified Goals: 1. Ease the learning curve 2. Make extending the framework trivially simple 3. Simplify 4. Favor the explicit over the magical ETA Q4/2010 or Q1/2011 Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 48 / 55
    • Doctrine 2 Separation of DBAL and ORM Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 49 / 55
    • Doctrine 2 Separation of DBAL and ORM Less Magic, More Explicit Design Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 49 / 55
    • Doctrine 2 Separation of DBAL and ORM Less Magic, More Explicit Design DataMapper instead of ActiveRecord Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 49 / 55
    • Doctrine 2 Separation of DBAL and ORM Less Magic, More Explicit Design DataMapper instead of ActiveRecord Powerful Metadata Mapping Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 49 / 55
    • Doctrine 2 Separation of DBAL and ORM Less Magic, More Explicit Design DataMapper instead of ActiveRecord Powerful Metadata Mapping Considerable Performance Improvements Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 49 / 55
    • Doctrine 2 Separation of DBAL and ORM Less Magic, More Explicit Design DataMapper instead of ActiveRecord Powerful Metadata Mapping Considerable Performance Improvements Currently Beta 1, Release on September 1st Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 49 / 55
    • Doctrine 2 Separation of DBAL and ORM Less Magic, More Explicit Design DataMapper instead of ActiveRecord Powerful Metadata Mapping Considerable Performance Improvements Currently Beta 1, Release on September 1st First class citizen in Symfony 2 Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 49 / 55
    • Wednesday, 8:30, Room Salon 1 Guilherme on Doctrine 2! Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 50 / 55
    • Doctrine 2 DBAL PDO API (ezcDatabase) Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 51 / 55
    • Doctrine 2 DBAL PDO API (ezcDatabase) Currently Support for MySql, PgSql, Oracle, Sqlite, IBM and PDO Db2 Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 51 / 55
    • Doctrine 2 DBAL PDO API (ezcDatabase) Currently Support for MySql, PgSql, Oracle, Sqlite, IBM and PDO Db2 SqlSrv (+PDO) under development Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 51 / 55
    • Doctrine 2 DBAL PDO API (ezcDatabase) Currently Support for MySql, PgSql, Oracle, Sqlite, IBM and PDO Db2 SqlSrv (+PDO) under development Lots of Convenience Methods (Zend Db) Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 51 / 55
    • Doctrine 2 DBAL PDO API (ezcDatabase) Currently Support for MySql, PgSql, Oracle, Sqlite, IBM and PDO Db2 SqlSrv (+PDO) under development Lots of Convenience Methods (Zend Db) Currently planned: A Query Object (Zend Db Select, ezcDatabaseQuery) Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 51 / 55
    • Doctrine 2 DBAL PDO API (ezcDatabase) Currently Support for MySql, PgSql, Oracle, Sqlite, IBM and PDO Db2 SqlSrv (+PDO) under development Lots of Convenience Methods (Zend Db) Currently planned: A Query Object (Zend Db Select, ezcDatabaseQuery) SQL DDL and Data-QL abstraction (PEAR MDB2 and ezcDatabaseSchema) Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 51 / 55
    • Doctrine 2 DBAL Schema An OO-Approach to Database Schema Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 52 / 55
    • Doctrine 2 DBAL Schema An OO-Approach to Database Schema Vendor independent abstraction of Tables, Indexes, ForeignKeys and Sequences Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 52 / 55
    • Doctrine 2 DBAL Schema An OO-Approach to Database Schema Vendor independent abstraction of Tables, Indexes, ForeignKeys and Sequences Get required set-up or tear-down SQL Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 52 / 55
    • Doctrine 2 DBAL Schema An OO-Approach to Database Schema Vendor independent abstraction of Tables, Indexes, ForeignKeys and Sequences Get required set-up or tear-down SQL Get SQL to move from one to another schema Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 52 / 55
    • Doctrine 2 DBAL Schema An OO-Approach to Database Schema Vendor independent abstraction of Tables, Indexes, ForeignKeys and Sequences Get required set-up or tear-down SQL Get SQL to move from one to another schema Doctrine Migrations Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 52 / 55
    • ZF 2 with Doctrine DBAL 2 First class support? Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 53 / 55
    • ZF 2 with Doctrine DBAL 2 First class support? Doctrine 2 DBAL API compatible with Zend Db? Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 53 / 55
    • ZF 2 with Doctrine DBAL 2 First class support? Doctrine 2 DBAL API compatible with Zend Db? Zend Db Select drop-in replacement? Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 53 / 55
    • ZF 2 with Doctrine DBAL 2 First class support? Doctrine 2 DBAL API compatible with Zend Db? Zend Db Select drop-in replacement? Table-, Row-Data-Gateway? Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 53 / 55
    • ZF 2 with Doctrine DBAL 2 First class support? Doctrine 2 DBAL API compatible with Zend Db? Zend Db Select drop-in replacement? Table-, Row-Data-Gateway? ORM Integration? Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 53 / 55
    • Questions? Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 54 / 55
    • Thank You! Please rate this talk on joind.in: http://joind.in/1710 Twitter: @beberlei Blog: http://www.whitewashing.de Eberlei (direkt effekt GmbH) ZF and Doctrine 1 IPC Spring 2010 55 / 55