@@ -718,17 +718,21 @@ discard block |
||
| 718 | 718 | if (!$query) { |
| 719 | 719 | return []; |
| 720 | 720 | } |
| 721 | - if (!empty($options['where'])) |
|
| 722 | - $query->where($options['where']); |
|
| 721 | + if (!empty($options['where'])) { |
|
| 722 | + $query->where($options['where']); |
|
| 723 | + } |
|
| 723 | 724 | if (!empty($options['group'])) { |
| 724 | 725 | $query->group($options['group']); |
| 725 | 726 | } |
| 726 | - if (!empty($options['order'])) |
|
| 727 | - $query->order($options['order']); |
|
| 728 | - if (!empty($options['join'])) |
|
| 729 | - $query->join($options['join']); |
|
| 730 | - if (!empty($options['distinct'])) |
|
| 731 | - $query->distinct = $options['distinct']; |
|
| 727 | + if (!empty($options['order'])) { |
|
| 728 | + $query->order($options['order']); |
|
| 729 | + } |
|
| 730 | + if (!empty($options['join'])) { |
|
| 731 | + $query->join($options['join']); |
|
| 732 | + } |
|
| 733 | + if (!empty($options['distinct'])) { |
|
| 734 | + $query->distinct = $options['distinct']; |
|
| 735 | + } |
|
| 732 | 736 | |
| 733 | 737 | foreach (static::$relJoins as $join) { |
| 734 | 738 | $query->join($join[0], $join[1]); |
@@ -754,14 +758,14 @@ discard block |
||
| 754 | 758 | } |
| 755 | 759 | static::$needJoin = []; |
| 756 | 760 | |
| 757 | - if (!empty($options['limit'])) |
|
| 758 | - $limit = (int) $options['limit']; |
|
| 759 | - else { |
|
| 761 | + if (!empty($options['limit'])) { |
|
| 762 | + $limit = (int) $options['limit']; |
|
| 763 | + } else { |
|
| 760 | 764 | $limit = 0; |
| 761 | 765 | } |
| 762 | - if (!empty($options['start'])) |
|
| 763 | - $start = (int) $options['start']; |
|
| 764 | - else { |
|
| 766 | + if (!empty($options['start'])) { |
|
| 767 | + $start = (int) $options['start']; |
|
| 768 | + } else { |
|
| 765 | 769 | $start = 0; |
| 766 | 770 | } |
| 767 | 771 | if ($limit || $start) { |
@@ -1020,21 +1024,23 @@ discard block |
||
| 1020 | 1024 | if (!empty($options['where'])) { |
| 1021 | 1025 | static::fixPrefix($options['where'], 'first'); |
| 1022 | 1026 | } |
| 1023 | - if (!empty($options['where'])) |
|
| 1024 | - $query->where($options['where']); |
|
| 1025 | - if (!empty($options['join'])) |
|
| 1026 | - $query->join($options['join']); |
|
| 1027 | + if (!empty($options['where'])) { |
|
| 1028 | + $query->where($options['where']); |
|
| 1029 | + } |
|
| 1030 | + if (!empty($options['join'])) { |
|
| 1031 | + $query->join($options['join']); |
|
| 1032 | + } |
|
| 1027 | 1033 | if (!empty($options['order'])) { |
| 1028 | 1034 | $query->order($options['order']); |
| 1029 | 1035 | } |
| 1030 | - if (!empty($options['limit'])) |
|
| 1031 | - $limit = (int) $options['limit']; |
|
| 1032 | - else { |
|
| 1036 | + if (!empty($options['limit'])) { |
|
| 1037 | + $limit = (int) $options['limit']; |
|
| 1038 | + } else { |
|
| 1033 | 1039 | $limit = 0; |
| 1034 | 1040 | } |
| 1035 | - if (!empty($options['start'])) |
|
| 1036 | - $start = (int) $options['start']; |
|
| 1037 | - else { |
|
| 1041 | + if (!empty($options['start'])) { |
|
| 1042 | + $start = (int) $options['start']; |
|
| 1043 | + } else { |
|
| 1038 | 1044 | $start = 0; |
| 1039 | 1045 | } |
| 1040 | 1046 | if ($limit || $start) { |
@@ -1112,8 +1118,9 @@ discard block |
||
| 1112 | 1118 | |
| 1113 | 1119 | $values = []; |
| 1114 | 1120 | foreach ($cols as $col => $param) { |
| 1115 | - if (isset($params[$col])) |
|
| 1116 | - $values[$col] = $params[$col]; |
|
| 1121 | + if (isset($params[$col])) { |
|
| 1122 | + $values[$col] = $params[$col]; |
|
| 1123 | + } |
|
| 1117 | 1124 | } |
| 1118 | 1125 | if (empty($values)) { |
| 1119 | 1126 | return false; |
@@ -1296,8 +1303,9 @@ discard block |
||
| 1296 | 1303 | $values = []; |
| 1297 | 1304 | |
| 1298 | 1305 | foreach ($this->cols() as $col => $param) { |
| 1299 | - if (isset($this->_params[$col])) |
|
| 1300 | - $values[$col] = $this->_params[$col]; |
|
| 1306 | + if (isset($this->_params[$col])) { |
|
| 1307 | + $values[$col] = $this->_params[$col]; |
|
| 1308 | + } |
|
| 1301 | 1309 | } |
| 1302 | 1310 | if (empty($values) && empty($options['empty'])) { |
| 1303 | 1311 | return false; |
@@ -1457,8 +1465,9 @@ discard block |
||
| 1457 | 1465 | { |
| 1458 | 1466 | |
| 1459 | 1467 | foreach (static::relations() as $relName => $rel) { |
| 1460 | - if ($rel['col'] == $col) |
|
| 1461 | - return $relName; |
|
| 1468 | + if ($rel['col'] == $col) { |
|
| 1469 | + return $relName; |
|
| 1470 | + } |
|
| 1462 | 1471 | } |
| 1463 | 1472 | return NULL; |
| 1464 | 1473 | } |