/** * @Given że w systemie nie ma testowych danych */ public function zeWSystemieNieMaTestowychDanych() { $suggestions = Suggestion::query()->where('author = :author:')->bind(['author' => 'Acceptance Test'])->execute(); foreach ($suggestions as $s) { $s->delete(); } }
/** * @Route("/remove/{id:[1-9]\d*}", name="frontend.remove") */ public function removeAction($id) { $item = Suggestion::findFirst(['id = ' . $id . '']); if ($item instanceof Suggestion) { // TODO: handle exception $item->delete(); } $url = $this->request->getHTTPReferer(); $url = trim($url); $url = !empty($url) ? $url : $this->getDI()->getUrl()->get(['for' => 'frontend.list']); $this->response->redirect($url, true); }