Skip to content

Commit 4af06d2

Browse files
committed
Remove not used type arg from GROUP BY
It should not be there since beginning. Issue #154 Signed-off-by: Michal Čihař <[email protected]>
1 parent f18666a commit 4af06d2

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

src/Components/GroupKeyword.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,20 @@
2121
class GroupKeyword extends Component
2222
{
2323
/**
24-
* The expression that is used for ordering.
24+
* The expression that is used for grouping.
2525
*
2626
* @var Expression
2727
*/
2828
public $expr;
29-
30-
/**
31-
* The order type.
32-
*
33-
* @var string
34-
*/
35-
public $type;
3629

3730
/**
3831
* Constructor.
3932
*
4033
* @param Expression $expr the expression that we are sorting by
41-
* @param string $type the sorting type
4234
*/
43-
public function __construct($expr = null, $type = '')
35+
public function __construct($expr = null)
4436
{
4537
$this->expr = $expr;
46-
$this->type = $type;
4738
}
4839

4940
/**
@@ -135,7 +126,7 @@ public static function build($component, array $options = array())
135126
return implode(', ', $component);
136127
}
137128

138-
return trim($component->expr . ' ' . $component->type);
129+
return trim($component->expr);
139130

140131
}
141132
}

tests/Builder/SelectStatementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function testBuilderAlias()
4646
$this->assertEquals(
4747
'SELECT sgu.id, sgu.email_address FROM `sf_guard_user` AS `sgu` '
4848
. 'RIGHT JOIN `student_course_booking` AS `scb` ON sgu.id = scb.user_id '
49-
. 'WHERE `has_found_course` = \'1\' GROUP BY sgu.id ASC '
49+
. 'WHERE `has_found_course` = \'1\' GROUP BY sgu.id '
5050
. 'ORDER BY scb.id DESC LIMIT 0, 300 ',
5151
$stmt->build()
5252
);

tests/Components/GroupKeywordTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ public function testBuild()
1313
$this->assertEquals(
1414
GroupKeyword::build(
1515
array(
16-
new GroupKeyword(new Expression('a'), 'ASC'),
17-
new GroupKeyword(new Expression('b'), 'DESC'),
16+
new GroupKeyword(new Expression('a')),
17+
new GroupKeyword(new Expression('b')),
1818
new GroupKeyword(new Expression('c')),
1919
)
2020
),
21-
'a ASC, b DESC, c'
21+
'a, b, c'
2222
);
2323
}
2424
}

0 commit comments

Comments
 (0)