本文整理汇总了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();
}