TreeWalkerAdapter.php 13 KB

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