Skip to content

Commit 71d0695

Browse files
author
Muhammad Usman
committed
Merge branch 'master' of github.com:usmanhalalit/pixie
2 parents 9b645fe + b95182a commit 71d0695

4 files changed

Lines changed: 4 additions & 6 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ QB::table('my_table')
317317

318318
### Group By and Order By
319319
```PHP
320-
$query = QB::table('my_table')->groupBy('age')->orderBy('created_at');
320+
$query = QB::table('my_table')->groupBy('age')->orderBy('created_at', 'ASC');
321321
```
322322

323323
#### Multiple Group By

src/Pixie/QueryBuilder/Adapters/BaseAdapter.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@ protected function buildCriteria($statements, $bindValues = true)
364364
$criteria = '';
365365
$bindings = array();
366366
foreach ($statements as $statement) {
367-
368367
$key = $this->wrapSanitizer($statement['key']);
369368
$value = $statement['value'];
370369

@@ -408,7 +407,7 @@ protected function buildCriteria($statements, $bindValues = true)
408407
break;
409408
}
410409
} elseif ($value instanceof Raw) {
411-
$criteria .= "{$statement['joiner']} {$key} {$statement['operator']} $value";
410+
$criteria .= "{$statement['joiner']} {$key} {$statement['operator']} $value ";
412411
} else {
413412
// Usual where like criteria
414413

src/Pixie/QueryBuilder/QueryBuilderHandler.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ private function doInsert($data, $type)
320320
// If first value is not an array
321321
// Its not a batch insert
322322
if (!is_array(current($data))) {
323-
324323
$queryObject = $this->getQuery($type, $data);
325324

326325
list($result, $executionTime) = $this->statement($queryObject->getSql(), $queryObject->getBindings());
@@ -331,7 +330,6 @@ private function doInsert($data, $type)
331330
$return = array();
332331
$executionTime = 0;
333332
foreach ($data as $subData) {
334-
335333
$queryObject = $this->getQuery($type, $subData);
336334

337335
list($result, $time) = $this->statement($queryObject->getSql(), $queryObject->getBindings());

tests/Pixie/QueryBuilderBehaviorTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,12 @@ public function testSelectQueryWithNestedCriteriaAndJoins()
126126
->leftJoin(array('person_details', 'b'), function($table) use ($builder)
127127
{
128128
$table->on('b.person_id', '=', 'my_table.id');
129+
$table->on('b.deleted', '=', $builder->raw(0));
129130
$table->orOn('b.age', '>', $builder->raw(1));
130131
})
131132
;
132133

133-
$this->assertEquals("SELECT * FROM `cb_my_table` INNER JOIN `cb_person_details` AS `cb_a` ON `cb_a`.`person_id` = `cb_my_table`.`id` LEFT JOIN `cb_person_details` AS `cb_b` ON `cb_b`.`person_id` = `cb_my_table`.`id` OR `cb_b`.`age` > 1 WHERE `cb_my_table`.`id` > 1 OR `cb_my_table`.`id` = 1 AND (`value` LIKE '%sana%' OR (`key` LIKE '%sana%' OR `value` LIKE '%sana%'))"
134+
$this->assertEquals("SELECT * FROM `cb_my_table` INNER JOIN `cb_person_details` AS `cb_a` ON `cb_a`.`person_id` = `cb_my_table`.`id` LEFT JOIN `cb_person_details` AS `cb_b` ON `cb_b`.`person_id` = `cb_my_table`.`id` AND `cb_b`.`deleted` = 0 OR `cb_b`.`age` > 1 WHERE `cb_my_table`.`id` > 1 OR `cb_my_table`.`id` = 1 AND (`value` LIKE '%sana%' OR (`key` LIKE '%sana%' OR `value` LIKE '%sana%'))"
134135
, $query->getQuery()->getRawSql());
135136
}
136137

0 commit comments

Comments
 (0)