@@ 49-71 (lines=23) @@ | ||
46 | } |
|
47 | } |
|
48 | ||
49 | class OrderByRule extends LimitRule |
|
50 | { |
|
51 | public function __construct($context){ |
|
52 | parent::__construct($context); |
|
53 | $this->impl = new OrderByImpl(); |
|
54 | } |
|
55 | /** |
|
56 | * |
|
57 | * orderBy('column') => "ORDER BY column" |
|
58 | * orderBy('column', Sql::ORDER_BY_ASC) => "ORDER BY column ASC" |
|
59 | * orderBy('column0')->orderBy('column1') => "ORDER BY column0, column1" |
|
60 | * orderBy(['column0', 'column1'=>Sql::ORDER_BY_ASC]) => "ORDER BY column0,column1 ASC" |
|
61 | * @param string $column |
|
62 | * @param string $order Sql::ORDER_BY_ASC or Sql::ORDER_BY_DESC |
|
63 | * |
|
64 | * @return \PhpBoot\DB\rules\basic\LimitRule |
|
65 | */ |
|
66 | public function orderBy($column, $order=null) { |
|
67 | $this->impl->orderBy($this->context, $column, $order); |
|
68 | return new LimitRule($this->context); |
|
69 | } |
|
70 | private $impl; |
|
71 | } |
|
72 | ||
73 | class WhereRule extends OrderByRule |
|
74 | { |
@@ 114-148 (lines=35) @@ | ||
111 | } |
|
112 | } |
|
113 | ||
114 | class OrderByRule extends LimitRule |
|
115 | { |
|
116 | public function __construct($context){ |
|
117 | parent::__construct($context); |
|
118 | $this->order = new OrderByImpl(); |
|
119 | } |
|
120 | /** |
|
121 | * orderBy('column') => "ORDER BY column" |
|
122 | * orderBy('column', Sql::ORDER_BY_ASC) => "ORDER BY column ASC" |
|
123 | * orderBy('column0')->orderBy('column1') => "ORDER BY column0, column1" |
|
124 | * |
|
125 | * orderBy(['column0', 'column1'=>Sql::ORDER_BY_ASC]) => "ORDER BY column0,column1 ASC" |
|
126 | * |
|
127 | * @param string $column |
|
128 | * @param string $order Sql::ORDER_BY_ASC or Sql::ORDER_BY_DESC |
|
129 | * @return \PhpBoot\DB\rules\select\OrderByRule |
|
130 | */ |
|
131 | public function orderBy($column, $order=null) { |
|
132 | $this->order->orderBy($this->context, $column, $order); |
|
133 | return $this; |
|
134 | } |
|
135 | // /** |
|
136 | // * orderByArgs(['column0', 'column1'=>Sql::ORDER_BY_ASC]) => "ORDER BY column0,column1 ASC" |
|
137 | // * @param array $args |
|
138 | // * @return \PhpBoot\DB\rules\select\OrderByRule |
|
139 | // */ |
|
140 | // public function orderByArgs($args) { |
|
141 | // $this->order->orderByArgs($this->context, $args); |
|
142 | // return $this; |
|
143 | // } |
|
144 | /** |
|
145 | * @var OrderByImpl |
|
146 | */ |
|
147 | private $order; |
|
148 | } |
|
149 | ||
150 | class HavingRule extends OrderByRule |
|
151 | { |