mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
Some minimal doc blocks changes for consitency
This commit is contained in:
@ -21,14 +21,16 @@ use yii\base\Event;
|
|||||||
* attribute(s). For example,
|
* attribute(s). For example,
|
||||||
*
|
*
|
||||||
* ~~~
|
* ~~~
|
||||||
|
* use yii\behaviors\AttributeBehavior;
|
||||||
|
*
|
||||||
* public function behaviors()
|
* public function behaviors()
|
||||||
* {
|
* {
|
||||||
* return [
|
* return [
|
||||||
* 'attributeStamp' => [
|
* 'attributeStamp' => [
|
||||||
* 'class' => 'yii\behaviors\AttributeBehavior',
|
* 'class' => AttributeBehavior::className(),
|
||||||
* 'attributes' => [
|
* 'attributes' => [
|
||||||
* ActiveRecord::EVENT_BEFORE_INSERT => ['attribute1'],
|
* ActiveRecord::EVENT_BEFORE_INSERT => 'attribute1',
|
||||||
* ActiveRecord::EVENT_BEFORE_UPDATE => ['attribute2'],
|
* ActiveRecord::EVENT_BEFORE_UPDATE => 'attribute2',
|
||||||
* ],
|
* ],
|
||||||
* 'value' => function ($event) {
|
* 'value' => function ($event) {
|
||||||
* return 'some value';
|
* return 'some value';
|
||||||
|
@ -39,8 +39,8 @@ use yii\db\BaseActiveRecord;
|
|||||||
* [
|
* [
|
||||||
* 'class' => BlameableBehavior::className(),
|
* 'class' => BlameableBehavior::className(),
|
||||||
* 'attributes' => [
|
* 'attributes' => [
|
||||||
* ActiveRecord::EVENT_BEFORE_INSERT => ['creator_id'],
|
* ActiveRecord::EVENT_BEFORE_INSERT => 'author_id',
|
||||||
* ActiveRecord::EVENT_BEFORE_UPDATE => ['updater_id'],
|
* ActiveRecord::EVENT_BEFORE_UPDATE => 'updater_id',
|
||||||
* ],
|
* ],
|
||||||
* ],
|
* ],
|
||||||
* ];
|
* ];
|
||||||
@ -63,7 +63,7 @@ class BlameableBehavior extends AttributeBehavior
|
|||||||
*/
|
*/
|
||||||
public $attributes = [
|
public $attributes = [
|
||||||
BaseActiveRecord::EVENT_BEFORE_INSERT => ['created_by', 'updated_by'],
|
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
|
* @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:
|
* you may configure the [[attributes]] and [[value]] properties like the following:
|
||||||
*
|
*
|
||||||
* ```php
|
* ```php
|
||||||
* use yii\behaviors\TimestampBehavior;
|
|
||||||
* use yii\db\Expression;
|
* use yii\db\Expression;
|
||||||
*
|
*
|
||||||
* public function behaviors()
|
* public function behaviors()
|
||||||
@ -43,8 +42,8 @@ use yii\db\Expression;
|
|||||||
* 'timestamp' => [
|
* 'timestamp' => [
|
||||||
* 'class' => TimestampBehavior::className(),
|
* 'class' => TimestampBehavior::className(),
|
||||||
* 'attributes' => [
|
* 'attributes' => [
|
||||||
* ActiveRecord::EVENT_BEFORE_INSERT => ['creation_time'],
|
* ActiveRecord::EVENT_BEFORE_INSERT => 'creation_time',
|
||||||
* ActiveRecord::EVENT_BEFORE_UPDATE => ['update_time'],
|
* ActiveRecord::EVENT_BEFORE_UPDATE => 'update_time',
|
||||||
* ],
|
* ],
|
||||||
* 'value' => new Expression('NOW()'),
|
* 'value' => new Expression('NOW()'),
|
||||||
* ],
|
* ],
|
||||||
@ -74,7 +73,7 @@ class TimestampBehavior extends AttributeBehavior
|
|||||||
*/
|
*/
|
||||||
public $attributes = [
|
public $attributes = [
|
||||||
BaseActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'],
|
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.
|
* @var callable|Expression The expression that will be used for generating the timestamp.
|
||||||
|
Reference in New Issue
Block a user