Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 3639 Rev 3720
Línea 58... Línea 58...
58
        $select->limit(1);
58
        $select->limit(1);
Línea 59... Línea 59...
59
        
59
        
60
        return $this->executeFetchOneObject($select, $prototype);
60
        return $this->executeFetchOneObject($select, $prototype);
Línea -... Línea 61...
-
 
61
    }
-
 
62
    
-
 
63
    
-
 
64
    /**
-
 
65
     *
-
 
66
     * @param string $code
-
 
67
     * @param int $company_id
-
 
68
     * @return  PushTemplate
-
 
69
     */
-
 
70
    public function fetchOneByCodeAndCompanyId($code, $company_id)
-
 
71
    {
-
 
72
        $prototype = new PushTemplate();
-
 
73
        $select = $this->sql->select(self::_TABLE);
-
 
74
        $select->where->equalTo('code', $code);
-
 
75
        $select->where->equalTo('company_id', $company_id);
-
 
76
        $select->limit(1);
-
 
77
        
-
 
78
        return $this->executeFetchOneObject($select, $prototype);
-
 
79
    }
-
 
80
    
-
 
81
    /**
-
 
82
     *
-
 
83
     * @param string $code
-
 
84
     * @return  PushTemplate
-
 
85
     */
-
 
86
    public function fetchOneByCodeDefault($code)
-
 
87
    {
-
 
88
        $prototype = new PushTemplate();
-
 
89
        $select = $this->sql->select(self::_TABLE);
-
 
90
        $select->where->equalTo('code', $code);
-
 
91
        $select->where->isNull('push_template_default_id');
-
 
92
        $select->limit(1);
-
 
93
        
-
 
94
        return $this->executeFetchOneObject($select, $prototype);
-
 
95
    }
61
    }
96
    
62
    
97
    
63
    /**
98
    /**
64
     *
99
     *
65
     * @param string $uuid
100
     * @param string $uuid
Línea 84... Línea 119...
84
    {
119
    {
85
        $prototype = new PushTemplate();
120
        $prototype = new PushTemplate();
86
        $select = $this->sql->select(self::_TABLE);
121
        $select = $this->sql->select(self::_TABLE);
87
        $select->where->equalTo('status', PushTemplate::STATUS_ACTIVE);
122
        $select->where->equalTo('status', PushTemplate::STATUS_ACTIVE);
88
        $select->where->equalTo('type', $type);
123
        $select->where->equalTo('type', $type);
89
        $select->limit(1);
-
 
90
        
124
 
91
        return $this->executeFetchAllObject($select, $prototype);
125
        return $this->executeFetchAllObject($select, $prototype);
92
    }
126
    }
Línea 93... Línea 127...
93
 
127
 
94
    
128
    
-
 
129
    /**
-
 
130
     *
-
 
131
     * @param string $type
-
 
132
     * @param int $company_id
-
 
133
     * @return  PushTemplate[]
-
 
134
     */
-
 
135
    public function fetchAllActiveByTypeAndCompanyId($type, $company_id)
-
 
136
    {
-
 
137
        $prototype = new PushTemplate();
-
 
138
        $select = $this->sql->select(self::_TABLE);
-
 
139
        $select->where->equalTo('status', PushTemplate::STATUS_ACTIVE);
Línea -... Línea 140...
-
 
140
        $select->where->equalTo('type', $type);
-
 
141
        $select->where->equalTo('company_id', $company_id);
-
 
142
 
-
 
143
        
-
 
144
        return $this->executeFetchAllObject($select, $prototype);
-
 
145
    }
-
 
146
    
95
    /**
147
    /**
96
     *
148
     *
97
 
149
     * @param string $type
98
     * @return  PushTemplate[]
150
     * @return  PushTemplate[]
99
     */
151
     */
100
    public function fetchAllDefault()
152
    public function fetchAllActiveByTypeDefault($type)
-
 
153
    {
-
 
154
        $prototype = new PushTemplate();
101
    {
155
        $select = $this->sql->select(self::_TABLE);
102
        $prototype = new PushTemplate();
-
 
-
 
156
        $select->where->equalTo('status', PushTemplate::STATUS_ACTIVE);
Línea 103... Línea 157...
103
        $select = $this->sql->select(self::_TABLE);
157
        $select->where->equalTo('type', $type);
104
        $select->where->isNull('push_template_default_id');
158
        $select->where->isNull('push_template_default_id');
Línea -... Línea 159...
-
 
159
 
-
 
160
        
-
 
161
        return $this->executeFetchAllObject($select, $prototype);
-
 
162
    }
-
 
163
    
-
 
164
    
-
 
165
    
-
 
166
    /**
-
 
167
     *
-
 
168
 
-
 
169
     * @return  PushTemplate[]
-
 
170
     */
-
 
171
    public function fetchAllDefault()
-
 
172
    {
-
 
173
        $prototype = new PushTemplate();
-
 
174
        $select = $this->sql->select(self::_TABLE);
-
 
175
        $select->where->isNull('push_template_default_id');
-
 
176
 
-
 
177
        
-
 
178
        return $this->executeFetchAllObject($select, $prototype);
-
 
179
    }
-
 
180
 
-
 
181
    
-
 
182
    /**
-
 
183
     *
-
 
184
     * @param int $company_id
-
 
185
     * @return  PushTemplate[]
-
 
186
     */
-
 
187
    public function fetchAllByCompanyId($company_id)
-
 
188
    {
Línea 105... Línea 189...
105
        $select->limit(1);
189
        $prototype = new PushTemplate();
106
        
190
        $select = $this->sql->select(self::_TABLE);
107
        return $this->executeFetchAllObject($select, $prototype);
191
        $select->where->equalTo('company_id', $company_id);
108
    }
192
        $select->limit(1);
109
    
193
        
110
    
194
        return $this->executeFetchAllObject($select, $prototype);
111
    
195
    }
112
    
196
    
113
    /**
197
    /**
114
     *
198
     *
115
     * @param string $search
199
     * @param string $search
116
     * @param int $page
200
     * @param int $page
117
     * @param int $records_per_page
201
     * @param int $records_per_page
-
 
202
     * @param string $order_field
Línea 118... Línea 203...
118
     * @param string $order_field
203
     * @param string $order_direction
119
     * @param string $order_direction
204
     * @return Paginator
120
     * @return Paginator
205
     */
121
     */
206
    public function fetchAllDataTableForDefault($search, $page = 1, $records_per_page = 10, $order_field= 'title', $order_direction = 'ASC')
Línea 142... Línea 227...
142
    }
227
    }
Línea 143... Línea 228...
143
 
228
 
144
    
229
    
-
 
230
    /**
-
 
231
     *
-
 
232
     * @param string $search
-
 
233
     * @param int $company_id
-
 
234
     * @param int $page
-
 
235
     * @param int $records_per_page
-
 
236
     * @param string $order_field
-
 
237
     * @param string $order_direction
-
 
238
     * @return Paginator
-
 
239
     */
-
 
240
    public function fetchAllDataTableByCompanyId($search, $company_id,  $page = 1, $records_per_page = 10, $order_field= 'title', $order_direction = 'ASC')
-
 
241
    {
-
 
242
        $prototype = new PushTemplate();
-
 
243
        $select = $this->sql->select(self::_TABLE);
-
 
244
        $select->where->equalTo('company_id', $company_id);
-
 
245
        
-
 
246
        if($search) {
-
 
247
            $select->where->like('id', '%' . $search . '%')->or->like('title', '%' . $search . '%');
-
 
248
        }
-
 
249
        $select->order($order_field . ' ' . $order_direction);
-
 
250
        
-
 
251
        $hydrator   = new ObjectPropertyHydrator();
-
 
252
        $resultset  = new HydratingResultSet($hydrator, $prototype);
-
 
253
        
-
 
254
        $adapter = new DbSelect($select, $this->sql, $resultset);
-
 
255
        $paginator = new Paginator($adapter);
-
 
256
        $paginator->setItemCountPerPage($records_per_page);
-
 
257
        $paginator->setCurrentPageNumber($page);
-
 
258
        
-
 
259
        
-
 
260
        return $paginator;
-
 
261
    }
-
 
262
    
145
    /**
263
    /**
146
     *
264
     *
147
     * @param PushTemplate $pushTemplate
265
     * @param PushTemplate $pushTemplate
148
     * @return boolean
266
     * @return boolean
149
     */
267
     */
Línea 156... Línea 274...
156
        $update->set($values);
274
        $update->set($values);
157
        $update->where->equalTo('id', $pushTemplate->id);
275
        $update->where->equalTo('id', $pushTemplate->id);
Línea 158... Línea 276...
158
        
276
        
159
        return $this->executeUpdate($update);
277
        return $this->executeUpdate($update);
-
 
278
    }
-
 
279
    
-
 
280
    
-
 
281
    /**
-
 
282
     *
-
 
283
     * @param PushTemplate $pushTemplate
-
 
284
     * @return boolean
-
 
285
     */
-
 
286
    public function insert($pushTemplate) 
-
 
287
    {
-
 
288
        $hydrator = new ObjectPropertyHydrator();
-
 
289
        $values = $hydrator->extract($pushTemplate);
-
 
290
        $values = $this->removeEmpty($values);
-
 
291
        
-
 
292
        $insert = $this->sql->insert(self::_TABLE);
-
 
293
        $insert->values($values);
-
 
294
        
-
 
295
        
-
 
296
        $result = $this->executeInsert($insert);
-
 
297
        if ($result) {
-
 
298
            $pushTemplate->id = $this->lastInsertId;
-
 
299
        }
-
 
300
        
-
 
301
        return $result;
Línea 160... Línea 302...
160
    }
302
    }
161
 
303