Methods

Configures the relationship

__construct(string $from, string $name, array $config) 

Parameters

$from

string

the model that initiates the relationship

$name

string

name of the relationship

$config

array

config 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, $models_to, bool $parent_deleted, null | bool $cascade) 

Parameters

$model_from

\Orm\Model

instance of model_from

$models_to

$parent_deleted

bool

whether the model_from has been saved already

$cascade

nullbool

either 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

$from

Model

$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, $models_to, $original_model_ids, $parent_saved, bool | null $cascade) : 

Parameters

$model_from

\Orm\Model

$models_to

$original_model_ids

$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

$table

string

Returns

array

select_through()

select_through($table) 

Parameters

$table

 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

 

<p>foreign key of from model in connection table</p>

$key_through_from : string

 

<p>foreign key of to model in connection table</p>

$key_through_to : string

 

<p>foreign key in related model</p>

$key_to : string

 

<p>classname of the parent model</p>

$model_from : \Orm\Model
Inherited

inherited_from \Orm\Relation::$$model_from
 

<p>classname of model to use as connection</p>

$model_through : string

 

<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
Inherited

inherited_from \Orm\Relation::$$singular
 

<p>table name of table to use as connection, alternative to $model_through setting</p>

$table_through : string