public function duplicateBlogCategory($check) { $conditions = ['BlogCategory.' . key($check) => $check[key($check)], 'BlogCategory.blog_content_id' => $this->validationParams['blogContentId']]; if ($this->exists()) { $conditions['NOT'] = ['BlogCategory.id' => $this->id]; } $ret = $this->find('first', ['conditions' => $conditions]); if ($ret) { return false; } else { return true; } }