using doctrine with codeigniter using doctrine with codeigniter codeigniter codeigniter

using doctrine with codeigniter


For anyone who is interested - I’ve posted up a project starter on my blog - a dev ready incorporation of the following technologies:

  • ExtJS : client side JS library,
  • CodeIgniter : presentation + domain tier,
  • Doctrine : ORM data layer framework

Some features of this project starter are:- CodeIgniter Models have been replaced with Doctrine Records- Doctrine is loaded into CI as a plugin- RoR type before and after filters….- Doctrine transactions automatically wrapped around every action at execution time (ATOMIC db updates)

Basic Role based security (I think Redux may be in there as well?)Simply extract, hook up the database.php config file and viola…. You can start coding your layouts, views and models. Probably a few things to iron out - but enjoy!

Hope it helps

GET IT AT: http://thecodeabode.blogspot.com


Check out this info on Doctrine_Table class.

To your 3 generated files:
BaseXXX.php:
Holds the definition of your models so that Doctrine is able to handle the operations on the database. This class tells the ORM what colums are available, their types, advaned functions (like Timestampable,...) and more. You should not put your own data into this file since it will be over-written when re-creating the models from the database.

XXX.php:
Your actual model. This won't be re-created with each new generation process and this is were you keep most of your code. You can overwrite functions of the BaseXXX.php if you have to.

XXXTable.php:
Check my link from the top, This gives you access to the table itself. Personally, I do not use it that often since I put most of the code into XXX.php.

Of course you can create new classes and use them inside your XXX.php file. In order to actually do something with the data (save, read,...) you need classes that are connected (exteneded) from Doctrine's classes.

edit: also check this on a more infos with extending from the Doctrine_Table class