当前位置: 首页>>代码示例>>PHP>>正文


PHP Conversation::findAllByItem方法代码示例

本文整理汇总了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();
 }
开发者ID:josephholsten,项目名称:swaplady,代码行数:42,代码来源:ItemsController.php


注:本文中的Conversation::findAllByItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。