Using Symfony with alternative ORM
Symfony 2 is quite awesome, and what I really like is the ability to switch out any component with another component. Ever since I started building applications with Symfony one thing really has bothered me, and that was Doctrine. It just did not feel natural to use it.
Lucky me, there is an alternative: Propel ORM. Have a look yourself. You can easily migrate existing projects, it does have the features needed to build something, and it has it’s very own way of forcing you into database independent development. On top of that I like the schema definitions and fixtures a lot.
Now let us switch the default Symfony project to Propel. First I recommend to install Composer.
Using Composer we create a project template:
Next we will remove Doctrine and add Propel to the Composer file. Edit
With this we have removed the Doctrine ORM and the Symfony bundle. Now we need to
The Symfony configuration in
app/config/config.yml also needs a bit of love
Last – but not least – we need to edit
To finalize the switch to Propel, we run Composer once
After a few moments, we are done. You now have a Propel enabled Symfony2
template. The application console now sports a lot of
Try the Propel documentation for an overview of the nifty things Propel can do for you.
All code snippets in this post are made available to use under the MIT Licence.