Proyectos de Subversion LeadersLinked - Services

Rev

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

Rev 324 Rev 325
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 HabitContentMapper extends MapperCommon
16
class HabitContentMapper extends MapperCommon
Línea 17... Línea 17...
17
{
17
{
18
    const _TABLE = 'tbl_habit_content';
18
    const _TABLE = 'tbl_habits_content';
19
    
19
    
20
    /**
20
    /**
Línea 43... Línea 43...
43
            self::$_instance = new HabitContentMapper($adapter);
43
            self::$_instance = new HabitContentMapper($adapter);
44
        }
44
        }
45
        return self::$_instance;
45
        return self::$_instance;
46
    }
46
    }
Línea 47... Línea -...
47
    
-
 
48
    /**
-
 
49
     *
-
 
50
     * @param int $company_id
-
 
51
     * @param int $topic_id
-
 
52
     * @param int $capsule_id
-
 
53
     * @return int
-
 
54
     */
-
 
55
    public function fetchTotalCountByCompanyIdAndTopicIdAndCapsuleId($company_id, $topic_id, $capsule_id)
-
 
56
    {
-
 
57
        $select = $this->sql->select();
-
 
58
        $select->columns(['total' => new Expression('COUNT(*)')]);
-
 
59
        $select->from(self::_TABLE);
-
 
60
        $select->where->equalTo('company_id', $company_id);
-
 
61
        $select->where->equalTo('topic_id', $topic_id);
-
 
62
        $select->where->equalTo('capsule_id', $capsule_id);
-
 
63
        
-
 
64
        $record = $this->executeFetchOneArray($select);
-
 
65
        return $record['total'];
-
 
66
    }
-
 
67
    
-
 
68
    /**
-
 
69
     *
-
 
70
     * @param int $company_id
-
 
71
     * @param int $topic_id
-
 
72
     * @return int
-
 
73
     */
-
 
74
    public function fetchTotalCountByCompanyIdAndTopicId($company_id, $topic_id)
-
 
75
    {
-
 
76
        $select = $this->sql->select();
-
 
77
        $select->columns(['total' => new Expression('COUNT(*)')]);
-
 
78
        $select->from(self::_TABLE);
-
 
79
        $select->where->equalTo('company_id', $company_id);
-
 
80
        $select->where->equalTo('topic_id', $topic_id);
-
 
81
        
-
 
82
        
-
 
83
       // echo $select->getSqlString($this->adapter->platform) . PHP_EOL;
-
 
84
        
-
 
85
        $record = $this->executeFetchOneArray($select);
-
 
86
        return $record['total'];
-
 
87
    }
-
 
88
    
-
 
89
    
-
 
90
    /**
-
 
91
     *
-
 
92
     * @param int $company_id
-
 
93
     * @param int $quiz_id
-
 
94
     * @return int
-
 
95
     */
-
 
96
    public function fetchTotalCountByCompanyIdQuizId($company_id, $quiz_id)
-
 
97
    {
-
 
98
        $select = $this->sql->select();
-
 
99
        $select->columns(['total' => new Expression('COUNT(*)')]);
-
 
100
        $select->from(self::_TABLE);
-
 
101
        $select->where->equalTo('company_id', $company_id);
-
 
102
        $select->where->equalTo('quiz_id', $quiz_id);
-
 
103
        
-
 
104
        $record = $this->executeFetchOneArray($select);
-
 
105
        return $record['total'];
-
 
Línea 106... Línea 47...
106
    }
47
    
107
 
48
 
108
    
49
    
Línea 133... Línea 74...
133
        $select->where->equalTo('uuid', $uuid);
74
        $select->where->equalTo('uuid', $uuid);
Línea 134... Línea 75...
134
        
75
        
135
        return $this->executeFetchOneObject($select, $prototype);
76
        return $this->executeFetchOneObject($select, $prototype);
Línea -... Línea 77...
-
 
77
    }
-
 
78
    
-
 
79
    
-
 
80
    /**
-
 
81
     *
-
 
82
     * @param int $company_id
-
 
83
     * @param int $order 
-
 
84
     * @return HabitContent
-
 
85
     */
-
 
86
    public function fetchOneNextAvailableForOrderByCompanyId($company_id, $order)
-
 
87
    {
-
 
88
        $prototype = new HabitContent;
-
 
89
        $select = $this->sql->select(self::_TABLE);
-
 
90
        $select->where->equalTo('company_id', $company_id);
-
 
91
        $select->where->equalTo('status', HabitContent::STATUS_ACTIVE);
-
 
92
        $select->where->greaterThan('order', $order);
-
 
93
        
-
 
94
        return $this->executeFetchOneObject($select, $prototype);
136
    }
95
    }
137
    
96
    
138
    /**
97
    /**
139
     *
98
     *
140
     * @param int $company_id
99
     * @param int $company_id