Product::behaviors PHP Method

behaviors() public method

public behaviors ( ) : array
return array
    public function behaviors()
    {
        $module = Yii::app()->getModule('store');
        return ['time' => ['class' => 'zii.behaviors.CTimestampBehavior', 'setUpdateOnCreate' => true, 'createAttribute' => 'create_time', 'updateAttribute' => 'update_time'], 'upload' => ['class' => 'yupe\\components\\behaviors\\ImageUploadBehavior', 'attributeName' => 'image', 'minSize' => $module->minSize, 'maxSize' => $module->maxSize, 'types' => $module->allowedExtensions, 'uploadPath' => $module->uploadPath . '/product', 'resizeOnUpload' => true, 'resizeOptions' => ['maxWidth' => 900, 'maxHeight' => 900]], 'sortable' => ['class' => 'yupe\\components\\behaviors\\SortableBehavior']];
    }

Usage Example

Example #1
0
 public function behaviors()
 {
     return array_merge(parent::behaviors(), array('wform' => array('class' => 'ext.wform.WFormBehavior', 'relations' => array('category' => array('unsetInvalid' => true, 'required' => false), 'tags' => array('required' => false), 'images', 'certificate', 'description'))));
 }