public function renderDelete($catid) { $this->template->refcount = $this->category->countReferences($catid); if ($this->template->refcount == 0) { $this->category->delete($catid); $this->redirect('Category:list'); } else { $this->template->category = $this->category->load($catid); } }