Makes data set for list column given attribute data.

@param ModelAttributeData                         $attribute
@param ModelInformationInterface|ModelInformation $info
@return ModelListColumnData
173217
protected function makeModelListColumnDataForAttributeData(ModelAttributeData $attribute, ModelInformationInterface $info)
    {
        $primaryIncrementing = $attribute->name === $this->model->getKeyName() && $info->incrementing;

        $sortable = (
            $attribute->isNumeric()
            ||  in_array($attribute->cast, [
                AttributeCast::BOOLEAN,
                AttributeCast::DATE,
                AttributeCast::STRING,
            ])
            &&  ! in_array($attribute->type, [
                'text', 'longtext', 'mediumtext',
                'blob', 'longblob', 'mediumblob',
            ])
        );

        $sortDirection = 'asc';
        if (    $primaryIncrementing
            ||  in_array($attribute->cast, [ AttributeCast::BOOLEAN, AttributeCast::DATE ])
        ) {
            $sortDirection = 'desc';
        }

        return new ModelListColumnData([
            'source'         => $attribute->name,
            'strategy'       => $this->determineListDisplayStrategyForAttribute($attribute),
            'style'          => $primaryIncrementing ? 'primary-id' : null,
            'editable'       => $attribute->fillable,
            'sortable'       => $sortable,
            'sort_strategy'  => $attribute->translated ? 'translated' : null,
            'sort_direction' => $sortDirection,
        ]);
    }
945540
public static function viaListFormat($model, $attribute, $options = [])
    {
        $relation = $model->getRelation($attribute);
        $relationClass = $relation->modelClass;
        $columns = Yii::$app->db->getTableSchema($relationClass::tableName())->columnNames;
        $titles = array_intersect(['title', 'name', 'username'], $columns);
        if (!$title = reset($titles)) {
            throw new \Exception(Yii::t('app', 'Relation does not have any title column'));
        }
        return array_merge([
            'attribute' => $attribute,
            'format' => 'raw',
            'value' => !$model->isNewRecord
                ? implode(', ', $relation->select($title)->column())
                : function ($data) use ($attribute, $title) {
                    return implode(', ', $data->getRelation($attribute)->select($title)->column());
                },
            'filter' => false,
            //'visible' => $model->isAttributeSafe($attribute),
        ], $options);
    }
614692
public function prepareModelDataForStatement($modelData)
    {
        $newModelData = [];
        foreach ($modelData as $column) {
            $name = $this->paramTransformer->transform($column['name']);

            switch (true) {
                case is_object($column['value']):
                    switch (true) {
                        case ($column['value'] instanceOf \DateTime):
                            $newModelData[] = [$name, (string) $column['value']->format('Y-m-d H:i:s')];
                            break;
                    }

                    break;
                default:
                    $newModelData[] = [$name, (string) $column['value']];
                    break;
            }

        }

        return $newModelData;
    }
82768
protected function makeModuleInstance(ModelInformationInterface $information)
    {
        $modelClass = $information->modelClass();

        $module = new ModelModule(
            app(ModelInformationRepositoryInterface::class),
            $this->moduleHelper,
            app(RouteHelperInterface::class),
            $this->makeModuleKey($modelClass),
            $this->makeModuleName($modelClass)
        );

        $module->setAssociatedClass($modelClass);

        if ($information->meta->controller) {
            $module->setWebController($information->meta->controller);
        }

        if ($information->meta->controller_api) {
            $module->setApiController($information->meta->controller_api);
        }

        return $module;
    }
362245
public static function activeTextArea($model, $attribute, $htmlOptions = array())
    {
        $htmlOptions = self::normalizeInputOptions($htmlOptions);
        return parent::activeTextArea($model, $attribute, $htmlOptions);
    }
743335
protected function makeModelShowFieldDataForRelationData(ModelRelationData $relation, ModelInformationInterface $info)
    {
        return new ModelShowFieldData([
            'source'         => $relation->method,
            'strategy'       => $this->determineListDisplayStrategyForRelation($relation),
            'label'          => ucfirst(str_replace('_', ' ', snake_case($relation->method))),
        ]);
    }
687738
public function findManyBy($attribute, array $values = [], $columns = [])
    {
        $query = $this->select($columns);

        foreach ($values as $value) {
            $query->orWhere([$attribute => $value]);
        }

        return $query->get();
    }
1274017
protected function _parseColumnInfo($info)
    {
        list($type, $length, $scope) = $this->_parseColumnType($info->Type);

        $column           = new KDatabaseSchemaColumn();
        $column->name     = $info->Field;
        $column->type     = $type;
        $column->length   = $length ? $length : null;
        $column->scope    = $scope ? (int) $scope : null;
        $column->default  = $info->Default;
        $column->required = $info->Null != 'YES';
        $column->primary  = $info->Key == 'PRI';
        $column->unique   = ($info->Key == 'UNI' || $info->Key == 'PRI');
        $column->autoinc  = strpos($info->Extra, 'auto_increment') !== false;
        $column->filter   = $this->_type_map[$type];

        // Don't keep "size" for integers.
        if(substr($type, -3) == 'int') {
            $column->length = null;
        }

        // Get the related fields if the column is primary key or part of a unique multi column index.
        if($indexes = $this->_table_schema[$info->Table]->indexes)
        {
            foreach($indexes as $index)
            {
                // We only deal with composite-unique indexes.
                if(count($index) > 1 && !$index[1]->Non_unique)
                {
                    $fields = array();
                    foreach($index as $field) {
                        $fields[$field->Column_name] = $field->Column_name;
                    }

                    if(array_key_exists($column->name, $fields))
                    {
                        unset($fields[$column->name]);
                        $column->related = array_values($fields);
                        $column->unique = true;
                        break;
                    }
                }
            }
        }

        return $column;
    }
535049
public function radioButtonListInlineRow($model, $attribute, $data = array(), $htmlOptions = array())
	{
		return $this->inputRow(CiiInput::TYPE_RADIOLIST_INLINE, $model, $attribute, $data, $htmlOptions);
	}
194965
public function update($attributes)
    {
        try {
            self::init();
            foreach ($attributes as $column => $value) {
                $columns[] = $column. ' = :'.$column;
            }
            $sql = 'UPDATE ' . self::$modelTable . ' SET ' . implode(', ', $columns) . ' WHERE id = ' . $this->id;
            $stm = self::$connect->prepare($sql);
            $stm->execute($attributes);
            $this->setAttributes($attributes);
            return $this;
        } catch (\Exception $exception) {
            var_dump($exception->getMessage());
        }
    }
1149844
protected function resolveAttribute($model, $attribute)
    {
        $result = $this->mapToClass($model->{$this->attribute . '_type'});

        foreach ($this->meta['types'] as $type) {

            $relatedModel = new $type['value'];

            if($this->mapToKey($type['value']) == $model->{$this->attribute . '_type'}) {
                $relatedModel = ($model->{$this->attribute}) ? $model->{$this->attribute}
                     : $relatedModel->newQuery()->findOrFail($model->{$this->attribute . '_id'});
            }

            foreach ($type['fields'] as $field) {
                $field->resolve($relatedModel);
            }

        }

        return $result;
    }
588931
public function addAttribute(AttributeMetadata $attribute)
    {
        if (isset($this->relationships[$attribute->getKey()])) {
            throw MetadataException::fieldKeyInUse('attribute', 'relationship', $attribute->getKey(), $this->type);
        }
        $this->attributes[$attribute->getKey()] = $attribute;
        ksort($this->attributes);
        return $this;
    }
387932
public function allowAttribute($attribute)
    {
        if (is_array($attribute))
        {
            foreach ($attribute as $attrib)
                $this->allowed_attributes[$attrib] = true;
        }
        else
            $this->allowed_attributes[$attribute] = true;
        return $this;
    }
91204
public function resolveForDisplay($model, $attribute = null)
    {
        try {
            parent::resolveForDisplay($model, $this->attribute.'_type');
        } catch (\Exception $e) {
            //
        }
 
        foreach ($this->meta['types'] as $index => $type) {
            $this->meta['types'][$index]['active'] =
                $this->mapToKey($type['value']) == $model->{$this->attribute . '_type'};

            foreach ($type['fields'] as $field) {
                try {
                    $field->resolveForDisplay($model->{$this->attribute});
                } catch (\Exception $e) {
                    //
                }
            }
        }
    }
46922
public function rowData($attribute, array $template)
    {
        if (count($template)) {
            $this->data[$attribute] = [];
            foreach ($template as $key => $value) {
                $this->data[$attribute][$key] = Helper::compileContent($value, $this->data, $this->row);
            }
        }

        return $this;
    }
871827
@XmlElement(name="attribute")
    public void setAttributeInfos(final List<AttributeInfo> attributeInfos) {
        if(attributeInfos == this.attributes) {
            // Java7の場合、getterで取得したインスタンスをそのまま設定するため、スキップする。
            return;
        }
        
        this.attributes.clear();
        for(AttributeInfo attr : attributeInfos) {
            addAttribute(attr.name, attr.value);
        }
    }
385935
private function collectAttributeTypeMetadata(
        PropertyMetadataBuilder $metadata,
        Attribute $attribute
    ) : void {
        $type = $attribute->type;

        // handle the case if the property type is mixed
        if ('mixed' === $type) {
            return;
        }

        if ($attribute->required) {
            $metadata->withBeingRequired();
        }

        // Evaluate type

        // Checks if the property has array<type>
        if (false !== $pos = strpos($type, '<')) {
            $arrayType = substr($type, $pos + 1, -1);

            $metadata->withType(new ArrayType(new MixedType(), $this->createTypeFromName($arrayType)));

            return;
        }

        // Checks if the property has type[]
         if (false !== $pos = strrpos($type, '[')) {
            $arrayType = substr($type, 0, $pos);

            $metadata->withType(new ArrayType(new MixedType(), $this->createTypeFromName($arrayType)));

            return;
        }

        $metadata->withType($this->createTypeFromName($attribute->type));
    }