1 <?php
2
3 namespace PLus\Orders\Repositories\Lists;
4
5
6 7 8 9 10
11 class JustifyRepository extends \PLus\Orders\Repositories\Repository {
12
13
14 15 16 17 18
19 function getPairDataNotOne(){
20 return $this->getTable()->select('id, text')->where('id !=', 1)->where('valid', 1)->order('text ASC')->fetchPairs('id', 'text');
21 }
22
23 24 25 26 27
28 function getPairDataOne(){
29 return $this->getTable()->select('id, text')->where('id', 1)->order('text ASC')->fetchPairs('id', 'text');
30 }
31
32 33 34 35 36
37 function getGridSelection(){
38 return $this->connection->query('(SELECT 1 AS sort_col, id, text, valid FROM justify WHERE id != 1) UNION (SELECT 2, id, text, valid FROM justify WHERE id = 1) '
39 . 'ORDER BY sort_col,text')->fetchAll();
40 }
41
42
43 44 45 46 47 48
49 function getCheckRecord($id) {
50 return $this->getTable()->select('id,valid')->where('id', $id)->fetch();
51 }
52
53
54 }
55