youshido / messages
Bundle for easy integrations messages logic
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 0
Type:symfony-bundle
Requires
- php: >=5.4
- doctrine/doctrine-bundle: ~1.3
- stof/doctrine-extensions-bundle: ^1.1
- symfony/form: ~2.3
- symfony/framework-bundle: ~2.3
This package is not auto-updated.
Last update: 2024-10-26 18:33:21 UTC
README
$user = $this->get('doctrine')->getRepository('AppBundle:User') ->find(1); $user2 = $this->get('doctrine')->getRepository('AppBundle:User') ->find(2); $user3 = $this->get('doctrine')->getRepository('AppBundle:User') ->find(3); $conversations = $this->get('messages')->getConversations($user); $newMessages = $this->get('messages')->countUnreadMessages($user); $conversation = $this->get('doctrine') ->getRepository('YMessagesBundle:Conversation') ->find(1); //only get messages $messages = $this->get('messages')->getMessages($conversation->getId()); //get messages and set it to read for user $messages = $this->get('messages')->getMessages($conversation->getId(), $user); //sending new message $this->get('messages')->sendMessage($conversation->getId(), $user, 'hello !'); $this->get('messages')->joinConversation($conversation->getId(), $user2); $this->get('messages')->leaveConversation($conversation->getId(), $user2); $members = $this->get('messages')->getMembers($conversation->getId()); $conversation = $this->get('messages')->findOrCreateConversation($user2, $user3); $is = $this->get('messages')->isConversationBetween($user, $user2);