PageRenderTime 46ms CodeModel.GetById 11ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/phalcon/devtools/ide/2.0.2/Phalcon/Mvc/Model/Query/Builder.php

https://gitlab.com/habracoder/advertising
PHP | 446 lines | 55 code | 87 blank | 304 comment | 0 complexity | b8cd0347831bb76cc9e0503c48ab6d47 MD5 | raw file
  1. <?php
  2. namespace Phalcon\Mvc\Model\Query {
  3. /**
  4. * Phalcon\Mvc\Model\Query\Builder
  5. *
  6. * Helps to create PHQL queries using an OO interface
  7. *
  8. *<code>
  9. * $params = array(
  10. * 'models' => array('Users'),
  11. * 'columns' => array('id', 'name', 'status'),
  12. * 'conditions' => array(
  13. * array(
  14. * "created > :min: AND created < :max:",
  15. * array("min" => '2013-01-01', 'max' => '2014-01-01'),
  16. * array("min" => PDO::PARAM_STR, 'max' => PDO::PARAM_STR),
  17. * ),
  18. * ),
  19. * // or 'conditions' => "created > '2013-01-01' AND created < '2014-01-01'",
  20. * 'group' => array('id', 'name'),
  21. * 'having' => "name = 'Kamil'",
  22. * 'order' => array('name', 'id'),
  23. * 'limit' => 20,
  24. * 'offset' => 20,
  25. * // or 'limit' => array(20, 20),
  26. *);
  27. *$queryBuilder = new \Phalcon\Mvc\Model\Query\Builder($params);
  28. *</code>
  29. */
  30. class Builder implements \Phalcon\Mvc\Model\Query\BuilderInterface, \Phalcon\Di\InjectionAwareInterface {
  31. protected $_dependencyInjector;
  32. protected $_columns;
  33. protected $_models;
  34. protected $_joins;
  35. protected $_conditions;
  36. protected $_group;
  37. protected $_having;
  38. protected $_order;
  39. protected $_limit;
  40. protected $_offset;
  41. protected $_forUpdate;
  42. protected $_sharedLock;
  43. protected $_bindParams;
  44. protected $_bindTypes;
  45. protected $_distinct;
  46. protected $_hiddenParamNumber;
  47. /**
  48. * \Phalcon\Mvc\Model\Query\Builder constructor
  49. *
  50. * @param array params
  51. * @param \Phalcon\DiInterface dependencyInjector
  52. */
  53. public function __construct($params=null, \Phalcon\DiInterface $dependencyInjector=null){ }
  54. /**
  55. * Sets the DependencyInjector container
  56. */
  57. public function setDI(\Phalcon\DiInterface $dependencyInjector){ }
  58. /**
  59. * Returns the DependencyInjector container
  60. */
  61. public function getDI(){ }
  62. /**
  63. * Sets SELECT DISTINCT / SELECT ALL flag
  64. *
  65. * @param bool|null distinct
  66. * @return \Phalcon\Mvc\Model\Query\BuilderInterface
  67. */
  68. public function distinct($distinct){ }
  69. /**
  70. * Returns SELECT DISTINCT / SELECT ALL flag
  71. */
  72. public function getDistinct(){ }
  73. /**
  74. * Sets the columns to be queried
  75. *
  76. *<code>
  77. * $builder->columns(array('id', 'name'));
  78. *</code>
  79. *
  80. * @param string|array columns
  81. * @return \Phalcon\Mvc\Model\Query\Builder
  82. */
  83. public function columns($columns){ }
  84. /**
  85. * Return the columns to be queried
  86. *
  87. * @return string|array
  88. */
  89. public function getColumns(){ }
  90. /**
  91. * Sets the models who makes part of the query
  92. *
  93. *<code>
  94. * $builder->from('Robots');
  95. * $builder->from(array('Robots', 'RobotsParts'));
  96. *</code>
  97. *
  98. * @param string|array models
  99. * @return \Phalcon\Mvc\Model\Query\Builder
  100. */
  101. public function from($models){ }
  102. /**
  103. * Add a model to take part of the query
  104. *
  105. *<code>
  106. * $builder->addFrom('Robots', 'r');
  107. *</code>
  108. *
  109. * @param string model
  110. * @param string alias
  111. * @return \Phalcon\Mvc\Model\Query\Builder
  112. */
  113. public function addFrom($model, $alias=null){ }
  114. /**
  115. * Return the models who makes part of the query
  116. *
  117. * @return string|array
  118. */
  119. public function getFrom(){ }
  120. /**
  121. * Adds a INNER join to the query
  122. *
  123. *<code>
  124. * $builder->join('Robots');
  125. * $builder->join('Robots', 'r.id = RobotsParts.robots_id');
  126. * $builder->join('Robots', 'r.id = RobotsParts.robots_id', 'r');
  127. * $builder->join('Robots', 'r.id = RobotsParts.robots_id', 'r', 'INNER');
  128. *</code>
  129. *
  130. * @param string model
  131. * @param string conditions
  132. * @param string alias
  133. * @param string type
  134. * @return \Phalcon\Mvc\Model\Query\Builder
  135. */
  136. public function join($model, $conditions=null, $alias=null, $type=null){ }
  137. /**
  138. * Adds a INNER join to the query
  139. *
  140. *<code>
  141. * $builder->innerJoin('Robots');
  142. * $builder->innerJoin('Robots', 'r.id = RobotsParts.robots_id');
  143. * $builder->innerJoin('Robots', 'r.id = RobotsParts.robots_id', 'r');
  144. *</code>
  145. *
  146. * @param string model
  147. * @param string conditions
  148. * @param string alias
  149. * @param string type
  150. * @return \Phalcon\Mvc\Model\Query\Builder
  151. */
  152. public function innerJoin($model, $conditions=null, $alias=null){ }
  153. /**
  154. * Adds a LEFT join to the query
  155. *
  156. *<code>
  157. * $builder->leftJoin('Robots', 'r.id = RobotsParts.robots_id', 'r');
  158. *</code>
  159. *
  160. * @param string model
  161. * @param string conditions
  162. * @param string alias
  163. * @return \Phalcon\Mvc\Model\Query\Builder
  164. */
  165. public function leftJoin($model, $conditions=null, $alias=null){ }
  166. /**
  167. * Adds a RIGHT join to the query
  168. *
  169. *<code>
  170. * $builder->rightJoin('Robots', 'r.id = RobotsParts.robots_id', 'r');
  171. *</code>
  172. *
  173. * @param string model
  174. * @param string conditions
  175. * @param string alias
  176. * @return \Phalcon\Mvc\Model\Query\Builder
  177. */
  178. public function rightJoin($model, $conditions=null, $alias=null){ }
  179. /**
  180. * Sets the query conditions
  181. *
  182. *<code>
  183. * $builder->where(100);
  184. * $builder->where('name = "Peter"');
  185. * $builder->where('name = :name: AND id > :id:', array('name' => 'Peter', 'id' => 100));
  186. *</code>
  187. *
  188. * @param mixed conditions
  189. * @param array bindParams
  190. * @param array bindTypes
  191. * @return \Phalcon\Mvc\Model\Query\Builder
  192. */
  193. public function where($conditions, $bindParams=null, $bindTypes=null){ }
  194. /**
  195. * Appends a condition to the current conditions using a AND operator
  196. *
  197. *<code>
  198. * $builder->andWhere('name = "Peter"');
  199. * $builder->andWhere('name = :name: AND id > :id:', array('name' => 'Peter', 'id' => 100));
  200. *</code>
  201. *
  202. * @param string conditions
  203. * @param array bindParams
  204. * @param array bindTypes
  205. * @return \Phalcon\Mvc\Model\Query\Builder
  206. */
  207. public function andWhere($conditions, $bindParams=null, $bindTypes=null){ }
  208. /**
  209. * Appends a condition to the current conditions using a OR operator
  210. *
  211. *<code>
  212. * $builder->orWhere('name = "Peter"');
  213. * $builder->orWhere('name = :name: AND id > :id:', array('name' => 'Peter', 'id' => 100));
  214. *</code>
  215. *
  216. * @param string conditions
  217. * @param array bindParams
  218. * @param array bindTypes
  219. * @return \Phalcon\Mvc\Model\Query\Builder
  220. */
  221. public function orWhere($conditions, $bindParams=null, $bindTypes=null){ }
  222. /**
  223. * Appends a BETWEEN condition to the current conditions
  224. *
  225. *<code>
  226. * $builder->betweenWhere('price', 100.25, 200.50);
  227. *</code>
  228. *
  229. * @param string expr
  230. * @param mixed minimum
  231. * @param mixed maximum
  232. * @return \Phalcon\Mvc\Model\Query\Builder
  233. */
  234. public function betweenWhere($expr, $minimum, $maximum){ }
  235. /**
  236. * Appends a NOT BETWEEN condition to the current conditions
  237. *
  238. *<code>
  239. * $builder->notBetweenWhere('price', 100.25, 200.50);
  240. *</code>
  241. *
  242. * @param string expr
  243. * @param mixed minimum
  244. * @param mixed maximum
  245. * @return \Phalcon\Mvc\Model\Query\Builder
  246. */
  247. public function notBetweenWhere($expr, $minimum, $maximum){ }
  248. /**
  249. * Appends an IN condition to the current conditions
  250. *
  251. *<code>
  252. * $builder->inWhere('id', [1, 2, 3]);
  253. *</code>
  254. */
  255. public function inWhere($expr, $values){ }
  256. /**
  257. * Appends a NOT IN condition to the current conditions
  258. *
  259. *<code>
  260. * $builder->notInWhere('id', [1, 2, 3]);
  261. *</code>
  262. */
  263. public function notInWhere($expr, $values){ }
  264. /**
  265. * Return the conditions for the query
  266. *
  267. * @return string|array
  268. */
  269. public function getWhere(){ }
  270. /**
  271. * Sets a ORDER BY condition clause
  272. *
  273. *<code>
  274. * $builder->orderBy('Robots.name');
  275. * $builder->orderBy(array('1', 'Robots.name'));
  276. *</code>
  277. *
  278. * @param string|array orderBy
  279. * @return \Phalcon\Mvc\Model\Query\Builder
  280. */
  281. public function orderBy($orderBy){ }
  282. /**
  283. * Returns the set ORDER BY clause
  284. *
  285. * @return string|array
  286. */
  287. public function getOrderBy(){ }
  288. /**
  289. * Sets a HAVING condition clause. You need to escape PHQL reserved words using [ and ] delimiters
  290. *
  291. *<code>
  292. * $builder->having('SUM(Robots.price) > 0');
  293. *</code>
  294. */
  295. public function having($having){ }
  296. /**
  297. * Return the current having clause
  298. *
  299. * @return string|array
  300. */
  301. public function getHaving(){ }
  302. /**
  303. * Sets a LIMIT clause, optionally a offset clause
  304. *
  305. *<code>
  306. * $builder->limit(100);
  307. * $builder->limit(100, 20);
  308. *</code>
  309. */
  310. public function limit($limit=null, $offset=null){ }
  311. /**
  312. * Returns the current LIMIT clause
  313. *
  314. * @return string|array
  315. */
  316. public function getLimit(){ }
  317. /**
  318. * Sets an OFFSET clause
  319. *
  320. *<code>
  321. * $builder->offset(30);
  322. *</code>
  323. */
  324. public function offset($offset){ }
  325. /**
  326. * Returns the current OFFSET clause
  327. *
  328. * @return string|array
  329. */
  330. public function getOffset(){ }
  331. /**
  332. * Sets a GROUP BY clause
  333. *
  334. *<code>
  335. * $builder->groupBy(array('Robots.name'));
  336. *</code>
  337. *
  338. * @param string|array group
  339. * @return \Phalcon\Mvc\Model\Query\Builder
  340. */
  341. public function groupBy($group){ }
  342. /**
  343. * Returns the GROUP BY clause
  344. *
  345. * @return string
  346. */
  347. public function getGroupBy(){ }
  348. /**
  349. * Returns a PHQL statement built based on the builder parameters
  350. *
  351. * @return string
  352. */
  353. public function getPhql(){ }
  354. /**
  355. * Returns the query built
  356. */
  357. public function getQuery(){ }
  358. }
  359. }