本文整理汇总了PHP中Conversation::fetchNew方法的典型用法代码示例。如果您正苦于以下问题:PHP Conversation::fetchNew方法的具体用法?PHP Conversation::fetchNew怎么用?PHP Conversation::fetchNew使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conversation
的用法示例。
在下文中一共展示了Conversation::fetchNew方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createAction
public function createAction()
{
$this->logger->entering();
$this->logger->info('Creating a new messsage row');
$messages = new Message();
$message = $messages->fetchNew();
$this->logger->info('Setting message from post parameters');
$messageParams = $messages->filterColumns($this->_getParam('message'));
$message->setFromArray($messageParams);
$date = new Zend_Date();
$message->created_on = $date->get(Zend_Date::ISO_8601);
$this->logger->info('Creating a new conversation if necessary');
if (empty($message->conversation_id)) {
$conversations = new Conversation();
$conversation = $conversations->fetchNew();
$conversationParams = $conversations->filterColumns($this->_getParam('conversation'));
$conversation->setfromArray($conversationParams);
$conversation->save();
$message->conversation_id = $conversation->id;
}
$this->logger->info('Saving the message');
$message->save();
$item = $conversation->findParentItem();
$owner = $item->findParentUser();
$asker = $conversation->findParentUser();
$mail = new Zend_Mail();
$mail->setFrom('swaplady@example.com', 'Swaplady');
$mail->addTo($owner->email, $owner->name);
$mail->setSubject("[Swaplady] New message about {$item->name}");
$mail->setBodyText($message->body . "\nYou can add to the conversation at http://swaplady.com/conversations/show/{$conversation->id}");
$mail->send();
$mail = new Zend_Mail();
$mail->setFrom('swaplady@example.com', 'Swaplady');
$mail->addTo($asker->email, $asker->name);
$mail->setSubject("[Swaplady] New message about {$item->name}");
$mail->setBodyText($message->body . "\nYou can add to the conversation at http://swaplady.com/conversations/show/{$conversation->id}");
$mail->send();
$this->logger->info('Redirecting to show the item of the message');
$this->_redirect('/conversations/show/' . $message->conversation_id);
}