TreeWalkerAdapter.php 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. <?php
  2. /*
  3. * $Id$
  4. *
  5. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  6. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  7. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  8. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  9. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  10. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  11. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  12. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  13. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  14. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  15. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  16. *
  17. * This software consists of voluntary contributions made by many individuals
  18. * and is licensed under the LGPL. For more information, see
  19. * <http://www.doctrine-project.org>.
  20. */
  21. namespace Doctrine\ORM\Query;
  22. /**
  23. * An adapter implementation of the TreeWalker interface. The methods in this class
  24. * are empty. This class exists as convenience for creating tree walkers.
  25. *
  26. * @author Roman Borschel <roman@code-factory.org>
  27. * @since 2.0
  28. */
  29. abstract class TreeWalkerAdapter implements TreeWalker
  30. {
  31. private $_query;
  32. private $_parserResult;
  33. private $_queryComponents;
  34. /**
  35. * {@inheritdoc}
  36. */
  37. public function __construct($query, $parserResult, array $queryComponents)
  38. {
  39. $this->_query = $query;
  40. $this->_parserResult = $parserResult;
  41. $this->_queryComponents = $queryComponents;
  42. }
  43. /**
  44. * @return array
  45. */
  46. protected function _getQueryComponents()
  47. {
  48. return $this->_queryComponents;
  49. }
  50. /**
  51. * Retrieve Query Instance reponsible for the current walkers execution.
  52. *
  53. * @return Doctrine\ORM\Query
  54. */
  55. protected function _getQuery()
  56. {
  57. return $this->_query;
  58. }
  59. /**
  60. * Retrieve ParserResult
  61. *
  62. * @return Doctrine\ORM\Query\ParserResult
  63. */
  64. protected function _getParserResult()
  65. {
  66. return $this->_parserResult;
  67. }
  68. /**
  69. * Walks down a SelectStatement AST node, thereby generating the appropriate SQL.
  70. *
  71. * @return string The SQL.
  72. */
  73. public function walkSelectStatement(AST\SelectStatement $AST) {}
  74. /**
  75. * Walks down a SelectClause AST node, thereby generating the appropriate SQL.
  76. *
  77. * @return string The SQL.
  78. */
  79. public function walkSelectClause($selectClause) {}
  80. /**
  81. * Walks down a FromClause AST node, thereby generating the appropriate SQL.
  82. *
  83. * @return string The SQL.
  84. */
  85. public function walkFromClause($fromClause) {}
  86. /**
  87. * Walks down a FunctionNode AST node, thereby generating the appropriate SQL.
  88. *
  89. * @return string The SQL.
  90. */
  91. public function walkFunction($function) {}
  92. /**
  93. * Walks down an OrderByClause AST node, thereby generating the appropriate SQL.
  94. *
  95. * @param OrderByClause
  96. * @return string The SQL.
  97. */
  98. public function walkOrderByClause($orderByClause) {}
  99. /**
  100. * Walks down an OrderByItem AST node, thereby generating the appropriate SQL.
  101. *
  102. * @param OrderByItem
  103. * @return string The SQL.
  104. */
  105. public function walkOrderByItem($orderByItem) {}
  106. /**
  107. * Walks down a HavingClause AST node, thereby generating the appropriate SQL.
  108. *
  109. * @param HavingClause
  110. * @return string The SQL.
  111. */
  112. public function walkHavingClause($havingClause) {}
  113. /**
  114. * Walks down a JoinVariableDeclaration AST node and creates the corresponding SQL.
  115. *
  116. * @param JoinVariableDeclaration $joinVarDecl
  117. * @return string The SQL.
  118. */
  119. public function walkJoinVariableDeclaration($joinVarDecl) {}
  120. /**
  121. * Walks down a SelectExpression AST node and generates the corresponding SQL.
  122. *
  123. * @param SelectExpression $selectExpression
  124. * @return string The SQL.
  125. */
  126. public function walkSelectExpression($selectExpression) {}
  127. /**
  128. * Walks down a QuantifiedExpression AST node, thereby generating the appropriate SQL.
  129. *
  130. * @param QuantifiedExpression
  131. * @return string The SQL.
  132. */
  133. public function walkQuantifiedExpression($qExpr) {}
  134. /**
  135. * Walks down a Subselect AST node, thereby generating the appropriate SQL.
  136. *
  137. * @param Subselect
  138. * @return string The SQL.
  139. */
  140. public function walkSubselect($subselect) {}
  141. /**
  142. * Walks down a SubselectFromClause AST node, thereby generating the appropriate SQL.
  143. *
  144. * @param SubselectFromClause
  145. * @return string The SQL.
  146. */
  147. public function walkSubselectFromClause($subselectFromClause) {}
  148. /**
  149. * Walks down a SimpleSelectClause AST node, thereby generating the appropriate SQL.
  150. *
  151. * @param SimpleSelectClause
  152. * @return string The SQL.
  153. */
  154. public function walkSimpleSelectClause($simpleSelectClause) {}
  155. /**
  156. * Walks down a SimpleSelectExpression AST node, thereby generating the appropriate SQL.
  157. *
  158. * @param SimpleSelectExpression
  159. * @return string The SQL.
  160. */
  161. public function walkSimpleSelectExpression($simpleSelectExpression) {}
  162. /**
  163. * Walks down an AggregateExpression AST node, thereby generating the appropriate SQL.
  164. *
  165. * @param AggregateExpression
  166. * @return string The SQL.
  167. */
  168. public function walkAggregateExpression($aggExpression) {}
  169. /**
  170. * Walks down a GroupByClause AST node, thereby generating the appropriate SQL.
  171. *
  172. * @param GroupByClause
  173. * @return string The SQL.
  174. */
  175. public function walkGroupByClause($groupByClause) {}
  176. /**
  177. * Walks down a GroupByItem AST node, thereby generating the appropriate SQL.
  178. *
  179. * @param GroupByItem
  180. * @return string The SQL.
  181. */
  182. public function walkGroupByItem(AST\PathExpression $pathExpr) {}
  183. /**
  184. * Walks down an UpdateStatement AST node, thereby generating the appropriate SQL.
  185. *
  186. * @param UpdateStatement
  187. * @return string The SQL.
  188. */
  189. public function walkUpdateStatement(AST\UpdateStatement $AST) {}
  190. /**
  191. * Walks down a DeleteStatement AST node, thereby generating the appropriate SQL.
  192. *
  193. * @param DeleteStatement
  194. * @return string The SQL.
  195. */
  196. public function walkDeleteStatement(AST\DeleteStatement $AST) {}
  197. /**
  198. * Walks down a DeleteClause AST node, thereby generating the appropriate SQL.
  199. *
  200. * @param DeleteClause
  201. * @return string The SQL.
  202. */
  203. public function walkDeleteClause(AST\DeleteClause $deleteClause) {}
  204. /**
  205. * Walks down an UpdateClause AST node, thereby generating the appropriate SQL.
  206. *
  207. * @param UpdateClause
  208. * @return string The SQL.
  209. */
  210. public function walkUpdateClause($updateClause) {}
  211. /**
  212. * Walks down an UpdateItem AST node, thereby generating the appropriate SQL.
  213. *
  214. * @param UpdateItem
  215. * @return string The SQL.
  216. */
  217. public function walkUpdateItem($updateItem) {}
  218. /**
  219. * Walks down a WhereClause AST node, thereby generating the appropriate SQL.
  220. *
  221. * @param WhereClause
  222. * @return string The SQL.
  223. */
  224. public function walkWhereClause($whereClause) {}
  225. /**
  226. * Walks down a ConditionalExpression AST node, thereby generating the appropriate SQL.
  227. *
  228. * @param ConditionalExpression
  229. * @return string The SQL.
  230. */
  231. public function walkConditionalExpression($condExpr) {}
  232. /**
  233. * Walks down a ConditionalTerm AST node, thereby generating the appropriate SQL.
  234. *
  235. * @param ConditionalTerm
  236. * @return string The SQL.
  237. */
  238. public function walkConditionalTerm($condTerm) {}
  239. /**
  240. * Walks down a ConditionalFactor AST node, thereby generating the appropriate SQL.
  241. *
  242. * @param ConditionalFactor
  243. * @return string The SQL.
  244. */
  245. public function walkConditionalFactor($factor) {}
  246. /**
  247. * Walks down a ConditionalPrimary AST node, thereby generating the appropriate SQL.
  248. *
  249. * @param ConditionalPrimary
  250. * @return string The SQL.
  251. */
  252. public function walkConditionalPrimary($primary) {}
  253. /**
  254. * Walks down an ExistsExpression AST node, thereby generating the appropriate SQL.
  255. *
  256. * @param ExistsExpression
  257. * @return string The SQL.
  258. */
  259. public function walkExistsExpression($existsExpr) {}
  260. /**
  261. * Walks down a CollectionMemberExpression AST node, thereby generating the appropriate SQL.
  262. *
  263. * @param CollectionMemberExpression
  264. * @return string The SQL.
  265. */
  266. public function walkCollectionMemberExpression($collMemberExpr) {}
  267. /**
  268. * Walks down an EmptyCollectionComparisonExpression AST node, thereby generating the appropriate SQL.
  269. *
  270. * @param EmptyCollectionComparisonExpression
  271. * @return string The SQL.
  272. */
  273. public function walkEmptyCollectionComparisonExpression($emptyCollCompExpr) {}
  274. /**
  275. * Walks down a NullComparisonExpression AST node, thereby generating the appropriate SQL.
  276. *
  277. * @param NullComparisonExpression
  278. * @return string The SQL.
  279. */
  280. public function walkNullComparisonExpression($nullCompExpr) {}
  281. /**
  282. * Walks down an InExpression AST node, thereby generating the appropriate SQL.
  283. *
  284. * @param InExpression
  285. * @return string The SQL.
  286. */
  287. public function walkInExpression($inExpr) {}
  288. /**
  289. * Walks down an InstanceOfExpression AST node, thereby generating the appropriate SQL.
  290. *
  291. * @param InstanceOfExpression
  292. * @return string The SQL.
  293. */
  294. function walkInstanceOfExpression($instanceOfExpr) {}
  295. /**
  296. * Walks down a literal that represents an AST node, thereby generating the appropriate SQL.
  297. *
  298. * @param mixed
  299. * @return string The SQL.
  300. */
  301. public function walkLiteral($literal) {}
  302. /**
  303. * Walks down a BetweenExpression AST node, thereby generating the appropriate SQL.
  304. *
  305. * @param BetweenExpression
  306. * @return string The SQL.
  307. */
  308. public function walkBetweenExpression($betweenExpr) {}
  309. /**
  310. * Walks down a LikeExpression AST node, thereby generating the appropriate SQL.
  311. *
  312. * @param LikeExpression
  313. * @return string The SQL.
  314. */
  315. public function walkLikeExpression($likeExpr) {}
  316. /**
  317. * Walks down a StateFieldPathExpression AST node, thereby generating the appropriate SQL.
  318. *
  319. * @param StateFieldPathExpression
  320. * @return string The SQL.
  321. */
  322. public function walkStateFieldPathExpression($stateFieldPathExpression) {}
  323. /**
  324. * Walks down a ComparisonExpression AST node, thereby generating the appropriate SQL.
  325. *
  326. * @param ComparisonExpression
  327. * @return string The SQL.
  328. */
  329. public function walkComparisonExpression($compExpr) {}
  330. /**
  331. * Walks down an InputParameter AST node, thereby generating the appropriate SQL.
  332. *
  333. * @param InputParameter
  334. * @return string The SQL.
  335. */
  336. public function walkInputParameter($inputParam) {}
  337. /**
  338. * Walks down an ArithmeticExpression AST node, thereby generating the appropriate SQL.
  339. *
  340. * @param ArithmeticExpression
  341. * @return string The SQL.
  342. */
  343. public function walkArithmeticExpression($arithmeticExpr) {}
  344. /**
  345. * Walks down an ArithmeticTerm AST node, thereby generating the appropriate SQL.
  346. *
  347. * @param mixed
  348. * @return string The SQL.
  349. */
  350. public function walkArithmeticTerm($term) {}
  351. /**
  352. * Walks down a StringPrimary that represents an AST node, thereby generating the appropriate SQL.
  353. *
  354. * @param mixed
  355. * @return string The SQL.
  356. */
  357. public function walkStringPrimary($stringPrimary) {}
  358. /**
  359. * Walks down an ArithmeticFactor that represents an AST node, thereby generating the appropriate SQL.
  360. *
  361. * @param mixed
  362. * @return string The SQL.
  363. */
  364. public function walkArithmeticFactor($factor) {}
  365. /**
  366. * Walks down an SimpleArithmeticExpression AST node, thereby generating the appropriate SQL.
  367. *
  368. * @param SimpleArithmeticExpression
  369. * @return string The SQL.
  370. */
  371. public function walkSimpleArithmeticExpression($simpleArithmeticExpr) {}
  372. /**
  373. * Walks down an PathExpression AST node, thereby generating the appropriate SQL.
  374. *
  375. * @param mixed
  376. * @return string The SQL.
  377. */
  378. public function walkPathExpression($pathExpr) {}
  379. /**
  380. * Gets an executor that can be used to execute the result of this walker.
  381. *
  382. * @return AbstractExecutor
  383. */
  384. public function getExecutor($AST) {}
  385. }