views:

79

answers:

3

Hi everybody,

I come from a Codeigniter MVC background that we've been working with for some time now. It's time to roll our own framework for a big project, but we have come now to the Database part and got a bit confused immediately.
In Codeigniter, we've used the ActiveRecord for all SQL database connections, which has worked well, but since it's not a separate part, we are on the search for a ORM solution to write as little code as possible in our models to get our data from the databases.

We have reviewed the major alternatives including Doctrine2 and Propel, but we're quite scared by the fact of those configuration files and how extensive these libraries really are.

Is it really good sense, from a maintenance-wise perspective to choose an ORM that requires editing in so many more files then the obvious MVC's when a schema change is rolled out?

Thanks

+1  A: 

Well, actually for Propel you don't have to edit many files when you change your schema (if you stick to basic ORM use). You just update your database schema file (schema.xml), afterwards run propel-gen and that tool will create the necessary Propel classes for you, in the folder you specified (in build.properties).

The BaseXXX classes in the om folder should never be edited, because they will be overwritten every time you change your schema and run propel-gen. Just add your business logic to the classes in the main folder (which per default inherit the Base classes), they are only created once and will not be touched by propel-gen afterwards.

wimvds
+4  A: 

Truth be told, propel and doctrine are perhaps the best php ORM in the market right now, I use propel which is bundle with symfony framework but once you have covered the documentation it really makes a huge difference and the both ORMs know how to stay out of your way when you need native sql. I would recommend you pick one(propel/doctrine) from the two and just invest time and go through the documentation, the end result will be worth it.

Ronald Conco
+1  A: 

And with doctrine you can basically just rely on the schema.yml file (YAML format). Using that file, doctrine is able to generate the SQL, the model classes, the filters, .... everything (of course then you can modify the files if you want but in most scenarions you won´t)

Jordi Cabot