Download the PHP package andrewdanilov/yii2-behaviors without Composer
On this page you can find all versions of the php package andrewdanilov/yii2-behaviors. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download andrewdanilov/yii2-behaviors
More information about andrewdanilov/yii2-behaviors
Files in andrewdanilov/yii2-behaviors
Package yii2-behaviors
Short Description Various behaviors for AR models
License MIT
Informations about the package yii2-behaviors
Yii2 Behaviors
Various behaviors for AR models
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the require
section of your composer.json
file.
Usage
DateBehavior
At your controller class add to behaviors()
method:
DateBehavior converts date into mysql format before it will be saved to database (onBeforeSave
event)
and into display format after it is fetched from database (onAfterFind
event).
You can define display format by modifiyng Yii::$app->formatter
component in your config:
If you have problems with time shifting, set defaultTimeZone
property of formatter.
TagBehavior
Use this behavior to link two models with many-to-many relation via staging table. This behavior will take care of saving new links to staging table and removing obsolete ones.
Model Product.php
Model Category.php
Model ProductCategory.php
View product/update.php
TagBehavior can be used several times in one model, so you can add at the same time categories, tags and linked products to your Product
model
JsonTypecastBehavior
Use this behavior to convert database field values saved in json-string format into array and back. This allows you to store a value in the database as a json string, but treat it as if it were an array.
RateLimitBehavior
Use this behavior to limit rate of requests from your visitors to specific controller actions.
All versions of yii2-behaviors with dependencies
yiisoft/yii2 Version ^2.0.0
mihaildev/yii2-elfinder Version *@dev
andrewdanilov/yii2-ckeditor Version ~1.0.1
andrewdanilov/yii2-helpers Version ~1.0.17
andrewdanilov/yii2-input-images Version ~1.0.4