/** * @param array $formData * * @return \Symfony\Component\HttpFoundation\RedirectResponse */ protected function executePost(array $formData) { return $this->actionHelper->handleCreatePostAction(function () use($formData) { $file = $this->request->getFiles()->get('picture'); $this->adminFormValidation->setFile($file)->setSettings($this->config->getSettings(Emoticons\Installer\Schema::MODULE_NAME))->setFileRequired(true)->validate($formData); $upload = new Core\Helpers\Upload($this->appPath, Emoticons\Installer\Schema::MODULE_NAME); $result = $upload->moveFile($file->getPathname(), $file->getClientOriginalName()); $formData['img'] = $result['name']; return $this->emoticonsModel->save($formData); }); }
/** * @param string $action * * @return array|string|\Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\RedirectResponse|void * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException */ public function execute($action = '') { return $this->actionHelper->handleDeleteAction($action, function (array $items) { return $this->emoticonsModel->delete($items); }); }