@@ -71,10 +71,7 @@ public function addOrder(Order ...$orders) {
71
71
* @deprecated Use #setColumns() instead
72
72
*/
73
73
public function setProjection (Expression ...$ components ) {
74
- $ this ->projections = array ();
75
- $ this ->_addColumns ($ components );
76
- $ this ->resultClassName = NULL ;
77
- return $ this ;
74
+ return call_user_func_array (array ($ this , 'setColumns ' ), $ components );
78
75
}
79
76
80
77
/**
@@ -83,30 +80,17 @@ public function setProjection(Expression ...$components) {
83
80
*/
84
81
public function setColumns (Expression ...$ components ) {
85
82
$ this ->projections = array ();
86
- $ this ->_addColumns ($ components );
87
- $ this ->resultClassName = NULL ;
88
- return $ this ;
83
+ return call_user_func_array (array ($ this , 'addColumns ' ), $ components );
89
84
}
90
85
91
86
/**
92
87
* Add select columns for the query.
93
88
*/
94
89
public function addColumns (Expression ...$ components ) {
95
- $ this ->_addColumns ($ components );
96
- return $ this ;
97
- }
98
-
99
- /**
100
- * Internal function to flatten array structure.
101
- */
102
- protected function _addColumns ($ components ) {
103
- if (is_array ($ components )) {
104
- foreach ($ components AS $ c ) {
105
- $ this ->_addColumns ($ c );
106
- }
107
- } else {
108
- if ($ components != NULL ) $ this ->projections [] = $ components ;
90
+ foreach ($ components AS $ c ) {
91
+ if ($ c != NULL ) $ this ->projections [] = $ c ;
109
92
}
93
+ return $ this ;
110
94
}
111
95
112
96
/**
0 commit comments