diff --git a/Entity/ChatRepository.php b/Entity/ChatRepository.php
index <HASH>..<HASH> 100755
--- a/Entity/ChatRepository.php
+++ b/Entity/ChatRepository.php
@@ -71,4 +71,20 @@ class ChatRepository extends EntityRepository
         $em->persist($chat);
         $em->flush();
     }
-}
\ No newline at end of file
+    
+     /**
+     *
+     * @param Chat $chat
+     * @param $user
+     * @return Message
+     */
+    public function getFirstMessage(Chat $chat, $user){
+
+        $em = $this->getEntityManager();
+        $repositoryMessage = $em->getRepository('SopinetChatBundle:Message');
+
+        $message = $repositoryMessage->findOneBy(array('chat'=> $chat, 'fromUser' => $user), array('createdAt' => 'ASC'));
+
+        return $message;
+    }
+}
Update ChatRepository

Add function to find my first message in a chat