BaseCcPrefQuery.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <?php
  2. /**
  3. * Base class that represents a query for the 'cc_pref' table.
  4. *
  5. *
  6. *
  7. * @method CcPrefQuery orderById($order = Criteria::ASC) Order by the id column
  8. * @method CcPrefQuery orderBySubjid($order = Criteria::ASC) Order by the subjid column
  9. * @method CcPrefQuery orderByKeystr($order = Criteria::ASC) Order by the keystr column
  10. * @method CcPrefQuery orderByValstr($order = Criteria::ASC) Order by the valstr column
  11. *
  12. * @method CcPrefQuery groupById() Group by the id column
  13. * @method CcPrefQuery groupBySubjid() Group by the subjid column
  14. * @method CcPrefQuery groupByKeystr() Group by the keystr column
  15. * @method CcPrefQuery groupByValstr() Group by the valstr column
  16. *
  17. * @method CcPrefQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
  18. * @method CcPrefQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
  19. * @method CcPrefQuery innerJoin($relation) Adds a INNER JOIN clause to the query
  20. *
  21. * @method CcPrefQuery leftJoinCcSubjs($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjs relation
  22. * @method CcPrefQuery rightJoinCcSubjs($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjs relation
  23. * @method CcPrefQuery innerJoinCcSubjs($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjs relation
  24. *
  25. * @method CcPref findOne(PropelPDO $con = null) Return the first CcPref matching the query
  26. * @method CcPref findOneOrCreate(PropelPDO $con = null) Return the first CcPref matching the query, or a new CcPref object populated from the query conditions when no match is found
  27. *
  28. * @method CcPref findOneById(int $id) Return the first CcPref filtered by the id column
  29. * @method CcPref findOneBySubjid(int $subjid) Return the first CcPref filtered by the subjid column
  30. * @method CcPref findOneByKeystr(string $keystr) Return the first CcPref filtered by the keystr column
  31. * @method CcPref findOneByValstr(string $valstr) Return the first CcPref filtered by the valstr column
  32. *
  33. * @method array findById(int $id) Return CcPref objects filtered by the id column
  34. * @method array findBySubjid(int $subjid) Return CcPref objects filtered by the subjid column
  35. * @method array findByKeystr(string $keystr) Return CcPref objects filtered by the keystr column
  36. * @method array findByValstr(string $valstr) Return CcPref objects filtered by the valstr column
  37. *
  38. * @package propel.generator.airtime.om
  39. */
  40. abstract class BaseCcPrefQuery extends ModelCriteria
  41. {
  42. /**
  43. * Initializes internal state of BaseCcPrefQuery object.
  44. *
  45. * @param string $dbName The dabase name
  46. * @param string $modelName The phpName of a model, e.g. 'Book'
  47. * @param string $modelAlias The alias for the model in this query, e.g. 'b'
  48. */
  49. public function __construct($dbName = 'airtime', $modelName = 'CcPref', $modelAlias = null)
  50. {
  51. parent::__construct($dbName, $modelName, $modelAlias);
  52. }
  53. /**
  54. * Returns a new CcPrefQuery object.
  55. *
  56. * @param string $modelAlias The alias of a model in the query
  57. * @param Criteria $criteria Optional Criteria to build the query from
  58. *
  59. * @return CcPrefQuery
  60. */
  61. public static function create($modelAlias = null, $criteria = null)
  62. {
  63. if ($criteria instanceof CcPrefQuery) {
  64. return $criteria;
  65. }
  66. $query = new CcPrefQuery();
  67. if (null !== $modelAlias) {
  68. $query->setModelAlias($modelAlias);
  69. }
  70. if ($criteria instanceof Criteria) {
  71. $query->mergeWith($criteria);
  72. }
  73. return $query;
  74. }
  75. /**
  76. * Find object by primary key
  77. * Use instance pooling to avoid a database query if the object exists
  78. * <code>
  79. * $obj = $c->findPk(12, $con);
  80. * </code>
  81. * @param mixed $key Primary key to use for the query
  82. * @param PropelPDO $con an optional connection object
  83. *
  84. * @return CcPref|array|mixed the result, formatted by the current formatter
  85. */
  86. public function findPk($key, $con = null)
  87. {
  88. if ((null !== ($obj = CcPrefPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
  89. // the object is alredy in the instance pool
  90. return $obj;
  91. } else {
  92. // the object has not been requested yet, or the formatter is not an object formatter
  93. $criteria = $this->isKeepQuery() ? clone $this : $this;
  94. $stmt = $criteria
  95. ->filterByPrimaryKey($key)
  96. ->getSelectStatement($con);
  97. return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
  98. }
  99. }
  100. /**
  101. * Find objects by primary key
  102. * <code>
  103. * $objs = $c->findPks(array(12, 56, 832), $con);
  104. * </code>
  105. * @param array $keys Primary keys to use for the query
  106. * @param PropelPDO $con an optional connection object
  107. *
  108. * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
  109. */
  110. public function findPks($keys, $con = null)
  111. {
  112. $criteria = $this->isKeepQuery() ? clone $this : $this;
  113. return $this
  114. ->filterByPrimaryKeys($keys)
  115. ->find($con);
  116. }
  117. /**
  118. * Filter the query by primary key
  119. *
  120. * @param mixed $key Primary key to use for the query
  121. *
  122. * @return CcPrefQuery The current query, for fluid interface
  123. */
  124. public function filterByPrimaryKey($key)
  125. {
  126. return $this->addUsingAlias(CcPrefPeer::ID, $key, Criteria::EQUAL);
  127. }
  128. /**
  129. * Filter the query by a list of primary keys
  130. *
  131. * @param array $keys The list of primary key to use for the query
  132. *
  133. * @return CcPrefQuery The current query, for fluid interface
  134. */
  135. public function filterByPrimaryKeys($keys)
  136. {
  137. return $this->addUsingAlias(CcPrefPeer::ID, $keys, Criteria::IN);
  138. }
  139. /**
  140. * Filter the query on the id column
  141. *
  142. * @param int|array $id The value to use as filter.
  143. * Accepts an associative array('min' => $minValue, 'max' => $maxValue)
  144. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  145. *
  146. * @return CcPrefQuery The current query, for fluid interface
  147. */
  148. public function filterById($id = null, $comparison = null)
  149. {
  150. if (is_array($id) && null === $comparison) {
  151. $comparison = Criteria::IN;
  152. }
  153. return $this->addUsingAlias(CcPrefPeer::ID, $id, $comparison);
  154. }
  155. /**
  156. * Filter the query on the subjid column
  157. *
  158. * @param int|array $subjid The value to use as filter.
  159. * Accepts an associative array('min' => $minValue, 'max' => $maxValue)
  160. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  161. *
  162. * @return CcPrefQuery The current query, for fluid interface
  163. */
  164. public function filterBySubjid($subjid = null, $comparison = null)
  165. {
  166. if (is_array($subjid)) {
  167. $useMinMax = false;
  168. if (isset($subjid['min'])) {
  169. $this->addUsingAlias(CcPrefPeer::SUBJID, $subjid['min'], Criteria::GREATER_EQUAL);
  170. $useMinMax = true;
  171. }
  172. if (isset($subjid['max'])) {
  173. $this->addUsingAlias(CcPrefPeer::SUBJID, $subjid['max'], Criteria::LESS_EQUAL);
  174. $useMinMax = true;
  175. }
  176. if ($useMinMax) {
  177. return $this;
  178. }
  179. if (null === $comparison) {
  180. $comparison = Criteria::IN;
  181. }
  182. }
  183. return $this->addUsingAlias(CcPrefPeer::SUBJID, $subjid, $comparison);
  184. }
  185. /**
  186. * Filter the query on the keystr column
  187. *
  188. * @param string $keystr The value to use as filter.
  189. * Accepts wildcards (* and % trigger a LIKE)
  190. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  191. *
  192. * @return CcPrefQuery The current query, for fluid interface
  193. */
  194. public function filterByKeystr($keystr = null, $comparison = null)
  195. {
  196. if (null === $comparison) {
  197. if (is_array($keystr)) {
  198. $comparison = Criteria::IN;
  199. } elseif (preg_match('/[\%\*]/', $keystr)) {
  200. $keystr = str_replace('*', '%', $keystr);
  201. $comparison = Criteria::LIKE;
  202. }
  203. }
  204. return $this->addUsingAlias(CcPrefPeer::KEYSTR, $keystr, $comparison);
  205. }
  206. /**
  207. * Filter the query on the valstr column
  208. *
  209. * @param string $valstr The value to use as filter.
  210. * Accepts wildcards (* and % trigger a LIKE)
  211. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  212. *
  213. * @return CcPrefQuery The current query, for fluid interface
  214. */
  215. public function filterByValstr($valstr = null, $comparison = null)
  216. {
  217. if (null === $comparison) {
  218. if (is_array($valstr)) {
  219. $comparison = Criteria::IN;
  220. } elseif (preg_match('/[\%\*]/', $valstr)) {
  221. $valstr = str_replace('*', '%', $valstr);
  222. $comparison = Criteria::LIKE;
  223. }
  224. }
  225. return $this->addUsingAlias(CcPrefPeer::VALSTR, $valstr, $comparison);
  226. }
  227. /**
  228. * Filter the query by a related CcSubjs object
  229. *
  230. * @param CcSubjs $ccSubjs the related object to use as filter
  231. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  232. *
  233. * @return CcPrefQuery The current query, for fluid interface
  234. */
  235. public function filterByCcSubjs($ccSubjs, $comparison = null)
  236. {
  237. return $this
  238. ->addUsingAlias(CcPrefPeer::SUBJID, $ccSubjs->getDbId(), $comparison);
  239. }
  240. /**
  241. * Adds a JOIN clause to the query using the CcSubjs relation
  242. *
  243. * @param string $relationAlias optional alias for the relation
  244. * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
  245. *
  246. * @return CcPrefQuery The current query, for fluid interface
  247. */
  248. public function joinCcSubjs($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
  249. {
  250. $tableMap = $this->getTableMap();
  251. $relationMap = $tableMap->getRelation('CcSubjs');
  252. // create a ModelJoin object for this join
  253. $join = new ModelJoin();
  254. $join->setJoinType($joinType);
  255. $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
  256. if ($previousJoin = $this->getPreviousJoin()) {
  257. $join->setPreviousJoin($previousJoin);
  258. }
  259. // add the ModelJoin to the current object
  260. if($relationAlias) {
  261. $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
  262. $this->addJoinObject($join, $relationAlias);
  263. } else {
  264. $this->addJoinObject($join, 'CcSubjs');
  265. }
  266. return $this;
  267. }
  268. /**
  269. * Use the CcSubjs relation CcSubjs object
  270. *
  271. * @see useQuery()
  272. *
  273. * @param string $relationAlias optional alias for the relation,
  274. * to be used as main alias in the secondary query
  275. * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
  276. *
  277. * @return CcSubjsQuery A secondary query class using the current class as primary query
  278. */
  279. public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
  280. {
  281. return $this
  282. ->joinCcSubjs($relationAlias, $joinType)
  283. ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery');
  284. }
  285. /**
  286. * Exclude object from result
  287. *
  288. * @param CcPref $ccPref Object to remove from the list of results
  289. *
  290. * @return CcPrefQuery The current query, for fluid interface
  291. */
  292. public function prune($ccPref = null)
  293. {
  294. if ($ccPref) {
  295. $this->addUsingAlias(CcPrefPeer::ID, $ccPref->getId(), Criteria::NOT_EQUAL);
  296. }
  297. return $this;
  298. }
  299. } // BaseCcPrefQuery