Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 6056 Rev 6521
Línea 48... Línea 48...
48
    /**
48
    /**
49
     * 
49
     * 
50
     * @param int $feed_id
50
     * @param int $feed_id
51
     * @return array
51
     * @return array
52
     */
52
     */
53
    public function fetchCountContentReactionsByFeedId($feed_id)
53
    public function fetchCountByFeedId($feed_id)
54
    {
54
    {
55
        $select = $this->sql->select(self::_TABLE);
55
        $select = $this->sql->select(self::_TABLE);
56
        $select->columns(['total' => new Expression('COUNT(*)'), 'reaction']);
56
        $select->columns(['total' => new Expression('COUNT(*)'), 'reaction']);
57
        $select->where->equalTo('feed_id', $feed_id);
57
        $select->where->equalTo('feed_id', $feed_id);
-
 
58
        $select->where->equalTo('relational', ContentReaction::RELATIONAL_FEED);
58
        $select->group('reaction');
59
        $select->group('reaction');
Línea 59... Línea 60...
59
        
60
        
60
        return $this->executeFetchAllArray($select);
61
        return $this->executeFetchAllArray($select);
Línea -... Línea 62...
-
 
62
    }
-
 
63
    
-
 
64
    /**
-
 
65
     *
-
 
66
     * @param int $my_coach_question_id
-
 
67
     * @return array
-
 
68
     */
-
 
69
    public function fetchCountByMyCoachQuestionId($my_coach_question_id)
-
 
70
    {
-
 
71
        $selectIn = $this->sql->select(MyCoachAnswerMapper::_TABLE);
-
 
72
        $selectIn->columns(['id']);
-
 
73
        $selectIn->where->equalTo('question_id', $my_coach_question_id);
-
 
74
        
-
 
75
        
-
 
76
        $select = $this->sql->select(self::_TABLE);
-
 
77
        $select->columns(['total' => new Expression('COUNT(*)'), 'reaction']);
-
 
78
        $select->where->in('my_coach_answer_id', $selectIn);
-
 
79
        $select->where->equalTo('relational', ContentReaction::RELATIONAL_MY_COACH);
-
 
80
        $select->group('reaction');
-
 
81
        
-
 
82
        return $this->executeFetchAllArray($select);
-
 
83
    }
-
 
84
    
-
 
85
    /**
-
 
86
     *
-
 
87
     * @param int $my_coach_answer_id
-
 
88
     * @return array
-
 
89
     */
-
 
90
    public function fetchCountByMyCoachAnswerId($my_coach_answer_id)
-
 
91
    {
-
 
92
        $select = $this->sql->select(self::_TABLE);
-
 
93
        $select->columns(['total' => new Expression('COUNT(*)'), 'reaction']);
-
 
94
        $select->where->equalTo('my_coach_answer_id', $my_coach_answer_id);
-
 
95
        $select->where->equalTo('relational', ContentReaction::RELATIONAL_MY_COACH);
-
 
96
        $select->group('reaction');
-
 
97
        
Línea 61... Línea 98...
61
    }
98
        return $this->executeFetchAllArray($select);
62
    
99
    }
63
    
100
    
64
    
101
    
65
    /**
102
    /**
66
     *
103
     *
67
     * @param int $knowledge_area_id
104
     * @param int $knowledge_area_id
68
     * @return array
105
     * @return array
69
     */
106
     */
70
    public function fetchCountContentReactionsByKnowledgeAreaId($knowledge_area_id)
107
    public function fetchCountByKnowledgeAreaId($knowledge_area_id)
-
 
108
    {
71
    {
109
        $select = $this->sql->select(self::_TABLE);
Línea 72... Línea 110...
72
        $select = $this->sql->select(self::_TABLE);
110
        $select->columns(['total' => new Expression('COUNT(*)'), 'reaction']);
73
        $select->columns(['total' => new Expression('COUNT(*)'), 'reaction']);
111
        $select->where->equalTo('knowledge_area_id', $knowledge_area_id);
-
 
112
        $select->where->equalTo('relational', ContentReaction::RELATIONAL_KNOWLEDGE_AREA);
-
 
113
        $select->group('reaction');
Línea 74... Línea 114...
74
        $select->where->equalTo('knowledge_area_id', $knowledge_area_id);
114
        
75
        $select->group('reaction');
115
        return $this->executeFetchAllArray($select);
76
        
116
    }
77
        return $this->executeFetchAllArray($select);
117
 
78
    }
118
    
79
    
119
    
80
    
120
    
81
    /**
121
    /**
82
     *
122
     *
83
     * @param int $post_id
123
     * @param int $post_id
-
 
124
     * @return array
84
     * @return array
125
     */
Línea 85... Línea 126...
85
     */
126
    public function fetchCountByPostId($post_id)
86
    public function fetchCountContentReactionsByPostId($post_id)
127
    {
Línea 128... Línea 169...
128
        return $this->executeFetchOneObject($select, $prototype);
169
        return $this->executeFetchOneObject($select, $prototype);
129
    }
170
    }
Línea 130... Línea 171...
130
    
171
    
131
    /**
172
    /**
-
 
173
     *
-
 
174
     * @param int $my_coach_answer_id
-
 
175
     * @param int $user_id
-
 
176
     * @return ContentReaction
-
 
177
     */
-
 
178
    public function fetchOneByMyCoachAnswerIdAndUserId($my_coach_answer_id, $user_id)
-
 
179
    {
-
 
180
        $select = $this->sql->select(self::_TABLE);
-
 
181
        $select->where->equalTo('my_coach_answer_id', $my_coach_answer_id);
-
 
182
        $select->where->equalTo('user_id', $user_id);
-
 
183
        $select->where->equalTo('relational', ContentReaction::RELATIONAL_MY_COACH);
-
 
184
        
-
 
185
        $prototype = new ContentReaction();
-
 
186
        return $this->executeFetchOneObject($select, $prototype);
-
 
187
    }
-
 
188
    
-
 
189
    /**
132
     *
190
     *
133
     * @param int $knowledge_area_id
191
     * @param int $knowledge_area_id
134
     * @param int $user_id
192
     * @param int $user_id
135
     * @return ContentReaction
193
     * @return ContentReaction
136
     */
194
     */
Línea 143... Línea 201...
143
        
201
        
144
        $prototype = new ContentReaction();
202
        $prototype = new ContentReaction();
145
        return $this->executeFetchOneObject($select, $prototype);
203
        return $this->executeFetchOneObject($select, $prototype);
Línea -... Línea 204...
-
 
204
    }
146
    }
205
    
147
    
206
    
148
    /**
207
    /**
149
     * 
208
     * 
150
     * @param int $feed_id
209
     * @param int $feed_id
Línea 175... Línea 234...
175
        $delete->where->equalTo('relational', ContentReaction::RELATIONAL_KNOWLEDGE_AREA);
234
        $delete->where->equalTo('relational', ContentReaction::RELATIONAL_KNOWLEDGE_AREA);
Línea 176... Línea 235...
176
        
235
        
177
        return $this->executeDelete($delete);
236
        return $this->executeDelete($delete);
Línea -... Línea 237...
-
 
237
    }
-
 
238
    
-
 
239
    /**
-
 
240
     *
-
 
241
     * @param int $my_coach_answer_id
-
 
242
     * @param int $user_id
-
 
243
     * @return boolean
-
 
244
     */
-
 
245
    public function deleteByByMyCoachAnswerId($my_coach_answer_id, $user_id)
-
 
246
    {
-
 
247
        $delete = $this->sql->delete(self::_TABLE);
-
 
248
        $delete->where->equalTo('my_coach_answer_id', $my_coach_answer_id);
-
 
249
        $delete->where->equalTo('user_id', $user_id);
-
 
250
        $delete->where->equalTo('relational', ContentReaction::RELATIONAL_MY_COACH);
-
 
251
        
-
 
252
        return $this->executeDelete($delete);
-
 
253
    }
-
 
254
    
-
 
255
    
Línea 178... Línea 256...
178
    }
256
    
179
    
257
    
180
    
258
    
181
    /**
259
    /**
Línea 201... Línea 279...
201
     */
279
     */
202
    public function insert($contentReaction)
280
    public function insert($contentReaction)
203
    {
281
    {
204
        $hydrator = new ObjectPropertyHydrator();
282
        $hydrator = new ObjectPropertyHydrator();
205
        $values = $hydrator->extract($contentReaction);
283
        $values = $hydrator->extract($contentReaction);
-
 
284
        $values = $this->removeEmpty($values);
Línea 206... Línea 285...
206
        
285
        
207
        $insert = $this->sql->insert(self::_TABLE);
286
        $insert = $this->sql->insert(self::_TABLE);
Línea 208... Línea 287...
208
        $insert->values($values);
287
        $insert->values($values);
Línea 223... Línea 302...
223
     */
302
     */
224
    public function update($contentReaction)
303
    public function update($contentReaction)
225
    {
304
    {
226
        $hydrator = new ObjectPropertyHydrator();
305
        $hydrator = new ObjectPropertyHydrator();
227
        $values = $hydrator->extract($contentReaction);
306
        $values = $hydrator->extract($contentReaction);
228
 
-
 
-
 
307
        $values = $this->removeEmpty($values);
Línea 229... Línea 308...
229
        
308
        
230
        $update = $this->sql->update(self::_TABLE);
309
        $update = $this->sql->update(self::_TABLE);
231
        $update->set($values);
310
        $update->set($values);