@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | public function create() |
29 | 29 | { |
30 | 30 | $data = []; |
31 | - foreach ($this->getColumns() as $column){ |
|
32 | - if(isset($this->object->$column)){ |
|
33 | - if(is_array($this->object->$column) || is_object($this->object->$column)){ |
|
31 | + foreach ($this->getColumns() as $column) { |
|
32 | + if (isset($this->object->$column)) { |
|
33 | + if (is_array($this->object->$column) || is_object($this->object->$column)) { |
|
34 | 34 | $data[$column] = json_encode($this->object->$column); |
35 | - }else{ |
|
35 | + }else { |
|
36 | 36 | $data[$column] = $this->object->$column; |
37 | 37 | } |
38 | 38 | |
@@ -48,18 +48,18 @@ discard block |
||
48 | 48 | * @param array $columns columns to update. if columns is empty array, update all of the columns |
49 | 49 | * @return int rows updated |
50 | 50 | */ |
51 | - public function update(array $columns=[]) |
|
51 | + public function update(array $columns = []) |
|
52 | 52 | { |
53 | 53 | $data = []; |
54 | 54 | $pk = $this->entity->getPK(); |
55 | - foreach ($this->getColumns() as $column){ |
|
56 | - if(count($columns) && !in_array($column, $columns)){ |
|
55 | + foreach ($this->getColumns() as $column) { |
|
56 | + if (count($columns) && !in_array($column, $columns)) { |
|
57 | 57 | continue; |
58 | 58 | } |
59 | - if($pk != $column && isset($this->object->$column)){ |
|
60 | - if(is_array($this->object->$column) || is_object($this->object->$column)){ |
|
59 | + if ($pk != $column && isset($this->object->$column)) { |
|
60 | + if (is_array($this->object->$column) || is_object($this->object->$column)) { |
|
61 | 61 | $data[$column] = json_encode($this->object->$column); |
62 | - }else{ |
|
62 | + }else { |
|
63 | 63 | $data[$column] = $this->object->$column; |
64 | 64 | } |
65 | 65 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | protected function getColumns() |
86 | 86 | { |
87 | 87 | $columns = []; |
88 | - foreach ($this->entity->getProperties() as $p){ |
|
88 | + foreach ($this->entity->getProperties() as $p) { |
|
89 | 89 | $columns[] = $p->name; |
90 | 90 | } |
91 | 91 | return $columns; |