/usr/share/php/kohana3.2/modules/orm/guide/orm/models.md is in libkohana3.2-mod-orm-php 3.2.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # Creating your Model
To create a model for the table `members` in your database, create the file `application/classes/model/member.php` with the following syntax:
class Model_Member extends ORM
{
...
}
(this should provide more examples)
## Overriding the Table name
If you wish to change the database table that a model uses, just override the `$_table_name` variable like this:
protected $_table_name = 'strange_tablename';
## Changing the primary key
ORM assumes each model (and database table) has an `id` column that is indexed and unique. If your primary key column isn't named `id`, that's fine - just override the `$_primary_key` variable like this:
protected $_primary_key = 'strange_pkey';
## Use a non-default database
For each model, you can define which database configuration ORM will run queries on. If you override the `$_db_group` variable in your model, ORM will connect to that database. Example:
protected $_db_group = 'alternate';
|