| 
					
				 | 
			
			
				@@ -2,6 +2,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 namespace AppBundle\Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use AppBundle\Entity\Commentaire; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use Doctrine\Common\Persistence\Event\LifecycleEventArgs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use AppBundle\Entity\Film; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use Symfony\Component\Config\Definition\Exception\Exception; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -21,13 +22,16 @@ class FilmCreationListener 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public function postPersist(LifecycleEventArgs $args) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $entity = $args->getObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!$entity instanceof Film) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!$entity instanceof Film and !$entity instanceof Commentaire) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            $this->mattermostSender->sendNouveauFilm($entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ($entity instanceof Film) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $this->mattermostSender->sendNouveauFilm($entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $this->mattermostSender->sendNouveauCommentaire($entity->getFilm()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } catch (Exception $exception) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 |