ActiveRecord In PHP
- Create your database and tables, if you haven’t already. (remember
use Rails’ conventions for table and column names)
Download recent ActiveRecord release or
svn co http://lukebaker.org/svn/repos/activerecord/trunk/ activerecord
Untar into a models/ directory within your project or move checked
out directory activerecord/ into your models/ directory.
- There should now be a models/activerecord/ directory, edit
models/activerecord/config.php to your liking.
- Run models/activerecord/generate.php
- This should have have generated model stubs inside your models/
directory. Edit these model files to tell ActiveRecord about the
relationships between tables. Do not edit *Base.php files as they
get overwritten every time you run generate.php
Use ActiveRecord, by including the models that you want to use: