Thursday, November 8, 2012

Zend Framework 2 and ActiveRecord

I googled for adding php ActiveRecord in zend framework 2 but could not find it. However Arthur Bodera proposed the activerecord for zend framework 2 but it is not yet in Zend library. So i have decided to integrate standalone php ActiveRecord in zf2 as a third party library.

I have used zf2's tool to generated autoload classmap for activerecord that includes all ActiveRecord library files inside one file autoload_classmap.php. But activerecord has one file Utils.php, that include some functions outside class definition. The autoload classmap loader only find class methods not any function outside class, so i changed the Utils.php file and put all the outside functions into class and changed accordingly throughout the activerecord library. So if you wish to change the ActiveRecord library then please change Utils.php file accordingly.

You can find the complete code with zend framework 2 skeleton application here. Please put the zf2 library inside vendor directory. 

No comments:

Post a Comment