====== Model Relationship Reference ====== See also: * [[tutorials:setting_up_models|Setting up Models and working with them]] * [[tutorials:model_relationship_recipes|Model Relationship Recipes]] ==== `BelongsTo`, `HasMany`, `HasOne` options ==== Basic options for all relationships are: || '''option''' || '''description''' || || foreign_class || The name of the model's class, eg: Vendor_Model_User || || foreign_key || The name of the foreign join key, eg: user_id || || foreign_col || || || native_col || || Also, all relationships can set SELECT parameters: || '''option''' || '''description''' || || distinct || || || cols || || || where || || || group || || || having || || || order || || || paging || || || fetch || || ==== `HasMany` special options ==== When dealing with intermediate tables, `HasMany` can use '''through''' options to specify the relationship properties through which it will find foreign records. || '''option''' || '''description''' || || through || || || through_key || || || through_table || || || through_alias || || || through_native_col || || || through_foreign_col || ||