@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function __construct() { |
44 | 44 | $this->table = $this->getTableName(); |
45 | - $this->primary = (array)$this->getPrimaryKey(); |
|
45 | + $this->primary = ( array ) $this->getPrimaryKey(); |
|
46 | 46 | $this->orderField = $this->getOrderField(); |
47 | 47 | } |
48 | 48 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return array|bool |
70 | 70 | * @throws QueryException |
71 | 71 | */ |
72 | - public function getRowById( $id, array $fields = [] ) { |
|
72 | + public function getRowById( $id, array $fields = [ ] ) { |
|
73 | 73 | $conditions = $this->getPrimaryKeyConditions( $id ); |
74 | 74 | $result = QueryBuild::select( $this->table )->fields( $fields ); |
75 | 75 | foreach ( $conditions as $field => $value ) |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @return array |
86 | 86 | * @throws QueryException |
87 | 87 | */ |
88 | - public function getFirstRowByCondition( $fieldName, $fieldValue, $fields = [] ) { |
|
88 | + public function getFirstRowByCondition( $fieldName, $fieldValue, $fields = [ ] ) { |
|
89 | 89 | return QueryBuild::select( $this->table ) |
90 | 90 | ->fields( $fields ) |
91 | 91 | ->whereEqual( $fieldName, $fieldValue ) |
@@ -168,14 +168,14 @@ discard block |
||
168 | 168 | throw new QueryException( 'Order field is not defined' ); |
169 | 169 | |
170 | 170 | $query = /** @lang text */ |
171 | - "UPDATE `{$this->table}` SET `{$this->orderField}` = CASE `{$this->primary[0]}` \r\n"; |
|
171 | + "UPDATE `{$this->table}` SET `{$this->orderField}` = CASE `{$this->primary[ 0 ]}` \r\n"; |
|
172 | 172 | foreach ( $updates_ord as $position => $id ) { |
173 | 173 | $pos = $position + 1; |
174 | 174 | $query .= " WHEN '$id' THEN '$pos' \r\n"; |
175 | 175 | } |
176 | 176 | $query .= "ELSE `{$this->orderField}` END"; |
177 | 177 | |
178 | - return PdoWrapperService::getInstance()->query( $query, [] ); |
|
178 | + return PdoWrapperService::getInstance()->query( $query, [ ] ); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | |
@@ -186,12 +186,12 @@ discard block |
||
186 | 186 | */ |
187 | 187 | protected function getPrimaryKeyConditions( $id ) { |
188 | 188 | |
189 | - $id = (array)$id; |
|
189 | + $id = ( array ) $id; |
|
190 | 190 | |
191 | 191 | if ( count( $this->primary ) !== count( $id ) ) |
192 | 192 | throw new QueryException( 'Invalid primary key', QueryException::QUERY_CRUD_INVALID_PRIMARY ); |
193 | 193 | |
194 | - $conditions = []; |
|
194 | + $conditions = [ ]; |
|
195 | 195 | |
196 | 196 | foreach ( $this->primary as $index => $key ) |
197 | 197 | $conditions[ $key ] = $id[ $index ]; |