/** * Delete a section * * Might throw an exception if the section is still associated with some * content objects. Make sure that no content objects are associated with * the section any more *before* calling this method. * * @param mixed $id */ public function delete($id) { $contentCount = $this->sectionGateway->countContentObjectsInSection($id); if ($contentCount > 0) { throw new RuntimeException("Section with ID '{$id}' still has content assigned."); } $this->sectionGateway->deleteSection($id); }
/** * Deletes the Section with $id. * * @param int $id */ public function deleteSection($id) { try { return $this->innerGateway->deleteSection($id); } catch (DBALException $e) { throw new RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new RuntimeException('Database error', 0, $e); } }