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
9c5ba231
Commit
9c5ba231
authored
Oct 25, 2013
by
Gudz Taras
Committed by
gudz.taras@gmail.com
Oct 25, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes issue #1063: Fatal Error while getting value from ActiveRelation generated by Gii
parent
c5801dc6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
Generator.php
framework/yii/gii/generators/model/Generator.php
+8
-8
No files found.
framework/yii/gii/generators/model/Generator.php
View file @
9c5ba231
...
@@ -265,8 +265,8 @@ class Generator extends \yii\gii\Generator
...
@@ -265,8 +265,8 @@ class Generator extends \yii\gii\Generator
$link
=
$this
->
generateRelationLink
(
array_flip
(
$refs
));
$link
=
$this
->
generateRelationLink
(
array_flip
(
$refs
));
$relationName
=
$this
->
generateRelationName
(
$relations
,
$className
,
$table
,
$fks
[
0
],
false
);
$relationName
=
$this
->
generateRelationName
(
$relations
,
$className
,
$table
,
$fks
[
0
],
false
);
$relations
[
$className
][
$relationName
]
=
[
$relations
[
$className
][
$relationName
]
=
[
"return
\$
this->hasOne('
$refClassName
',
$link
);"
,
"return
\$
this->hasOne('
$
this->ns
\\
$
refClassName
',
$link
);"
,
$refClassName
,
$
this
->
ns
.
'\\'
.
$
refClassName
,
false
,
false
,
];
];
...
@@ -281,8 +281,8 @@ class Generator extends \yii\gii\Generator
...
@@ -281,8 +281,8 @@ class Generator extends \yii\gii\Generator
$link
=
$this
->
generateRelationLink
(
$refs
);
$link
=
$this
->
generateRelationLink
(
$refs
);
$relationName
=
$this
->
generateRelationName
(
$relations
,
$refClassName
,
$refTable
,
$className
,
$hasMany
);
$relationName
=
$this
->
generateRelationName
(
$relations
,
$refClassName
,
$refTable
,
$className
,
$hasMany
);
$relations
[
$refClassName
][
$relationName
]
=
[
$relations
[
$refClassName
][
$relationName
]
=
[
"return
\$
this->"
.
(
$hasMany
?
'hasMany'
:
'hasOne'
)
.
"('
$className
',
$link
);"
,
"return
\$
this->"
.
(
$hasMany
?
'hasMany'
:
'hasOne'
)
.
"('
$
this->ns
\\
$
className
',
$link
);"
,
$className
,
$
this
->
ns
.
'\\'
.
$
className
,
$hasMany
,
$hasMany
,
];
];
}
}
...
@@ -299,8 +299,8 @@ class Generator extends \yii\gii\Generator
...
@@ -299,8 +299,8 @@ class Generator extends \yii\gii\Generator
$viaLink
=
$this
->
generateRelationLink
([
$table
->
primaryKey
[
0
]
=>
$fks
[
$table
->
primaryKey
[
0
]][
1
]]);
$viaLink
=
$this
->
generateRelationLink
([
$table
->
primaryKey
[
0
]
=>
$fks
[
$table
->
primaryKey
[
0
]][
1
]]);
$relationName
=
$this
->
generateRelationName
(
$relations
,
$className0
,
$db
->
getTableSchema
(
$table0
),
$table
->
primaryKey
[
1
],
true
);
$relationName
=
$this
->
generateRelationName
(
$relations
,
$className0
,
$db
->
getTableSchema
(
$table0
),
$table
->
primaryKey
[
1
],
true
);
$relations
[
$className0
][
$relationName
]
=
[
$relations
[
$className0
][
$relationName
]
=
[
"return
\$
this->hasMany('
$className1
',
$link
)->viaTable('
{
$table
->
name
}
',
$viaLink
);"
,
"return
\$
this->hasMany('
$
this->ns
\\
$
className1
',
$link
)->viaTable('
{
$table
->
name
}
',
$viaLink
);"
,
$className0
,
$
this
->
ns
.
'\\'
.
$
className0
,
true
,
true
,
];
];
...
@@ -308,8 +308,8 @@ class Generator extends \yii\gii\Generator
...
@@ -308,8 +308,8 @@ class Generator extends \yii\gii\Generator
$viaLink
=
$this
->
generateRelationLink
([
$table
->
primaryKey
[
1
]
=>
$fks
[
$table
->
primaryKey
[
1
]][
1
]]);
$viaLink
=
$this
->
generateRelationLink
([
$table
->
primaryKey
[
1
]
=>
$fks
[
$table
->
primaryKey
[
1
]][
1
]]);
$relationName
=
$this
->
generateRelationName
(
$relations
,
$className1
,
$db
->
getTableSchema
(
$table1
),
$table
->
primaryKey
[
0
],
true
);
$relationName
=
$this
->
generateRelationName
(
$relations
,
$className1
,
$db
->
getTableSchema
(
$table1
),
$table
->
primaryKey
[
0
],
true
);
$relations
[
$className1
][
$relationName
]
=
[
$relations
[
$className1
][
$relationName
]
=
[
"return
\$
this->hasMany('
$className0
',
$link
)->viaTable('
{
$table
->
name
}
',
$viaLink
);"
,
"return
\$
this->hasMany('
$
this->ns
\\
$
className0
',
$link
)->viaTable('
{
$table
->
name
}
',
$viaLink
);"
,
$className1
,
$
this
->
ns
.
'\\'
.
$
className1
,
true
,
true
,
];
];
}
}
...
...
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