public function updateBannersAction() { $this->view->disable(); $patch = $this->request->getPost('patch'); if (!$patch) { return $this->response->setStatusCode(406, 'Not Acceptable'); } $event = new Events(); $event->state = Events::OPEN; $event->type = Events::UPDATE_BANNER; $event->data = json_encode(['patch' => $patch]); $event->create(); return $this->response->setStatusCode(200, 'OK'); }
public function cacheImageAction() { /** @var Events $event */ $event = Events::findFirst(['(type = :type1: OR type = :type2:) AND state = :state:', 'bind' => ['type1' => Events::CACHE_IMAGE_AFTER_PARTIAL_UPDATE, 'type2' => Events::CACHE_IMAGE_AFTER_FULL_UPDATE, 'state' => Events::OPEN], 'order' => 'created_at ASC']); if ($event) { return $event->processCacheImage($this); } return false; }