Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 4808
Línea 58... Línea 58...
58
        
58
        
59
        $record = $this->executeFetchOneArray($select);
59
        $record = $this->executeFetchOneArray($select);
60
        return $record['total'];
60
        return $record['total'];
Línea -... Línea 61...
-
 
61
    }
-
 
62
    
-
 
63
    
-
 
64
    /**
-
 
65
     *
-
 
66
     * @param int $post_id
-
 
67
     * @return int
-
 
68
     */
-
 
69
    public function fetchCountLikeByPostId($post_id)
-
 
70
    {
-
 
71
        $select = $this->sql->select(self::_TABLE);
-
 
72
        $select->columns(['total' => new Expression('COUNT(*)') ]);
-
 
73
        $select->where->equalTo('post_id', $post_id);
-
 
74
        
-
 
75
        $record = $this->executeFetchOneArray($select);
-
 
76
        return $record['total'];
61
    }
77
    }
62
    
78
    
63
    /**
79
    /**
64
     * 
80
     * 
65
     * @param int $feed_id
81
     * @param int $feed_id
66
     * @param int $user_id
82
     * @param int $user_id
67
     * @return Like
83
     * @return Like
68
     */
84
     */
69
    public function fetchOneByFeedIdAndUserId($feed_id, $user_id)
85
    public function fetchOneByFeedIdAndUserId($feed_id, $user_id)
-
 
86
    {
70
    {
87
        $select = $this->sql->select(self::_TABLE);
-
 
88
        $select->where->equalTo('feed_id', $feed_id);
-
 
89
        $select->where->equalTo('user_id', $user_id);
-
 
90
        $select->where->equalTo('relational', Like::RELATIONAL_FEED);
-
 
91
        
-
 
92
        $prototype = new Like();
-
 
93
        return $this->executeFetchOneObject($select, $prototype);
-
 
94
    }
-
 
95
    
-
 
96
    
-
 
97
    /**
-
 
98
     *
-
 
99
     * @param int $post_id
-
 
100
     * @param int $user_id
-
 
101
     * @return Like
-
 
102
     */
-
 
103
    public function fetchOneByPostIdAndUserId($post_id, $user_id)
-
 
104
    {
-
 
105
        $select = $this->sql->select(self::_TABLE);
-
 
106
        $select->where->equalTo('post_id', $post_id);
Línea 71... Línea 107...
71
        $select = $this->sql->select(self::_TABLE);
107
        $select->where->equalTo('user_id', $user_id);
72
        $select->where->equalTo('feed_id', $feed_id)->and->equalTo('user_id', $user_id);
108
        $select->where->equalTo('relational', Like::RELATIONAL_POST);
73
        
109
        
Línea 82... Línea 118...
82
     * @return boolean
118
     * @return boolean
83
     */
119
     */
84
    public function deleteByFeedIdAndUserId($feed_id, $user_id)
120
    public function deleteByFeedIdAndUserId($feed_id, $user_id)
85
    {
121
    {
86
        $delete = $this->sql->delete(self::_TABLE);
122
        $delete = $this->sql->delete(self::_TABLE);
-
 
123
        $delete->where->equalTo('feed_id', $feed_id); 
87
        $delete->where->equalTo('feed_id', $feed_id)->and->equalTo('user_id', $user_id);
124
        $delete->where->equalTo('user_id', $user_id);
-
 
125
        $delete->where->equalTo('relational', Like::RELATIONAL_FEED);
-
 
126
        
-
 
127
        return $this->executeDelete($delete);
-
 
128
    }
-
 
129
    
-
 
130
    
-
 
131
    /**
-
 
132
     *
-
 
133
     * @param int $post_id
-
 
134
     * @param int $user_id
-
 
135
     * @return boolean
-
 
136
     */
-
 
137
    public function deleteByPostIdAndUserId($post_id, $user_id)
-
 
138
    {
-
 
139
        $delete = $this->sql->delete(self::_TABLE);
-
 
140
        $delete->where->equalTo('post_id', $post_id);
-
 
141
        $delete->where->equalTo('user_id', $user_id);
-
 
142
        $delete->where->equalTo('relational', Like::RELATIONAL_POST);
Línea 88... Línea 143...
88
        
143
        
89
        return $this->executeDelete($delete);
144
        return $this->executeDelete($delete);
Línea 90... Línea 145...
90
    }
145
    }