1 | <?php |
||
31 | class QueryBuilder extends \Doctrine\DBAL\Query\QueryBuilder |
||
32 | { |
||
33 | |||
34 | /** |
||
35 | * @var Connection DBAL Connection |
||
36 | */ |
||
37 | private $connection = null; |
||
38 | |||
39 | /** |
||
40 | * __construct |
||
41 | */ |
||
42 | 90 | public function __construct(Connection $connection) |
|
47 | |||
48 | /** |
||
49 | * Turns the query being built into a bulk delete query that ranges over |
||
50 | * a certain table. |
||
51 | * |
||
52 | * <code> |
||
53 | * $qb = $conn->createQueryBuilder() |
||
54 | * ->delete('users', 'u') |
||
55 | * ->where('u.id = :user_id'); |
||
56 | * ->setParameter(':user_id', 1); |
||
57 | * </code> |
||
58 | * |
||
59 | * @param string $delete The table whose rows are subject to the deletion. |
||
60 | * Adds table prefix to table. |
||
61 | * @param string $alias The table alias used in the constructed query. |
||
62 | * |
||
63 | * @return QueryBuilder This QueryBuilder instance. |
||
64 | */ |
||
65 | 2 | public function deletePrefix($delete = null, $alias = null) |
|
70 | |||
71 | /** |
||
72 | * Turns the query being built into a bulk update query that ranges over |
||
73 | * a certain table |
||
74 | * |
||
75 | * <code> |
||
76 | * $qb = $conn->createQueryBuilder() |
||
77 | * ->update('users', 'u') |
||
78 | * ->set('u.password', md5('password')) |
||
79 | * ->where('u.id = ?'); |
||
80 | * </code> |
||
81 | * |
||
82 | * @param string $update The table whose rows are subject to the update. |
||
83 | * Adds table prefix to table. |
||
84 | * @param string $alias The table alias used in the constructed query. |
||
85 | * |
||
86 | * @return QueryBuilder This QueryBuilder instance. |
||
87 | */ |
||
88 | public function updatePrefix($update = null, $alias = null) |
||
93 | |||
94 | /** |
||
95 | * Turns the query being built into an insert query that inserts into |
||
96 | * a certain table |
||
97 | * |
||
98 | * <code> |
||
99 | * $qb = $conn->createQueryBuilder() |
||
100 | * ->insert('users') |
||
101 | * ->values( |
||
102 | * array( |
||
103 | * 'name' => '?', |
||
104 | * 'password' => '?' |
||
105 | * ) |
||
106 | * ); |
||
107 | * </code> |
||
108 | * |
||
109 | * @param string $insert The table into which the rows should be inserted. |
||
110 | * Adds table prefix to table. |
||
111 | * |
||
112 | * @return QueryBuilder This QueryBuilder instance. |
||
113 | */ |
||
114 | public function insertPrefix($insert = null) |
||
119 | |||
120 | /** |
||
121 | * Create and add a query root corresponding to the table identified by the |
||
122 | * given alias, forming a cartesian product with any existing query roots. |
||
123 | * |
||
124 | * <code> |
||
125 | * $qb = $conn->createQueryBuilder() |
||
126 | * ->select('u.id') |
||
127 | * ->from('users', 'u') |
||
128 | * </code> |
||
129 | * |
||
130 | * @param string $from The table. Adds table prefix to table. |
||
131 | * @param string|null $alias The alias of the table. |
||
132 | * |
||
133 | * @return QueryBuilder This QueryBuilder instance. |
||
134 | */ |
||
135 | 31 | public function fromPrefix($from, $alias = null) |
|
140 | |||
141 | /** |
||
142 | * Creates and adds a join to the query. |
||
143 | * |
||
144 | * <code> |
||
145 | * $qb = $conn->createQueryBuilder() |
||
146 | * ->select('u.name') |
||
147 | * ->from('users', 'u') |
||
148 | * ->join('u', 'phonenumbers', 'p', 'p.is_primary = 1'); |
||
149 | * </code> |
||
150 | * |
||
151 | * @param string $fromAlias The alias that points to a from clause |
||
152 | * @param string $join The table name to join. Adds table prefix to table. |
||
153 | * @param string $alias The alias of the join table |
||
154 | * @param string $condition The condition for the join |
||
155 | * |
||
156 | * @return QueryBuilder This QueryBuilder instance. |
||
157 | */ |
||
158 | public function joinPrefix($fromAlias, $join, $alias, $condition = null) |
||
163 | |||
164 | |||
165 | /** |
||
166 | * Creates and adds a join to the query. |
||
167 | * |
||
168 | * <code> |
||
169 | * $qb = $conn->createQueryBuilder() |
||
170 | * ->select('u.name') |
||
171 | * ->from('users', 'u') |
||
172 | * ->innerJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1'); |
||
173 | * </code> |
||
174 | * |
||
175 | * @param string $fromAlias The alias that points to a from clause |
||
176 | * @param string $join The table name to join. Adds table prefix to table. |
||
177 | * @param string $alias The alias of the join table |
||
178 | * @param string $condition The condition for the join |
||
179 | * |
||
180 | * @return QueryBuilder This QueryBuilder instance. |
||
181 | */ |
||
182 | public function innerJoinPrefix($fromAlias, $join, $alias, $condition = null) |
||
187 | |||
188 | /** |
||
189 | * Creates and adds a left join to the query. |
||
190 | * |
||
191 | * <code> |
||
192 | * $qb = $conn->createQueryBuilder() |
||
193 | * ->select('u.name') |
||
194 | * ->from('users', 'u') |
||
195 | * ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1'); |
||
196 | * </code> |
||
197 | * |
||
198 | * @param string $fromAlias The alias that points to a from clause |
||
199 | * @param string $join The table name to join. Adds table prefix to table. |
||
200 | * @param string $alias The alias of the join table |
||
201 | * @param string $condition The condition for the join |
||
202 | * |
||
203 | * @return QueryBuilder This QueryBuilder instance. |
||
204 | */ |
||
205 | 5 | public function leftJoinPrefix($fromAlias, $join, $alias, $condition = null) |
|
210 | |||
211 | /** |
||
212 | * Creates and adds a right join to the query. |
||
213 | * |
||
214 | * <code> |
||
215 | * $qb = $conn->createQueryBuilder() |
||
216 | * ->select('u.name') |
||
217 | * ->from('users', 'u') |
||
218 | * ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1'); |
||
219 | * </code> |
||
220 | * |
||
221 | * @param string $fromAlias The alias that points to a from clause |
||
222 | * @param string $join The table name to join. Adds table prefix to table. |
||
223 | * @param string $alias The alias of the join table |
||
224 | * @param string $condition The condition for the join |
||
225 | * |
||
226 | * @return QueryBuilder This QueryBuilder instance. |
||
227 | */ |
||
228 | public function rightJoinPrefix($fromAlias, $join, $alias, $condition = null) |
||
233 | } |
||
234 |