定制 consultnn/yii2-behaviors 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

consultnn/yii2-behaviors

最新稳定版本:1.0.3

Composer 安装命令:

composer require consultnn/yii2-behaviors

包简介

README 文档

README

Use consultnn/yii2-validators instead AttributeTypeBehavior

yii2-behaviors

Extension of the class yii\base\Behavior

###Class AttributeTypeBehavior to converts attribute for all simple types and mongoDb types.
Number and boolean type taken from the corresponding attribute validator

Example of a call from the model.
    public function behaviors()
    {
        return [
            [
                'class' => AttributeTypeBehavior::className(),
                'attributes' => [
                    '_id' => AttributeTypeBehavior::TYPE_MONGO_ID,
                    'attribute1' => [AttributeTypeBehavior::TYPE_ARRAY_OF => AttributeTypeBehavior::TYPE_INTEGER]
                ]
            ]
        ];
    }

Default events ActiveRecord::EVENT_BEFORE_INSERT, ActiveRecord::EVENT_BEFORE_UPDATE

Example add convert MongoDate type.

Add attributes => ['date' => 'MongoDate']
Add a method to the class AttributeTypeBehavior:

    private function setMongoDate(&$value)
    {
        $value = new \MongoDate(strtotime($value));
    }

###Class TreeViewBehavior to dynamically update the model attributes with the use of plug-in jstree Events ActiveRecord::EVENT_BEFORE_INSERT, ActiveRecord::EVENT_BEFORE_UPDATE, ActiveRecord::EVENT_BEFORE_DELETE

统计信息

  • 总下载量: 95
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固