1 | <?php |
||
23 | class TableCompiler |
||
24 | { |
||
25 | /** |
||
26 | * @var array |
||
27 | */ |
||
28 | private $joinPrefixes; |
||
29 | |||
30 | /** |
||
31 | * TableCompiler constructor. |
||
32 | */ |
||
33 | 9 | public function __construct() |
|
43 | |||
44 | /** |
||
45 | * @param AbstractTable $table |
||
46 | * |
||
47 | * @return string |
||
48 | */ |
||
49 | 9 | public function compileTableDeclaration(AbstractTable $table) |
|
50 | { |
||
51 | 9 | $declaration = ''; |
|
52 | |||
53 | 9 | if ($table->isJoin()) { |
|
54 | 5 | $declaration .= $this->compileJoinName($table) . ' '; |
|
55 | 5 | } |
|
56 | |||
57 | 9 | $declaration .= $table->getTableName(); |
|
58 | |||
59 | 9 | if ($alias = $table->getAlias()) { |
|
60 | $declaration .= ' AS ' . $alias; |
||
61 | } |
||
62 | |||
63 | 9 | if ($joinOn = $table->getJoinOn()) { |
|
64 | $declaration .= ' ON ' . $joinOn; |
||
65 | } |
||
66 | |||
67 | 9 | return $declaration; |
|
68 | } |
||
69 | |||
70 | /** |
||
71 | * @param AbstractTable $table |
||
72 | * |
||
73 | * @return string |
||
74 | */ |
||
75 | 5 | private function compileJoinName(AbstractTable $table) |
|
84 | |||
85 | /** |
||
86 | * @param int $joinType |
||
87 | * |
||
88 | * @return string |
||
89 | */ |
||
90 | 5 | private function compileJoinPrefix($joinType) |
|
98 | |||
99 | /** |
||
100 | * @param int $joinType |
||
101 | * |
||
102 | * @return string |
||
103 | */ |
||
104 | 5 | private function compileJoinSuffix($joinType) |
|
108 | |||
109 | /** |
||
110 | * @param CompilerPayload $payload |
||
111 | * |
||
112 | * @return CompilerPayload |
||
113 | */ |
||
114 | 4 | public function compileRootTables(CompilerPayload $payload) |
|
129 | |||
130 | /** |
||
131 | * @param CompilerPayload $payload |
||
132 | * |
||
133 | * @return CompilerPayload |
||
134 | */ |
||
135 | 4 | public function compileJoinTables(CompilerPayload $payload) |
|
146 | } |