@@ -150,6 +150,9 @@ protected function getRelation(&$result,$name='',$return=false) {
150
150
$ pk = $ result [$ mappingKey ];
151
151
$ mappingCondition .= " AND {$ mappingFk }=' {$ pk }' " ;
152
152
$ relationData = $ model ->where ($ mappingCondition )->field ($ mappingFields )->find ();
153
+ if (!empty ($ val ['relation_deep ' ])){
154
+ $ model ->getRelation ($ relationData ,$ val ['relation_deep ' ]);
155
+ }
153
156
break ;
154
157
case BELONGS_TO :
155
158
if (strtoupper ($ mappingClass )==strtoupper ($ this ->name )) {
@@ -161,6 +164,9 @@ protected function getRelation(&$result,$name='',$return=false) {
161
164
$ fk = $ result [$ mappingFk ];
162
165
$ mappingCondition .= " AND {$ model ->getPk ()}=' {$ fk }' " ;
163
166
$ relationData = $ model ->where ($ mappingCondition )->field ($ mappingFields )->find ();
167
+ if (!empty ($ val ['relation_deep ' ])){
168
+ $ model ->getRelation ($ relationData ,$ val ['relation_deep ' ]);
169
+ }
164
170
break ;
165
171
case HAS_MANY :
166
172
$ pk = $ result [$ mappingKey ];
@@ -169,6 +175,12 @@ protected function getRelation(&$result,$name='',$return=false) {
169
175
$ mappingLimit = !empty ($ val ['mapping_limit ' ])?$ val ['mapping_limit ' ]:'' ;
170
176
// 延时获取关联记录
171
177
$ relationData = $ model ->where ($ mappingCondition )->field ($ mappingFields )->order ($ mappingOrder )->limit ($ mappingLimit )->select ();
178
+ if (!empty ($ val ['relation_deep ' ])){
179
+ foreach ($ relationData as $ key =>$ data ){
180
+ $ model ->getRelation ($ data ,$ val ['relation_deep ' ]);
181
+ $ relationData [$ key ] = $ data ;
182
+ }
183
+ }
172
184
break ;
173
185
case MANY_TO_MANY :
174
186
$ pk = $ result [$ mappingKey ];
@@ -188,6 +200,12 @@ protected function getRelation(&$result,$name='',$return=false) {
188
200
$ sql .= ' LIMIT ' .$ mappingLimit ;
189
201
}
190
202
$ relationData = $ this ->query ($ sql );
203
+ if (!empty ($ val ['relation_deep ' ])){
204
+ foreach ($ relationData as $ key =>$ data ){
205
+ $ model ->getRelation ($ data ,$ val ['relation_deep ' ]);
206
+ $ relationData [$ key ] = $ data ;
207
+ }
208
+ }
191
209
break ;
192
210
}
193
211
if (!$ return ){
@@ -339,6 +357,9 @@ protected function opRelation($opType,$data='',$name='') {
339
357
}
340
358
break ;
341
359
}
360
+ if (!empty ($ val ['relation_deep ' ])){
361
+ $ model ->opRelation ($ opType ,$ mappingData ,$ val ['relation_deep ' ]);
362
+ }
342
363
}
343
364
}
344
365
}
0 commit comments