Exemplo n.º 1
0
 /**
  * Remove movieComment
  *
  * @param MovieComment $movieComment
  */
 public function removeMovieComment(MovieComment $movieComment)
 {
     $movieComment->removeImage($this);
     $this->movieComments->removeElement($movieComment);
 }
 /**
  * Unlink image from movie comment
  *
  * @ApiDoc(
  *     views={"default", "movie-comment"},
  *     section="MovieComment API",
  *     statusCodes={
  *         204="Returned when successful",
  *         400="Returned when an error has occurred",
  *     }
  * )
  *
  * @Security("is_granted('ROLE_MOVIE_COMMENT_EDIT', movieComment)")
  *
  * @Route("movie-comments/{movieComment}/images/{image}", name="api_movie_comment_unlink_movie_comment_images", defaults={"_format": "json"}, methods={"UNLINK"})
  *
  * @param MovieComment $movieComment
  * @param Image $image
  * @return Response
  */
 public function unlinkMovieCommentImagesAction(MovieComment $movieComment, Image $image)
 {
     if (!$movieComment->getImages()->contains($image)) {
         return new Response('', 204);
     }
     $movieComment->removeImage($image);
     $image->removeMovieComment($movieComment);
     $this->getDoctrine()->getManager()->flush();
     return new Response('', 204);
 }