コード例 #1
0
ファイル: Log.php プロジェクト: mwyatt/core
 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));
     }
 }
コード例 #2
0
ファイル: AbstractMapper.php プロジェクト: mwyatt/core
 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();
 }