Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 1 Rev 192
Línea 5... Línea 5...
5
 
5
 
6
use LeadersLinked\Mapper\Common\MapperCommon;
6
use LeadersLinked\Mapper\Common\MapperCommon;
7
use Laminas\Db\Adapter\AdapterInterface;
7
use Laminas\Db\Adapter\AdapterInterface;
8
use LeadersLinked\Model\CompanyMicrolearningAnswer;
8
use LeadersLinked\Model\CompanyMicrolearningAnswer;
-
 
9
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
-
 
10
use Laminas\Db\ResultSet\HydratingResultSet;
-
 
11
use Laminas\Paginator\Adapter\DbSelect;
Línea 9... Línea 12...
9
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
12
use Laminas\Paginator\Paginator;
10
 
13
 
11
 
14
 
Línea 87... Línea 90...
87
        
90
        
88
        return $this->executeFetchAllObject($select, $prototype);
91
        return $this->executeFetchAllObject($select, $prototype);
Línea 89... Línea 92...
89
    }
92
    }
-
 
93
    
-
 
94
    /**
-
 
95
     *
-
 
96
     * @param int $companyId
-
 
97
     * @param int $quizId
-
 
98
     * @param int $questionId
-
 
99
     * @param string $search
-
 
100
     * @param int $page
-
 
101
     * @param int $records_per_page
-
 
102
     * @param string $order_field
-
 
103
     * @param string $order_direction
-
 
104
     * @return Paginator
-
 
105
     *
-
 
106
     */
-
 
107
    public function fetchAllDataTableByCompanyIdAndQuizId($companyId, $quizId, $questionId, $search, $page = 1, $records_per_page = 10, $order_field= 'text', $order_direction = 'ASC')
-
 
108
    {
-
 
109
        $prototype = new CompanyMicrolearningAnswer();
-
 
110
        
-
 
111
        $select = $this->sql->select(self::_TABLE);
-
 
112
        $select->where->equalTo('company_id', $companyId);
-
 
113
        $select->where->equalTo('quiz_id', $quizId);
-
 
114
        $select->where->equalTo('question_id', $questionId);
-
 
115
        
-
 
116
        
-
 
117
        if($search) {
-
 
118
            $select->where->like('text', '%' . $search . '%');
-
 
119
        }
-
 
120
        $select->order($order_field . ' ' . $order_direction);
-
 
121
        
-
 
122
        //echo $select->getSqlString($this->adapter->platform); exit;
-
 
123
        
-
 
124
        $hydrator   = new ObjectPropertyHydrator();
-
 
125
        $resultset  = new HydratingResultSet($hydrator, $prototype);
-
 
126
        
-
 
127
        $adapter = new DbSelect($select, $this->sql, $resultset);
-
 
128
        $paginator = new Paginator($adapter);
-
 
129
        $paginator->setItemCountPerPage($records_per_page);
-
 
130
        $paginator->setCurrentPageNumber($page);
-
 
131
        
-
 
132
        
-
 
133
        return $paginator;
-
 
134
    }
90
    
135
    
91
    /**
136
    /**
92
     * 
137
     * 
93
     * @param CompanyMicrolearningAnswer $answer
138
     * @param CompanyMicrolearningAnswer $answer
94
     * @return boolean
139
     * @return boolean