cornernote / gii-modeldoc-generator
为 Yii 框架的 Gii ModelDoc 生成器
    1.2.7
    2017-05-19 09:39 UTC
Requires (Dev)
- yiisoft/yii: 1.1.15
README
ModelDoc 生成器将扩展 Gii,允许通过 phpDoc 兼容的文档来更新现有的模型。
功能
- 表字段
- 为每个字段添加属性。
- 属性注解来自数据库的字段注释。
 
- 关系
- 为每个关系添加一个带有返回类型的属性。
 
- CActiveRecord 继承
- 添加从 CActiveRecord 继承的方法,包括:find()、findByPk()、findByAttributes()、fndBySql()、findAll()、findAllByPk()、findAllByAttributes()、findAllBySql()、with()、together()、cache()、resetScope()、populateRecord() 和 populateRecords()。
 
- 行为
- 为每个行为添加一个带有返回类型的属性。
- 添加分配给行为的方法,除非模型本身已定义。
- 可选地使用 @mixin 为行为。
 
- 范围
- 为每个范围添加一个方法。
 
- 完整语法
- 所有 PHPDoc 标签包含完整语法,包括:方法参数和返回类型。
- 所有返回的模型都有命名空间支持。
 
屏幕截图
安装
请使用以下方法之一下载
Composer 安装
当使用 composer 时,所有要求都将自动下载到正确的位置。无需下载额外的文件或设置第三方文件的路径。
获取 composer
curl http://getcomposer.org/installer | php
安装最新版本或开发版本
php composer.phar require cornernote/gii-modeldoc-generator:*				// latest release
php composer.phar require cornernote/gii-modeldoc-generator:dev-master	// development version
将 vendor 文件夹添加到你的 yii 配置中的 aliases
手动安装
下载最新发布版或开发版本,并将 gii-modeldoc-generator 文件夹移动到你的 protected/modules 文件夹。
配置
将 gii-modeldoc-generator 的路径添加到你的 gii 配置中的 generatorPaths
return array( 'modules' => array( 'gii' => array( 'class'=>'system.gii.GiiModule', 'generatorPaths' => array( // use this if you installed with composer '/path/to/vendor/cornernote/gii-modeldoc-generator/gii', // OR, use this if you downloaded into your extensions folder //'ext.gii-modeldoc-generator.gii', ), ), ), );
使用方法
确保你的模型中包含 --- BEGIN ModelDoc --- 和 --- END ModelDoc ---,例如
/** * Your class description that will not be altered by ModelDoc * * --- BEGIN ModelDoc --- * * this section will be replaced by ModelDoc * * --- END ModelDoc --- */ class MyModel extends CActiveRecord { ... }
访问 index.php?r=gii,然后从菜单中选择 ModelDoc。
注意
此扩展不会创建任何新的模型文件。你应该首先创建它们或使用模型生成器生成它们。
资源
支持
许可证
BSD-3-Clause,版权所有 © 2013-2014 Mr PHP