/lib/model/om/BasesfGuardUserProfileQuery.php

https://github.com/pixel-cookers/symfony_bootstrap · PHP · 442 lines · 180 code · 23 blank · 239 comment · 31 complexity · 68ef3fff0c120c15d19aa13dddbde1d8 MD5 · raw file

  1. <?php
  2. /**
  3. * Base class that represents a query for the 'sf_guard_user_profile' table.
  4. *
  5. *
  6. *
  7. * This class was autogenerated by Propel 1.6.2 on:
  8. *
  9. * 09/27/11 11:02:53
  10. *
  11. * @method sfGuardUserProfileQuery orderById($order = Criteria::ASC) Order by the id column
  12. * @method sfGuardUserProfileQuery orderByUserId($order = Criteria::ASC) Order by the user_id column
  13. * @method sfGuardUserProfileQuery orderByGenre($order = Criteria::ASC) Order by the genre column
  14. * @method sfGuardUserProfileQuery orderByFirstName($order = Criteria::ASC) Order by the first_name column
  15. * @method sfGuardUserProfileQuery orderByLastName($order = Criteria::ASC) Order by the last_name column
  16. * @method sfGuardUserProfileQuery orderByEmail($order = Criteria::ASC) Order by the email column
  17. *
  18. * @method sfGuardUserProfileQuery groupById() Group by the id column
  19. * @method sfGuardUserProfileQuery groupByUserId() Group by the user_id column
  20. * @method sfGuardUserProfileQuery groupByGenre() Group by the genre column
  21. * @method sfGuardUserProfileQuery groupByFirstName() Group by the first_name column
  22. * @method sfGuardUserProfileQuery groupByLastName() Group by the last_name column
  23. * @method sfGuardUserProfileQuery groupByEmail() Group by the email column
  24. *
  25. * @method sfGuardUserProfileQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
  26. * @method sfGuardUserProfileQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
  27. * @method sfGuardUserProfileQuery innerJoin($relation) Adds a INNER JOIN clause to the query
  28. *
  29. * @method sfGuardUserProfileQuery leftJoinsfGuardUser($relationAlias = null) Adds a LEFT JOIN clause to the query using the sfGuardUser relation
  30. * @method sfGuardUserProfileQuery rightJoinsfGuardUser($relationAlias = null) Adds a RIGHT JOIN clause to the query using the sfGuardUser relation
  31. * @method sfGuardUserProfileQuery innerJoinsfGuardUser($relationAlias = null) Adds a INNER JOIN clause to the query using the sfGuardUser relation
  32. *
  33. * @method sfGuardUserProfile findOne(PropelPDO $con = null) Return the first sfGuardUserProfile matching the query
  34. * @method sfGuardUserProfile findOneOrCreate(PropelPDO $con = null) Return the first sfGuardUserProfile matching the query, or a new sfGuardUserProfile object populated from the query conditions when no match is found
  35. *
  36. * @method sfGuardUserProfile findOneById(int $id) Return the first sfGuardUserProfile filtered by the id column
  37. * @method sfGuardUserProfile findOneByUserId(int $user_id) Return the first sfGuardUserProfile filtered by the user_id column
  38. * @method sfGuardUserProfile findOneByGenre(int $genre) Return the first sfGuardUserProfile filtered by the genre column
  39. * @method sfGuardUserProfile findOneByFirstName(string $first_name) Return the first sfGuardUserProfile filtered by the first_name column
  40. * @method sfGuardUserProfile findOneByLastName(string $last_name) Return the first sfGuardUserProfile filtered by the last_name column
  41. * @method sfGuardUserProfile findOneByEmail(string $email) Return the first sfGuardUserProfile filtered by the email column
  42. *
  43. * @method array findById(int $id) Return sfGuardUserProfile objects filtered by the id column
  44. * @method array findByUserId(int $user_id) Return sfGuardUserProfile objects filtered by the user_id column
  45. * @method array findByGenre(int $genre) Return sfGuardUserProfile objects filtered by the genre column
  46. * @method array findByFirstName(string $first_name) Return sfGuardUserProfile objects filtered by the first_name column
  47. * @method array findByLastName(string $last_name) Return sfGuardUserProfile objects filtered by the last_name column
  48. * @method array findByEmail(string $email) Return sfGuardUserProfile objects filtered by the email column
  49. *
  50. * @package propel.generator.lib.model.om
  51. */
  52. abstract class BasesfGuardUserProfileQuery extends ModelCriteria
  53. {
  54. /**
  55. * Initializes internal state of BasesfGuardUserProfileQuery object.
  56. *
  57. * @param string $dbName The dabase name
  58. * @param string $modelName The phpName of a model, e.g. 'Book'
  59. * @param string $modelAlias The alias for the model in this query, e.g. 'b'
  60. */
  61. public function __construct($dbName = 'propel', $modelName = 'sfGuardUserProfile', $modelAlias = null)
  62. {
  63. parent::__construct($dbName, $modelName, $modelAlias);
  64. }
  65. /**
  66. * Returns a new sfGuardUserProfileQuery object.
  67. *
  68. * @param string $modelAlias The alias of a model in the query
  69. * @param Criteria $criteria Optional Criteria to build the query from
  70. *
  71. * @return sfGuardUserProfileQuery
  72. */
  73. public static function create($modelAlias = null, $criteria = null)
  74. {
  75. if ($criteria instanceof sfGuardUserProfileQuery) {
  76. return $criteria;
  77. }
  78. $query = new sfGuardUserProfileQuery();
  79. if (null !== $modelAlias) {
  80. $query->setModelAlias($modelAlias);
  81. }
  82. if ($criteria instanceof Criteria) {
  83. $query->mergeWith($criteria);
  84. }
  85. return $query;
  86. }
  87. /**
  88. * Find object by primary key
  89. * Use instance pooling to avoid a database query if the object exists
  90. * <code>
  91. * $obj = $c->findPk(12, $con);
  92. * </code>
  93. * @param mixed $key Primary key to use for the query
  94. * @param PropelPDO $con an optional connection object
  95. *
  96. * @return sfGuardUserProfile|array|mixed the result, formatted by the current formatter
  97. */
  98. public function findPk($key, $con = null)
  99. {
  100. if ((null !== ($obj = sfGuardUserProfilePeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
  101. // the object is alredy in the instance pool
  102. return $obj;
  103. } else {
  104. // the object has not been requested yet, or the formatter is not an object formatter
  105. $criteria = $this->isKeepQuery() ? clone $this : $this;
  106. $stmt = $criteria
  107. ->filterByPrimaryKey($key)
  108. ->getSelectStatement($con);
  109. return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
  110. }
  111. }
  112. /**
  113. * Find objects by primary key
  114. * <code>
  115. * $objs = $c->findPks(array(12, 56, 832), $con);
  116. * </code>
  117. * @param array $keys Primary keys to use for the query
  118. * @param PropelPDO $con an optional connection object
  119. *
  120. * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
  121. */
  122. public function findPks($keys, $con = null)
  123. {
  124. $criteria = $this->isKeepQuery() ? clone $this : $this;
  125. return $this
  126. ->filterByPrimaryKeys($keys)
  127. ->find($con);
  128. }
  129. /**
  130. * Filter the query by primary key
  131. *
  132. * @param mixed $key Primary key to use for the query
  133. *
  134. * @return sfGuardUserProfileQuery The current query, for fluid interface
  135. */
  136. public function filterByPrimaryKey($key)
  137. {
  138. return $this->addUsingAlias(sfGuardUserProfilePeer::ID, $key, Criteria::EQUAL);
  139. }
  140. /**
  141. * Filter the query by a list of primary keys
  142. *
  143. * @param array $keys The list of primary key to use for the query
  144. *
  145. * @return sfGuardUserProfileQuery The current query, for fluid interface
  146. */
  147. public function filterByPrimaryKeys($keys)
  148. {
  149. return $this->addUsingAlias(sfGuardUserProfilePeer::ID, $keys, Criteria::IN);
  150. }
  151. /**
  152. * Filter the query on the id column
  153. *
  154. * Example usage:
  155. * <code>
  156. * $query->filterById(1234); // WHERE id = 1234
  157. * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
  158. * $query->filterById(array('min' => 12)); // WHERE id > 12
  159. * </code>
  160. *
  161. * @param mixed $id The value to use as filter.
  162. * Use scalar values for equality.
  163. * Use array values for in_array() equivalent.
  164. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
  165. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  166. *
  167. * @return sfGuardUserProfileQuery The current query, for fluid interface
  168. */
  169. public function filterById($id = null, $comparison = null)
  170. {
  171. if (is_array($id) && null === $comparison) {
  172. $comparison = Criteria::IN;
  173. }
  174. return $this->addUsingAlias(sfGuardUserProfilePeer::ID, $id, $comparison);
  175. }
  176. /**
  177. * Filter the query on the user_id column
  178. *
  179. * Example usage:
  180. * <code>
  181. * $query->filterByUserId(1234); // WHERE user_id = 1234
  182. * $query->filterByUserId(array(12, 34)); // WHERE user_id IN (12, 34)
  183. * $query->filterByUserId(array('min' => 12)); // WHERE user_id > 12
  184. * </code>
  185. *
  186. * @see filterBysfGuardUser()
  187. *
  188. * @param mixed $userId The value to use as filter.
  189. * Use scalar values for equality.
  190. * Use array values for in_array() equivalent.
  191. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
  192. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  193. *
  194. * @return sfGuardUserProfileQuery The current query, for fluid interface
  195. */
  196. public function filterByUserId($userId = null, $comparison = null)
  197. {
  198. if (is_array($userId)) {
  199. $useMinMax = false;
  200. if (isset($userId['min'])) {
  201. $this->addUsingAlias(sfGuardUserProfilePeer::USER_ID, $userId['min'], Criteria::GREATER_EQUAL);
  202. $useMinMax = true;
  203. }
  204. if (isset($userId['max'])) {
  205. $this->addUsingAlias(sfGuardUserProfilePeer::USER_ID, $userId['max'], Criteria::LESS_EQUAL);
  206. $useMinMax = true;
  207. }
  208. if ($useMinMax) {
  209. return $this;
  210. }
  211. if (null === $comparison) {
  212. $comparison = Criteria::IN;
  213. }
  214. }
  215. return $this->addUsingAlias(sfGuardUserProfilePeer::USER_ID, $userId, $comparison);
  216. }
  217. /**
  218. * Filter the query on the genre column
  219. *
  220. * Example usage:
  221. * <code>
  222. * $query->filterByGenre(1234); // WHERE genre = 1234
  223. * $query->filterByGenre(array(12, 34)); // WHERE genre IN (12, 34)
  224. * $query->filterByGenre(array('min' => 12)); // WHERE genre > 12
  225. * </code>
  226. *
  227. * @param mixed $genre The value to use as filter.
  228. * Use scalar values for equality.
  229. * Use array values for in_array() equivalent.
  230. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
  231. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  232. *
  233. * @return sfGuardUserProfileQuery The current query, for fluid interface
  234. */
  235. public function filterByGenre($genre = null, $comparison = null)
  236. {
  237. if (is_array($genre)) {
  238. $useMinMax = false;
  239. if (isset($genre['min'])) {
  240. $this->addUsingAlias(sfGuardUserProfilePeer::GENRE, $genre['min'], Criteria::GREATER_EQUAL);
  241. $useMinMax = true;
  242. }
  243. if (isset($genre['max'])) {
  244. $this->addUsingAlias(sfGuardUserProfilePeer::GENRE, $genre['max'], Criteria::LESS_EQUAL);
  245. $useMinMax = true;
  246. }
  247. if ($useMinMax) {
  248. return $this;
  249. }
  250. if (null === $comparison) {
  251. $comparison = Criteria::IN;
  252. }
  253. }
  254. return $this->addUsingAlias(sfGuardUserProfilePeer::GENRE, $genre, $comparison);
  255. }
  256. /**
  257. * Filter the query on the first_name column
  258. *
  259. * Example usage:
  260. * <code>
  261. * $query->filterByFirstName('fooValue'); // WHERE first_name = 'fooValue'
  262. * $query->filterByFirstName('%fooValue%'); // WHERE first_name LIKE '%fooValue%'
  263. * </code>
  264. *
  265. * @param string $firstName The value to use as filter.
  266. * Accepts wildcards (* and % trigger a LIKE)
  267. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  268. *
  269. * @return sfGuardUserProfileQuery The current query, for fluid interface
  270. */
  271. public function filterByFirstName($firstName = null, $comparison = null)
  272. {
  273. if (null === $comparison) {
  274. if (is_array($firstName)) {
  275. $comparison = Criteria::IN;
  276. } elseif (preg_match('/[\%\*]/', $firstName)) {
  277. $firstName = str_replace('*', '%', $firstName);
  278. $comparison = Criteria::LIKE;
  279. }
  280. }
  281. return $this->addUsingAlias(sfGuardUserProfilePeer::FIRST_NAME, $firstName, $comparison);
  282. }
  283. /**
  284. * Filter the query on the last_name column
  285. *
  286. * Example usage:
  287. * <code>
  288. * $query->filterByLastName('fooValue'); // WHERE last_name = 'fooValue'
  289. * $query->filterByLastName('%fooValue%'); // WHERE last_name LIKE '%fooValue%'
  290. * </code>
  291. *
  292. * @param string $lastName The value to use as filter.
  293. * Accepts wildcards (* and % trigger a LIKE)
  294. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  295. *
  296. * @return sfGuardUserProfileQuery The current query, for fluid interface
  297. */
  298. public function filterByLastName($lastName = null, $comparison = null)
  299. {
  300. if (null === $comparison) {
  301. if (is_array($lastName)) {
  302. $comparison = Criteria::IN;
  303. } elseif (preg_match('/[\%\*]/', $lastName)) {
  304. $lastName = str_replace('*', '%', $lastName);
  305. $comparison = Criteria::LIKE;
  306. }
  307. }
  308. return $this->addUsingAlias(sfGuardUserProfilePeer::LAST_NAME, $lastName, $comparison);
  309. }
  310. /**
  311. * Filter the query on the email column
  312. *
  313. * Example usage:
  314. * <code>
  315. * $query->filterByEmail('fooValue'); // WHERE email = 'fooValue'
  316. * $query->filterByEmail('%fooValue%'); // WHERE email LIKE '%fooValue%'
  317. * </code>
  318. *
  319. * @param string $email The value to use as filter.
  320. * Accepts wildcards (* and % trigger a LIKE)
  321. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  322. *
  323. * @return sfGuardUserProfileQuery The current query, for fluid interface
  324. */
  325. public function filterByEmail($email = null, $comparison = null)
  326. {
  327. if (null === $comparison) {
  328. if (is_array($email)) {
  329. $comparison = Criteria::IN;
  330. } elseif (preg_match('/[\%\*]/', $email)) {
  331. $email = str_replace('*', '%', $email);
  332. $comparison = Criteria::LIKE;
  333. }
  334. }
  335. return $this->addUsingAlias(sfGuardUserProfilePeer::EMAIL, $email, $comparison);
  336. }
  337. /**
  338. * Filter the query by a related sfGuardUser object
  339. *
  340. * @param sfGuardUser|PropelCollection $sfGuardUser The related object(s) to use as filter
  341. * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  342. *
  343. * @return sfGuardUserProfileQuery The current query, for fluid interface
  344. */
  345. public function filterBysfGuardUser($sfGuardUser, $comparison = null)
  346. {
  347. if ($sfGuardUser instanceof sfGuardUser) {
  348. return $this
  349. ->addUsingAlias(sfGuardUserProfilePeer::USER_ID, $sfGuardUser->getId(), $comparison);
  350. } elseif ($sfGuardUser instanceof PropelCollection) {
  351. if (null === $comparison) {
  352. $comparison = Criteria::IN;
  353. }
  354. return $this
  355. ->addUsingAlias(sfGuardUserProfilePeer::USER_ID, $sfGuardUser->toKeyValue('PrimaryKey', 'Id'), $comparison);
  356. } else {
  357. throw new PropelException('filterBysfGuardUser() only accepts arguments of type sfGuardUser or PropelCollection');
  358. }
  359. }
  360. /**
  361. * Adds a JOIN clause to the query using the sfGuardUser relation
  362. *
  363. * @param string $relationAlias optional alias for the relation
  364. * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
  365. *
  366. * @return sfGuardUserProfileQuery The current query, for fluid interface
  367. */
  368. public function joinsfGuardUser($relationAlias = null, $joinType = Criteria::INNER_JOIN)
  369. {
  370. $tableMap = $this->getTableMap();
  371. $relationMap = $tableMap->getRelation('sfGuardUser');
  372. // create a ModelJoin object for this join
  373. $join = new ModelJoin();
  374. $join->setJoinType($joinType);
  375. $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
  376. if ($previousJoin = $this->getPreviousJoin()) {
  377. $join->setPreviousJoin($previousJoin);
  378. }
  379. // add the ModelJoin to the current object
  380. if($relationAlias) {
  381. $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
  382. $this->addJoinObject($join, $relationAlias);
  383. } else {
  384. $this->addJoinObject($join, 'sfGuardUser');
  385. }
  386. return $this;
  387. }
  388. /**
  389. * Use the sfGuardUser relation sfGuardUser object
  390. *
  391. * @see useQuery()
  392. *
  393. * @param string $relationAlias optional alias for the relation,
  394. * to be used as main alias in the secondary query
  395. * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
  396. *
  397. * @return sfGuardUserQuery A secondary query class using the current class as primary query
  398. */
  399. public function usesfGuardUserQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
  400. {
  401. return $this
  402. ->joinsfGuardUser($relationAlias, $joinType)
  403. ->useQuery($relationAlias ? $relationAlias : 'sfGuardUser', 'sfGuardUserQuery');
  404. }
  405. /**
  406. * Exclude object from result
  407. *
  408. * @param sfGuardUserProfile $sfGuardUserProfile Object to remove from the list of results
  409. *
  410. * @return sfGuardUserProfileQuery The current query, for fluid interface
  411. */
  412. public function prune($sfGuardUserProfile = null)
  413. {
  414. if ($sfGuardUserProfile) {
  415. $this->addUsingAlias(sfGuardUserProfilePeer::ID, $sfGuardUserProfile->getId(), Criteria::NOT_EQUAL);
  416. }
  417. return $this;
  418. }
  419. } // BasesfGuardUserProfileQuery