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
a5188f1f
Commit
a5188f1f
authored
Dec 07, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #1457: support string representation of AR.
parent
72db6ffb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
BaseActiveRecord.php
framework/yii/db/BaseActiveRecord.php
+11
-0
No files found.
framework/yii/db/BaseActiveRecord.php
View file @
a5188f1f
...
...
@@ -93,6 +93,17 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
/**
* Returns the string representation of this AR instance.
* The default implementation will return the primary key (or JSON representation of the primary key if it is composite).
* @return string the string representation of this AR instance.
*/
public
function
__toString
()
{
$pk
=
$this
->
getPrimaryKey
();
return
is_array
(
$pk
)
?
json_encode
(
$pk
)
:
$pk
;
}
/**
* Creates an [[ActiveQuery]] instance for query purpose.
*
* @include @yii/db/ActiveRecord-find.md
...
...
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