Changeset 49 for trunk/README

Show
Ignore:
Timestamp:
10/21/05 00:45:51 (6 years ago)
Author:
john
Message:

updated the readme

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/README

    r26 r49  
    6767Allowed relationships in model classes are:  
    6868* 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 
    6971    public $belongs_to = array("foreign_table_name" => null); 
    7072    - foreign table name is always singular. 
    7173* 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); 
    7377     - foreign table name is always singular. 
    7478* 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); 
    7682     - foreign table name is always plural. 
    7783* 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); 
    7987     - 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) 
    8189 
    8290In place of the null you can specify an array of parameters such as "foreign_key". 
     
    92100        $array_of_objects = $model->find_all("id > 10"); // everyone with id > 10 
    93101 
    94     * find(id, [conditions]) 
     102    * find(id, [orderings], [limit], [joins]) 
    95103        $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. 
    96105 
    97106    * find_first([conditions])