Commit a625b79b by Luciano Baraglia

Some minimal doc blocks changes for consitency

parent 54476b48
......@@ -21,14 +21,16 @@ use yii\base\Event;
* attribute(s). For example,
*
* ~~~
* use yii\behaviors\AttributeBehavior;
*
* public function behaviors()
* {
* return [
* 'attributeStamp' => [
* 'class' => 'yii\behaviors\AttributeBehavior',
* 'class' => AttributeBehavior::className(),
* 'attributes' => [
* ActiveRecord::EVENT_BEFORE_INSERT => ['attribute1'],
* ActiveRecord::EVENT_BEFORE_UPDATE => ['attribute2'],
* ActiveRecord::EVENT_BEFORE_INSERT => 'attribute1',
* ActiveRecord::EVENT_BEFORE_UPDATE => 'attribute2',
* ],
* 'value' => function ($event) {
* return 'some value';
......
......@@ -39,8 +39,8 @@ use yii\db\BaseActiveRecord;
* [
* 'class' => BlameableBehavior::className(),
* 'attributes' => [
* ActiveRecord::EVENT_BEFORE_INSERT => ['creator_id'],
* ActiveRecord::EVENT_BEFORE_UPDATE => ['updater_id'],
* ActiveRecord::EVENT_BEFORE_INSERT => 'author_id',
* ActiveRecord::EVENT_BEFORE_UPDATE => 'updater_id',
* ],
* ],
* ];
......@@ -63,7 +63,7 @@ class BlameableBehavior extends AttributeBehavior
*/
public $attributes = [
BaseActiveRecord::EVENT_BEFORE_INSERT => ['created_by', 'updated_by'],
BaseActiveRecord::EVENT_BEFORE_UPDATE => ['updated_by'],
BaseActiveRecord::EVENT_BEFORE_UPDATE => 'updated_by',
];
/**
* @var callable the value that will be assigned to the attributes. This should be a valid
......
......@@ -34,7 +34,6 @@ use yii\db\Expression;
* you may configure the [[attributes]] and [[value]] properties like the following:
*
* ```php
* use yii\behaviors\TimestampBehavior;
* use yii\db\Expression;
*
* public function behaviors()
......@@ -43,8 +42,8 @@ use yii\db\Expression;
* 'timestamp' => [
* 'class' => TimestampBehavior::className(),
* 'attributes' => [
* ActiveRecord::EVENT_BEFORE_INSERT => ['creation_time'],
* ActiveRecord::EVENT_BEFORE_UPDATE => ['update_time'],
* ActiveRecord::EVENT_BEFORE_INSERT => 'creation_time',
* ActiveRecord::EVENT_BEFORE_UPDATE => 'update_time',
* ],
* 'value' => new Expression('NOW()'),
* ],
......@@ -74,7 +73,7 @@ class TimestampBehavior extends AttributeBehavior
*/
public $attributes = [
BaseActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'],
BaseActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
BaseActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at',
];
/**
* @var callable|Expression The expression that will be used for generating the timestamp.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment