Field_Reference::setModel PHP Метод

setModel() публичный Метод

Set model
public setModel ( Model | string $model, string | boolean $display_field = null ) : Model | $this
$model Model | string
$display_field string | boolean
Результат Model | $this
    public function setModel($model, $display_field = null)
    {
        if ($model instanceof Model) {
            return AbstractObject::setModel($model);
        }
        $this->model_name = is_string($model) ? $model : get_class($model);
        $this->model_name = (string) $this->app->normalizeClassName($this->model_name, 'Model');
        if ($display_field) {
            $this->display_field = (string) $display_field;
        }
        if ($display_field !== false) {
            $this->owner->addExpression($this->getDereferenced())->set(array($this, 'calculateSubQuery'))->caption((string) $this->caption());
        }
        $this->system(true);
        $this->editable(true);
        $this->visible(false);
        return $this;
    }