From 4b2fc1d174c54f9e435c46ce8e3ceaafd11995c4 Mon Sep 17 00:00:00 2001 From: prasad83 Date: Wed, 21 Jun 2017 17:47:15 +0530 Subject: [PATCH 1/2] Accept Column object through setColumns. Select->setColumns was limited to accept string... having it accept Column type object extends ability to add complex functions or manipulations. --- src/Syntax/SyntaxFactory.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Syntax/SyntaxFactory.php b/src/Syntax/SyntaxFactory.php index 80294e3..821ae87 100644 --- a/src/Syntax/SyntaxFactory.php +++ b/src/Syntax/SyntaxFactory.php @@ -35,6 +35,8 @@ public static function createColumns(array &$arguments, $table = null) $column->setAlias($index); } + $createdColumns[] = $column; + } else if ($column instanceof Column) { $createdColumns[] = $column; } } From 13fd053017c8db2fdcfbdd199151f5f1115b46ca Mon Sep 17 00:00:00 2001 From: prasad83 Date: Wed, 21 Jun 2017 18:40:34 +0530 Subject: [PATCH 2/2] Support for specifying column in condition. Nice to have ability to passing on instance of Column as part of condition. Helpful to build complex query. Example: ``` where()->equals( new Column("aCol", "tmpTable"), 1); ``` --- src/Syntax/Where.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Syntax/Where.php b/src/Syntax/Where.php index 0897dbe..7e9b883 100644 --- a/src/Syntax/Where.php +++ b/src/Syntax/Where.php @@ -267,7 +267,8 @@ public function compare($column, $value, $operator) private function prepareColumn($column) { //This condition handles the "Select as a a column" special case. - if ($column instanceof Select) { + //or when compare column is customized. + if ($column instanceof Select || $column instanceof Column) { return $column; }