Skip to content
nik-os edited this page Sep 19, 2014 · 4 revisions

First of all you should add to composer file composer.json new module ActiveRecord "samsonos/php_activerecord": "*" and php composer.phar update to uploud new module. Now in folder vendor you have new folder vendor/samsonos/php_activerecord.

To configure conection to your database you should create configuration file /www/app/config/ActiveRecordConfig.php (How to confire module)

Configuration parameters

  • $name - database name
  • $login - login name for your conection
  • $pwd - password
  • $host - database host
  • $port - port number
  • $prefix - database table prefix. It's usefull when we have several prodjects in one database.
  • $relations - array of additional relations to set (Table relations)

Example

class ActiveRecordConfig extends \samson\core\Config
{
    public $__module = 'activerecord';

    public $name 	= 'db name';
    public $login 	= 'db user';
    public $pwd 	= 'password';
    public $host        = 'localhost';
    public $prefix      = 'example_';
    public $relations   = array(
        array('client', 'material', 'client_id', 0, 'client_id', 'company'),
        array('gallery', 'material', 'MaterialID', 0)
    );
}

Clone this wiki locally