Devise\Pages\Interpreter\TagManager::getInstanceForModel PHP Method

getInstanceForModel() protected method

Get the instance for a model in this tag
protected getInstanceForModel ( array $tag ) : DvsModelField
$tag array
return DvsModelField
    protected function getInstanceForModel($tag)
    {
        $mappings = $this->fetchMappingsForModelField($tag);
        $fields = $this->fetchModelFields($tag['key'], $tag['type'], $mappings);
        // if the count doesn't add up
        // then create more model fields in DB
        if (count($fields) != count($mappings)) {
            $this->createMissingModelFields($tag, $fields, $mappings);
            $fields = $this->fetchModelFields($tag['key'], $tag['type'], $mappings);
        }
        // sync over model values into the json values
        $model = $fields[0]->model;
        foreach ($fields as $field) {
            $field->syncValuesWithModelValues($model);
        }
        return $fields;
    }