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 {
1818 use LimitBuilder;
1919 use OffsetBuilder;
2020
21- /**
22- * @var string[]
23- */
21+ /** @var string[] */
2422 private $ aliases = array ();
2523
2624 /**
@@ -31,9 +29,7 @@ class Delete extends Statement {
3129 * @return $this
3230 */
3331 public function from ($ alias , $ table = null ) {
34- if ($ table === null ) {
35- list ($ alias , $ table ) = [$ table , $ alias ];
36- } else {
32+ if ($ table !== null ) {
3733 $ this ->aliases [] = $ alias ;
3834 }
3935 $ this ->addTable ($ alias , $ table );
Original file line number Diff line number Diff line change 1313
1414class Select extends Statement {
1515 use TableNameBuilder;
16- use TableBuilder {
17- addTable as addFrom;
18- }
16+ use TableBuilder;
1917 use JoinBuilder;
2018 use WhereBuilder;
2119 use HavingBuilder;
@@ -79,16 +77,6 @@ public function getFields() {
7977 return $ this ->fields ;
8078 }
8179
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-
9280 /**
9381 * @param bool $enabled
9482 * @return $this
@@ -118,6 +106,16 @@ public function setCalcFoundRows($calcFoundRows = true) {
118106 return $ this ;
119107 }
120108
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+
121119 /**
122120 * @return string
123121 */
Original file line number Diff line number Diff line change @@ -14,7 +14,10 @@ trait TableBuilder {
1414 * @param string $table
1515 * @return $this
1616 */
17- public function addTable ($ alias , $ table ) {
17+ protected function addTable ($ alias , $ table = null ) {
18+ if ($ table === null ) {
19+ list ($ alias , $ table ) = [$ table , $ alias ];
20+ }
1821 $ this ->tables [] = array ('alias ' => $ alias , 'name ' => $ table );
1922 return $ this ;
2023 }
Original file line number Diff line number Diff line change @@ -30,9 +30,6 @@ class Update extends InsertUpdateStatement {
3030 * @return $this
3131 */
3232 public function table ($ alias , $ table = null ) {
33- if ($ table === null ) {
34- list ($ alias , $ table ) = [$ table , $ alias ];
35- }
3633 $ this ->addTable ($ alias , $ table );
3734 return $ this ;
3835 }
You can’t perform that action at this time.
0 commit comments