本文整理汇总了PHP中Conversation::createConversation方法的典型用法代码示例。如果您正苦于以下问题:PHP Conversation::createConversation方法的具体用法?PHP Conversation::createConversation怎么用?PHP Conversation::createConversation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conversation
的用法示例。
在下文中一共展示了Conversation::createConversation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: composeAction
public function composeAction(Player $me, Request $request)
{
if (!$me->hasPermission(Permission::SEND_PRIVATE_MSG)) {
throw new ForbiddenException("You are not allowed to send messages");
}
$creator = new ConversationFormCreator($me);
$form = $creator->create()->handleRequest($request);
if ($form->isSubmitted()) {
if ($form->isValid()) {
$subject = $form->get('Subject')->getData();
$content = $form->get('Message')->getData();
$recipients = $form->get('Recipients')->getData();
$conversation_to = Conversation::createConversation($subject, $me->getId(), $recipients);
$message = $conversation_to->sendMessage($me, $content);
$event = new NewMessageEvent($message, true);
$this->dispatch(Events::MESSAGE_NEW, $event);
if ($this->isJson()) {
return new JsonResponse(array('success' => true, 'message' => 'Your message was sent successfully', 'id' => $conversation_to->getId()));
} else {
return new RedirectResponse($conversation_to->getUrl());
}
} elseif ($this->isJson()) {
throw new BadRequestException($this->getErrorMessage($form));
}
} else {
// Load the list of recipients from the URL
if ($request->query->has('recipients')) {
$form->get('Recipients')->setData($this->decompose($request->query->get('recipients'), array('Player', 'Team')));
}
}
return array("form" => $form->createView());
}
示例2: ConversationAbandonEvent
$conversation->sendMessage($autoreport, "This conversation is full of many of my messages");
$conversation->sendMessage($autoreport, "This conversation is full of a large amount of my messages");
$conversation->sendMessage($autoreport, "This conversation has messages by AutoReport");
$conversation->sendMessage($autoreport, "This conversation contains messages by AutoReport");
$conversation->sendMessage($autoreport, "This conversation includes messages by AutoReport");
$conversation->sendMessage($autoreport, "This is a test message by AutoReport");
$conversation->sendMessage($autoreport, "This is another test message by AutoReport");
$conversation->sendMessage($autoreport, "This is yet another test message by AutoReport");
$conversation->sendMessage($autoreport, "This test complements the list of test messages by AutoReport");
$conversation->sendMessage($autoreport, "This test message contains various characters: ↛ ħĽřƒƕƜƷǟʤϠℋℕℹ⅖Ⅲ");
$event = new ConversationAbandonEvent($conversation, $brad);
ConversationEvent::storeEvent($conversation->getId(), $event, Events::CONVERSATION_ABANDON);
$conversation->sendMessage($autoreport, "This is a message");
$conversation->sendMessage($autoreport, "This is another message");
$conversation->sendMessage($autoreport, "This is yet another message");
$conversation = Conversation::createConversation("Test", $alezakos->getId(), array($olfm, $reptitles, $fflood, $fradis, $lweak, $gsepar, $constitution));
$conversation->sendMessage($allejo, "then I can type at 12,000 wpm?");
$conversation->sendMessage($blast, "like:");
$event = new ConversationAbandonEvent($conversation, $brad);
ConversationEvent::storeEvent($conversation->getId(), $event, Events::CONVERSATION_ABANDON);
$event = new ConversationAbandonEvent($conversation, $mdskpr);
ConversationEvent::storeEvent($conversation->getId(), $event, Events::CONVERSATION_ABANDON);
$conversation->sendMessage($allejo, "tea?");
$event = new ConversationJoinEvent($conversation, array($brad, $mdskpr, $lweak));
ConversationEvent::storeEvent($conversation->getId(), $event, Events::CONVERSATION_JOIN);
$event = new ConversationRenameEvent($conversation, "test", "Test", $alezakos);
ConversationEvent::storeEvent($conversation->getId(), $event, Events::CONVERSATION_RENAME);
$conversation->sendMessage($allejo, "what would have some.");
$conversation->sendMessage($snake, "hahaha I'm sure I've used a url shorten urls book I'm not sure it would be used it");
$conversation->sendMessage($blast, "so I assume you're the correlative still always_ goes down history\"'s for anything");
$conversation->sendMessage($kierra, "I had a page. No addon, plugin to windows it...");
示例3: sendsAMessageAbout
/**
* @When :sender sends :recipient a message about :content
*/
public function sendsAMessageAbout($sender, $recipient, $content)
{
$sender = Player::getFromUsername($sender);
if ($recipient === 'me') {
$recipient = $this->me;
} else {
$recipient = Player::getFromUsername($recipient);
}
$participants = array($sender, $recipient);
$conversation = Conversation::createConversation("Subject", $sender->getId(), $participants);
$message = $conversation->sendMessage($sender, $content);
// Empty message so that the results are not skewed by showing the
// contents of the message in the sidebar
$conversation->sendMessage($sender, '--');
}