| 
														
															@@ -6,6 +6,7 @@ use App\Entity\Commentaire; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 use App\Entity\Film; 
														 | 
														
														 | 
														
															 use App\Entity\Film; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 use App\Entity\MediaVideo; 
														 | 
														
														 | 
														
															 use App\Entity\MediaVideo; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 use Doctrine\Bundle\DoctrineBundle\Attribute\AsDoctrineListener; 
														 | 
														
														 | 
														
															 use Doctrine\Bundle\DoctrineBundle\Attribute\AsDoctrineListener; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+use Doctrine\ORM\EntityManagerInterface; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 use Doctrine\ORM\Event\PostPersistEventArgs; 
														 | 
														
														 | 
														
															 use Doctrine\ORM\Event\PostPersistEventArgs; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 use Doctrine\ORM\Events; 
														 | 
														
														 | 
														
															 use Doctrine\ORM\Events; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 use Symfony\Component\Config\Definition\Exception\Exception; 
														 | 
														
														 | 
														
															 use Symfony\Component\Config\Definition\Exception\Exception; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -13,7 +14,10 @@ use Symfony\Component\Config\Definition\Exception\Exception; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 #[AsDoctrineListener(event: Events::postPersist)] 
														 | 
														
														 | 
														
															 #[AsDoctrineListener(event: Events::postPersist)] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 class FilmCreationListener 
														 | 
														
														 | 
														
															 class FilmCreationListener 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 { 
														 | 
														
														 | 
														
															 { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    public function __construct(protected Mattermost $mattermostSender) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public function __construct( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        protected Mattermost $mattermostSender, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        protected EntityManagerInterface $em 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    ) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     { 
														 | 
														
														 | 
														
															     { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -36,6 +40,16 @@ class FilmCreationListener 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $this->mattermostSender->sendNewMediaVideo($entity->getFilm()); 
														 | 
														
														 | 
														
															                 $this->mattermostSender->sendNewMediaVideo($entity->getFilm()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } else { 
														 | 
														
														 | 
														
															             } else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 $this->mattermostSender->sendNouveauCommentaire($entity->getUser(), $entity->getFilm()); 
														 | 
														
														 | 
														
															                 $this->mattermostSender->sendNouveauCommentaire($entity->getUser(), $entity->getFilm()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if ($entity->getFilm()->getUsersWantToView()->contains($entity->getUser())) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    $entity->getFilm()->removeUserWantToView($entity->getUser()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if (!$entity->getFilm()->getUsersWhoSeen()->contains($entity->getUser())) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    $entity->getFilm()->addUserWhoSeen($entity->getUser()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                $this->em->flush(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } catch (Exception $exception) { 
														 | 
														
														 | 
														
															         } catch (Exception $exception) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 |