コード例 #1
0
ファイル: WikiRepository.php プロジェクト: CSHH/website
 /**
  * @param  ArrayHash $values
  * @param  Entities\TagEntity $tag
  * @param  string $type
  * @param  Entities\WikiEntity $e
  * @throws PossibleUniqueKeyDuplicationException
  * @return Entities\WikiEntity
  */
 public function update(ArrayHash $values, Entities\TagEntity $tag, $type, Entities\WikiEntity $e)
 {
     $e->setValues($values);
     if ($e->tag->id !== $tag->id && $this->getByTagAndNameAndType($tag, $values->name, $type)) {
         throw new PossibleUniqueKeyDuplicationException($this->translator->translate('locale.duplicity.article_tag_and_name'));
     }
     $e->slug = $e->slug ?: Slugger::slugify($e->name);
     if ($e->tag->id !== $tag->id && $this->getByTagAndSlugAndType($tag, $e->slug, $type)) {
         throw new PossibleUniqueKeyDuplicationException($this->translator->translate('locale.duplicity.article_tag_and_slug'));
     }
     $e->text = $this->htmlPurifier->purify($values->text);
     $e->tag = $tag;
     $e->type = $type;
     $this->persistAndFlush($this->em, $e);
     return $e;
 }
コード例 #2
0
ファイル: ArticleRepository.php プロジェクト: CSHH/website
 public function update(ArrayHash $values, Entities\TagEntity $tag, Entities\UserEntity $user, Entities\ArticleEntity $e)
 {
     if ($e->tag->id !== $tag->id) {
         $this->menuCache->deleteSection(MenuCache::SECTION_ARTICLES);
     }
     $e->setValues($values);
     if ($e->tag->id !== $tag->id && $this->getByTagAndName($tag, $values->name)) {
         throw new PossibleUniqueKeyDuplicationException($this->translator->translate('locale.duplicity.article_tag_and_name'));
     }
     $e->slug = $e->slug ?: Slugger::slugify($e->name);
     if ($e->tag->id !== $tag->id && $this->getByTagAndSlug($tag, $e->slug)) {
         throw new PossibleUniqueKeyDuplicationException($this->translator->translate('locale.duplicity.article_tag_and_slug'));
     }
     $e->text = $this->htmlPurifier->purify($values->text);
     $e->tag = $tag;
     $e->user = $user;
     $this->persistAndFlush($this->em, $e);
     return $e;
 }
コード例 #3
0
ファイル: VideoRepository.php プロジェクト: CSHH/website
 public function update(ArrayHash $values, Entities\TagEntity $tag, Entities\UserEntity $user, Entities\VideoEntity $e)
 {
     if ($e->tag->id !== $tag->id) {
         $this->menuCache->deleteSection(MenuCache::SECTION_VIDEOS);
     }
     $e->setValues($values);
     if ($e->tag->id !== $tag->id && $this->getByTagAndName($tag, $values->name)) {
         throw new PossibleUniqueKeyDuplicationException($this->translator->translate('locale.duplicity.video_tag_and_name'));
     }
     $e->slug = $e->slug ?: Slugger::slugify($e->name);
     if ($e->tag->id !== $tag->id && $this->getByTagAndSlug($tag, $e->slug)) {
         throw new PossibleUniqueKeyDuplicationException($this->translator->translate('locale.duplicity.video_tag_and_slug'));
     }
     $url = $e->url;
     $this->processVideo($e, $url);
     $e->tag = $tag;
     $e->user = $user;
     $this->persistAndFlush($this->em, $e);
     return $e;
 }
コード例 #4
0
ファイル: VideoThumbnail.php プロジェクト: CSHH/website
 /**
  * @param  VideoEntity $video
  * @return string
  */
 private function getFilePath(VideoEntity $video)
 {
     return $this->videoThumbnailsDir . '/' . Slugger::slugify($video->url);
 }