| @@ 32-39 (lines=8) @@ | ||
| 29 | { |
|
| 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)){ |
|
| 34 | $data[$column] = json_encode($this->object->$column); |
|
| 35 | }else{ |
|
| 36 | $data[$column] = $this->object->$column; |
|
| 37 | } |
|
| 38 | ||
| 39 | } |
|
| 40 | } |
|
| 41 | $id = $this->db->insertInto($this->entity->getTable()) |
|
| 42 | ->values($data) |
|
| @@ 59-65 (lines=7) @@ | ||
| 56 | if(count($columns) && !in_array($column, $columns)){ |
|
| 57 | continue; |
|
| 58 | } |
|
| 59 | if($pk != $column && isset($this->object->$column)){ |
|
| 60 | if(is_array($this->object->$column) || is_object($this->object->$column)){ |
|
| 61 | $data[$column] = json_encode($this->object->$column); |
|
| 62 | }else{ |
|
| 63 | $data[$column] = $this->object->$column; |
|
| 64 | } |
|
| 65 | } |
|
| 66 | } |
|
| 67 | ||
| 68 | return $this->db->update($this->entity->getTable()) |
|