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
efda450a
Commit
efda450a
authored
Jun 09, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3764 from creocoder/excess-model-methods
Excess \yii\base\Model::resolveFields() method removed
parents
364153cd
7bce33f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
38 deletions
+0
-38
Model.php
framework/base/Model.php
+0
-38
No files found.
framework/base/Model.php
View file @
efda450a
...
...
@@ -860,44 +860,6 @@ class Model extends Component implements IteratorAggregate, ArrayAccess, Arrayab
}
/**
* Determines which fields can be returned by [[toArray()]].
* This method will check the requested fields against those declared in [[fields()]] and [[extraFields()]]
* to determine which fields can be returned.
* @param array $fields the fields being requested for exporting
* @param array $expand the additional fields being requested for exporting
* @return array the list of fields to be exported. The array keys are the field names, and the array values
* are the corresponding object property names or PHP callables returning the field values.
*/
protected
function
resolveFields
(
array
$fields
,
array
$expand
)
{
$result
=
[];
foreach
(
$this
->
fields
()
as
$field
=>
$definition
)
{
if
(
is_integer
(
$field
))
{
$field
=
$definition
;
}
if
(
empty
(
$fields
)
||
in_array
(
$field
,
$fields
,
true
))
{
$result
[
$field
]
=
$definition
;
}
}
if
(
empty
(
$expand
))
{
return
$result
;
}
foreach
(
$this
->
extraFields
()
as
$field
=>
$definition
)
{
if
(
is_integer
(
$field
))
{
$field
=
$definition
;
}
if
(
in_array
(
$field
,
$expand
,
true
))
{
$result
[
$field
]
=
$definition
;
}
}
return
$result
;
}
/**
* Returns an iterator for traversing the attributes in the model.
* This method is required by the interface IteratorAggregate.
* @return ArrayIterator an iterator for traversing the items in the list.
...
...
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