本文整理匯總了PHP中Conversation::findAllByItem方法的典型用法代碼示例。如果您正苦於以下問題:PHP Conversation::findAllByItem方法的具體用法?PHP Conversation::findAllByItem怎麽用?PHP Conversation::findAllByItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Conversation
的用法示例。
在下文中一共展示了Conversation::findAllByItem方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: showAction
public function showAction()
{
$this->logger->entering();
$this->logger->info('Loading the item by id');
$items = new Item();
$item = $items->find($this->_getParam('id'))->current();
if ($item == null) {
$this->logger->warn('Tried to show an non-existant item');
$this->flash->notice = 'Invalid Action';
$this->_redirect('/');
}
$this->logger->info('Find all the tags for the item');
$tags = $items->findTags($item->id);
$this->logger->info('Find owner');
$users = new User();
$owner = $item->findParentUser();
$user = $users->find($this->session->user_id)->current();
$this->logger->info('Calculating price total');
$shipping = Item::shippingCharge($item->weight);
$total = $item->points + $shipping;
$this->logger->info('Loading existing conversations');
$conversation = null;
$conversations = null;
if (isset($user)) {
$conversationTable = new Conversation();
if ($owner->id == $user->id) {
$conversationRows = $conversationTable->findAllByItem($item);
foreach ($conversationRows as $conversationRow) {
$convo = $conversationRow->toArray();
$convo['user'] = $conversationRow->findParentUser()->toArray();
$conversations[] = $convo;
}
} else {
$conversation = $conversationTable->findByUserAndItem($user, $item);
}
}
$this->logger->info('Loading the view parameters');
$this->view->assign(array('title' => "Item: {$item->name}", 'item' => $item, 'owner' => $owner, 'tags' => $tags, 'shipping' => $shipping, 'total' => $total, 'conversations' => $conversations, 'conversation' => $conversation));
$this->logger->info('Rendering the application template');
$this->render();
$this->logger->exiting();
}