private function validateModel(\Mwyatt\Core\ModelInterface $model) { $errors = []; if (strlen($model->get('userId')) < 1) { $errors[] = 'Must have userId.'; } if (strlen($model->get('logId')) < 1) { $errors[] = 'Must have logId.'; } if ($errors) { throw new \Exception('Log validation errors: ' . implode(' ', $errors)); } }
public function deleteById(\Mwyatt\Core\ModelInterface $model) { $sql = ['delete', 'from', $this->getTableNameLazy(), 'where id = ?']; $this->adapter->prepare(implode(' ', $sql)); $this->adapter->bindParam(1, $model->get('id'), $this->adapter->getParamInt()); $this->adapter->execute(); return $this->adapter->getRowCount(); }