Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 1 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 2219
Línea 10... Línea 10...
10
use Laminas\Paginator\Paginator;
10
use Laminas\Paginator\Paginator;
11
use Laminas\Log\LoggerInterface;
11
use Laminas\Log\LoggerInterface;
12
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
12
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
13
use LeadersLinked\Model\ChatMessage;
13
use LeadersLinked\Model\ChatMessage;
14
use LeadersLinked\Mapper\Common\MapperCommon;
14
use LeadersLinked\Mapper\Common\MapperCommon;
-
 
15
use Laminas\Db\Sql\Expression;
Línea 15... Línea 16...
15
 
16
 
16
 
17
 
17
class ChatMessageMapper extends MapperCommon
18
class ChatMessageMapper extends MapperCommon
Línea 49... Línea 50...
49
    
50
    
50
    /**
51
    /**
51
     *
52
     *
52
     * @param int $from_id
53
     * @param int $from_id
-
 
54
     * @param int $to_id
-
 
55
     * @return boolean
-
 
56
     */
-
 
57
    public function countNotSeenMessagesByChatIdAndToId($chat_id, $to_id)
-
 
58
    {
-
 
59
        $select = $this->sql->select(self::_TABLE);
-
 
60
        $select->columns(['total' => new Expression('COUNT(*)')]);
-
 
61
        $select->where->equalTo('chat_id', $chat_id);
-
 
62
        $select->where->equalTo('to_id', $to_id);
-
 
63
        $select->where->equalTo('seen', ChatMessage::SEEN_NO);
-
 
64
        
-
 
65
        $record = $this->executeFetchOneArray($select);
-
 
66
        return $record['total'];
-
 
67
    }
-
 
68
    
-
 
69
    /**
-
 
70
     *
-
 
71
     * @param int $from_id
-
 
72
     * @param int $to_id
-
 
73
     * @return boolean
-
 
74
     */
-
 
75
    public function countNotReceivedMessagesByChatIdAndToId($chat_id, $to_id)
-
 
76
    {
-
 
77
        $select = $this->sql->select(self::_TABLE);
-
 
78
        $select->columns(['total' => new Expression('COUNT(*)')]);
-
 
79
        $select->where->equalTo('chat_id', $chat_id);
-
 
80
        $select->where->equalTo('to_id', $to_id);
-
 
81
        $select->where->equalTo('recd', ChatMessage::RECD_NO);
-
 
82
        
-
 
83
        $record = $this->executeFetchOneArray($select);
-
 
84
        return $record['total'];
-
 
85
    }
-
 
86
    
-
 
87
    
-
 
88
    /**
-
 
89
     *
-
 
90
     * @param int $from_id
53
     * @param int $to_id
91
     * @param int $to_id
54
     * @return boolean
92
     * @return boolean
55
     */
93
     */
56
    public function existNotSeenMessagesByChatIdAndToId($chat_id, $to_id)
94
    public function existNotSeenMessagesByChatIdAndToId($chat_id, $to_id)
57
    {
95
    {