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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
378b765e
Commit
378b765e
authored
Aug 02, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #4571: ignore non-string attribute names for AttributeBehavior.
parent
066989f0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
2 deletions
+9
-2
AttributeBehavior.php
framework/behaviors/AttributeBehavior.php
+4
-1
BlameableBehavior.php
framework/behaviors/BlameableBehavior.php
+2
-0
TimestampBehavior.php
framework/behaviors/TimestampBehavior.php
+3
-1
No files found.
framework/behaviors/AttributeBehavior.php
View file @
378b765e
...
...
@@ -93,7 +93,10 @@ class AttributeBehavior extends Behavior
$attributes
=
(
array
)
$this
->
attributes
[
$event
->
name
];
$value
=
$this
->
getValue
(
$event
);
foreach
(
$attributes
as
$attribute
)
{
$this
->
owner
->
$attribute
=
$value
;
// ignore attribute names which are not string (e.g. when set by TimestampBehavior::updatedAtAttribute)
if
(
is_string
(
$attribute
))
{
$this
->
owner
->
$attribute
=
$value
;
}
}
}
}
...
...
framework/behaviors/BlameableBehavior.php
View file @
378b765e
...
...
@@ -54,10 +54,12 @@ class BlameableBehavior extends AttributeBehavior
{
/**
* @var string the attribute that will receive current user ID value
* Set this property to be null if you do not want to record the creator ID.
*/
public
$createdByAttribute
=
'created_by'
;
/**
* @var string the attribute that will receive current user ID value
* Set this property to be null if you do not want to record the updater ID.
*/
public
$updatedByAttribute
=
'updated_by'
;
/**
...
...
framework/behaviors/TimestampBehavior.php
View file @
378b765e
...
...
@@ -64,10 +64,12 @@ class TimestampBehavior extends AttributeBehavior
{
/**
* @var string the attribute that will receive timestamp value
* Set this property to be null if you do not want to record the creation time.
*/
public
$createdAtAttribute
=
'created_at'
;
/**
* @var string the attribute that will receive timestamp value
* @var string the attribute that will receive timestamp value.
* Set this property to be null if you do not want to record the update time.
*/
public
$updatedAtAttribute
=
'updated_at'
;
/**
...
...
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