Open marksparrish opened 8 years ago
I think the update function should not set the 'created' date and only set the 'update' date.
public function update(\Modler\Model $model) { $data = $model->toArray(); $data['created'] = date('Y-m-d H:i:s'); // <- This should be removed $data['updated'] = date('Y-m-d H:i:s'); list($columns, $bind) = $this->setup($data); $update = array(); $properties = $model->getProperties(); foreach ($bind as $column => $name) { $colName = $properties[$column]['column']; $update[] = $colName.' = '.$name; } $sql = 'update '.$model->getTableName().' set '.implode(',', $update).' where ID = '.$model->id; return $this->execute($sql, $data); }
I think the update function should not set the 'created' date and only set the 'update' date.