class MorphOne extends MorphOne

Adapted from october\rain\database\relations\MorphOne

Traits

Adapted from october\rain\database\relations\MorphOneOrMany

Adapted from october\rain\database\relations\DeferOneOrMany

Properties

protected string $relationName from  MorphOneOrMany

Methods

Builder
withDeferred($sessionKey)

Returns the model query with deferred bindings added

Expression
getWithDeferredQualifiedKeyName()

Returns the related "slave id" key in a database friendly format.

save(Model $model, $sessionKey = null)

Save the supplied related model with deferred binding support.

create(array $attributes = [], $sessionKey = null)

Create a new instance of this related model with deferred binding support.

add(Model $model, $sessionKey = null)

Adds a model to this relationship type.

remove(Model $model, $sessionKey = null)

Removes a model from this relationship type.

void
addDefinedConstraints()

Set the defined constraints on the relation query.

addDefinedConstraintsToRelation(Relation $relation, array $args = null)

Add relation based constraints.

addDefinedConstraintsToQuery(Builder $query, array $args = null)

Add query based constraints.

void
__construct(Builder $query, Model $parent, $type, $id, $localKey, $relationName = null)

Create a new has many relationship instance.

setSimpleValue($value)

Helper for setting this relationship using various expected values. For example, $model->relation = $value;

getSimpleValue()

Helper for getting this relationship simple value, generally useful with form values.

Details

in DeferOneOrMany at line 17
Builder withDeferred($sessionKey)

Returns the model query with deferred bindings added

Parameters

$sessionKey

Return Value

Builder

in DeferOneOrMany at line 125
protected Expression getWithDeferredQualifiedKeyName()

Returns the related "slave id" key in a database friendly format.

Return Value

Expression

in MorphOneOrMany at line 22
save(Model $model, $sessionKey = null)

Save the supplied related model with deferred binding support.

Parameters

Model $model
$sessionKey

in MorphOneOrMany at line 36
create(array $attributes = [], $sessionKey = null)

Create a new instance of this related model with deferred binding support.

Parameters

array $attributes
$sessionKey

in MorphOneOrMany at line 50
add(Model $model, $sessionKey = null)

Adds a model to this relationship type.

Parameters

Model $model
$sessionKey

in MorphOneOrMany at line 75
remove(Model $model, $sessionKey = null)

Removes a model from this relationship type.

Parameters

Model $model
$sessionKey

in DefinedConstraints at line 20
void addDefinedConstraints()

Set the defined constraints on the relation query.

Return Value

void

in DefinedConstraints at line 35
addDefinedConstraintsToRelation(Relation $relation, array $args = null)

Add relation based constraints.

Parameters

Relation $relation
array $args

in DefinedConstraints at line 85
addDefinedConstraintsToQuery(Builder $query, array $args = null)

Add query based constraints.

Parameters

Builder $query
array $args

at line 21
void __construct(Builder $query, Model $parent, $type, $id, $localKey, $relationName = null)

Create a new has many relationship instance.

Parameters

Builder $query
Model $parent
$type
$id
$localKey
$relationName

Return Value

void

at line 34
setSimpleValue($value)

Helper for setting this relationship using various expected values. For example, $model->relation = $value;

Parameters

$value

at line 95
getSimpleValue()

Helper for getting this relationship simple value, generally useful with form values.