/** * Process banner form. * * @param FormInterface $form * @param Request $request * * @return bool */ public function process(FormInterface $form, Request $request) { if ($request->isMethod('POST')) { $form->submit($request); if ($form->isValid()) { $this->bannerManager->add($form->getData()); return true; } } return false; }
/** * Get banner or 404. * * @param int $bannerId * * @return BannerInterface * * @throws NotFoundHttpException */ private function getBannerOr404($bannerId) { $banner = $this->bannerManager->findById($bannerId); if (null === $banner) { throw new NotFoundHttpException(sprintf('Not found %s banner', $bannerId)); } return $banner; }