| 56 | | $fields = array("Message.id", "Message.title", "Message.body", "Message.created", "Message.sender", "Message.status", "User.id", "User.username"); |
| | 56 | $fields = array("Message.id", "Message.title", "Message.body", "Message.created", "Message.sender_id", "Message.status", "User.id", "User.username"); |
| | 159 | |
| | 160 | function paginateCount($conditions = null, $recursive = null) |
| | 161 | { |
| | 162 | $this->unbindModel(array('belongsTo'=>array('User'))); |
| | 163 | $this->bindModel(array( |
| | 164 | 'belongsTo' => array( |
| | 165 | 'User' => array( |
| | 166 | 'className' => 'User', |
| | 167 | 'foreignKey' => 'sender_id' |
| | 168 | ) |
| | 169 | ) |
| | 170 | )); |
| | 171 | return $this->findCount($conditions, $recursive); |
| | 172 | } |
| | 173 | |
| | 174 | function paginate($conditions = null, $fields = null, $order = null, $limit = null, $page = 1, $recursive = null) |
| | 175 | { |
| | 176 | $this->unbindModel(array('belongsTo'=>array('User'))); |
| | 177 | $this->bindModel(array( |
| | 178 | 'belongsTo' => array( |
| | 179 | 'User' => array( |
| | 180 | 'className' => 'User', |
| | 181 | 'foreignKey' => 'sender_id', |
| | 182 | 'fields' => 'id, username, avatar' |
| | 183 | ) |
| | 184 | ) |
| | 185 | )); |
| | 186 | return $this->findAll($conditions, $fields, $order, $limit, $page, $recursive); |
| | 187 | } |