schmunk42\giiant\generators\crud\ProviderTrait::shorthandAttributeFormat PHP Метод

shorthandAttributeFormat() защищенный Метод

protected shorthandAttributeFormat ( $attribute, $model )
    protected function shorthandAttributeFormat($attribute, $model)
    {
        $column = $this->getColumnByAttribute($attribute, $model);
        if (!$column) {
            Yii::trace("No column for '{$attribute}' found", __METHOD__);
            return;
        } else {
            Yii::trace("Table column detected for '{$attribute}'", __METHOD__);
        }
        if ($column->phpType === 'boolean') {
            $format = 'boolean';
        } elseif ($column->type === 'text') {
            $format = 'ntext';
        } elseif (stripos($column->name, 'time') !== false && $column->phpType === 'integer') {
            $format = 'datetime';
        } elseif (stripos($column->name, 'email') !== false) {
            $format = 'email';
        } elseif (stripos($column->name, 'url') !== false) {
            $format = 'url';
        } else {
            $format = 'text';
        }
        return "        '" . $column->name . ($format === 'text' ? '' : ':' . $format) . "'";
    }