Here it is, Doctrine 2.0 (dedicated to the release of Doctrine 2.0 Alpha 3)

    image
    Congratulations, colleagues! 3 days ago, the third alpha version of the most powerful PHP ORM framework for today: Doctrine was released.

    And this news is by and large deserving of attention because in Doctrine 2.0 there were very significant changes in comparison with the previous versions. I’ll immediately notice that these goodies will require us no less - support for php 5.3.

    The official Doctrine 2.0 teaser looks like this: So, what should we pay attention to here: 1) We set the meta data for class mapping using DocBlock comments (XML mapping and YAML mapping have not gone away) 2) We will not inherit our CmsArticle class is from Doctrine's built-in classes.
    1.  
    2. namespace Doctrine\Tests\Models\CMS;
    3.  
    4. /**
      * @DoctrineEntity(tableName="cms_articles")
      */
    5. class CmsArticle
    6. {
    7.    /**
          * @DoctrineId
          * @DoctrineColumn(type="integer")
          * @DoctrineIdGenerator("auto")
          */
    8.    public $id;
    9.  
    10.    /**
          * @DoctrineColumn(type="varchar", length=255)
          */
    11.    public $topic;
    12.  
    13.    /**
          * @DoctrineColumn(type="varchar")
          */
    14.    public $text;
    15.  
    16.    /**
          * @DoctrineManyToOne(targetEntity="Doctrine\Tests\Models\CMS\CmsUser",
                 joinColumns={"user_id" = "id"})
          */
    17.    public $user;
    18.  
    19.    /**
          * @DoctrineOneToMany(targetEntity="Doctrine\Tests\Models\CMS\CmsComment", mappedBy="article")
          */
    20.    public $comments;
    21. }








    3.) Class properties do not have to be declared as public, they can be private or protected. Doctrine does not require you to have getters and setters for each property. You are completely free to design your classes.

    Friends, I think it's great!

    I dare to assume that reading DocBlock comments is implemented using Reflection (the getDocComment method is there).
    A rather interesting application of Reflection.
    By the way, even more actively and more elegantly (IMHO) this is used in the Recess php framework . I stumbled upon it and was amazed, I saw there exactly what I wanted to do in my own bike. The thing definitely deserves attention.

    Performance:
    Doctrine 2.0 on php5.3 eats up to 31% less memory and runs 17% faster than Doctrine 1.0 on PHP 5.2.8
    (information from preliminary tests in the developers blog)

    What's New in Doctrine 2.0 Alpha 3:
    The Most Essential From My Point of View This is the functionality for converting schemes from Doctrine 1.0 to 2.0.
    And also more than 60 fixes, code refactoring, work on drivers for mapping and export, as the developers say, the code begins to become stable.

    What can we expect:
    on December 11, 2009 there will be another alpha release, and on January 8 the first beta will be released.

    Links:
    Doctrine PHP ORM lives here.
    Here is the documentation for version 2.0:
    Posts from the developer blog with a tag 2.0

    Friends, I hope you were interested and you learned something new for yourself! (I personally really liked the use of DocBlock comments) I look forward to an active discussion!

    Also popular now: