public function addSeries(Series $series) { if (1 == count($this->breadcrumbs)) { $this->add($this->session->get('breadcrumbs/title', $this->allTitle), $this->session->get('breadcrumbs/routeName', $this->allRoute), $this->session->get('breadcrumbs/routeParameters', array())); } $this->add($series->getTitle(), "pumukit_webtv_series_index", array("id" => $series->getId())); }
/** * Set a pic from an url into the series */ public function addPicFile(Series $series, UploadedFile $picFile, $isBanner = false, $bannerTargetUrl = "") { if (UPLOAD_ERR_OK != $picFile->getError()) { throw new \Exception($picFile->getErrorMessage()); } if (!is_file($picFile->getPathname())) { throw new FileNotFoundException($picFile->getPathname()); } $path = $picFile->move($this->targetPath . "/" . $series->getId(), $picFile->getClientOriginalName()); $pic = new Pic(); $pic->setUrl(str_replace($this->targetPath, $this->targetUrl, $path)); $pic->setPath($path); if ($isBanner) { $pic->setHide(true); $pic->addTag('banner'); $series = $this->addBanner($series, $pic->getUrl(), $bannerTargetUrl); } // TODO: add pic the latest if it is banner $series->addPic($pic); $this->dm->persist($series); $this->dm->flush(); return $series; }