Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
0129efcb
Commit
0129efcb
authored
Feb 20, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2500 from lucianobaraglia/master
Some minimal doc blocks changes for consitency
parents
314b897f
a625b79b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
10 deletions
+11
-10
AttributeBehavior.php
framework/behaviors/AttributeBehavior.php
+5
-3
BlameableBehavior.php
framework/behaviors/BlameableBehavior.php
+3
-3
TimestampBehavior.php
framework/behaviors/TimestampBehavior.php
+3
-4
No files found.
framework/behaviors/AttributeBehavior.php
View file @
0129efcb
...
...
@@ -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';
...
...
framework/behaviors/BlameableBehavior.php
View file @
0129efcb
...
...
@@ -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
...
...
framework/behaviors/TimestampBehavior.php
View file @
0129efcb
...
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment