Location: PHPKode > projects > ActiveRecord > php-activerecord/examples/simple/simple_with_options.php
<?php
require_once dirname(__FILE__) . '/../../ActiveRecord.php';

class Book extends ActiveRecord\Model
{
	// explicit table name since our table is not "books"
	static $table_name = 'simple_book';

	// explicit pk since our pk is not "id"
	static $primary_key = 'book_id';

	// explicit connection name since we always want production with this model
	static $connection = 'production';

	// explicit database name will generate sql like so => db.table_name
	static $db = 'test';
}

$connections = array(
	'development' => 'mysql://invalid',
	'production' => 'mysql://test:hide@address.com/test'
);

// initialize ActiveRecord
ActiveRecord\Config::initialize(function($cfg) use ($connections)
{
    $cfg->set_model_directory('.');
    $cfg->set_connections($connections);
});

print_r(Book::first()->attributes());
?>
Return current item: ActiveRecord