/** * Returns an instance of class. * * @return OCSFAQ_BOL_CategoryDao */ public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
public function deleteCategory($id) { if (!$id) { return false; } $questions = $this->findQuestionsByCategoryId($id); if ($questions) { foreach ($questions as $q) { $q->categoryId = 0; $this->questionDao->save($q); } } $this->categoryDao->deleteById($id); return true; }