File tree Expand file tree Collapse file tree 4 files changed +17
-23
lines changed Expand file tree Collapse file tree 4 files changed +17
-23
lines changed Original file line number Diff line number Diff line change @@ -18,9 +18,7 @@ class Delete extends Statement {
18
18
use LimitBuilder;
19
19
use OffsetBuilder;
20
20
21
- /**
22
- * @var string[]
23
- */
21
+ /** @var string[] */
24
22
private $ aliases = array ();
25
23
26
24
/**
@@ -31,9 +29,7 @@ class Delete extends Statement {
31
29
* @return $this
32
30
*/
33
31
public function from ($ alias , $ table = null ) {
34
- if ($ table === null ) {
35
- list ($ alias , $ table ) = [$ table , $ alias ];
36
- } else {
32
+ if ($ table !== null ) {
37
33
$ this ->aliases [] = $ alias ;
38
34
}
39
35
$ this ->addTable ($ alias , $ table );
Original file line number Diff line number Diff line change 13
13
14
14
class Select extends Statement {
15
15
use TableNameBuilder;
16
- use TableBuilder {
17
- addTable as addFrom;
18
- }
16
+ use TableBuilder;
19
17
use JoinBuilder;
20
18
use WhereBuilder;
21
19
use HavingBuilder;
@@ -79,16 +77,6 @@ public function getFields() {
79
77
return $ this ->fields ;
80
78
}
81
79
82
- /**
83
- * @param string $alias
84
- * @param string $table
85
- * @return $this
86
- */
87
- public function from ($ alias , $ table ) {
88
- $ this ->addFrom ($ alias , $ table );
89
- return $ this ;
90
- }
91
-
92
80
/**
93
81
* @param bool $enabled
94
82
* @return $this
@@ -118,6 +106,16 @@ public function setCalcFoundRows($calcFoundRows = true) {
118
106
return $ this ;
119
107
}
120
108
109
+ /**
110
+ * @param string $alias
111
+ * @param string $tableName
112
+ * @return $this
113
+ */
114
+ public function from ($ alias , $ tableName = null ) {
115
+ $ this ->addTable ($ alias , $ tableName );
116
+ return $ this ;
117
+ }
118
+
121
119
/**
122
120
* @return string
123
121
*/
Original file line number Diff line number Diff line change @@ -14,7 +14,10 @@ trait TableBuilder {
14
14
* @param string $table
15
15
* @return $this
16
16
*/
17
- public function addTable ($ alias , $ table ) {
17
+ protected function addTable ($ alias , $ table = null ) {
18
+ if ($ table === null ) {
19
+ list ($ alias , $ table ) = [$ table , $ alias ];
20
+ }
18
21
$ this ->tables [] = array ('alias ' => $ alias , 'name ' => $ table );
19
22
return $ this ;
20
23
}
Original file line number Diff line number Diff line change @@ -30,9 +30,6 @@ class Update extends InsertUpdateStatement {
30
30
* @return $this
31
31
*/
32
32
public function table ($ alias , $ table = null ) {
33
- if ($ table === null ) {
34
- list ($ alias , $ table ) = [$ table , $ alias ];
35
- }
36
33
$ this ->addTable ($ alias , $ table );
37
34
return $ this ;
38
35
}
You can’t perform that action at this time.
0 commit comments