@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | ->from($this->entity->getTable()) |
| 30 | 30 | ->where("`{$this->entity->getPK()}` = ?", $id) |
| 31 | 31 | ->getFirst(); |
| 32 | - if($row){ |
|
| 32 | + if ($row) { |
|
| 33 | 33 | return $this->entity->make($row, false); |
| 34 | - }else{ |
|
| 34 | + }else { |
|
| 35 | 35 | return null; |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @param mixed|null $_ |
| 54 | 54 | * @return \PhpBoot\DB\rules\basic\WhereRule |
| 55 | 55 | */ |
| 56 | - public function deleteWhere($conditions, $_=null) |
|
| 56 | + public function deleteWhere($conditions, $_ = null) |
|
| 57 | 57 | { |
| 58 | 58 | $query = $this->db->deleteFrom($this->entity->getTable()); |
| 59 | 59 | return call_user_func_array([$query, 'where'], func_get_args()); |
@@ -75,12 +75,12 @@ discard block |
||
| 75 | 75 | * @param string $_ |
| 76 | 76 | * @return \PhpBoot\DB\rules\select\WhereRule |
| 77 | 77 | */ |
| 78 | - public function findWhere($conditions=null, $_=null) |
|
| 78 | + public function findWhere($conditions = null, $_ = null) |
|
| 79 | 79 | { |
| 80 | - $query = $this->db->select($this->getColumns()) |
|
| 80 | + $query = $this->db->select($this->getColumns()) |
|
| 81 | 81 | ->from($this->entity->getTable()); |
| 82 | - $query->context->resultHandler = function ($result){ |
|
| 83 | - foreach ($result as &$i){ |
|
| 82 | + $query->context->resultHandler = function($result) { |
|
| 83 | + foreach ($result as &$i) { |
|
| 84 | 84 | $i = $this->entity->make($i, false); |
| 85 | 85 | } |
| 86 | 86 | return $result; |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | * @param string $_ |
| 108 | 108 | * @return \PhpBoot\DB\rules\basic\WhereRule |
| 109 | 109 | */ |
| 110 | - public function updateWhere($values, $conditions, $_=null) |
|
| 110 | + public function updateWhere($values, $conditions, $_ = null) |
|
| 111 | 111 | { |
| 112 | - $query = $this->db->update($this->entity->getTable())->set($values); |
|
| 113 | - return call_user_func_array([$query, 'where'], array_slice(func_get_args(),1)); |
|
| 112 | + $query = $this->db->update($this->entity->getTable())->set($values); |
|
| 113 | + return call_user_func_array([$query, 'where'], array_slice(func_get_args(), 1)); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | protected function getColumns() |
| 128 | 128 | { |
| 129 | 129 | $columns = []; |
| 130 | - foreach ($this->entity->getProperties() as $p){ |
|
| 130 | + foreach ($this->entity->getProperties() as $p) { |
|
| 131 | 131 | $columns[] = $p->name; |
| 132 | 132 | } |
| 133 | 133 | return $columns; |