SlideShare ist ein Scribd-Unternehmen logo
1 von 128
Downloaden Sie, um offline zu lesen
Nashville LAMP




                    What is Doctrine?



What is Doctrine?      www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Doctrine is a ORM
                     written in PHP




What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    What is an ORM?




What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    ORM stands for
                Object Relational Mapper




What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                      Manipulate RDBMS
                    as a set of PHP objects




What is Doctrine?       www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Easy to get started




What is Doctrine?     www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Doctrine Sandbox




What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                    Doctrine Sandbox
   $ svn co http://svn.doctrine-project.org/branches/1.1 lamp_doctrine
   $ cd lamp_doctrine/tools/sandbox
   $ php doctrine.php




            Command Line



What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

User:                  Test Schema
  columns:
    first_name:
                    lamp_doctrine/tools/sandbox/schema/schema.yml
      type: string(255)
      notnull: true                 Phonenumber:
    last_name:                        columns:
      type: string(255)                 phonenumber:
      notnull: true                       type: string(55)
    username:                             notnull: true
      type: string(255)                 user_id:
      unique: true                        type: integer
      notnull: true                       notnull: true
    password:                         relations:
      type: string(255)                 User:
      notnull: true                       foreignAlias: Phonenumbers
    email_address:                        onDelete: CASCADE
      type: string(255)
      notnull: true
      email: true
      unique: true

What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                                        Test Data
                    lamp_doctrine/tools/sandbox/data/fixtures/data.yml

                       User:
                         jwage:
                           first_name: Jonathan
                           last_name: Wage
                           username: jwage
                           password: changeme
                           email_address: jonathan.wage@sensio.com
                           Phonenumbers:
                             cell:
                                phonenumber: 6155139185
                             office:
                                phonenumber: 4159925468




What is Doctrine?            www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                    Build All Reload
                    $ php doctrine.php build-all-reload




What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                    Running Tests
• First DQL Query
• Working with objects
• Writing DQL Queries
     – SELECT queries
     – UPDATE queries
     – DELETE queries
• Custom Accessors/Mutators
• Using Migrations


What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                       First DQL Query
            $ php doctrine.php dql quot;FROM User u, u.Phonenumbers pquot;




What is Doctrine?       www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                       Working with Objects
                           lamp_doctrine/tools/sandbox/index.php

                                       Insert new User

                    $user = new User();
                    $user->first_name = 'Fabien';
                    $user->last_name = 'Potencier';
                    $user->username = 'fabpot';
                    $user->password = 'changeme';
                    $user->email_address = 'fabien.potencier@sensio.com';
                    $user->save();




                                $ php index.php

What is Doctrine?              www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                    Working with Objects
                        lamp_doctrine/tools/sandbox/index.php


                                 Edit existing User

                    $userTable = Doctrine::getTable('User');

                    $user = $userTable->findOneByUsername('jwage');
                    $user->password = 'newpassword';
                    $user->save();




                             $ php index.php

What is Doctrine?           www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                      Working with Objects
                         lamp_doctrine/tools/sandbox/index.php


                            Adding Phonenumbers
                    $userTable = Doctrine::getTable('User');

                    $user = $userTable->findOneByUsername('fabpot');

                    $user->Phonenumbers[]->phonenumber = '1233451234';
                    $user->Phonenumbers[]->phonenumber = '9875674543';

                    $user->save();


                              $ php index.php

What is Doctrine?            www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                    Working with Objects
                       lamp_doctrine/tools/sandbox/index.php


                                 Deleting Objects

                    $userTable = Doctrine::getTable('User');

                    $user = $userTable->findOneByUsername('fabpot');
                    $user->Phonenumbers[0]->delete();




                            $ php index.php

What is Doctrine?          www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                     Working with Objects
                        lamp_doctrine/tools/sandbox/index.php


                             Deleting Collections

                    $userTable = Doctrine::getTable('User');

                    $user = $userTable->findOneByUsername('fabpot');
                    $user->Phonenumbers->delete();




                             $ php index.php

What is Doctrine?           www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                    Writing DQL Queries
                     lamp_doctrine/tools/sandbox/index.php


                              SELECT Queries

                                    $q = Doctrine::getTable('User')
                                      ->createQuery('u');

                                    $users = $q->execute();

                                    print_r($users->toArray());




                         $ php index.php

What is Doctrine?       www.doctrine-project.org                  www.sensiolabs.com
Nashville LAMP

                    Writing DQL Queries
                    Array
                    (
                      [0] => Array
                         (
                           [id] => 1
                           [first_name] => Jonathan
                           [last_name] => Wage
                           [username] => jwage
                           [password] => changeme
                           [email_address] => jonathan.wage@sensio.com
                         )

                        [1] => Array
                           (
                             [id] => 2
                             [first_name] => Fabien
                             [last_name] => Potencier
                             [username] => fabpot
                             [password] => changeme
                             [email_address] => fabien.potencier@sensio.com
                           )

                    )
What is Doctrine?           www.doctrine-project.org       www.sensiolabs.com
Nashville LAMP

                    Writing DQL Queries
                     lamp_doctrine/tools/sandbox/index.php


                              SELECT Queries
                    $q = Doctrine::getTable('User')
                      ->createQuery('u')
                      ->leftJoin('u.Phonenumbers p')
                      ->andWhere('u.username = ?', 'jwage');

                    $users = $q->execute();

                    print_r($users->toArray(true));


                         $ php index.php

What is Doctrine?       www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                    Writing DQL Queries
                       Array
                       (
                         [0] => Array
                            (
                              [id] => 1
                              [first_name] => Jonathan
                              [last_name] => Wage
                              [username] => jwage
                              [password] => changeme
                              [email_address] => jonathan.wage@sensio.com
                              [Phonenumbers] => Array
                                  (
                                     [0] => Array
                                        (
                                          [id] => 1
                                          [phonenumber] => 6155139185
                                          [user_id] => 1
                                          [User] =>
                                        )

                                     [1] => Array
                                        (
                                          [id] => 2
                                          [phonenumber] => 4159925468
                                          [user_id] => 1
                                          [User] =>
                                        )

                                 )

                            )

                       )


What is Doctrine?     www.doctrine-project.org                      www.sensiolabs.com
Nashville LAMP

                       Writing DQL Queries
                          lamp_doctrine/tools/sandbox/index.php

                                  UPDATE Queries
                    $q = Doctrine::getTable('User')
                      ->createQuery('u')
                      ->update()
                      ->set('email_address', '?', 'jonwage@gmail.com')
                      ->andWhere('username = ?', 'jwage');

                    $affectedRows = $q->execute();

                    echo $affectedRows; // 1


                              $ php index.php

What is Doctrine?            www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                    Writing DQL Queries
                     lamp_doctrine/tools/sandbox/index.php

                             DELETE Queries
                     $q = Doctrine::getTable('User')
                       ->createQuery('u')
                       ->delete()
                       ->andWhere('username = ?', 'jwage');

                     $affectedRows = $q->execute();

                     echo $affectedRows; // 1



                         $ php index.php

What is Doctrine?       www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

          Custom Accessors
    Enable Auto Accessor Override

                    lamp_doctrine/tools/sandbox/config.php



   // ...
   $manager = Doctrine_Manager::getInstance();
   $manager->setAttribute('auto_accessor_override', true);




What is Doctrine?       www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                    Custom Accessors




               Custom `name` accessor




What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                       Custom Accessors
                    lamp_doctrine/tools/sandbox/models/User.php




              class User extends BaseUser
              {
                public function getName()
                {
                  return trim($this->first_name.' '.$this->last_name);
                }
              }




What is Doctrine?          www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                    Custom Accessors
                    lamp_doctrine/tools/sandbox/index.php




                    $q = Doctrine::getTable('User')
                      ->createQuery('u')
                      ->andWhere('username = ?', 'jwage');

                    $user = $q->fetchOne();

                    echo $user->name; // Jonathan Wage




                        $ php index.php

What is Doctrine?      www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                          Custom Mutator

                          MD5 encrypt passwords

                    class User extends BaseUser
                    {
                      // ...

                        public function setPassword($password)
                        {
                          $this->_set('password', md5($password));
                        }
                    }




What is Doctrine?           www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                       Custom Mutator

                       MD5 encrypt passwords

            $q = Doctrine::getTable('User')
              ->createQuery('u')
              ->andWhere('username = ?', 'jwage');

            $user = $q->fetchOne();

            $user->password = 'changeme';
            $user->save();

            echo $user->password; // 4cb9c8a8048fd02294477fcb1a41191a




What is Doctrine?        www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                Accessor/Mutator Syntax
                    Object property, function, array access




                        echo $user->name;
                        echo $user->get('name');
                        echo $user['name'];




What is Doctrine?        www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Database Migrations




What is Doctrine?     www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Deploy schema changes




What is Doctrine?       www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                Maintain production data




What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




              Programmatic interface
            for issuing DDL statements




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Versions your database




What is Doctrine?       www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




       Upgrade your database to new versions
          Downgrade to previous versions




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                    Database Migrations




 Add new status column to users




What is Doctrine?     www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                    Database Migrations



                    User:
                      columns:
                    # ...
                        status:
                          type: enum
                          values: [Pending, Active, Inactive]




What is Doctrine?        www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                      Database Migrations

                    Generate migration class

                       $ php doctrine generate-migrations-diff




What is Doctrine?         www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                        Database Migrations
                    Generate migration class
                    class Version1 extends Doctrine_Migration_Base
                    {
                        public function up()
                        {
                            $this->addColumn('user', 'status', 'enum',
                    '', array('values' => array(0 => 'Pending', 1 =>
                    'Active', 2 => 'Inactive')));
                        }

                        public function down()
                        {
                            $this->removeColumn('user', 'status');
                        }
                    }

What is Doctrine?              www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                    Database Migrations
             Customize migration class
class Version1 extends Doctrine_Migration_Base
{
    public function postUp()
    {
        Doctrine::loadModels(realpath(dirname(__FILE__).'/../models'));

               Doctrine::getTable('User')
                   ->createQuery('u')
                   ->update()
                   ->set('status', '?', 'Active')
                   ->execute();
       }

// ...
}

What is Doctrine?          www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                    Database Migrations
                    Executing migration


                    $ php doctrine migrate
                    migrate - migrated successfully to version #1




What is Doctrine?         www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                    Database Migrations
             Update models from YAML

                     $ php doctrine generate-models-yaml




What is Doctrine?       www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                    Database Migrations
                    Inspect migration was
                       successful or not




                     New status column exists
                      Default `Active` value
What is Doctrine?       www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




               Future of Doctrine?



What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                     New Versions




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                        Doctrine 1.2




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Continued evolution
                    of the 1.x codebase




What is Doctrine?     www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                        Doctrine 2.0




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




           Almost complete re-rewrite




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                     Major version




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Requires PHP 5.3




What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




  Performance increases from 5.3




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Test suite runs
                      20% faster



What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                     And uses 30%
                     less memory



What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Hydration performance
                        improvements



What is Doctrine?       www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

                    Hydration Performance

                      Doctrine 1.1
                      4.3435637950897 for 5000 records

                      Doctrine 2.0
                      1.4314442552312 for 5000 records

                      Doctrine 2.0
                      3.4690098762512 for 10000 records




What is Doctrine?         www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP

              Removed Major Limitation
                    No need to extend a base class


                                                             /**
class User extends Doctrine_Record                             * @DoctrineEntity
{                                                              * @DoctrineTable(name=quot;userquot;)
    public function setTableDefinition()                       */
    {                                                        class User
        $this->hasColumn('id', 'integer', null, array(       {
          'primary' => true,                                      /**
          'auto_increment' => true                                 * @DoctrineId
        ));                                                        * @DoctrineColumn(type=quot;integerquot;)
                                                                   * @DoctrineGeneratedValue(strategy=quot;autoquot;)
          $this->hasColumn('username', 'string', 255);             */
     }                                                            public $id;
}
                                                                 /**
                                                                  * @DoctrineColumn(type=quot;varcharquot;, length=255)
                                                                  */
                                                                 public $username;
                                                             }




What is Doctrine?                 www.doctrine-project.org              www.sensiolabs.com
Nashville LAMP




  No more crazy cyclic references




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP



                    print_r() your objects

                      $user = new User();
                      $user->username = 'jwage';
                      print_r($user);


                      User Object
                      (
                        [id] =>
                        [username] => jwage
                      )


What is Doctrine?      www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                     Positive effects of
                    removing the base
                      class all around



What is Doctrine?     www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                       General
                    Improvements


What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Code de-coupled




What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    3 Main Packages




What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                               Common




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                                        DBAL




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                                          ORM




What is Doctrine?   www.doctrine-project.org    www.sensiolabs.com
Nashville LAMP




                      Use Doctrine DBAL
                    separate from the ORM



What is Doctrine?       www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




       Easier to extend and override
                   things



What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Better support for
                    multiple databases




What is Doctrine?     www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Sequences, schemas
                       and catalogs




What is Doctrine?     www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Simplified connection
                        information

   $config = new DoctrineORMConfiguration();
   $eventManager = new DoctrineCommonEventManager();
   $connectionOptions = array(
       'driver' => 'pdo_sqlite',
       'path' => 'database.sqlite'
   );
   $em = DoctrineORMEntityManager::create($connectionOptions, $config, $eventManager);




What is Doctrine?         www.doctrine-project.org       www.sensiolabs.com
Nashville LAMP




               No more DSN nightmares




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Connection information
                      specified as arrays




What is Doctrine?       www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                      Removed old
                    attribute system




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Replaced with simpler
                     string based system




What is Doctrine?      www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Real Native SQL support




What is Doctrine?       www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Driver Based
                     Meta Data


What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP


                        PHP Annotations
                    /**
                      * @DoctrineEntity
                      * @DoctrineTable(name=quot;userquot;)
                      */
                    class User
                    {
                         /**
                          * @DoctrineId
                          * @DoctrineColumn(type=quot;integerquot;)
                          * @DoctrineGeneratedValue(strategy=quot;autoquot;)
                          */
                         public $id;

                        /**
                         * @DoctrineColumn(type=quot;varcharquot;, length=255)
                         */
                        public $username;
                    }




What is Doctrine?        www.doctrine-project.org        www.sensiolabs.com
Nashville LAMP


                              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 is Doctrine?   www.doctrine-project.org        www.sensiolabs.com
Nashville LAMP


                                        YAML

                                         class User
                                         {
                                           public
                                             $id,
                                             $username;
                                         }



                                 User:
                                   properties:
                                     id:
                                       id: true
                                       type: integer
                                       idGenerator: auto
                                     username:
                                       type: varchar
                                       length: 255




What is Doctrine?   www.doctrine-project.org              www.sensiolabs.com
Nashville LAMP




                    Write your own driver




What is Doctrine?      www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                                  Cache



What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                           Query Cache
                    Cache final SQL that is parsed from DQL




What is Doctrine?       www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Metadata Cache
                    Cache the parsing of meta data




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                       Result Cache
                    Cache the results of your queries




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Inheritance
                     Mapping


What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                        Single Table
                            One table per hierarchy




What is Doctrine?   www.doctrine-project.org    www.sensiolabs.com
Nashville LAMP




                          Class Table
                                One table per class




What is Doctrine?   www.doctrine-project.org      www.sensiolabs.com
Nashville LAMP




                    Concrete Table
                       One table per concrete class




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                              Testing



What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Switched to phpUnit




What is Doctrine?     www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Better mock testing




What is Doctrine?     www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




Easy to run tests against multiple
              DBMS




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Code de-coupled so
                     it is easier to test




What is Doctrine?      www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    New Features



What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    New DQL Parser



What is Doctrine?     www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                       Hand written




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Recursive-descent
                         parser




What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Constructs AST




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    PHP Class names
                    directly represent
                      DQL language



What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                     Every DQL feature
                    has a class to handle
                           parsing



What is Doctrine?      www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                        Easy to maintain
                    Easy to add new features
                           Easy to use



What is Doctrine?        www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                      Performance?




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                Final SQL can be
         easily and effectively cached



What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Not practical to parse
                         every time



What is Doctrine?      www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                       Custom
                    Column Types


What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Add your own data types




What is Doctrine?       www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Types are OOP classes




What is Doctrine?      www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                     Easy to extend
                    or add new types




What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Extend DQL



What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    DQL parser can
                     be extended




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Add your own
                    DQL functions




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                                 When?



What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                       First release
                    in September 09`



What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                                     ALPHA




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                                         BETA




What is Doctrine?   www.doctrine-project.org    www.sensiolabs.com
Nashville LAMP




                                               RC




What is Doctrine?   www.doctrine-project.org        www.sensiolabs.com
Nashville LAMP




                    Stable - 2010’ ?




What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    What is next?



What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Publishing of first
                     Doctrine book



What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                      Write more
                    documentation



What is Doctrine?   www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    Publish more books




What is Doctrine?     www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP



                    Doctrine community
                    extension repository

                      Symfony has Plugins

                                                  and

                     Doctrine has Extensions


What is Doctrine?      www.doctrine-project.org         www.sensiolabs.com
Nashville LAMP




                       Default DBAL
                    and ORM in PEAR2?



                    De-facto standard?


What is Doctrine?     www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP




                    It is up to you! :)




What is Doctrine?    www.doctrine-project.org   www.sensiolabs.com
Nashville LAMP



                      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 is Doctrine?      www.doctrine-project.org   www.sensiolabs.com

Weitere ähnliche Inhalte

Was ist angesagt?

Object Oriented Programming with PHP 5 - More OOP
Object Oriented Programming with PHP 5 - More OOPObject Oriented Programming with PHP 5 - More OOP
Object Oriented Programming with PHP 5 - More OOPWildan Maulana
 
Object Oriented Programming in PHP
Object Oriented Programming in PHPObject Oriented Programming in PHP
Object Oriented Programming in PHPLorna Mitchell
 
Moose workshop
Moose workshopMoose workshop
Moose workshopYnon Perek
 
What's New In Doctrine
What's New In DoctrineWhat's New In Doctrine
What's New In DoctrineJonathan Wage
 
Introduction to Moose
Introduction to MooseIntroduction to Moose
Introduction to Moosethashaa
 
Synapseindia object oriented programming in php
Synapseindia object oriented programming in phpSynapseindia object oriented programming in php
Synapseindia object oriented programming in phpSynapseindiappsdevelopment
 
Why (I think) CoffeeScript Is Awesome
Why (I think) CoffeeScript Is AwesomeWhy (I think) CoffeeScript Is Awesome
Why (I think) CoffeeScript Is AwesomeJo Cranford
 
Introduction To Moose
Introduction To MooseIntroduction To Moose
Introduction To MooseMike Whitaker
 
Class and Objects in PHP
Class and Objects in PHPClass and Objects in PHP
Class and Objects in PHPRamasubbu .P
 
Advanced php
Advanced phpAdvanced php
Advanced phphamfu
 
Drupal 8 templating with twig
Drupal 8 templating with twigDrupal 8 templating with twig
Drupal 8 templating with twigTaras Omelianenko
 
Coffeescript: No really, it's just Javascript
Coffeescript: No really, it's just JavascriptCoffeescript: No really, it's just Javascript
Coffeescript: No really, it's just JavascriptBrian Mann
 
Intermediate OOP in PHP
Intermediate OOP in PHPIntermediate OOP in PHP
Intermediate OOP in PHPDavid Stockton
 

Was ist angesagt? (18)

Object Oriented Programming with PHP 5 - More OOP
Object Oriented Programming with PHP 5 - More OOPObject Oriented Programming with PHP 5 - More OOP
Object Oriented Programming with PHP 5 - More OOP
 
Object Oriented Programming in PHP
Object Oriented Programming in PHPObject Oriented Programming in PHP
Object Oriented Programming in PHP
 
Moose workshop
Moose workshopMoose workshop
Moose workshop
 
Oops in PHP
Oops in PHPOops in PHP
Oops in PHP
 
Ch8(oop)
Ch8(oop)Ch8(oop)
Ch8(oop)
 
Oops concept in php
Oops concept in phpOops concept in php
Oops concept in php
 
What's New In Doctrine
What's New In DoctrineWhat's New In Doctrine
What's New In Doctrine
 
Introduction to Moose
Introduction to MooseIntroduction to Moose
Introduction to Moose
 
Synapseindia object oriented programming in php
Synapseindia object oriented programming in phpSynapseindia object oriented programming in php
Synapseindia object oriented programming in php
 
Why (I think) CoffeeScript Is Awesome
Why (I think) CoffeeScript Is AwesomeWhy (I think) CoffeeScript Is Awesome
Why (I think) CoffeeScript Is Awesome
 
Php Oop
Php OopPhp Oop
Php Oop
 
Introduction To Moose
Introduction To MooseIntroduction To Moose
Introduction To Moose
 
Class and Objects in PHP
Class and Objects in PHPClass and Objects in PHP
Class and Objects in PHP
 
Advanced php
Advanced phpAdvanced php
Advanced php
 
Drupal 8 templating with twig
Drupal 8 templating with twigDrupal 8 templating with twig
Drupal 8 templating with twig
 
Coffeescript: No really, it's just Javascript
Coffeescript: No really, it's just JavascriptCoffeescript: No really, it's just Javascript
Coffeescript: No really, it's just Javascript
 
OOP in PHP
OOP in PHPOOP in PHP
OOP in PHP
 
Intermediate OOP in PHP
Intermediate OOP in PHPIntermediate OOP in PHP
Intermediate OOP in PHP
 

Andere mochten auch

Doctrine 2 - Not The Same Old Php Orm
Doctrine 2 - Not The Same Old Php OrmDoctrine 2 - Not The Same Old Php Orm
Doctrine 2 - Not The Same Old Php OrmJonathan Wage
 
What's new in Doctrine
What's new in DoctrineWhat's new in Doctrine
What's new in DoctrineJonathan Wage
 
Ssm Theology Week 2
Ssm Theology Week 2Ssm Theology Week 2
Ssm Theology Week 2Alan Shelby
 
Ssm Theology Week 1
Ssm Theology Week 1Ssm Theology Week 1
Ssm Theology Week 1Alan Shelby
 
Is The Trinity Doctrine Divinely Inspired
Is The Trinity Doctrine Divinely InspiredIs The Trinity Doctrine Divinely Inspired
Is The Trinity Doctrine Divinely Inspiredzakir2012
 
Ecclesiology Part 2 - The Purpose of the Church.
Ecclesiology Part 2 - The Purpose of the Church.Ecclesiology Part 2 - The Purpose of the Church.
Ecclesiology Part 2 - The Purpose of the Church.Robert Tan
 
Ssm Theology Week 8
Ssm Theology Week 8Ssm Theology Week 8
Ssm Theology Week 8Alan Shelby
 
Ecclesiology Part 4 - Discipleship 2 -The Cost of discipleship
Ecclesiology Part 4  -  Discipleship 2 -The Cost of discipleshipEcclesiology Part 4  -  Discipleship 2 -The Cost of discipleship
Ecclesiology Part 4 - Discipleship 2 -The Cost of discipleshipRobert Tan
 
the doctrine of the trinity by a f buzzard and c f hunting
the doctrine of the trinity by a f buzzard and c f huntingthe doctrine of the trinity by a f buzzard and c f hunting
the doctrine of the trinity by a f buzzard and c f huntingAbuToshiba
 
Ecclesiology Part 1 - The Study of the Church
Ecclesiology Part 1 - The Study of the Church Ecclesiology Part 1 - The Study of the Church
Ecclesiology Part 1 - The Study of the Church Robert Tan
 
Ecclesiology Catholic Church
Ecclesiology Catholic ChurchEcclesiology Catholic Church
Ecclesiology Catholic ChurchJunmar Tagbacaola
 
The doctrine of the trinity
The doctrine of the trinityThe doctrine of the trinity
The doctrine of the trinityAndre Fernandez
 
Ecclesiology: Doctrine of the Church
Ecclesiology:  Doctrine of the ChurchEcclesiology:  Doctrine of the Church
Ecclesiology: Doctrine of the ChurchBangkok, Thailand
 
Symfony 1.3 + Doctrine 1.2
Symfony 1.3 + Doctrine 1.2Symfony 1.3 + Doctrine 1.2
Symfony 1.3 + Doctrine 1.2Jonathan Wage
 
Eclesiology Part 3 - Discipleship 1 - The Call of discipleship
Eclesiology Part 3 - Discipleship 1 - The Call of discipleshipEclesiology Part 3 - Discipleship 1 - The Call of discipleship
Eclesiology Part 3 - Discipleship 1 - The Call of discipleshipRobert Tan
 
Apples Doctrine of Marketing Report
Apples Doctrine of Marketing ReportApples Doctrine of Marketing Report
Apples Doctrine of Marketing ReportTink Newman
 
The doctrine of salvation
The doctrine of salvationThe doctrine of salvation
The doctrine of salvationAndre Fernandez
 

Andere mochten auch (20)

Doctrine 2 - Not The Same Old Php Orm
Doctrine 2 - Not The Same Old Php OrmDoctrine 2 - Not The Same Old Php Orm
Doctrine 2 - Not The Same Old Php Orm
 
What's new in Doctrine
What's new in DoctrineWhat's new in Doctrine
What's new in Doctrine
 
Symfony 2.0 on PHP 5.3
Symfony 2.0 on PHP 5.3Symfony 2.0 on PHP 5.3
Symfony 2.0 on PHP 5.3
 
Ssm Theology Week 2
Ssm Theology Week 2Ssm Theology Week 2
Ssm Theology Week 2
 
Ssm Theology Week 1
Ssm Theology Week 1Ssm Theology Week 1
Ssm Theology Week 1
 
Ecclessiology 2
Ecclessiology 2Ecclessiology 2
Ecclessiology 2
 
Is The Trinity Doctrine Divinely Inspired
Is The Trinity Doctrine Divinely InspiredIs The Trinity Doctrine Divinely Inspired
Is The Trinity Doctrine Divinely Inspired
 
Ecclesiology Part 2 - The Purpose of the Church.
Ecclesiology Part 2 - The Purpose of the Church.Ecclesiology Part 2 - The Purpose of the Church.
Ecclesiology Part 2 - The Purpose of the Church.
 
Ssm Theology Week 8
Ssm Theology Week 8Ssm Theology Week 8
Ssm Theology Week 8
 
Ecclesiology Part 4 - Discipleship 2 -The Cost of discipleship
Ecclesiology Part 4  -  Discipleship 2 -The Cost of discipleshipEcclesiology Part 4  -  Discipleship 2 -The Cost of discipleship
Ecclesiology Part 4 - Discipleship 2 -The Cost of discipleship
 
Doctrine of sin
Doctrine of sinDoctrine of sin
Doctrine of sin
 
the doctrine of the trinity by a f buzzard and c f hunting
the doctrine of the trinity by a f buzzard and c f huntingthe doctrine of the trinity by a f buzzard and c f hunting
the doctrine of the trinity by a f buzzard and c f hunting
 
Ecclesiology Part 1 - The Study of the Church
Ecclesiology Part 1 - The Study of the Church Ecclesiology Part 1 - The Study of the Church
Ecclesiology Part 1 - The Study of the Church
 
Ecclesiology Catholic Church
Ecclesiology Catholic ChurchEcclesiology Catholic Church
Ecclesiology Catholic Church
 
The doctrine of the trinity
The doctrine of the trinityThe doctrine of the trinity
The doctrine of the trinity
 
Ecclesiology: Doctrine of the Church
Ecclesiology:  Doctrine of the ChurchEcclesiology:  Doctrine of the Church
Ecclesiology: Doctrine of the Church
 
Symfony 1.3 + Doctrine 1.2
Symfony 1.3 + Doctrine 1.2Symfony 1.3 + Doctrine 1.2
Symfony 1.3 + Doctrine 1.2
 
Eclesiology Part 3 - Discipleship 1 - The Call of discipleship
Eclesiology Part 3 - Discipleship 1 - The Call of discipleshipEclesiology Part 3 - Discipleship 1 - The Call of discipleship
Eclesiology Part 3 - Discipleship 1 - The Call of discipleship
 
Apples Doctrine of Marketing Report
Apples Doctrine of Marketing ReportApples Doctrine of Marketing Report
Apples Doctrine of Marketing Report
 
The doctrine of salvation
The doctrine of salvationThe doctrine of salvation
The doctrine of salvation
 

Ähnlich wie What Is Doctrine?

Donetconf2016: The Future of C#
Donetconf2016: The Future of C#Donetconf2016: The Future of C#
Donetconf2016: The Future of C#Jacinto Limjap
 
oop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.comoop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.comtutorialsruby
 
Oop in php_tutorial_for_killerphp.com
Oop in php_tutorial_for_killerphp.comOop in php_tutorial_for_killerphp.com
Oop in php_tutorial_for_killerphp.comayandoesnotemail
 
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applicationschartjes
 
Dependency Injection for PHP
Dependency Injection for PHPDependency Injection for PHP
Dependency Injection for PHPmtoppa
 
WordPress Development in a Modern PHP World
WordPress Development in a Modern PHP WorldWordPress Development in a Modern PHP World
WordPress Development in a Modern PHP WorldDrewAPicture
 
Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.Workhorse Computing
 
WordPress Development in a Modern PHP World
WordPress Development in a Modern PHP WorldWordPress Development in a Modern PHP World
WordPress Development in a Modern PHP WorldDrewAPicture
 
Basic Oops concept of PHP
Basic Oops concept of PHPBasic Oops concept of PHP
Basic Oops concept of PHPRohan Sharma
 
RubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - KeynoteRubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - KeynoteDr Nic Williams
 
Modernizing Legacy Applications in PHP, por Paul Jones
Modernizing Legacy Applications in PHP, por Paul JonesModernizing Legacy Applications in PHP, por Paul Jones
Modernizing Legacy Applications in PHP, por Paul JonesiMasters
 
Learning PHP for Drupal Theming, DC Chicago 2009
Learning PHP for Drupal Theming, DC Chicago 2009Learning PHP for Drupal Theming, DC Chicago 2009
Learning PHP for Drupal Theming, DC Chicago 2009Emma Jane Hogbin Westby
 

Ähnlich wie What Is Doctrine? (20)

Donetconf2016: The Future of C#
Donetconf2016: The Future of C#Donetconf2016: The Future of C#
Donetconf2016: The Future of C#
 
oop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.comoop_in_php_tutorial_for_killerphp.com
oop_in_php_tutorial_for_killerphp.com
 
Oop in php_tutorial_for_killerphp.com
Oop in php_tutorial_for_killerphp.comOop in php_tutorial_for_killerphp.com
Oop in php_tutorial_for_killerphp.com
 
Oop in php tutorial
Oop in php tutorialOop in php tutorial
Oop in php tutorial
 
Building Testable PHP Applications
Building Testable PHP ApplicationsBuilding Testable PHP Applications
Building Testable PHP Applications
 
Laravel doctrine
Laravel doctrineLaravel doctrine
Laravel doctrine
 
Dependency Injection for PHP
Dependency Injection for PHPDependency Injection for PHP
Dependency Injection for PHP
 
Lecture9_OOPHP_SPring2023.pptx
Lecture9_OOPHP_SPring2023.pptxLecture9_OOPHP_SPring2023.pptx
Lecture9_OOPHP_SPring2023.pptx
 
WordPress Development in a Modern PHP World
WordPress Development in a Modern PHP WorldWordPress Development in a Modern PHP World
WordPress Development in a Modern PHP World
 
2009-02 Oops!
2009-02 Oops!2009-02 Oops!
2009-02 Oops!
 
Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.
 
WordPress Development in a Modern PHP World
WordPress Development in a Modern PHP WorldWordPress Development in a Modern PHP World
WordPress Development in a Modern PHP World
 
Oop in php_tutorial
Oop in php_tutorialOop in php_tutorial
Oop in php_tutorial
 
Introduction Php
Introduction PhpIntroduction Php
Introduction Php
 
Basic Oops concept of PHP
Basic Oops concept of PHPBasic Oops concept of PHP
Basic Oops concept of PHP
 
RubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - KeynoteRubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - Keynote
 
OOP in PHP.pptx
OOP in PHP.pptxOOP in PHP.pptx
OOP in PHP.pptx
 
Modernizing Legacy Applications in PHP, por Paul Jones
Modernizing Legacy Applications in PHP, por Paul JonesModernizing Legacy Applications in PHP, por Paul Jones
Modernizing Legacy Applications in PHP, por Paul Jones
 
Learning PHP for Drupal Theming, DC Chicago 2009
Learning PHP for Drupal Theming, DC Chicago 2009Learning PHP for Drupal Theming, DC Chicago 2009
Learning PHP for Drupal Theming, DC Chicago 2009
 
Spl Not A Bridge Too Far phpNW09
Spl Not A Bridge Too Far phpNW09Spl Not A Bridge Too Far phpNW09
Spl Not A Bridge Too Far phpNW09
 

Mehr von Jonathan Wage

Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For BeginnersJonathan Wage
 
OpenSky Infrastructure
OpenSky InfrastructureOpenSky Infrastructure
OpenSky InfrastructureJonathan Wage
 
Doctrine In The Real World sflive2011 Paris
Doctrine In The Real World sflive2011 ParisDoctrine In The Real World sflive2011 Paris
Doctrine In The Real World sflive2011 ParisJonathan Wage
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the TrenchesJonathan Wage
 
Doctrine in the Real World
Doctrine in the Real WorldDoctrine in the Real World
Doctrine in the Real WorldJonathan Wage
 
ZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMJonathan Wage
 
ZendCon2010 The Doctrine Project
ZendCon2010 The Doctrine ProjectZendCon2010 The Doctrine Project
ZendCon2010 The Doctrine ProjectJonathan Wage
 
Symfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODMSymfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODMJonathan Wage
 
Doctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document MapperDoctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document MapperJonathan Wage
 
Symfony2 and Doctrine2 Integration
Symfony2 and Doctrine2 IntegrationSymfony2 and Doctrine2 Integration
Symfony2 and Doctrine2 IntegrationJonathan Wage
 
Doctrine 2 - Enterprise Persistence Layer For PHP
Doctrine 2 - Enterprise Persistence Layer For PHPDoctrine 2 - Enterprise Persistence Layer For PHP
Doctrine 2 - Enterprise Persistence Layer For PHPJonathan Wage
 
Introduction To Doctrine 2
Introduction To Doctrine 2Introduction To Doctrine 2
Introduction To Doctrine 2Jonathan Wage
 
Doctrine 2: Enterprise Persistence Layer for PHP
Doctrine 2: Enterprise Persistence Layer for PHPDoctrine 2: Enterprise Persistence Layer for PHP
Doctrine 2: Enterprise Persistence Layer for PHPJonathan Wage
 
Sympal A Cmf Based On Symfony
Sympal   A Cmf Based On SymfonySympal   A Cmf Based On Symfony
Sympal A Cmf Based On SymfonyJonathan Wage
 
Sympal - The flexible Symfony CMS
Sympal - The flexible Symfony CMSSympal - The flexible Symfony CMS
Sympal - The flexible Symfony CMSJonathan Wage
 
Sympal - Symfony CMS Preview
Sympal - Symfony CMS PreviewSympal - Symfony CMS Preview
Sympal - Symfony CMS PreviewJonathan Wage
 
Doctrine Php Object Relational Mapper
Doctrine Php Object Relational MapperDoctrine Php Object Relational Mapper
Doctrine Php Object Relational MapperJonathan Wage
 
Sympal - The Flexible Symfony Cms
Sympal - The Flexible Symfony CmsSympal - The Flexible Symfony Cms
Sympal - The Flexible Symfony CmsJonathan Wage
 

Mehr von Jonathan Wage (19)

Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For Beginners
 
OpenSky Infrastructure
OpenSky InfrastructureOpenSky Infrastructure
OpenSky Infrastructure
 
Doctrine In The Real World sflive2011 Paris
Doctrine In The Real World sflive2011 ParisDoctrine In The Real World sflive2011 Paris
Doctrine In The Real World sflive2011 Paris
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
 
Doctrine in the Real World
Doctrine in the Real WorldDoctrine in the Real World
Doctrine in the Real World
 
ZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODM
 
ZendCon2010 The Doctrine Project
ZendCon2010 The Doctrine ProjectZendCon2010 The Doctrine Project
ZendCon2010 The Doctrine Project
 
Symfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODMSymfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODM
 
Doctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document MapperDoctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document Mapper
 
Libertyvasion2010
Libertyvasion2010Libertyvasion2010
Libertyvasion2010
 
Symfony2 and Doctrine2 Integration
Symfony2 and Doctrine2 IntegrationSymfony2 and Doctrine2 Integration
Symfony2 and Doctrine2 Integration
 
Doctrine 2 - Enterprise Persistence Layer For PHP
Doctrine 2 - Enterprise Persistence Layer For PHPDoctrine 2 - Enterprise Persistence Layer For PHP
Doctrine 2 - Enterprise Persistence Layer For PHP
 
Introduction To Doctrine 2
Introduction To Doctrine 2Introduction To Doctrine 2
Introduction To Doctrine 2
 
Doctrine 2: Enterprise Persistence Layer for PHP
Doctrine 2: Enterprise Persistence Layer for PHPDoctrine 2: Enterprise Persistence Layer for PHP
Doctrine 2: Enterprise Persistence Layer for PHP
 
Sympal A Cmf Based On Symfony
Sympal   A Cmf Based On SymfonySympal   A Cmf Based On Symfony
Sympal A Cmf Based On Symfony
 
Sympal - The flexible Symfony CMS
Sympal - The flexible Symfony CMSSympal - The flexible Symfony CMS
Sympal - The flexible Symfony CMS
 
Sympal - Symfony CMS Preview
Sympal - Symfony CMS PreviewSympal - Symfony CMS Preview
Sympal - Symfony CMS Preview
 
Doctrine Php Object Relational Mapper
Doctrine Php Object Relational MapperDoctrine Php Object Relational Mapper
Doctrine Php Object Relational Mapper
 
Sympal - The Flexible Symfony Cms
Sympal - The Flexible Symfony CmsSympal - The Flexible Symfony Cms
Sympal - The Flexible Symfony Cms
 

Kürzlich hochgeladen

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
"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
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"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
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
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
 
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
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
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
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 

Kürzlich hochgeladen (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
"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
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"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
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
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
 
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
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
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
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
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
 

What Is Doctrine?

  • 1. Nashville LAMP What is Doctrine? What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 2. Nashville LAMP Doctrine is a ORM written in PHP What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 3. Nashville LAMP What is an ORM? What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 4. Nashville LAMP ORM stands for Object Relational Mapper What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 5. Nashville LAMP Manipulate RDBMS as a set of PHP objects What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 6. Nashville LAMP Easy to get started What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 7. Nashville LAMP Doctrine Sandbox What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 8. Nashville LAMP Doctrine Sandbox $ svn co http://svn.doctrine-project.org/branches/1.1 lamp_doctrine $ cd lamp_doctrine/tools/sandbox $ php doctrine.php Command Line What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 9. Nashville LAMP User: Test Schema columns: first_name: lamp_doctrine/tools/sandbox/schema/schema.yml type: string(255) notnull: true Phonenumber: last_name: columns: type: string(255) phonenumber: notnull: true type: string(55) username: notnull: true type: string(255) user_id: unique: true type: integer notnull: true notnull: true password: relations: type: string(255) User: notnull: true foreignAlias: Phonenumbers email_address: onDelete: CASCADE type: string(255) notnull: true email: true unique: true What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 10. Nashville LAMP Test Data lamp_doctrine/tools/sandbox/data/fixtures/data.yml User: jwage: first_name: Jonathan last_name: Wage username: jwage password: changeme email_address: jonathan.wage@sensio.com Phonenumbers: cell: phonenumber: 6155139185 office: phonenumber: 4159925468 What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 11. Nashville LAMP Build All Reload $ php doctrine.php build-all-reload What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 12. Nashville LAMP Running Tests • First DQL Query • Working with objects • Writing DQL Queries – SELECT queries – UPDATE queries – DELETE queries • Custom Accessors/Mutators • Using Migrations What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 13. Nashville LAMP First DQL Query $ php doctrine.php dql quot;FROM User u, u.Phonenumbers pquot; What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 14. Nashville LAMP Working with Objects lamp_doctrine/tools/sandbox/index.php Insert new User $user = new User(); $user->first_name = 'Fabien'; $user->last_name = 'Potencier'; $user->username = 'fabpot'; $user->password = 'changeme'; $user->email_address = 'fabien.potencier@sensio.com'; $user->save(); $ php index.php What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 15. Nashville LAMP Working with Objects lamp_doctrine/tools/sandbox/index.php Edit existing User $userTable = Doctrine::getTable('User'); $user = $userTable->findOneByUsername('jwage'); $user->password = 'newpassword'; $user->save(); $ php index.php What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 16. Nashville LAMP Working with Objects lamp_doctrine/tools/sandbox/index.php Adding Phonenumbers $userTable = Doctrine::getTable('User'); $user = $userTable->findOneByUsername('fabpot'); $user->Phonenumbers[]->phonenumber = '1233451234'; $user->Phonenumbers[]->phonenumber = '9875674543'; $user->save(); $ php index.php What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 17. Nashville LAMP Working with Objects lamp_doctrine/tools/sandbox/index.php Deleting Objects $userTable = Doctrine::getTable('User'); $user = $userTable->findOneByUsername('fabpot'); $user->Phonenumbers[0]->delete(); $ php index.php What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 18. Nashville LAMP Working with Objects lamp_doctrine/tools/sandbox/index.php Deleting Collections $userTable = Doctrine::getTable('User'); $user = $userTable->findOneByUsername('fabpot'); $user->Phonenumbers->delete(); $ php index.php What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 19. Nashville LAMP Writing DQL Queries lamp_doctrine/tools/sandbox/index.php SELECT Queries $q = Doctrine::getTable('User') ->createQuery('u'); $users = $q->execute(); print_r($users->toArray()); $ php index.php What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 20. Nashville LAMP Writing DQL Queries Array ( [0] => Array ( [id] => 1 [first_name] => Jonathan [last_name] => Wage [username] => jwage [password] => changeme [email_address] => jonathan.wage@sensio.com ) [1] => Array ( [id] => 2 [first_name] => Fabien [last_name] => Potencier [username] => fabpot [password] => changeme [email_address] => fabien.potencier@sensio.com ) ) What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 21. Nashville LAMP Writing DQL Queries lamp_doctrine/tools/sandbox/index.php SELECT Queries $q = Doctrine::getTable('User') ->createQuery('u') ->leftJoin('u.Phonenumbers p') ->andWhere('u.username = ?', 'jwage'); $users = $q->execute(); print_r($users->toArray(true)); $ php index.php What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 22. Nashville LAMP Writing DQL Queries Array ( [0] => Array ( [id] => 1 [first_name] => Jonathan [last_name] => Wage [username] => jwage [password] => changeme [email_address] => jonathan.wage@sensio.com [Phonenumbers] => Array ( [0] => Array ( [id] => 1 [phonenumber] => 6155139185 [user_id] => 1 [User] => ) [1] => Array ( [id] => 2 [phonenumber] => 4159925468 [user_id] => 1 [User] => ) ) ) ) What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 23. Nashville LAMP Writing DQL Queries lamp_doctrine/tools/sandbox/index.php UPDATE Queries $q = Doctrine::getTable('User') ->createQuery('u') ->update() ->set('email_address', '?', 'jonwage@gmail.com') ->andWhere('username = ?', 'jwage'); $affectedRows = $q->execute(); echo $affectedRows; // 1 $ php index.php What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 24. Nashville LAMP Writing DQL Queries lamp_doctrine/tools/sandbox/index.php DELETE Queries $q = Doctrine::getTable('User') ->createQuery('u') ->delete() ->andWhere('username = ?', 'jwage'); $affectedRows = $q->execute(); echo $affectedRows; // 1 $ php index.php What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 25. Nashville LAMP Custom Accessors Enable Auto Accessor Override lamp_doctrine/tools/sandbox/config.php // ... $manager = Doctrine_Manager::getInstance(); $manager->setAttribute('auto_accessor_override', true); What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 26. Nashville LAMP Custom Accessors Custom `name` accessor What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 27. Nashville LAMP Custom Accessors lamp_doctrine/tools/sandbox/models/User.php class User extends BaseUser { public function getName() { return trim($this->first_name.' '.$this->last_name); } } What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 28. Nashville LAMP Custom Accessors lamp_doctrine/tools/sandbox/index.php $q = Doctrine::getTable('User') ->createQuery('u') ->andWhere('username = ?', 'jwage'); $user = $q->fetchOne(); echo $user->name; // Jonathan Wage $ php index.php What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 29. Nashville LAMP Custom Mutator MD5 encrypt passwords class User extends BaseUser { // ... public function setPassword($password) { $this->_set('password', md5($password)); } } What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 30. Nashville LAMP Custom Mutator MD5 encrypt passwords $q = Doctrine::getTable('User') ->createQuery('u') ->andWhere('username = ?', 'jwage'); $user = $q->fetchOne(); $user->password = 'changeme'; $user->save(); echo $user->password; // 4cb9c8a8048fd02294477fcb1a41191a What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 31. Nashville LAMP Accessor/Mutator Syntax Object property, function, array access echo $user->name; echo $user->get('name'); echo $user['name']; What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 32. Nashville LAMP Database Migrations What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 33. Nashville LAMP Deploy schema changes What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 34. Nashville LAMP Maintain production data What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 35. Nashville LAMP Programmatic interface for issuing DDL statements What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 36. Nashville LAMP Versions your database What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 37. Nashville LAMP Upgrade your database to new versions Downgrade to previous versions What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 38. Nashville LAMP Database Migrations Add new status column to users What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 39. Nashville LAMP Database Migrations User: columns: # ... status: type: enum values: [Pending, Active, Inactive] What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 40. Nashville LAMP Database Migrations Generate migration class $ php doctrine generate-migrations-diff What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 41. Nashville LAMP Database Migrations Generate migration class class Version1 extends Doctrine_Migration_Base { public function up() { $this->addColumn('user', 'status', 'enum', '', array('values' => array(0 => 'Pending', 1 => 'Active', 2 => 'Inactive'))); } public function down() { $this->removeColumn('user', 'status'); } } What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 42. Nashville LAMP Database Migrations Customize migration class class Version1 extends Doctrine_Migration_Base { public function postUp() { Doctrine::loadModels(realpath(dirname(__FILE__).'/../models')); Doctrine::getTable('User') ->createQuery('u') ->update() ->set('status', '?', 'Active') ->execute(); } // ... } What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 43. Nashville LAMP Database Migrations Executing migration $ php doctrine migrate migrate - migrated successfully to version #1 What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 44. Nashville LAMP Database Migrations Update models from YAML $ php doctrine generate-models-yaml What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 45. Nashville LAMP Database Migrations Inspect migration was successful or not New status column exists Default `Active` value What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 46. Nashville LAMP Future of Doctrine? What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 47. Nashville LAMP New Versions What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 48. Nashville LAMP Doctrine 1.2 What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 49. Nashville LAMP Continued evolution of the 1.x codebase What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 50. Nashville LAMP Doctrine 2.0 What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 51. Nashville LAMP Almost complete re-rewrite What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 52. Nashville LAMP Major version What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 53. Nashville LAMP Requires PHP 5.3 What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 54. Nashville LAMP Performance increases from 5.3 What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 55. Nashville LAMP Test suite runs 20% faster What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 56. Nashville LAMP And uses 30% less memory What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 57. Nashville LAMP Hydration performance improvements What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 58. Nashville LAMP Hydration Performance Doctrine 1.1 4.3435637950897 for 5000 records Doctrine 2.0 1.4314442552312 for 5000 records Doctrine 2.0 3.4690098762512 for 10000 records What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 59. Nashville LAMP Removed Major Limitation No need to extend a base class /** class User extends Doctrine_Record * @DoctrineEntity { * @DoctrineTable(name=quot;userquot;) public function setTableDefinition() */ { class User $this->hasColumn('id', 'integer', null, array( { 'primary' => true, /** 'auto_increment' => true * @DoctrineId )); * @DoctrineColumn(type=quot;integerquot;) * @DoctrineGeneratedValue(strategy=quot;autoquot;) $this->hasColumn('username', 'string', 255); */ } public $id; } /** * @DoctrineColumn(type=quot;varcharquot;, length=255) */ public $username; } What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 60. Nashville LAMP No more crazy cyclic references What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 61. Nashville LAMP print_r() your objects $user = new User(); $user->username = 'jwage'; print_r($user); User Object ( [id] => [username] => jwage ) What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 62. Nashville LAMP Positive effects of removing the base class all around What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 63. Nashville LAMP General Improvements What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 64. Nashville LAMP Code de-coupled What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 65. Nashville LAMP 3 Main Packages What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 66. Nashville LAMP Common What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 67. Nashville LAMP DBAL What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 68. Nashville LAMP ORM What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 69. Nashville LAMP Use Doctrine DBAL separate from the ORM What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 70. Nashville LAMP Easier to extend and override things What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 71. Nashville LAMP Better support for multiple databases What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 72. Nashville LAMP Sequences, schemas and catalogs What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 73. Nashville LAMP Simplified connection information $config = new DoctrineORMConfiguration(); $eventManager = new DoctrineCommonEventManager(); $connectionOptions = array( 'driver' => 'pdo_sqlite', 'path' => 'database.sqlite' ); $em = DoctrineORMEntityManager::create($connectionOptions, $config, $eventManager); What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 74. Nashville LAMP No more DSN nightmares What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 75. Nashville LAMP Connection information specified as arrays What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 76. Nashville LAMP Removed old attribute system What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 77. Nashville LAMP Replaced with simpler string based system What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 78. Nashville LAMP Real Native SQL support What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 79. Nashville LAMP Driver Based Meta Data What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 80. Nashville LAMP PHP Annotations /** * @DoctrineEntity * @DoctrineTable(name=quot;userquot;) */ class User { /** * @DoctrineId * @DoctrineColumn(type=quot;integerquot;) * @DoctrineGeneratedValue(strategy=quot;autoquot;) */ public $id; /** * @DoctrineColumn(type=quot;varcharquot;, length=255) */ public $username; } What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 81. Nashville LAMP 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 is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 82. Nashville LAMP YAML class User { public $id, $username; } User: properties: id: id: true type: integer idGenerator: auto username: type: varchar length: 255 What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 83. Nashville LAMP Write your own driver What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 84. Nashville LAMP Cache What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 85. Nashville LAMP Query Cache Cache final SQL that is parsed from DQL What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 86. Nashville LAMP Metadata Cache Cache the parsing of meta data What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 87. Nashville LAMP Result Cache Cache the results of your queries What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 88. Nashville LAMP Inheritance Mapping What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 89. Nashville LAMP Single Table One table per hierarchy What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 90. Nashville LAMP Class Table One table per class What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 91. Nashville LAMP Concrete Table One table per concrete class What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 92. Nashville LAMP Testing What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 93. Nashville LAMP Switched to phpUnit What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 94. Nashville LAMP Better mock testing What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 95. Nashville LAMP Easy to run tests against multiple DBMS What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 96. Nashville LAMP Code de-coupled so it is easier to test What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 97. Nashville LAMP New Features What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 98. Nashville LAMP New DQL Parser What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 99. Nashville LAMP Hand written What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 100. Nashville LAMP Recursive-descent parser What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 101. Nashville LAMP Constructs AST What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 102. Nashville LAMP PHP Class names directly represent DQL language What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 103. Nashville LAMP Every DQL feature has a class to handle parsing What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 104. Nashville LAMP Easy to maintain Easy to add new features Easy to use What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 105. Nashville LAMP Performance? What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 106. Nashville LAMP Final SQL can be easily and effectively cached What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 107. Nashville LAMP Not practical to parse every time What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 108. Nashville LAMP Custom Column Types What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 109. Nashville LAMP Add your own data types What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 110. Nashville LAMP Types are OOP classes What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 111. Nashville LAMP Easy to extend or add new types What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 112. Nashville LAMP Extend DQL What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 113. Nashville LAMP DQL parser can be extended What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 114. Nashville LAMP Add your own DQL functions What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 115. Nashville LAMP When? What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 116. Nashville LAMP First release in September 09` What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 117. Nashville LAMP ALPHA What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 118. Nashville LAMP BETA What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 119. Nashville LAMP RC What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 120. Nashville LAMP Stable - 2010’ ? What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 121. Nashville LAMP What is next? What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 122. Nashville LAMP Publishing of first Doctrine book What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 123. Nashville LAMP Write more documentation What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 124. Nashville LAMP Publish more books What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 125. Nashville LAMP Doctrine community extension repository Symfony has Plugins and Doctrine has Extensions What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 126. Nashville LAMP Default DBAL and ORM in PEAR2? De-facto standard? What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 127. Nashville LAMP It is up to you! :) What is Doctrine? www.doctrine-project.org www.sensiolabs.com
  • 128. Nashville LAMP 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 is Doctrine? www.doctrine-project.org www.sensiolabs.com