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
ecb113f1
Commit
ecb113f1
authored
Nov 01, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed model serializtaion example
parent
8ed9ce0c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
rest-resources.md
docs/guide/rest-resources.md
+2
-2
Arrayable.php
framework/base/Arrayable.php
+2
-2
Model.php
framework/base/Model.php
+2
-2
No files found.
docs/guide/rest-resources.md
View file @
ecb113f1
...
@@ -71,8 +71,8 @@ public function fields()
...
@@ -71,8 +71,8 @@ public function fields()
// field name is "email", the corresponding attribute name is "email_address"
// field name is "email", the corresponding attribute name is "email_address"
'email'
=>
'email_address'
,
'email'
=>
'email_address'
,
// field name is "name", its value is defined by a PHP callback
// field name is "name", its value is defined by a PHP callback
'name'
=>
function
()
{
'name'
=>
function
(
$model
)
{
return
$
this
->
first_name
.
' '
.
$this
->
last_name
;
return
$
model
->
first_name
.
' '
.
$model
->
last_name
;
},
},
];
];
}
}
...
...
framework/base/Arrayable.php
View file @
ecb113f1
...
@@ -52,8 +52,8 @@ interface Arrayable
...
@@ -52,8 +52,8 @@ interface Arrayable
* 'email',
* 'email',
* 'firstName' => 'first_name',
* 'firstName' => 'first_name',
* 'lastName' => 'last_name',
* 'lastName' => 'last_name',
* 'fullName' => function () {
* 'fullName' => function (
$model
) {
* return $
this->first_name . ' ' . $this
->last_name;
* return $
model->first_name . ' ' . $model
->last_name;
* },
* },
* ];
* ];
* ```
* ```
...
...
framework/base/Model.php
View file @
ecb113f1
...
@@ -841,8 +841,8 @@ class Model extends Component implements IteratorAggregate, ArrayAccess, Arrayab
...
@@ -841,8 +841,8 @@ class Model extends Component implements IteratorAggregate, ArrayAccess, Arrayab
* 'email',
* 'email',
* 'firstName' => 'first_name',
* 'firstName' => 'first_name',
* 'lastName' => 'last_name',
* 'lastName' => 'last_name',
* 'fullName' => function () {
* 'fullName' => function (
$model
) {
* return $
this->first_name . ' ' . $this
->last_name;
* return $
model->first_name . ' ' . $model
->last_name;
* },
* },
* ];
* ];
* ```
* ```
...
...
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