PHP ORMs: Doctrine vs. Propel

前端 未结 10 2169
日久生厌
日久生厌 2020-12-02 05:57

I\'m starting a new project with symfony which is readily integrated with Doctrine and Propel, but I of course need to make a choice.... I was wondering if more experienced

相关标签:
10条回答
  • 2020-12-02 06:25

    I'd suggest using DbFinder Plugin. This is actually a very powerful plugin that supports both, and is quite a nice powerful. I actually like using it better than either.

    0 讨论(0)
  • 2020-12-02 06:31

    I'd suggest to use propel 1.6 which is better for IDE's autocomplete function.

    0 讨论(0)
  • 2020-12-02 06:31

    If I'm not wrong, both ORMs use XML-based schema, and creating these schema definition is pretty cumbersome. If you need a PHP-based simple schema with fluent style. You may try LazyRecord https://github.com/c9s/LazyRecord it supports automatic migration and upgrade/downgrade script generators. And all the class files are generated statically without runtime cost.

    0 讨论(0)
  • 2020-12-02 06:35

    It comes down to personal preference. I use Propel because (among other things) I like the fact that everything has its own concrete getter & setter method. In Doctrine, this is not the case.

    Propel:

    $person->setName('Derek');
    echo $person->getName();
    

    Doctrine:

    $person->name = 'Derek';
    echo $person->name;
    

    The reason I like having getters & setters is that I can put all kinds of logic in them, if I need to. But that's just my personal preference.

    I should also add that although Propel was slow-moving in the past, it is now under active development again. It has released several new versions in the past few months. The most recent version of Propel includes a "fluent query interface" similar to Doctrine's, so you don't have to use Criteria anymore if you don't want to.

    0 讨论(0)
提交回复
热议问题