コード例 #1
0
ファイル: SaveVideoService.php プロジェクト: HHPnet/core
 /**
  * @param HHPnet\Core\Application\Services\Videos\SaveVideo\SaveVideoRequest $request
  *
  * @return HHPnet\Core\Application\Services\Videos\SaveVideo\SaveVideoResponse
  */
 public function execute(SaveVideoRequest $request)
 {
     try {
         $this->repository->getByVideoServiceId($request->videoServiceId(), $request->videoService());
         throw new \DomainException('Given video has been registered in our database');
     } catch (\UnexpectedValueException $e) {
     }
     $video = $this->repository->save($this->factory->getVideoEntity(null, $request->videoServiceId(), $request->videoService(), $request->title(), $request->description()));
     return new SaveVideoResponse($video);
 }
コード例 #2
0
ファイル: GetVideoServiceSpec.php プロジェクト: HHPnet/core
 /**
  * @param HHPnet\Core\Application\Services\Videos\GetVideo\GetVideoRequest $request
  */
 public function it_is_not_possible_to_get_a_non_existing_video(GetVideoRequest $request)
 {
     $request->videoId()->willReturn(1);
     $this->repository->getById(1)->willThrow('\\UnexpectedValueException');
     $this->shouldThrow('\\UnexpectedValueException')->during('execute', array($request));
 }
コード例 #3
0
ファイル: GetVideoService.php プロジェクト: HHPnet/core
 /**
  * @param HHPnet\Core\Application\Services\Videos\GetVideo\GetVideoRequest $request
  *
  * @return HHPnet\Core\Application\Services\Videos\GetVideo\GetVideoResponse
  */
 public function execute(GetVideoRequest $request)
 {
     return new GetVideoResponse($this->repository->getById($request->videoId()));
 }