예제 #1
0
파일: Messages.php 프로젝트: valizr/MMA
 public function getTrashMessagesNumber()
 {
     $model = new Default_Model_Messages();
     $select = $model->getMapper()->getDbTable()->select()->from(array('u' => 'messages'), array('id' => 'COUNT(u.id)'))->where("" . "(u.idUserTo = '" . Zend_Registry::get('user')->getId() . "' AND u.trashedTo = 1 AND NOT u.deletedTo)  " . "OR " . "(u.idUserFrom = '" . Zend_Registry::get('user')->getId() . "'  AND u.trashedFrom = 1 AND NOT u.deletedFrom)")->order('u.created  DESC')->setIntegrityCheck(false);
     $model->fetchRow($select);
     return $model->getId();
 }