One of the most important changes in symfony 1.1 was the creation of the symfony platform, the core of symfony had it’s classes completely refactored into a fully decoupled set of classes that could easily be picked or overruled when required. It meant total independence of those classes whenever you would choose to do that. An excellent path to go for symfony, as it gives more control to the developer.

With the ORM, that was not fully possible. You would still have to write your code ORM-specific. For Propel, you’d use the Criteria object to build your query, and for Doctrine, you’d use the (slightly more beautiful) chaining of methods to build a query. But if you’d written code for one, you could not easily change to the other. Even moving from Propel 1.2 to Propel 1.3 would offer some challenges.

Enter the DbFinderPlugin, a plugin written by Francois Zaninotto. This seems to be the ultimate solution in writing code that is portable between the different ORM’s. When used consistently throughout a project, switching to another ORM should be as simple as installing and configuring the new ORM plugin, configuring your databases.yml, and that’s it. DbFinderPlugin will take care of the rest.

I see two very important advantages for the usage of this plugin:

  • Plugin development – Using DbFinderPlugin, it’s now very easy to write plugins that don’t care about the ORM you are using. The community will benefit a lot from this, as all plugin authors that use this plugin will now write plugins that are compatible with all ORMs. And the plugin authors will benefit a lot from this as well, since it will make their life a lot easier in writing plugins for all ORMs
  • Project development – You don’t really need to think about which ORM you need to use up front. You just start with the default Propel with DbFinderPlugin. Then, as the project advances, you can decide what you prefer: Propel or Doctrine. Or you make a choice at the start of your project, but halfway a technical requirement makes you reconsider that choice: switching should now be very easy. No need to rewrite all your queries anymore.

The only possible downside at this point is that Doctrine is not fully supported yet. Propel 1.2 and Propel 1.3 are fully supported already though, so at least switching to the speed and efficiency of Propel 1.3 is already possible. As Doctrine-support is completed, I see a bright future for this plugin and symfony development in general.


Leave a Reply

Your email address will not be published. Required fields are marked *