@@ -717,17 +717,21 @@ discard block |
||
| 717 | 717 | if (!$query) { |
| 718 | 718 | return false; |
| 719 | 719 | } |
| 720 | - if (!empty($options['where'])) |
|
| 721 | - $query->where($options['where']); |
|
| 720 | + if (!empty($options['where'])) { |
|
| 721 | + $query->where($options['where']); |
|
| 722 | + } |
|
| 722 | 723 | if (!empty($options['group'])) { |
| 723 | 724 | $query->group($options['group']); |
| 724 | 725 | } |
| 725 | - if (!empty($options['order'])) |
|
| 726 | - $query->order($options['order']); |
|
| 727 | - if (!empty($options['join'])) |
|
| 728 | - $query->join($options['join']); |
|
| 729 | - if (!empty($options['distinct'])) |
|
| 730 | - $query->distinct = $options['distinct']; |
|
| 726 | + if (!empty($options['order'])) { |
|
| 727 | + $query->order($options['order']); |
|
| 728 | + } |
|
| 729 | + if (!empty($options['join'])) { |
|
| 730 | + $query->join($options['join']); |
|
| 731 | + } |
|
| 732 | + if (!empty($options['distinct'])) { |
|
| 733 | + $query->distinct = $options['distinct']; |
|
| 734 | + } |
|
| 731 | 735 | |
| 732 | 736 | foreach (static::$relJoins as $join) { |
| 733 | 737 | $query->join($join[0], $join[1]); |
@@ -753,14 +757,14 @@ discard block |
||
| 753 | 757 | } |
| 754 | 758 | static::$needJoin = []; |
| 755 | 759 | |
| 756 | - if (!empty($options['limit'])) |
|
| 757 | - $limit = (int) $options['limit']; |
|
| 758 | - else { |
|
| 760 | + if (!empty($options['limit'])) { |
|
| 761 | + $limit = (int) $options['limit']; |
|
| 762 | + } else { |
|
| 759 | 763 | $limit = 0; |
| 760 | 764 | } |
| 761 | - if (!empty($options['start'])) |
|
| 762 | - $start = (int) $options['start']; |
|
| 763 | - else { |
|
| 765 | + if (!empty($options['start'])) { |
|
| 766 | + $start = (int) $options['start']; |
|
| 767 | + } else { |
|
| 764 | 768 | $start = 0; |
| 765 | 769 | } |
| 766 | 770 | if ($limit || $start) { |
@@ -1019,21 +1023,23 @@ discard block |
||
| 1019 | 1023 | if (!empty($options['where'])) { |
| 1020 | 1024 | static::fixPrefix($options['where'], 'first'); |
| 1021 | 1025 | } |
| 1022 | - if (!empty($options['where'])) |
|
| 1023 | - $query->where($options['where']); |
|
| 1024 | - if (!empty($options['join'])) |
|
| 1025 | - $query->join($options['join']); |
|
| 1026 | + if (!empty($options['where'])) { |
|
| 1027 | + $query->where($options['where']); |
|
| 1028 | + } |
|
| 1029 | + if (!empty($options['join'])) { |
|
| 1030 | + $query->join($options['join']); |
|
| 1031 | + } |
|
| 1026 | 1032 | if (!empty($options['order'])) { |
| 1027 | 1033 | $query->order($options['order']); |
| 1028 | 1034 | } |
| 1029 | - if (!empty($options['limit'])) |
|
| 1030 | - $limit = (int) $options['limit']; |
|
| 1031 | - else { |
|
| 1035 | + if (!empty($options['limit'])) { |
|
| 1036 | + $limit = (int) $options['limit']; |
|
| 1037 | + } else { |
|
| 1032 | 1038 | $limit = 0; |
| 1033 | 1039 | } |
| 1034 | - if (!empty($options['start'])) |
|
| 1035 | - $start = (int) $options['start']; |
|
| 1036 | - else { |
|
| 1040 | + if (!empty($options['start'])) { |
|
| 1041 | + $start = (int) $options['start']; |
|
| 1042 | + } else { |
|
| 1037 | 1043 | $start = 0; |
| 1038 | 1044 | } |
| 1039 | 1045 | 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 | } |
@@ -1614,8 +1623,9 @@ discard block |
||
| 1614 | 1623 | App::$cur->db->where($relation['relTablePrefix'] . $this->index(), $this->pk()); |
| 1615 | 1624 | App::$cur->db->where($relation['relTablePrefix'] . $relation['model']::index(), $objectId); |
| 1616 | 1625 | $isset = App::$cur->db->select($relation['relTable'])->fetch_assoc(); |
| 1617 | - if ($isset) |
|
| 1618 | - return true; |
|
| 1626 | + if ($isset) { |
|
| 1627 | + return true; |
|
| 1628 | + } |
|
| 1619 | 1629 | |
| 1620 | 1630 | App::$cur->db->insert($relation['relTable'], [ |
| 1621 | 1631 | $relation['relTablePrefix'] . $this->index() => $this->{$this->index()}, |