|
@@ 811-828 (lines=18) @@
|
| 808 |
|
$query->join($join[0], $join[1]); |
| 809 |
|
} |
| 810 |
|
static::$relJoins = []; |
| 811 |
|
foreach (static::$needJoin as $rel) { |
| 812 |
|
$relations = static::relations(); |
| 813 |
|
if (isset($relations[$rel])) { |
| 814 |
|
$type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type']; |
| 815 |
|
switch ($type) { |
| 816 |
|
case 'to': |
| 817 |
|
$relCol = $relations[$rel]['col']; |
| 818 |
|
static::fixPrefix($relCol); |
| 819 |
|
$query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
| 820 |
|
break; |
| 821 |
|
case 'one': |
| 822 |
|
$col = $relations[$rel]['col']; |
| 823 |
|
$relations[$rel]['model']::fixPrefix($col); |
| 824 |
|
$query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
| 825 |
|
break; |
| 826 |
|
} |
| 827 |
|
} |
| 828 |
|
} |
| 829 |
|
static::$needJoin = []; |
| 830 |
|
|
| 831 |
|
if (!empty($options['limit'])) |
|
@@ 1138-1155 (lines=18) @@
|
| 1135 |
|
$query->join($join[0], $join[1]); |
| 1136 |
|
} |
| 1137 |
|
static::$relJoins = []; |
| 1138 |
|
foreach (static::$needJoin as $rel) { |
| 1139 |
|
$relations = static::relations(); |
| 1140 |
|
if (isset($relations[$rel])) { |
| 1141 |
|
$type = empty($relations[$rel]['type']) ? 'to' : $relations[$rel]['type']; |
| 1142 |
|
switch ($type) { |
| 1143 |
|
case 'to': |
| 1144 |
|
$relCol = $relations[$rel]['col']; |
| 1145 |
|
static::fixPrefix($relCol); |
| 1146 |
|
$query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
| 1147 |
|
break; |
| 1148 |
|
case 'one': |
| 1149 |
|
$col = $relations[$rel]['col']; |
| 1150 |
|
$relations[$rel]['model']::fixPrefix($col); |
| 1151 |
|
$query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
| 1152 |
|
break; |
| 1153 |
|
} |
| 1154 |
|
} |
| 1155 |
|
} |
| 1156 |
|
static::$needJoin = []; |
| 1157 |
|
$cols = 'COUNT('; |
| 1158 |
|
|