2017 © Pedro Peláez
 

library yii2-behaviors

image

consultnn/yii2-behaviors

  • Tuesday, May 30, 2017
  • by sokrat
  • Repository
  • 10 Watchers
  • 1 Stars
  • 86 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 8 % Grown

The README.md

[We no longer maintain this repository]

Use consultnn/yii2-validators instead AttributeTypeBehavior, (*1)

yii2-behaviors

Extension of the class yii\base\Behavior, (*2)


Class AttributeTypeBehavior to converts attribute for all simple types and mongoDb types.

Number and boolean type taken from the corresponding attribute validator, (*3)

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, (*4)

Example add convert MongoDate type.

Add attributes => ['date' => 'MongoDate']
Add a method to the class AttributeTypeBehavior:, (*5)

    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, (*6)

The Versions

30/05 2017

dev-new-mongo-driver

dev-new-mongo-driver

  Sources   Download

MIT

The Requires

 

by Maxim Mironyuk
by Sergey Sipatov
by ICC

12/07 2016

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

by Maxim Mironyuk
by Sergey Sipatov
by ICC

30/06 2016

dev-2-new-major-version

dev-2-new-major-version

Pack of Yii2 behaviors for Yii2 from ICC

  Sources   Download

MIT

The Requires

 

by Maxim Mironyuk
by Sergey Sipatov
by ICC

yii2 yii yii 2 behaviors icc

08/03 2016

1.0.3

1.0.3.0

  Sources   Download

MIT

The Requires

 

by Maxim Mironyuk
by Sergey Sipatov
by ICC

10/12 2015

v1.0.2

1.0.2.0

  Sources   Download

MIT

The Requires

 

by Sergey Sipatov
by ICC

04/09 2015

v1.0.1

1.0.1.0

  Sources   Download

MIT

The Requires

 

by Sergey Sipatov
by ICC

22/07 2015

v1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

by Sergey Sipatov
by ICC