public function deleteImageAction() { $id = $this->request->getPost('id', 'int'); $this->view->cleanTemplateBefore(); $model = Image::findFirst(array('id = ' . $id)); $slider_id = $model->getSliderId(); if ($model) { $imageFilter = new \Image\Filter(array('id' => $id, 'type' => 'slider')); $imageFilter->remove(true); $entity = Slider::findFirst('id = ' . $model->getSliderId()); if ($model->delete()) { $result = true; } else { $result = false; } } else { $result = false; } $this->response->setHeader('Content-Type', 'text/plain'); $this->response->setContentType('application/json', 'UTF-8'); $this->response->setStatusCode(200, 'OK'); $this->response->setContent(json_encode($result)); $this->view->disable(); echo !!$result; return $this->response; }