MorphOne
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
Returns the model query with deferred bindings added
Returns the related "slave id" key in a database friendly format.
Save the supplied related model with deferred binding support.
Create a new instance of this related model with deferred binding support.
Removes a model from this relationship type.
Set the defined constraints on the relation query.
Add relation based constraints.
Create a new has many relationship instance.
Helper for setting this relationship using various expected values. For example, $model->relation = $value;
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
in
DeferOneOrMany at line 125
protected Expression
getWithDeferredQualifiedKeyName()
Returns the related "slave id" key in a database friendly format.
in
MorphOneOrMany at line 22
save(Model $model, $sessionKey = null)
Save the supplied related model with deferred binding support.
in
MorphOneOrMany at line 36
create(array $attributes = [], $sessionKey = null)
Create a new instance of this related model with deferred binding support.
in
MorphOneOrMany at line 50
add(Model $model, $sessionKey = null)
Adds a model to this relationship type.
in
MorphOneOrMany at line 75
remove(Model $model, $sessionKey = null)
Removes a model from this relationship type.
in
DefinedConstraints at line 20
void
addDefinedConstraints()
Set the defined constraints on the relation query.
in
DefinedConstraints at line 35
addDefinedConstraintsToRelation(Relation $relation, array $args = null)
Add relation based constraints.
in
DefinedConstraints at line 85
addDefinedConstraintsToQuery(Builder $query, array $args = null)
Add query based constraints.
at line 21
void
__construct(Builder $query, Model $parent, $type, $id, $localKey, $relationName = null)
Create a new has many relationship instance.
at line 34
setSimpleValue($value)
Helper for setting this relationship using various expected values. For example, $model->relation = $value;
at line 95
getSimpleValue()
Helper for getting this relationship simple value, generally useful with form values.