|
@@ 922-939 (lines=18) @@
|
| 919 |
|
$query->join($join[0], $join[1]); |
| 920 |
|
} |
| 921 |
|
static::$relJoins = []; |
| 922 |
|
foreach (static::$needJoin as $rel) { |
| 923 |
|
$relations = static::relations(); |
| 924 |
|
if (isset($relations[$rel])) { |
| 925 |
|
$type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type']; |
| 926 |
|
switch ($type) { |
| 927 |
|
case 'to': |
| 928 |
|
$relCol = $relations[$rel]['col']; |
| 929 |
|
static::fixPrefix($relCol); |
| 930 |
|
$query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
| 931 |
|
break; |
| 932 |
|
case 'one': |
| 933 |
|
$col = $relations[$rel]['col']; |
| 934 |
|
$relations[$rel]['model']::fixPrefix($col); |
| 935 |
|
$query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
| 936 |
|
break; |
| 937 |
|
} |
| 938 |
|
} |
| 939 |
|
} |
| 940 |
|
static::$needJoin = []; |
| 941 |
|
|
| 942 |
|
if (!empty($options['limit'])) |
|
@@ 1249-1266 (lines=18) @@
|
| 1246 |
|
$query->join($join[0], $join[1]); |
| 1247 |
|
} |
| 1248 |
|
static::$relJoins = []; |
| 1249 |
|
foreach (static::$needJoin as $rel) { |
| 1250 |
|
$relations = static::relations(); |
| 1251 |
|
if (isset($relations[$rel])) { |
| 1252 |
|
$type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type']; |
| 1253 |
|
switch ($type) { |
| 1254 |
|
case 'to': |
| 1255 |
|
$relCol = $relations[$rel]['col']; |
| 1256 |
|
static::fixPrefix($relCol); |
| 1257 |
|
$query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
| 1258 |
|
break; |
| 1259 |
|
case 'one': |
| 1260 |
|
$col = $relations[$rel]['col']; |
| 1261 |
|
$relations[$rel]['model']::fixPrefix($col); |
| 1262 |
|
$query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
| 1263 |
|
break; |
| 1264 |
|
} |
| 1265 |
|
} |
| 1266 |
|
} |
| 1267 |
|
static::$needJoin = []; |
| 1268 |
|
$cols = 'COUNT('; |
| 1269 |
|
|