Methods
Configures the relationship
__construct(string $from, string $name, array $config) 
Parameters
$from
stringthe model that initiates the relationship
 
$name
stringname of the relationship
 
$config
arrayconfig values like model_to classname, key_from /p>
 
  
 
Allow outside access to protected properties
__get($property) : 
Inherited
| inherited_from | 
\Orm\Relation::__get() | 
Parameters
$property
Exceptions
\FuelException | 
Invalid relation property | 
Returns
  
 
Takes the current relations and attempts to delete them when cascading is allowed or forced
delete(\Orm\Model $model_from, array | \Orm\Model $model_to, bool $parent_deleted, null | bool $cascade) 
Parameters
$model_to
array\Orm\Modelsingle or multiple model instances to delete
 
$parent_deleted
boolwhether the model_from has been saved already
 
$cascade
nullbooleither uses default setting (null) or forces when true or prevents when false
 
  
 
Should get the objects related to the given object by this relation
get(\Orm\Model $from, array $conditions) : object | array
Parameters
$conditions
Returns
objectarray
  
 
Returns true if this relation is a singular relation.
is_singular() : bool
Inherited
Eg, has_one not has_many
| inherited_from | 
\Orm\Relation::is_singular() | 
Returns
bool
  
 
Returns tables to join and fields to select with optional additional settings like order/where
join($alias_from, $rel_name, $alias_to_nr, $conditions) : array
Parameters
$alias_from
$rel_name
$alias_to_nr
$conditions
Returns
array
  
 
Saves the current relationships and may cascade saving to model_to instances
save(\Orm\Model $model_from, \Orm\Model $model_to, $original_model_id, $parent_saved, bool | null $cascade) : 
Parameters
$original_model_id
$parent_saved
$cascade
boolnull
Returns
  
 
Should get the properties as associative array with alias => property, the table alias is
given to be included with the property
select($table) : array
Inherited
| inherited_from | 
\Orm\Relation::select() | 
Parameters
Returns
array
  
 
 Properties
 
<p>whether deleting this one's model_from should cascade to delete model_to</p>
$cascade_delete : bool
Inherited
| inherited_from | 
\Orm\Relation::$$cascade_delete | 
  
 
 
<p>whether saving this one's model_from should cascade to save model_to</p>
$cascade_save : bool
Inherited
| inherited_from | 
\Orm\Relation::$$cascade_save | 
  
 
 
<p>where /p>
$conditions : array
Inherited
| inherited_from | 
\Orm\Relation::$$conditions | 
  
 
 
<p>primary key of parent model</p>
$key_from : string
Inherited
| inherited_from | 
\Orm\Relation::$$key_from | 
  
 
 
<p>foreign key in related model</p>
$key_to : string
Inherited
| inherited_from | 
\Orm\Relation::$$key_to | 
  
 
 
<p>classname of the parent model</p>
$model_from : \Orm\Model
Inherited
| inherited_from | 
\Orm\Relation::$$model_from | 
  
 
 
<p>classname of the related model</p>
$model_to : string
Inherited
| inherited_from | 
\Orm\Relation::$$model_to | 
  
 
 
<p>name of the relationship in the model_from</p>
$name : string
Inherited
| inherited_from | 
\Orm\Relation::$$name | 
  
 
 
<p>whether it's a single object or multiple</p>
$singular : bool