PHPActiveRecord and Concrete5

Permalink
Hi all,

We're looking to build a plugin for Concrete5 and would love to use the Active Record system we're familiar with.

http://www.phpactiverecord.org/...

If you've never tried it before, do so. You'll never go back... Is there any reason why we wouldn't be able to set this up to work alongside Concrete5's db system?

Suggestions on how to implement?

Thanks!

 
andrew replied on at Permalink Reply
andrew
I haven't really taken a look at phpactiverecord, but I would just do this:

1. Create a directory named "3rdparty" in your libraries/ folder (the local one that's empty).
2. Put the phpactiverecord library folder into there.
3. If the file that needs to be loaded to load phpactiverecord is in phpactiverecord/library.php, you'd add a site_post.php file to config/ and in it add Loader::library('3rdparty/phpactiverecord/library'). (you just leave off the .php on whatever file you're including.)

That should do it. Now, if any of the classes have naming conflicts with core concrete5 you might have a problem, but that hasn't really been a problem with too many other systems. You might also want to figure out how to get the MySQL resource from the ADODB database library, if there's a way to bind the library to a particular active database connection. Otherwise the database parameters can be used again in the site_post.php file (DB_SERVER, DB_PASSWORD, etc.. you can find these in config/site.php)