public function deleteBrand() { $id = null; if (!empty($_GET['id'])) { $id = (int) $_GET['id']; } $brand = new Brand(); $brand->withId($id); if ($brand->hasId()) { $brand->delete(); } header('Location: ' . $this->getUrl('brands')); exit; }