/**
  * @Route("/message/hi/{id}", name="user_message_hi", requirements={"id" = "\d+"})
  * @ParamConverter("User", class="ConnectionUserBundle:User")
  */
 public function removeFavoriteUserAction(User $recipient)
 {
     /* @var $user \Connection\UserBundle\Entity\User */
     $sender = $this->getUser();
     if ($sender->getId() == $recipient->getId()) {
         throw new \Exception('You cannot send message to yourself');
     }
     $threadBuilder = $this->get('fos_message.composer')->newThread();
     $threadBuilder->addRecipient($recipient)->setSender($sender)->setSubject('Hi')->setBody('Hi!');
     $senderService = $this->get('fos_message.sender');
     $senderService->send($threadBuilder->getMessage());
     return new Response();
 }
 /**
  * {@inheritDoc}
  */
 public function getId()
 {
     if ($this->__isInitialized__ === false) {
         return parent::getId();
     }
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', array());
     return parent::getId();
 }