@@ 134-147 (lines=14) @@ | ||
131 | * |
|
132 | * @return void |
|
133 | */ |
|
134 | private function create() |
|
135 | { |
|
136 | $this->checkDb(); |
|
137 | $properties = $this->getProperties(); |
|
138 | unset($properties['id']); |
|
139 | $columns = array_keys($properties); |
|
140 | $values = array_values($properties); |
|
141 | ||
142 | $this->db->connect() |
|
143 | ->insert($this->tableName, $columns) |
|
144 | ->execute($values); |
|
145 | ||
146 | $this->id = $this->db->lastInsertId(); |
|
147 | } |
|
148 | ||
149 | ||
150 | ||
@@ 156-169 (lines=14) @@ | ||
153 | * |
|
154 | * @return void |
|
155 | */ |
|
156 | private function update() |
|
157 | { |
|
158 | $this->checkDb(); |
|
159 | $properties = $this->getProperties(); |
|
160 | unset($properties['id']); |
|
161 | $columns = array_keys($properties); |
|
162 | $values = array_values($properties); |
|
163 | $values[] = $this->id; |
|
164 | ||
165 | $this->db->connect() |
|
166 | ->update($this->tableName, $columns) |
|
167 | ->where("id = ?") |
|
168 | ->execute($values); |
|
169 | } |
|
170 | ||
171 | ||
172 |