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
abb2a0db
Commit
abb2a0db
authored
Feb 15, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor improvement of label generation.
parent
eeff0ea6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
BaseActiveRecord.php
framework/db/BaseActiveRecord.php
+11
-8
No files found.
framework/db/BaseActiveRecord.php
View file @
abb2a0db
...
@@ -1124,7 +1124,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
...
@@ -1124,7 +1124,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
/** @var $viaClass ActiveRecord */
/** @var $viaClass ActiveRecord */
/** @var $record ActiveRecord */
/** @var $record ActiveRecord */
$record
=
new
$viaClass
();
$record
=
new
$viaClass
();
foreach
(
$columns
as
$column
=>
$value
)
{
foreach
(
$columns
as
$column
=>
$value
)
{
$record
->
$column
=
$value
;
$record
->
$column
=
$value
;
}
}
$record
->
insert
(
false
);
$record
->
insert
(
false
);
...
@@ -1300,19 +1300,22 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
...
@@ -1300,19 +1300,22 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
$labels
=
$this
->
attributeLabels
();
$labels
=
$this
->
attributeLabels
();
if
(
isset
(
$labels
[
$attribute
]))
{
if
(
isset
(
$labels
[
$attribute
]))
{
return
(
$labels
[
$attribute
]);
return
(
$labels
[
$attribute
]);
}
elseif
(
strpos
(
$attribute
,
'.'
))
{
}
elseif
(
strpos
(
$attribute
,
'.'
))
{
$attributeParts
=
explode
(
'.'
,
$attribute
);
$attributeParts
=
explode
(
'.'
,
$attribute
);
$neededAttribute
=
array_pop
(
$attributeParts
);
$neededAttribute
=
array_pop
(
$attributeParts
);
$relatedModel
=
$this
;
$relatedModel
=
$this
;
foreach
(
$attributeParts
as
$relationName
)
{
foreach
(
$attributeParts
as
$relationName
)
{
try
{
if
(
isset
(
$this
->
_related
[
$relationName
])
&&
$this
->
_related
[
$relationName
]
instanceof
self
)
{
$relation
=
$relatedModel
->
getRelation
(
$relationName
);
$relatedModel
=
$this
->
_related
[
$relationName
];
}
catch
(
InvalidParamException
$e
)
{
}
else
{
return
$this
->
generateAttributeLabel
(
$attribute
);
try
{
$relation
=
$relatedModel
->
getRelation
(
$relationName
);
}
catch
(
InvalidParamException
$e
)
{
return
$this
->
generateAttributeLabel
(
$attribute
);
}
$relatedModel
=
new
$relation
->
modelClass
;
}
}
$relatedModel
=
new
$relation
->
modelClass
;
}
}
$labels
=
$relatedModel
->
attributeLabels
();
$labels
=
$relatedModel
->
attributeLabels
();
...
...
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