BaseCcPermsQuery.php 12 KB

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