Changeset 14793

Show
Ignore:
Timestamp:
06/28/08 23:22:50 (5 years ago)
Author:
kumatch
Message:

Added the listReplies() method.

Location:
events/phpframework/piece_framework/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • events/phpframework/piece_framework/trunk/config/orm/mappers/Statuses.yaml

    r14789 r14793  
    3232      OR statuses.user_id = $userId 
    3333 
     34- name: findAllByReplyUserId 
     35  query: > 
     36    SELECT 
     37      statuses.id as status_id, 
     38      statuses.comment as comment, 
     39      users.id as user_id, 
     40      users.user_name as user_name, 
     41      users.image as image, 
     42      statuses.created_at 
     43    FROM 
     44      statuses 
     45      JOIN users ON users.id = statuses.user_id 
     46    WHERE 
     47      statuses.reply_user_id = $replyUserId 
    3448 
    3549 
  • events/phpframework/piece_framework/trunk/libs/Phwittr/Self.php

    r14787 r14793  
    9999    } 
    100100 
     101    // }}} 
     102    // {{{ listReplies 
     103 
     104    /** 
     105     * 自身への返信リストを取得する 
     106     *  
     107     * @param  integer $page 
     108     * @return mixed 
     109     */ 
     110    public function listReplies($page = 1) 
     111    { 
     112        $mapper = $this->_createStatusListMapper($this->_limit * ($page - 1)); 
     113        $statusList = $mapper->findAllByReplyUserId($this->id); 
     114        if (count($statusList) == 0 && $page > 2) { 
     115            return $this->listReplies(); 
     116        } 
     117 
     118        $this->_checkNextPage($mapper, $page); 
     119 
     120        return $statusList; 
     121    } 
     122 
    101123    /**#@-*/ 
    102124