Changeset 49 for trunk/README
- Timestamp:
- 10/21/05 00:45:51 (6 years ago)
- Files:
-
- 1 modified
-
trunk/README (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/README
r26 r49 67 67 Allowed relationships in model classes are: 68 68 * belongs_to: means that there is a foreign key from another table in in this table. 69 public $belongs_to = "foreign_table_name,foreign_table_name2,etc..."; 70 or 69 71 public $belongs_to = array("foreign_table_name" => null); 70 72 - foreign table name is always singular. 71 73 * has_one: means that there is a foreign key in another table to this table 72 public $belongs_to = array("foreign_table_name" => null); 74 public $has_one = "foreign_table_name,foreign_table_name2,etc..."; 75 or 76 public $has_one = array("foreign_table_name" => null); 73 77 - foreign table name is always singular. 74 78 * has_many: means that there is a foreign key in another table to this table 75 public $belongs_to = array("foreign_table_name" => null); 79 public $has_many = "foreign_table_name,foreign_table_name2,etc..."; 80 or 81 public $has_many = array("foreign_table_name" => null); 76 82 - foreign table name is always plural. 77 83 * has_and_belongs_to_many: means there is a join with another table into a third joining table 78 public $belongs_to = array("foreign_table_name" => null); 84 public $has_and_belongs_to_many = "foreign_table_name,foreign_table_name2,etc..."; 85 or 86 public $has_and_belongs_to_many = array("foreign_table_name" => null); 79 87 - foreign table name is always plural. 80 - joining table must be named table1_table2 (plural names for both )88 - joining table must be named table1_table2 (plural names for both in alphabetical order) 81 89 82 90 In place of the null you can specify an array of parameters such as "foreign_key". … … 92 100 $array_of_objects = $model->find_all("id > 10"); // everyone with id > 10 93 101 94 * find(id, [ conditions])102 * find(id, [orderings], [limit], [joins]) 95 103 $object = $model->find($id); // one object where id=$id 104 id can be where conditions name='John', an array of ids or a single id. 96 105 97 106 * find_first([conditions])
