coksnuss/yii2-gii-modelgen 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

coksnuss/yii2-gii-modelgen

最新稳定版本:2.0.15-p3

Composer 安装命令:

composer require coksnuss/yii2-gii-modelgen

包简介

A tweaked model generator for the Gii module of the Yii 2 framework.

README 文档

README

A tweaked model generator for the Gii module of the Yii 2 framework. The generator re-uses Gii-native code wherever possible and thus has a high chance of retaining all the latest changes of Gii without the need for an update. When checked for the last time, the generator retains the full featureset of Gii 2.0.8.

What this extension does

This extension basically adds three features to gii's basic model template generator:

  1. The generated models are splitted into a base model and a concrete model. Whenever the database structure is changed (e.g. through a migration) the base model can simply be overridden by the newly generated model. No custom code is touched. All custom code is written into the concrete model which is used throughout the application and extends the base model.
  2. A new option is added to directly integrate the timestamp behavior into models by providing the column names of the created_at and updated_at column.
  3. When generating models for all tables using the wildcard operator * the migration table is omitted.
  4. In addition to the model class, it is possible to generate a query class. (This feature is now natively supported by Gii)

In addition, the template files were slightly adapted:

  1. The tableName() function within the generated model classes is only generated if it is required, i.e., if default implementation of ActiveRecord::tableName() is insufficient.
  2. When generating a query class, it does not contain any boilerplate functions.

Installation

First this extension needs to be included via composer by issuing the following console command within the root directory of your yii2 project:

composer require --prefer-dist "coksnuss/yii2-gii-modelgen"

Furthermore Gii needs to know of the newly available model template. This is achieved by modifying the corresponding configuration file

[...]
'class' => 'yii\gii\Module',
'generators' => [
    'model' => ['class' => 'coksnuss\gii\modelgen\generators\model\Generator'],
],
[...]

Thats it.

统计信息

  • 总下载量: 2.63k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-11-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固