@@ -40,7 +40,7 @@ |
||
40 | 40 | $finder = Orm::finder($modelClass); |
41 | 41 | |
42 | 42 | return $finder->select() |
43 | - ->where($foreignAttribute, $this->getAttribute($attribute)) |
|
44 | - ->execute(); |
|
43 | + ->where($foreignAttribute, $this->getAttribute($attribute)) |
|
44 | + ->execute(); |
|
45 | 45 | } |
46 | 46 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | $finder = Orm::finder($modelClass); |
41 | 41 | |
42 | 42 | return $finder->select() |
43 | - ->where($foreignAttribute, $this->getAttribute($attribute)) |
|
44 | - ->one(); |
|
43 | + ->where($foreignAttribute, $this->getAttribute($attribute)) |
|
44 | + ->one(); |
|
45 | 45 | } |
46 | 46 | } |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | return false; |
313 | 313 | } |
314 | 314 | if (true === $this->isLoaded()) { |
315 | - if (false === $this->beforeUpdate()){ |
|
315 | + if (false === $this->beforeUpdate()) { |
|
316 | 316 | return false; |
317 | 317 | } |
318 | 318 | if ($this->useTimestamps()) { |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | */ |
458 | 458 | protected function getQueryBuilderInstance() |
459 | 459 | { |
460 | - $connection = Orm::getConnection(); |
|
460 | + $connection = Orm::getConnection(); |
|
461 | 461 | |
462 | 462 | return new QueryBuilder( |
463 | 463 | $connection, |
@@ -59,7 +59,7 @@ |
||
59 | 59 | */ |
60 | 60 | static public function getEmitter() |
61 | 61 | { |
62 | - if (! static::$emitter instanceof EventEmitter) { |
|
62 | + if (!static::$emitter instanceof EventEmitter) { |
|
63 | 63 | static::$emitter = new EventEmitter(); |
64 | 64 | } |
65 | 65 |
@@ -86,8 +86,7 @@ |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | return $result; |
89 | - } |
|
90 | - catch (Exception $ex) { |
|
89 | + } catch (Exception $ex) { |
|
91 | 90 | $connection->rollback(); |
92 | 91 | throw $ex; |
93 | 92 | } |
@@ -167,7 +167,7 @@ |
||
167 | 167 | return false; |
168 | 168 | } |
169 | 169 | if (true === $this->isLoaded()) { |
170 | - if (false === $this->beforeUpdate()){ |
|
170 | + if (false === $this->beforeUpdate()) { |
|
171 | 171 | return false; |
172 | 172 | } |
173 | 173 | if ($this->useTimestamps()) { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function hydrate(array $array, Model $model) |
31 | 31 | { |
32 | - $closure = function ($data) { |
|
32 | + $closure = function($data) { |
|
33 | 33 | $this->data = $data; |
34 | 34 | $this->afterLoad(); |
35 | 35 | }; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function dehydrate(Model $model) |
48 | 48 | { |
49 | - $closure = function () { |
|
49 | + $closure = function() { |
|
50 | 50 | return $this->data; |
51 | 51 | }; |
52 | 52 | $dehydrator = $closure->bindTo($model, $model); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | public function query($sql, $params = [], $page = null, $perPage = 20) |
132 | 132 | { |
133 | 133 | if (!is_null($page)) { |
134 | - $page = (int) $page; |
|
134 | + $page = (int) $page; |
|
135 | 135 | if ($page < 1) { |
136 | 136 | $page = 1; |
137 | 137 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | */ |
220 | 220 | protected function generateCallback() |
221 | 221 | { |
222 | - return function ($query, $sql, $params) { |
|
222 | + return function($query, $sql, $params) { |
|
223 | 223 | $sql = trim($sql); |
224 | 224 | Orm::getEmitter()->emit('query.init', [ |
225 | 225 | $sql, |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $stmt = $this->connection->prepare( |
229 | 229 | $sql |
230 | 230 | ); |
231 | - $params = array_map(function ($value) { |
|
231 | + $params = array_map(function($value) { |
|
232 | 232 | if ($value instanceof Model) { |
233 | 233 | $value = $value->id; |
234 | 234 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | $finder = Orm::finder($modelClass); |
41 | 41 | |
42 | 42 | return $finder->select() |
43 | - ->where($foreignAttribute, $this->getAttribute($attribute)) |
|
44 | - ->one(); |
|
43 | + ->where($foreignAttribute, $this->getAttribute($attribute)) |
|
44 | + ->one(); |
|
45 | 45 | } |
46 | 46 | } |