Beispiel #1
0
 /**
  * Create a new post from a given submission
  *
  * @param Submission $submission
  *
  * @return Post
  */
 private function createPostFromSubmission(Submission $submission)
 {
     $title = $submission->getTitle();
     $author = $submission->getAuthor();
     $now = $this->clock->now();
     $baseUrl = $submission->getBaseUrl();
     $video = $this->resolver->resolve($submission->getBaseUrl());
     $key = $video->getKey();
     $webm = $video->getWebmUrl();
     $mp4 = $video->getMp4Url();
     $width = $video->getWidth();
     $height = $video->getHeight();
     $post = new Post($title, $key, $now, $baseUrl, $webm, $mp4, $width, $height, $author);
     return $post;
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function delete(Submission $submission)
 {
     $entity = $this->find($submission->getIdentifier());
     $this->converter->computeTo($submission, $entity);
     $this->getRepository()->delete($entity);
 }
Beispiel #3
0
 /**
  * Compute data from the given submission in the given submission entity
  *
  * @param Submission       $submission
  * @param SubmissionEntity $entity
  */
 public function computeTo(Submission $submission, SubmissionEntity $entity)
 {
     $entity->setTitle($submission->getTitle())->setAuthor($submission->getAuthor())->setGfycatKey($submission->getGfycatKey())->setBaseUrl($submission->getBaseUrl())->setCreatedAt($submission->getCreatedAt())->setWebmUrl($submission->getWebmUrl())->setMp4Url($submission->getMp4Url())->setWidth($submission->getWidth())->setHeight($submission->getHeight());
 }