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
4a9f47be
Commit
4a9f47be
authored
Feb 03, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored sphinx and db AR to call parent implementation of populateRecord()
parent
16e1aff4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
19 deletions
+5
-19
ActiveRecord.php
extensions/sphinx/ActiveRecord.php
+3
-10
ActiveRecord.php
framework/db/ActiveRecord.php
+2
-9
No files found.
extensions/sphinx/ActiveRecord.php
View file @
4a9f47be
...
...
@@ -623,20 +623,13 @@ abstract class ActiveRecord extends BaseActiveRecord
*/
public
static
function
populateRecord
(
$record
,
$row
)
{
// TODO refactor to call parent
$columns
=
static
::
getIndexSchema
()
->
columns
;
foreach
(
$row
as
$name
=>
$value
)
{
if
(
isset
(
$columns
[
$name
]))
{
$column
=
$columns
[
$name
];
if
(
$column
->
isMva
)
{
$value
=
explode
(
','
,
$value
);
}
$record
->
setAttribute
(
$name
,
$value
);
}
else
{
$record
->
$name
=
$value
;
if
(
isset
(
$columns
[
$name
])
&&
$columns
[
$name
]
->
isMva
)
{
$row
[
$name
]
=
explode
(
','
,
$value
);
}
}
$record
->
setOldAttributes
(
$record
->
getAttributes
()
);
parent
::
populateRecord
(
$record
,
$row
);
}
/**
...
...
framework/db/ActiveRecord.php
View file @
4a9f47be
...
...
@@ -279,20 +279,13 @@ class ActiveRecord extends BaseActiveRecord
*/
public
static
function
populateRecord
(
$record
,
$row
)
{
// TODO refactor to call parent
$attributes
=
array_flip
(
$record
->
attributes
());
$columns
=
static
::
getTableSchema
()
->
columns
;
foreach
(
$row
as
$name
=>
$value
)
{
if
(
isset
(
$columns
[
$name
]))
{
$value
=
$columns
[
$name
]
->
typecast
(
$value
);
}
if
(
isset
(
$attributes
[
$name
]))
{
$record
->
setAttribute
(
$name
,
$value
);
}
else
{
$record
->
$name
=
$value
;
$row
[
$name
]
=
$columns
[
$name
]
->
typecast
(
$value
);
}
}
$record
->
setOldAttributes
(
$record
->
getAttributes
()
);
parent
::
populateRecord
(
$record
,
$row
);
}
/**
...
...
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