Proyectos de Subversion LeadersLinked - Services

Rev

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

Rev 283 Rev 558
Línea 13... Línea 13...
13
use Laminas\Paginator\Adapter\DbSelect;
13
use Laminas\Paginator\Adapter\DbSelect;
Línea 14... Línea 14...
14
 
14
 
15
 
15
 
16
class MicrolearningTopicCapsuleMapper extends MapperCommon
16
class MicrolearningTopicCapsuleMapper extends MapperCommon
Línea 17... Línea 17...
17
{
17
{
18
    const _TABLE = 'tbl_microlearning_capsules';
18
    const _TABLE = 'tbl_microlearning_topic_capsules';
19
    
19
    
20
    /**
20
    /**
Línea 110... Línea 110...
110
        
110
        
111
        return $this->executeFetchOneObject($select, $prototype);
111
        return $this->executeFetchOneObject($select, $prototype);
Línea 112... Línea 112...
112
    }
112
    }
-
 
113
    
-
 
114
    /**
-
 
115
     * Fetches a single topic-capsule relationship by capsule ID.
-
 
116
     * Since a capsule might theoretically be in multiple topics, this fetches the first one found.
-
 
117
     * 
-
 
118
     * @param int $capsule_id
-
 
119
     * @return MicrolearningTopicCapsule|null
-
 
120
     */
-
 
121
    public function fetchOneByCapsuleId($capsule_id)
-
 
122
    {
-
 
123
        $prototype = new MicrolearningTopicCapsule();
-
 
124
        
-
 
125
        $select = $this->sql->select(self::_TABLE);
-
 
126
        $select->where->equalTo('capsule_id', $capsule_id);
-
 
127
        $select->limit(1); // Ensure only one record is fetched
-
 
128
        
-
 
129
        return $this->executeFetchOneObject($select, $prototype);
-
 
130
    }
113
    
131
    
114
    /**
132
    /**
115
     *
133
     *
116
     * @param int $company_id
134
     * @param int $company_id
117
     * @param int $topic_id
135
     * @param int $topic_id
Línea 142... Línea 160...
142
    public function fetchAllByTopicId($topic_id)
160
    public function fetchAllByTopicId($topic_id)
143
    {
161
    {
144
        $prototype = new MicrolearningTopicCapsule();
162
        $prototype = new MicrolearningTopicCapsule();
Línea 145... Línea 163...
145
        
163
        
146
        $select = $this->sql->select(self::_TABLE);
164
        $select = $this->sql->select(self::_TABLE);
147
        $select->where->equalTo('topic_id', 'topic_id');
165
        $select->where->equalTo('topic_id', $topic_id);
Línea 148... Línea 166...
148
        $select->where->order('added_on DESC');
166
        $select->order('added_on DESC');
149
        
167
        
Línea 150... Línea 168...
150
        return $this->executeFetchAllObject($select, $prototype);
168
        return $this->executeFetchAllObject($select, $prototype);
Línea 158... Línea 176...
158
    public function fetchAllActiveByTopicId($topic_id)
176
    public function fetchAllActiveByTopicId($topic_id)
159
    {
177
    {
160
        $prototype = new MicrolearningTopicCapsule();
178
        $prototype = new MicrolearningTopicCapsule();
Línea 161... Línea 179...
161
        
179
        
162
        $select = $this->sql->select(self::_TABLE);
180
        $select = $this->sql->select(self::_TABLE);
163
        $select->where->equalTo('topic_id', 'topic_id');
181
        $select->where->equalTo('topic_id', $topic_id);
164
        $select->where->equalTo('status', MicrolearningTopicCapsule::STATUS_ACTIVE);
182
        $select->where->equalTo('status', MicrolearningTopicCapsule::STATUS_ACTIVE);
Línea 165... Línea 183...
165
        $select->where->order('added_on DESC');
183
        $select->order('added_on DESC');
166
        
184
        
Línea 167... Línea 185...
167
        return $this->executeFetchAllObject($select, $prototype);
185
        return $this->executeFetchAllObject($select, $prototype);
Línea 175... Línea 193...
175
    public function fetchAllActiveAndPublishByTopicId($topic_id)
193
    public function fetchAllActiveAndPublishByTopicId($topic_id)
176
    {
194
    {
177
        $prototype = new MicrolearningTopicCapsule();
195
        $prototype = new MicrolearningTopicCapsule();
Línea 178... Línea 196...
178
        
196
        
179
        $select = $this->sql->select(self::_TABLE);
197
        $select = $this->sql->select(self::_TABLE);
180
        $select->where->equalTo('topic_id', 'topic_id');
198
        $select->where->equalTo('topic_id', $topic_id);
181
        $select->where->equalTo('status', MicrolearningTopicCapsule::STATUS_ACTIVE);
199
        $select->where->equalTo('status', MicrolearningTopicCapsule::STATUS_ACTIVE);
182
        $select->where->greaterThanOrEqualTo('publish_on', new Expression('CURRENT_DATE()'));
200
        $select->where->greaterThanOrEqualTo('publish_on', new Expression('CURRENT_DATE()'));
Línea 183... Línea 201...
183
        $select->where->order('added_on DESC');
201
        $select->order('added_on DESC');
184
        
202