Relation renders a field pre-populated with a belongsTo and belongsToHasMany relation


Public Properties

public string $nameFrom

nameFrom is the model column to use for the name reference

public string $sqlSelect

sqlSelect is the custom SQL column selection to use for the name reference

public string $emptyOption

emptyOption to use if the relation is singular (belongsTo)

public string $scope

scope method for the list query.

public string $conditions

conditions filters the relation using a raw where query statement.

public mixed $defaultSort

defaultSort column to look for.

public mixed $excludeFrom

excludeFrom identifiers from the specified model attribute.

public bool $useController

useController to completely replace this widget the RelationController behavior.

public array $useControllerConfig

useControllerConfig manually configures the RelationController behavior.

public FormField $renderFormField

renderFormField object used for rendering a simple field type

Show inherited public properties

Inherited Public Properties

Protected Properties

protected $defaultAlias

defaultAlias to identify this widget.

Show inherited protected properties

Inherited Protected Properties

Public Methods

public bindToController()

public bindToController(): void

bindToController ensures manual relation controller configuration is applied.

public getSaveValue()

public getSaveValue($value): void

getSaveValue processes the postback value for this widget. If the value is omitted from postback data, the form widget will be skipped.

public init()

public init(): void

init the widget, called by the constructor and free from its parameters.

public nearestModelAttribute()

public nearestModelAttribute($attribute): void

public prepareVars()

public prepareVars(): void

prepareVars for display

public render()

public render(): void

render the widget's primary contents.

public resolveModelAttribute()

public resolveModelAttribute(string $attribute): array 

Returns the final model and attribute name of a nested HTML array attribute. Eg: [$model, $attribute] = $this->resolveModelAttribute($this->valueFrom);

Show inherited public methods

Inherited Public Methods

Protected Methods

protected applyDefaultSortToQuery()

protected applyDefaultSortToQuery($query): void

protected defineRelationControllerConfig()

protected defineRelationControllerConfig(): void

protected evalUseController()

protected evalUseController($defaultPref): bool 

evalUseController determines if the relation controller is usable and returns the default preference if it can be used.

protected getRelationControllerFieldName()

protected getRelationControllerFieldName(): void

protected getRelationModel()

protected getRelationModel(): Relation 

Returns the model of a relation type, supports nesting via HTML array.

protected getRelationObject()

protected getRelationObject(): Relation 

Returns the value as a relation object from the model, supports nesting via HTML array.

protected getRelationType()

protected getRelationType(): string 

getRelationType returns the value as a relation type from the model, supports nesting via HTML array.

protected isRelationTypeSingular()

protected isRelationTypeSingular(): bool 

isRelationTypeSingular checks if the related model is singular.

protected makeRenderFormField()

protected makeRenderFormField(): void

makeRenderFormField for rendering a simple field type

Show inherited protected methods

Inherited Protected Methods