Exemplo n.º 1
0
 public function behaviors()
 {
     $behaviors = ['attributesMapBehavior' => ['class' => '\\yiicod\\mailqueue\\models\\behaviors\\AttributesMapBehavior', 'attributesMap' => Yii::$app->get('mailqueue')->modelMap['MailQueue']], 'timestampBehavior' => ['class' => TimestampBehavior::className(), 'createdAtAttribute' => in_array(Yii::$app->get('mailqueue')->modelMap['MailQueue']['fieldCreateDate'], $this->attributes()) ? Yii::$app->get('mailqueue')->modelMap['MailQueue']['fieldCreateDate'] : null, 'updatedAtAttribute' => in_array(Yii::$app->get('mailqueue')->modelMap['MailQueue']['fieldUpdateDate'], $this->attributes()) ? Yii::$app->get('mailqueue')->modelMap['MailQueue']['fieldUpdateDate'] : null, 'value' => function () {
         return date("Y-m-d H:i:s");
     }], 'XssBehavior' => ['class' => '\\yiicod\\base\\models\\behaviors\\XssBehavior', 'attributesExclude' => array(Yii::$app->get('mailqueue')->modelMap['MailQueue']['fieldBody'])]];
     return ArrayHelper::merge(parent::behaviors(), $behaviors);
 }
Exemplo n.º 2
0
 public function behaviors()
 {
     $result = parent::behaviors();
     return array_merge($result, ['timestamp' => ['class' => \yii\behaviors\TimestampBehavior::className(), 'attributes' => [\yii\db\ActiveRecord::EVENT_BEFORE_UPDATE => 'date_update'], 'value' => function () {
         return date('Y-m-d H:i:s');
     }]]);
 }
Exemplo n.º 3
0
 /**
  * @return array Behaviors
  */
 public function behaviors()
 {
     $items = parent::behaviors();
     if ($this->timeStampBehaviorEnabled && $this->hasAttribute('created_at')) {
         $items['date'] = ['class' => TimestampBehavior::className(), 'createdAtAttribute' => 'created_at', 'updatedAtAttribute' => $this->hasAttribute('updated_at') ? 'updated_at' : 'created_at', 'value' => function () {
             return date('Y-m-d H:i:s');
         }];
     }
     return $items;
 }
Exemplo n.º 4
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return array_merge(parent::behaviors(), [BlameableBehavior::className() => ['class' => BlameableBehavior::className(), 'value' => function ($event) {
         if (\Yii::$app instanceof \yii\console\Application) {
             return null;
         } else {
             $user = Yii::$app->get('user', false);
             return $user && !$user->isGuest ? $user->id : null;
         }
     }], TimestampBehavior::className() => ['class' => TimestampBehavior::className()], HasTableCache::className() => ['class' => HasTableCache::className(), 'cache' => \Yii::$app->cache]]);
 }
Exemplo n.º 5
0
 /**
  * (array) behaviors :
  * @return array
  */
 public function behaviors()
 {
     return array_merge(parent::behaviors(), ['timestamp' => ['class' => TimestampBehavior::className()], 'audit' => ['class' => AuditTrailBehavior::className()]]);
 }
Exemplo n.º 6
0
Arquivo: Post.php Projeto: giicms/tour
 public function behaviors()
 {
     return array_merge(parent::behaviors(), ['timestamp' => ['class' => 'yii\\behaviors\\TimestampBehavior', 'attributes' => [ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at']]], 'slug' => ['class' => 'yii\\behaviors\\SluggableBehavior', 'attribute' => 'title', 'slugAttribute' => 'slug', 'immutable' => true, 'ensureUnique' => true]]);
 }
Exemplo n.º 7
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['timestamp' => ['class' => TimestampBehavior::className(), 'createdAtAttribute' => 'createdAt', 'updatedAtAttribute' => 'updatedAt']]);
 }
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['timestamp' => ['class' => TimestampBehavior::className(), 'attributes' => [ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'], 'value' => function () {
         return time();
     }]]);
 }
Exemplo n.º 9
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return array_merge(parent::behaviors(), [['class' => CascadeBehavior::className(), 'children' => ['files']]]);
 }
Exemplo n.º 10
0
 public function behaviors()
 {
     return array_merge(parent::behaviors(), ['slug' => ['class' => SluggableBehavior::className(), 'attribute' => 'title', 'slugAttribute' => 'slug', 'immutable' => true, 'ensureUnique' => true]]);
 }
Exemplo n.º 11
0
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), [Relations::className(), ['class' => TimestampBehavior::className()]]);
 }
Exemplo n.º 12
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors[] = TimestampBehavior::className();
     return $behaviors;
 }
Exemplo n.º 13
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors[] = ['class' => AttachBehavior::className(), 'models' => ['avatar' => ['class' => UserAvatarFile::className()]]];
     return $behaviors;
 }
Exemplo n.º 14
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return array_merge(parent::behaviors(), [['class' => CascadeBehavior::className(), 'children' => ['disciplineNames', 'studentEducations', 'files']]]);
 }
Exemplo n.º 15
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return array_merge(parent::behaviors(), [FileBehavior::className()]);
 }
Exemplo n.º 16
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $parentBehaviors = parent::behaviors();
     $thisBehaviors = ['relationDelete' => ['class' => RelationsDelete::className(), 'relations' => ['plans', 'prices', 'requests', 'usages']]];
     return ArrayHelper::merge($parentBehaviors, $thisBehaviors);
 }
Exemplo n.º 17
0
 public function behaviors()
 {
     $ret = parent::behaviors();
     $ret[] = ['class' => TimestampBehavior::className(), 'value' => new Expression('NOW()')];
     return $ret;
 }
Exemplo n.º 18
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return array_merge(parent::behaviors(), [EmailBehavior::className(), 'timestamp' => ['class' => 'yii\\behaviors\\TimestampBehavior', 'attributes' => [self::EVENT_BEFORE_INSERT => ['created_at']]]]);
 }
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['translateable' => ['class' => TranslateableBehavior::className(), 'translationAttributes' => ['to', 'bcc', 'from', 'subject', 'message']], 'timestamp' => ['class' => TimestampBehavior::className(), 'attributes' => [ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'], 'value' => function () {
         return time();
     }]]);
 }
 /**
  * @inheritDoc
  */
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['sort' => ['class' => SortBehavior::class, 'query' => function (AttributeEnumRecord $r) {
         return AttributeEnumRecord::find()->byRule($r->rule_id);
     }]]);
 }
Exemplo n.º 21
0
 /**
  * @return array
  */
 public function behaviors()
 {
     return array_merge(parent::behaviors(), [HasJsonFieldsBehavior::className() => ['class' => HasJsonFieldsBehavior::className(), 'fields' => ['provider_data']]]);
 }
Exemplo n.º 22
0
 /**
  * @inheritDoc
  */
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['timestamp' => ['class' => TimestampBehavior::className()], 'blame' => ['class' => BlameableBehavior::className()], 'ARLog' => ['class' => ARLogBehavior::className()], 'sortable' => ['class' => SortableModel::className()]]);
 }
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['timestamp' => ['class' => TimestampBehavior::className(), 'attributes' => [ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'], 'value' => function () {
         return time();
     }], 'image' => ['class' => 'infoweb\\cms\\behaviors\\ImageBehave'], 'pdf' => ['class' => 'infoweb\\skarabee\\behaviors\\PdfBehave']]);
 }
Exemplo n.º 24
0
 public function behaviors()
 {
     return array_merge(parent::behaviors(), ['timestamp' => ['class' => 'yii\\behaviors\\TimestampBehavior', 'attributes' => [self::EVENT_BEFORE_INSERT => ['create_time', 'update_time'], self::EVENT_BEFORE_UPDATE => ['update_time']], 'value' => function () {
         return new Expression('CURRENT_TIMESTAMP');
     }], 'blameable' => ['class' => BlameableBehavior::className(), 'createdByAttribute' => 'create_by', 'updatedByAttribute' => false], 'attachments' => ['class' => \nemmo\attachments\behaviors\FileBehavior::className()], 'ip' => ['class' => IpBehavior::className(), 'attributes' => [self::EVENT_BEFORE_INSERT => ['ip']]]]);
 }
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return array_merge(parent::behaviors(), [TimestampBehavior::className(), BlameableBehavior::className()]);
 }
Exemplo n.º 26
0
 /**
  * @return array
  */
 public function behaviors()
 {
     $rVal = parent::behaviors();
     $rVal['timestamp'] = ['class' => SqlToTimestampBehavior::className(), 'attributes' => ['expires_at']];
     return $rVal;
 }
Exemplo n.º 27
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return array_merge(parent::behaviors(), [['class' => CascadeBehavior::className(), 'children' => ['disciplineSemesters']]]);
 }
Exemplo n.º 28
0
 /**
  * @inheritdoc;
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['typecast'] = \cookyii\behaviors\AttributeTypecastBehavior::class;
     return $behaviors;
 }
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), [TimestampBehavior::className()]);
 }
Exemplo n.º 30
0
 public function behaviors()
 {
     return array_merge(parent::behaviors(), [['class' => AttributeBehavior::className(), 'attributes' => [ActiveRecord::EVENT_AFTER_FIND => 'data'], 'value' => function ($event) {
         return unserialize($this->data);
     }]]);
 }