PageRenderTime 51ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/model/om/BaseCheckinsPeer.php

https://github.com/fbriceno/test
PHP | 1499 lines | 754 code | 253 blank | 492 comment | 117 complexity | 684f38fcb7cb5caf41dca59ba1deb7d7 MD5 | raw file
Possible License(s): ISC

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /**
  3. * Base static class for performing query and update operations on the 'checkins' table.
  4. *
  5. *
  6. *
  7. * This class was autogenerated by Propel 1.4.2 on:
  8. *
  9. * 04/15/13 20:46:42
  10. *
  11. * @package lib.model.om
  12. */
  13. abstract class BaseCheckinsPeer {
  14. /** the default database name for this class */
  15. const DATABASE_NAME = 'propel';
  16. /** the table name for this class */
  17. const TABLE_NAME = 'checkins';
  18. /** the related Propel class for this table */
  19. const OM_CLASS = 'Checkins';
  20. /** A class that can be returned by this peer. */
  21. const CLASS_DEFAULT = 'lib.model.Checkins';
  22. /** the related TableMap class for this table */
  23. const TM_CLASS = 'CheckinsTableMap';
  24. /** The total number of columns. */
  25. const NUM_COLUMNS = 13;
  26. /** The number of lazy-loaded columns. */
  27. const NUM_LAZY_LOAD_COLUMNS = 0;
  28. /** the column name for the CHE_ID2 field */
  29. const CHE_ID2 = 'checkins.CHE_ID2';
  30. /** the column name for the USE_ID2 field */
  31. const USE_ID2 = 'checkins.USE_ID2';
  32. /** the column name for the USE_ID field */
  33. const USE_ID = 'checkins.USE_ID';
  34. /** the column name for the CHE_ID field */
  35. const CHE_ID = 'checkins.CHE_ID';
  36. /** the column name for the CON_ID field */
  37. const CON_ID = 'checkins.CON_ID';
  38. /** the column name for the CHE_NAME field */
  39. const CHE_NAME = 'checkins.CHE_NAME';
  40. /** the column name for the CHE_PLACE field */
  41. const CHE_PLACE = 'checkins.CHE_PLACE';
  42. /** the column name for the CHE_MESSAGE field */
  43. const CHE_MESSAGE = 'checkins.CHE_MESSAGE';
  44. /** the column name for the CHE_LATITUDE field */
  45. const CHE_LATITUDE = 'checkins.CHE_LATITUDE';
  46. /** the column name for the CHE_LONGITUDE field */
  47. const CHE_LONGITUDE = 'checkins.CHE_LONGITUDE';
  48. /** the column name for the CHE_APPLICATION field */
  49. const CHE_APPLICATION = 'checkins.CHE_APPLICATION';
  50. /** the column name for the CREATED_AT field */
  51. const CREATED_AT = 'checkins.CREATED_AT';
  52. /** the column name for the UPDATED_AT field */
  53. const UPDATED_AT = 'checkins.UPDATED_AT';
  54. /**
  55. * An identiy map to hold any loaded instances of Checkins objects.
  56. * This must be public so that other peer classes can access this when hydrating from JOIN
  57. * queries.
  58. * @var array Checkins[]
  59. */
  60. public static $instances = array();
  61. // symfony behavior
  62. /**
  63. * Indicates whether the current model includes I18N.
  64. */
  65. const IS_I18N = false;
  66. /**
  67. * holds an array of fieldnames
  68. *
  69. * first dimension keys are the type constants
  70. * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
  71. */
  72. private static $fieldNames = array (
  73. BasePeer::TYPE_PHPNAME => array ('CheId2', 'UseId2', 'UseId', 'CheId', 'ConId', 'CheName', 'ChePlace', 'CheMessage', 'CheLatitude', 'CheLongitude', 'CheApplication', 'CreatedAt', 'UpdatedAt', ),
  74. BasePeer::TYPE_STUDLYPHPNAME => array ('cheId2', 'useId2', 'useId', 'cheId', 'conId', 'cheName', 'chePlace', 'cheMessage', 'cheLatitude', 'cheLongitude', 'cheApplication', 'createdAt', 'updatedAt', ),
  75. BasePeer::TYPE_COLNAME => array (self::CHE_ID2, self::USE_ID2, self::USE_ID, self::CHE_ID, self::CON_ID, self::CHE_NAME, self::CHE_PLACE, self::CHE_MESSAGE, self::CHE_LATITUDE, self::CHE_LONGITUDE, self::CHE_APPLICATION, self::CREATED_AT, self::UPDATED_AT, ),
  76. BasePeer::TYPE_FIELDNAME => array ('che_id2', 'use_id2', 'use_id', 'che_id', 'con_id', 'che_name', 'che_place', 'che_message', 'che_latitude', 'che_longitude', 'che_application', 'created_at', 'updated_at', ),
  77. BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
  78. );
  79. /**
  80. * holds an array of keys for quick access to the fieldnames array
  81. *
  82. * first dimension keys are the type constants
  83. * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
  84. */
  85. private static $fieldKeys = array (
  86. BasePeer::TYPE_PHPNAME => array ('CheId2' => 0, 'UseId2' => 1, 'UseId' => 2, 'CheId' => 3, 'ConId' => 4, 'CheName' => 5, 'ChePlace' => 6, 'CheMessage' => 7, 'CheLatitude' => 8, 'CheLongitude' => 9, 'CheApplication' => 10, 'CreatedAt' => 11, 'UpdatedAt' => 12, ),
  87. BasePeer::TYPE_STUDLYPHPNAME => array ('cheId2' => 0, 'useId2' => 1, 'useId' => 2, 'cheId' => 3, 'conId' => 4, 'cheName' => 5, 'chePlace' => 6, 'cheMessage' => 7, 'cheLatitude' => 8, 'cheLongitude' => 9, 'cheApplication' => 10, 'createdAt' => 11, 'updatedAt' => 12, ),
  88. BasePeer::TYPE_COLNAME => array (self::CHE_ID2 => 0, self::USE_ID2 => 1, self::USE_ID => 2, self::CHE_ID => 3, self::CON_ID => 4, self::CHE_NAME => 5, self::CHE_PLACE => 6, self::CHE_MESSAGE => 7, self::CHE_LATITUDE => 8, self::CHE_LONGITUDE => 9, self::CHE_APPLICATION => 10, self::CREATED_AT => 11, self::UPDATED_AT => 12, ),
  89. BasePeer::TYPE_FIELDNAME => array ('che_id2' => 0, 'use_id2' => 1, 'use_id' => 2, 'che_id' => 3, 'con_id' => 4, 'che_name' => 5, 'che_place' => 6, 'che_message' => 7, 'che_latitude' => 8, 'che_longitude' => 9, 'che_application' => 10, 'created_at' => 11, 'updated_at' => 12, ),
  90. BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
  91. );
  92. /**
  93. * Translates a fieldname to another type
  94. *
  95. * @param string $name field name
  96. * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  97. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  98. * @param string $toType One of the class type constants
  99. * @return string translated name of the field.
  100. * @throws PropelException - if the specified name could not be found in the fieldname mappings.
  101. */
  102. static public function translateFieldName($name, $fromType, $toType)
  103. {
  104. $toNames = self::getFieldNames($toType);
  105. $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
  106. if ($key === null) {
  107. throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
  108. }
  109. return $toNames[$key];
  110. }
  111. /**
  112. * Returns an array of field names.
  113. *
  114. * @param string $type The type of fieldnames to return:
  115. * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  116. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  117. * @return array A list of field names
  118. */
  119. static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
  120. {
  121. if (!array_key_exists($type, self::$fieldNames)) {
  122. throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
  123. }
  124. return self::$fieldNames[$type];
  125. }
  126. /**
  127. * Convenience method which changes table.column to alias.column.
  128. *
  129. * Using this method you can maintain SQL abstraction while using column aliases.
  130. * <code>
  131. * $c->addAlias("alias1", TablePeer::TABLE_NAME);
  132. * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
  133. * </code>
  134. * @param string $alias The alias for the current table.
  135. * @param string $column The column name for current table. (i.e. CheckinsPeer::COLUMN_NAME).
  136. * @return string
  137. */
  138. public static function alias($alias, $column)
  139. {
  140. return str_replace(CheckinsPeer::TABLE_NAME.'.', $alias.'.', $column);
  141. }
  142. /**
  143. * Add all the columns needed to create a new object.
  144. *
  145. * Note: any columns that were marked with lazyLoad="true" in the
  146. * XML schema will not be added to the select list and only loaded
  147. * on demand.
  148. *
  149. * @param criteria object containing the columns to add.
  150. * @throws PropelException Any exceptions caught during processing will be
  151. * rethrown wrapped into a PropelException.
  152. */
  153. public static function addSelectColumns(Criteria $criteria)
  154. {
  155. $criteria->addSelectColumn(CheckinsPeer::CHE_ID2);
  156. $criteria->addSelectColumn(CheckinsPeer::USE_ID2);
  157. $criteria->addSelectColumn(CheckinsPeer::USE_ID);
  158. $criteria->addSelectColumn(CheckinsPeer::CHE_ID);
  159. $criteria->addSelectColumn(CheckinsPeer::CON_ID);
  160. $criteria->addSelectColumn(CheckinsPeer::CHE_NAME);
  161. $criteria->addSelectColumn(CheckinsPeer::CHE_PLACE);
  162. $criteria->addSelectColumn(CheckinsPeer::CHE_MESSAGE);
  163. $criteria->addSelectColumn(CheckinsPeer::CHE_LATITUDE);
  164. $criteria->addSelectColumn(CheckinsPeer::CHE_LONGITUDE);
  165. $criteria->addSelectColumn(CheckinsPeer::CHE_APPLICATION);
  166. $criteria->addSelectColumn(CheckinsPeer::CREATED_AT);
  167. $criteria->addSelectColumn(CheckinsPeer::UPDATED_AT);
  168. }
  169. /**
  170. * Returns the number of rows matching criteria.
  171. *
  172. * @param Criteria $criteria
  173. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  174. * @param PropelPDO $con
  175. * @return int Number of matching rows.
  176. */
  177. public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
  178. {
  179. // we may modify criteria, so copy it first
  180. $criteria = clone $criteria;
  181. // We need to set the primary table name, since in the case that there are no WHERE columns
  182. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  183. // tables go into the FROM clause.
  184. $criteria->setPrimaryTableName(CheckinsPeer::TABLE_NAME);
  185. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  186. $criteria->setDistinct();
  187. }
  188. if (!$criteria->hasSelectClause()) {
  189. CheckinsPeer::addSelectColumns($criteria);
  190. }
  191. $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
  192. $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
  193. if ($con === null) {
  194. $con = Propel::getConnection(CheckinsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  195. }
  196. // symfony_behaviors behavior
  197. foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook)
  198. {
  199. call_user_func($sf_hook, 'BaseCheckinsPeer', $criteria, $con);
  200. }
  201. // BasePeer returns a PDOStatement
  202. $stmt = BasePeer::doCount($criteria, $con);
  203. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  204. $count = (int) $row[0];
  205. } else {
  206. $count = 0; // no rows returned; we infer that means 0 matches.
  207. }
  208. $stmt->closeCursor();
  209. return $count;
  210. }
  211. /**
  212. * Method to select one object from the DB.
  213. *
  214. * @param Criteria $criteria object used to create the SELECT statement.
  215. * @param PropelPDO $con
  216. * @return Checkins
  217. * @throws PropelException Any exceptions caught during processing will be
  218. * rethrown wrapped into a PropelException.
  219. */
  220. public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
  221. {
  222. $critcopy = clone $criteria;
  223. $critcopy->setLimit(1);
  224. $objects = CheckinsPeer::doSelect($critcopy, $con);
  225. if ($objects) {
  226. return $objects[0];
  227. }
  228. return null;
  229. }
  230. /**
  231. * Method to do selects.
  232. *
  233. * @param Criteria $criteria The Criteria object used to build the SELECT statement.
  234. * @param PropelPDO $con
  235. * @return array Array of selected Objects
  236. * @throws PropelException Any exceptions caught during processing will be
  237. * rethrown wrapped into a PropelException.
  238. */
  239. public static function doSelect(Criteria $criteria, PropelPDO $con = null)
  240. {
  241. return CheckinsPeer::populateObjects(CheckinsPeer::doSelectStmt($criteria, $con));
  242. }
  243. /**
  244. * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
  245. *
  246. * Use this method directly if you want to work with an executed statement durirectly (for example
  247. * to perform your own object hydration).
  248. *
  249. * @param Criteria $criteria The Criteria object used to build the SELECT statement.
  250. * @param PropelPDO $con The connection to use
  251. * @throws PropelException Any exceptions caught during processing will be
  252. * rethrown wrapped into a PropelException.
  253. * @return PDOStatement The executed PDOStatement object.
  254. * @see BasePeer::doSelect()
  255. */
  256. public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
  257. {
  258. if ($con === null) {
  259. $con = Propel::getConnection(CheckinsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  260. }
  261. if (!$criteria->hasSelectClause()) {
  262. $criteria = clone $criteria;
  263. CheckinsPeer::addSelectColumns($criteria);
  264. }
  265. // Set the correct dbName
  266. $criteria->setDbName(self::DATABASE_NAME);
  267. // symfony_behaviors behavior
  268. foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook)
  269. {
  270. call_user_func($sf_hook, 'BaseCheckinsPeer', $criteria, $con);
  271. }
  272. // BasePeer returns a PDOStatement
  273. return BasePeer::doSelect($criteria, $con);
  274. }
  275. /**
  276. * Adds an object to the instance pool.
  277. *
  278. * Propel keeps cached copies of objects in an instance pool when they are retrieved
  279. * from the database. In some cases -- especially when you override doSelect*()
  280. * methods in your stub classes -- you may need to explicitly add objects
  281. * to the cache in order to ensure that the same objects are always returned by doSelect*()
  282. * and retrieveByPK*() calls.
  283. *
  284. * @param Checkins $value A Checkins object.
  285. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  286. */
  287. public static function addInstanceToPool(Checkins $obj, $key = null)
  288. {
  289. if (Propel::isInstancePoolingEnabled()) {
  290. if ($key === null) {
  291. $key = (string) $obj->getCheId2();
  292. } // if key === null
  293. self::$instances[$key] = $obj;
  294. }
  295. }
  296. /**
  297. * Removes an object from the instance pool.
  298. *
  299. * Propel keeps cached copies of objects in an instance pool when they are retrieved
  300. * from the database. In some cases -- especially when you override doDelete
  301. * methods in your stub classes -- you may need to explicitly remove objects
  302. * from the cache in order to prevent returning objects that no longer exist.
  303. *
  304. * @param mixed $value A Checkins object or a primary key value.
  305. */
  306. public static function removeInstanceFromPool($value)
  307. {
  308. if (Propel::isInstancePoolingEnabled() && $value !== null) {
  309. if (is_object($value) && $value instanceof Checkins) {
  310. $key = (string) $value->getCheId2();
  311. } elseif (is_scalar($value)) {
  312. // assume we've been passed a primary key
  313. $key = (string) $value;
  314. } else {
  315. $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or Checkins object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
  316. throw $e;
  317. }
  318. unset(self::$instances[$key]);
  319. }
  320. } // removeInstanceFromPool()
  321. /**
  322. * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
  323. *
  324. * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
  325. * a multi-column primary key, a serialize()d version of the primary key will be returned.
  326. *
  327. * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
  328. * @return Checkins Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
  329. * @see getPrimaryKeyHash()
  330. */
  331. public static function getInstanceFromPool($key)
  332. {
  333. if (Propel::isInstancePoolingEnabled()) {
  334. if (isset(self::$instances[$key])) {
  335. return self::$instances[$key];
  336. }
  337. }
  338. return null; // just to be explicit
  339. }
  340. /**
  341. * Clear the instance pool.
  342. *
  343. * @return void
  344. */
  345. public static function clearInstancePool()
  346. {
  347. self::$instances = array();
  348. }
  349. /**
  350. * Method to invalidate the instance pool of all tables related to checkins
  351. * by a foreign key with ON DELETE CASCADE
  352. */
  353. public static function clearRelatedInstancePool()
  354. {
  355. }
  356. /**
  357. * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
  358. *
  359. * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
  360. * a multi-column primary key, a serialize()d version of the primary key will be returned.
  361. *
  362. * @param array $row PropelPDO resultset row.
  363. * @param int $startcol The 0-based offset for reading from the resultset row.
  364. * @return string A string version of PK or NULL if the components of primary key in result array are all null.
  365. */
  366. public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
  367. {
  368. // If the PK cannot be derived from the row, return NULL.
  369. if ($row[$startcol] === null) {
  370. return null;
  371. }
  372. return (string) $row[$startcol];
  373. }
  374. /**
  375. * The returned array will contain objects of the default type or
  376. * objects that inherit from the default.
  377. *
  378. * @throws PropelException Any exceptions caught during processing will be
  379. * rethrown wrapped into a PropelException.
  380. */
  381. public static function populateObjects(PDOStatement $stmt)
  382. {
  383. $results = array();
  384. // set the class once to avoid overhead in the loop
  385. $cls = CheckinsPeer::getOMClass(false);
  386. // populate the object(s)
  387. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  388. $key = CheckinsPeer::getPrimaryKeyHashFromRow($row, 0);
  389. if (null !== ($obj = CheckinsPeer::getInstanceFromPool($key))) {
  390. // We no longer rehydrate the object, since this can cause data loss.
  391. // See http://propel.phpdb.org/trac/ticket/509
  392. // $obj->hydrate($row, 0, true); // rehydrate
  393. $results[] = $obj;
  394. } else {
  395. $obj = new $cls();
  396. $obj->hydrate($row);
  397. $results[] = $obj;
  398. CheckinsPeer::addInstanceToPool($obj, $key);
  399. } // if key exists
  400. }
  401. $stmt->closeCursor();
  402. return $results;
  403. }
  404. /**
  405. * Returns the number of rows matching criteria, joining the related Concurso table
  406. *
  407. * @param Criteria $criteria
  408. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  409. * @param PropelPDO $con
  410. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  411. * @return int Number of matching rows.
  412. */
  413. public static function doCountJoinConcurso(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
  414. {
  415. // we're going to modify criteria, so copy it first
  416. $criteria = clone $criteria;
  417. // We need to set the primary table name, since in the case that there are no WHERE columns
  418. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  419. // tables go into the FROM clause.
  420. $criteria->setPrimaryTableName(CheckinsPeer::TABLE_NAME);
  421. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  422. $criteria->setDistinct();
  423. }
  424. if (!$criteria->hasSelectClause()) {
  425. CheckinsPeer::addSelectColumns($criteria);
  426. }
  427. $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
  428. // Set the correct dbName
  429. $criteria->setDbName(self::DATABASE_NAME);
  430. if ($con === null) {
  431. $con = Propel::getConnection(CheckinsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  432. }
  433. $criteria->addJoin(CheckinsPeer::CON_ID, ConcursoPeer::CON_ID, $join_behavior);
  434. // symfony_behaviors behavior
  435. foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook)
  436. {
  437. call_user_func($sf_hook, 'BaseCheckinsPeer', $criteria, $con);
  438. }
  439. $stmt = BasePeer::doCount($criteria, $con);
  440. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  441. $count = (int) $row[0];
  442. } else {
  443. $count = 0; // no rows returned; we infer that means 0 matches.
  444. }
  445. $stmt->closeCursor();
  446. return $count;
  447. }
  448. /**
  449. * Returns the number of rows matching criteria, joining the related Users table
  450. *
  451. * @param Criteria $criteria
  452. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  453. * @param PropelPDO $con
  454. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  455. * @return int Number of matching rows.
  456. */
  457. public static function doCountJoinUsers(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
  458. {
  459. // we're going to modify criteria, so copy it first
  460. $criteria = clone $criteria;
  461. // We need to set the primary table name, since in the case that there are no WHERE columns
  462. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  463. // tables go into the FROM clause.
  464. $criteria->setPrimaryTableName(CheckinsPeer::TABLE_NAME);
  465. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  466. $criteria->setDistinct();
  467. }
  468. if (!$criteria->hasSelectClause()) {
  469. CheckinsPeer::addSelectColumns($criteria);
  470. }
  471. $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
  472. // Set the correct dbName
  473. $criteria->setDbName(self::DATABASE_NAME);
  474. if ($con === null) {
  475. $con = Propel::getConnection(CheckinsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  476. }
  477. $criteria->addJoin(CheckinsPeer::USE_ID2, UsersPeer::USE_ID2, $join_behavior);
  478. // symfony_behaviors behavior
  479. foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook)
  480. {
  481. call_user_func($sf_hook, 'BaseCheckinsPeer', $criteria, $con);
  482. }
  483. $stmt = BasePeer::doCount($criteria, $con);
  484. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  485. $count = (int) $row[0];
  486. } else {
  487. $count = 0; // no rows returned; we infer that means 0 matches.
  488. }
  489. $stmt->closeCursor();
  490. return $count;
  491. }
  492. /**
  493. * Selects a collection of Checkins objects pre-filled with their Concurso objects.
  494. * @param Criteria $criteria
  495. * @param PropelPDO $con
  496. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  497. * @return array Array of Checkins objects.
  498. * @throws PropelException Any exceptions caught during processing will be
  499. * rethrown wrapped into a PropelException.
  500. */
  501. public static function doSelectJoinConcurso(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  502. {
  503. $criteria = clone $criteria;
  504. // Set the correct dbName if it has not been overridden
  505. if ($criteria->getDbName() == Propel::getDefaultDB()) {
  506. $criteria->setDbName(self::DATABASE_NAME);
  507. }
  508. CheckinsPeer::addSelectColumns($criteria);
  509. $startcol = (CheckinsPeer::NUM_COLUMNS - CheckinsPeer::NUM_LAZY_LOAD_COLUMNS);
  510. ConcursoPeer::addSelectColumns($criteria);
  511. $criteria->addJoin(CheckinsPeer::CON_ID, ConcursoPeer::CON_ID, $join_behavior);
  512. // symfony_behaviors behavior
  513. foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook)
  514. {
  515. call_user_func($sf_hook, 'BaseCheckinsPeer', $criteria, $con);
  516. }
  517. $stmt = BasePeer::doSelect($criteria, $con);
  518. $results = array();
  519. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  520. $key1 = CheckinsPeer::getPrimaryKeyHashFromRow($row, 0);
  521. if (null !== ($obj1 = CheckinsPeer::getInstanceFromPool($key1))) {
  522. // We no longer rehydrate the object, since this can cause data loss.
  523. // See http://propel.phpdb.org/trac/ticket/509
  524. // $obj1->hydrate($row, 0, true); // rehydrate
  525. } else {
  526. $cls = CheckinsPeer::getOMClass(false);
  527. $obj1 = new $cls();
  528. $obj1->hydrate($row);
  529. CheckinsPeer::addInstanceToPool($obj1, $key1);
  530. } // if $obj1 already loaded
  531. $key2 = ConcursoPeer::getPrimaryKeyHashFromRow($row, $startcol);
  532. if ($key2 !== null) {
  533. $obj2 = ConcursoPeer::getInstanceFromPool($key2);
  534. if (!$obj2) {
  535. $cls = ConcursoPeer::getOMClass(false);
  536. $obj2 = new $cls();
  537. $obj2->hydrate($row, $startcol);
  538. ConcursoPeer::addInstanceToPool($obj2, $key2);
  539. } // if obj2 already loaded
  540. // Add the $obj1 (Checkins) to $obj2 (Concurso)
  541. $obj2->addCheckins($obj1);
  542. } // if joined row was not null
  543. $results[] = $obj1;
  544. }
  545. $stmt->closeCursor();
  546. return $results;
  547. }
  548. /**
  549. * Selects a collection of Checkins objects pre-filled with their Users objects.
  550. * @param Criteria $criteria
  551. * @param PropelPDO $con
  552. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  553. * @return array Array of Checkins objects.
  554. * @throws PropelException Any exceptions caught during processing will be
  555. * rethrown wrapped into a PropelException.
  556. */
  557. public static function doSelectJoinUsers(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  558. {
  559. $criteria = clone $criteria;
  560. // Set the correct dbName if it has not been overridden
  561. if ($criteria->getDbName() == Propel::getDefaultDB()) {
  562. $criteria->setDbName(self::DATABASE_NAME);
  563. }
  564. CheckinsPeer::addSelectColumns($criteria);
  565. $startcol = (CheckinsPeer::NUM_COLUMNS - CheckinsPeer::NUM_LAZY_LOAD_COLUMNS);
  566. UsersPeer::addSelectColumns($criteria);
  567. $criteria->addJoin(CheckinsPeer::USE_ID2, UsersPeer::USE_ID2, $join_behavior);
  568. // symfony_behaviors behavior
  569. foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook)
  570. {
  571. call_user_func($sf_hook, 'BaseCheckinsPeer', $criteria, $con);
  572. }
  573. $stmt = BasePeer::doSelect($criteria, $con);
  574. $results = array();
  575. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  576. $key1 = CheckinsPeer::getPrimaryKeyHashFromRow($row, 0);
  577. if (null !== ($obj1 = CheckinsPeer::getInstanceFromPool($key1))) {
  578. // We no longer rehydrate the object, since this can cause data loss.
  579. // See http://propel.phpdb.org/trac/ticket/509
  580. // $obj1->hydrate($row, 0, true); // rehydrate
  581. } else {
  582. $cls = CheckinsPeer::getOMClass(false);
  583. $obj1 = new $cls();
  584. $obj1->hydrate($row);
  585. CheckinsPeer::addInstanceToPool($obj1, $key1);
  586. } // if $obj1 already loaded
  587. $key2 = UsersPeer::getPrimaryKeyHashFromRow($row, $startcol);
  588. if ($key2 !== null) {
  589. $obj2 = UsersPeer::getInstanceFromPool($key2);
  590. if (!$obj2) {
  591. $cls = UsersPeer::getOMClass(false);
  592. $obj2 = new $cls();
  593. $obj2->hydrate($row, $startcol);
  594. UsersPeer::addInstanceToPool($obj2, $key2);
  595. } // if obj2 already loaded
  596. // Add the $obj1 (Checkins) to $obj2 (Users)
  597. $obj2->addCheckins($obj1);
  598. } // if joined row was not null
  599. $results[] = $obj1;
  600. }
  601. $stmt->closeCursor();
  602. return $results;
  603. }
  604. /**
  605. * Returns the number of rows matching criteria, joining all related tables
  606. *
  607. * @param Criteria $criteria
  608. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  609. * @param PropelPDO $con
  610. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  611. * @return int Number of matching rows.
  612. */
  613. public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
  614. {
  615. // we're going to modify criteria, so copy it first
  616. $criteria = clone $criteria;
  617. // We need to set the primary table name, since in the case that there are no WHERE columns
  618. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  619. // tables go into the FROM clause.
  620. $criteria->setPrimaryTableName(CheckinsPeer::TABLE_NAME);
  621. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  622. $criteria->setDistinct();
  623. }
  624. if (!$criteria->hasSelectClause()) {
  625. CheckinsPeer::addSelectColumns($criteria);
  626. }
  627. $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
  628. // Set the correct dbName
  629. $criteria->setDbName(self::DATABASE_NAME);
  630. if ($con === null) {
  631. $con = Propel::getConnection(CheckinsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  632. }
  633. $criteria->addJoin(CheckinsPeer::CON_ID, ConcursoPeer::CON_ID, $join_behavior);
  634. $criteria->addJoin(CheckinsPeer::USE_ID2, UsersPeer::USE_ID2, $join_behavior);
  635. // symfony_behaviors behavior
  636. foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook)
  637. {
  638. call_user_func($sf_hook, 'BaseCheckinsPeer', $criteria, $con);
  639. }
  640. $stmt = BasePeer::doCount($criteria, $con);
  641. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  642. $count = (int) $row[0];
  643. } else {
  644. $count = 0; // no rows returned; we infer that means 0 matches.
  645. }
  646. $stmt->closeCursor();
  647. return $count;
  648. }
  649. /**
  650. * Selects a collection of Checkins objects pre-filled with all related objects.
  651. *
  652. * @param Criteria $criteria
  653. * @param PropelPDO $con
  654. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  655. * @return array Array of Checkins objects.
  656. * @throws PropelException Any exceptions caught during processing will be
  657. * rethrown wrapped into a PropelException.
  658. */
  659. public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  660. {
  661. $criteria = clone $criteria;
  662. // Set the correct dbName if it has not been overridden
  663. if ($criteria->getDbName() == Propel::getDefaultDB()) {
  664. $criteria->setDbName(self::DATABASE_NAME);
  665. }
  666. CheckinsPeer::addSelectColumns($criteria);
  667. $startcol2 = (CheckinsPeer::NUM_COLUMNS - CheckinsPeer::NUM_LAZY_LOAD_COLUMNS);
  668. ConcursoPeer::addSelectColumns($criteria);
  669. $startcol3 = $startcol2 + (ConcursoPeer::NUM_COLUMNS - ConcursoPeer::NUM_LAZY_LOAD_COLUMNS);
  670. UsersPeer::addSelectColumns($criteria);
  671. $startcol4 = $startcol3 + (UsersPeer::NUM_COLUMNS - UsersPeer::NUM_LAZY_LOAD_COLUMNS);
  672. $criteria->addJoin(CheckinsPeer::CON_ID, ConcursoPeer::CON_ID, $join_behavior);
  673. $criteria->addJoin(CheckinsPeer::USE_ID2, UsersPeer::USE_ID2, $join_behavior);
  674. // symfony_behaviors behavior
  675. foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook)
  676. {
  677. call_user_func($sf_hook, 'BaseCheckinsPeer', $criteria, $con);
  678. }
  679. $stmt = BasePeer::doSelect($criteria, $con);
  680. $results = array();
  681. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  682. $key1 = CheckinsPeer::getPrimaryKeyHashFromRow($row, 0);
  683. if (null !== ($obj1 = CheckinsPeer::getInstanceFromPool($key1))) {
  684. // We no longer rehydrate the object, since this can cause data loss.
  685. // See http://propel.phpdb.org/trac/ticket/509
  686. // $obj1->hydrate($row, 0, true); // rehydrate
  687. } else {
  688. $cls = CheckinsPeer::getOMClass(false);
  689. $obj1 = new $cls();
  690. $obj1->hydrate($row);
  691. CheckinsPeer::addInstanceToPool($obj1, $key1);
  692. } // if obj1 already loaded
  693. // Add objects for joined Concurso rows
  694. $key2 = ConcursoPeer::getPrimaryKeyHashFromRow($row, $startcol2);
  695. if ($key2 !== null) {
  696. $obj2 = ConcursoPeer::getInstanceFromPool($key2);
  697. if (!$obj2) {
  698. $cls = ConcursoPeer::getOMClass(false);
  699. $obj2 = new $cls();
  700. $obj2->hydrate($row, $startcol2);
  701. ConcursoPeer::addInstanceToPool($obj2, $key2);
  702. } // if obj2 loaded
  703. // Add the $obj1 (Checkins) to the collection in $obj2 (Concurso)
  704. $obj2->addCheckins($obj1);
  705. } // if joined row not null
  706. // Add objects for joined Users rows
  707. $key3 = UsersPeer::getPrimaryKeyHashFromRow($row, $startcol3);
  708. if ($key3 !== null) {
  709. $obj3 = UsersPeer::getInstanceFromPool($key3);
  710. if (!$obj3) {
  711. $cls = UsersPeer::getOMClass(false);
  712. $obj3 = new $cls();
  713. $obj3->hydrate($row, $startcol3);
  714. UsersPeer::addInstanceToPool($obj3, $key3);
  715. } // if obj3 loaded
  716. // Add the $obj1 (Checkins) to the collection in $obj3 (Users)
  717. $obj3->addCheckins($obj1);
  718. } // if joined row not null
  719. $results[] = $obj1;
  720. }
  721. $stmt->closeCursor();
  722. return $results;
  723. }
  724. /**
  725. * Returns the number of rows matching criteria, joining the related Concurso table
  726. *
  727. * @param Criteria $criteria
  728. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  729. * @param PropelPDO $con
  730. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  731. * @return int Number of matching rows.
  732. */
  733. public static function doCountJoinAllExceptConcurso(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
  734. {
  735. // we're going to modify criteria, so copy it first
  736. $criteria = clone $criteria;
  737. // We need to set the primary table name, since in the case that there are no WHERE columns
  738. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  739. // tables go into the FROM clause.
  740. $criteria->setPrimaryTableName(CheckinsPeer::TABLE_NAME);
  741. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  742. $criteria->setDistinct();
  743. }
  744. if (!$criteria->hasSelectClause()) {
  745. CheckinsPeer::addSelectColumns($criteria);
  746. }
  747. $criteria->clearOrderByColumns(); // ORDER BY should not affect count
  748. // Set the correct dbName
  749. $criteria->setDbName(self::DATABASE_NAME);
  750. if ($con === null) {
  751. $con = Propel::getConnection(CheckinsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  752. }
  753. $criteria->addJoin(CheckinsPeer::USE_ID2, UsersPeer::USE_ID2, $join_behavior);
  754. // symfony_behaviors behavior
  755. foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook)
  756. {
  757. call_user_func($sf_hook, 'BaseCheckinsPeer', $criteria, $con);
  758. }
  759. $stmt = BasePeer::doCount($criteria, $con);
  760. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  761. $count = (int) $row[0];
  762. } else {
  763. $count = 0; // no rows returned; we infer that means 0 matches.
  764. }
  765. $stmt->closeCursor();
  766. return $count;
  767. }
  768. /**
  769. * Returns the number of rows matching criteria, joining the related Users table
  770. *
  771. * @param Criteria $criteria
  772. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  773. * @param PropelPDO $con
  774. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  775. * @return int Number of matching rows.
  776. */
  777. public static function doCountJoinAllExceptUsers(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
  778. {
  779. // we're going to modify criteria, so copy it first
  780. $criteria = clone $criteria;
  781. // We need to set the primary table name, since in the case that there are no WHERE columns
  782. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  783. // tables go into the FROM clause.
  784. $criteria->setPrimaryTableName(CheckinsPeer::TABLE_NAME);
  785. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  786. $criteria->setDistinct();
  787. }
  788. if (!$criteria->hasSelectClause()) {
  789. CheckinsPeer::addSelectColumns($criteria);
  790. }
  791. $criteria->clearOrderByColumns(); // ORDER BY should not affect count
  792. // Set the correct dbName
  793. $criteria->setDbName(self::DATABASE_NAME);
  794. if ($con === null) {
  795. $con = Propel::getConnection(CheckinsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  796. }
  797. $criteria->addJoin(CheckinsPeer::CON_ID, ConcursoPeer::CON_ID, $join_behavior);
  798. // symfony_behaviors behavior
  799. foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook)
  800. {
  801. call_user_func($sf_hook, 'BaseCheckinsPeer', $criteria, $con);
  802. }
  803. $stmt = BasePeer::doCount($criteria, $con);
  804. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  805. $count = (int) $row[0];
  806. } else {
  807. $count = 0; // no rows returned; we infer that means 0 matches.
  808. }
  809. $stmt->closeCursor();
  810. return $count;
  811. }
  812. /**
  813. * Selects a collection of Checkins objects pre-filled with all related objects except Concurso.
  814. *
  815. * @param Criteria $criteria
  816. * @param PropelPDO $con
  817. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  818. * @return array Array of Checkins objects.
  819. * @throws PropelException Any exceptions caught during processing will be
  820. * rethrown wrapped into a PropelException.
  821. */
  822. public static function doSelectJoinAllExceptConcurso(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  823. {
  824. $criteria = clone $criteria;
  825. // Set the correct dbName if it has not been overridden
  826. // $criteria->getDbName() will return the same object if not set to another value
  827. // so == check is okay and faster
  828. if ($criteria->getDbName() == Propel::getDefaultDB()) {
  829. $criteria->setDbName(self::DATABASE_NAME);
  830. }
  831. CheckinsPeer::addSelectColumns($criteria);
  832. $startcol2 = (CheckinsPeer::NUM_COLUMNS - CheckinsPeer::NUM_LAZY_LOAD_COLUMNS);
  833. UsersPeer::addSelectColumns($criteria);
  834. $startcol3 = $startcol2 + (UsersPeer::NUM_COLUMNS - UsersPeer::NUM_LAZY_LOAD_COLUMNS);
  835. $criteria->addJoin(CheckinsPeer::USE_ID2, UsersPeer::USE_ID2, $join_behavior);
  836. // symfony_behaviors behavior
  837. foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook)
  838. {
  839. call_user_func($sf_hook, 'BaseCheckinsPeer', $criteria, $con);
  840. }
  841. $stmt = BasePeer::doSelect($criteria, $con);
  842. $results = array();
  843. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  844. $key1 = CheckinsPeer::getPrimaryKeyHashFromRow($row, 0);
  845. if (null !== ($obj1 = CheckinsPeer::getInstanceFromPool($key1))) {
  846. // We no longer rehydrate the object, since this can cause data loss.
  847. // See http://propel.phpdb.org/trac/ticket/509
  848. // $obj1->hydrate($row, 0, true); // rehydrate
  849. } else {
  850. $cls = CheckinsPeer::getOMClass(false);
  851. $obj1 = new $cls();
  852. $obj1->hydrate($row);
  853. CheckinsPeer::addInstanceToPool($obj1, $key1);
  854. } // if obj1 already loaded
  855. // Add objects for joined Users rows
  856. $key2 = UsersPeer::getPrimaryKeyHashFromRow($row, $startcol2);
  857. if ($key2 !== null) {
  858. $obj2 = UsersPeer::getInstanceFromPool($key2);
  859. if (!$obj2) {
  860. $cls = UsersPeer::getOMClass(false);
  861. $obj2 = new $cls();
  862. $obj2->hydrate($row, $startcol2);
  863. UsersPeer::addInstanceToPool($obj2, $key2);
  864. } // if $obj2 already loaded
  865. // Add the $obj1 (Checkins) to the collection in $obj2 (Users)
  866. $obj2->addCheckins($obj1);
  867. } // if joined row is not null
  868. $results[] = $obj1;
  869. }
  870. $stmt->closeCursor();
  871. return $results;
  872. }
  873. /**
  874. * Selects a collection of Checkins objects pre-filled with all related objects except Users.
  875. *
  876. * @param Criteria $criteria
  877. * @param PropelPDO $con
  878. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  879. * @return array Array of Checkins objects.
  880. * @throws PropelException Any exceptions caught during processing will be
  881. * rethrown wrapped into a PropelException.
  882. */
  883. public static function doSelectJoinAllExceptUsers(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  884. {
  885. $criteria = clone $criteria;
  886. // Set the correct dbName if it has not been overridden
  887. // $criteria->getDbName() will return the same object if not set to another value
  888. // so == check is okay and faster
  889. if ($criteria->getDbName() == Propel::getDefaultDB()) {
  890. $criteria->setDbName(self::DATABASE_NAME);
  891. }
  892. CheckinsPeer::addSelectColumns($criteria);
  893. $startcol2 = (CheckinsPeer::NUM_COLUMNS - CheckinsPeer::NUM_LAZY_LOAD_COLUMNS);
  894. ConcursoPeer::addSelectColumns($criteria);
  895. $startcol3 = $startcol2 + (ConcursoPeer::NUM_COLUMNS - ConcursoPeer::NUM_LAZY_LOAD_COLUMNS);
  896. $criteria->addJoin(CheckinsPeer::CON_ID, ConcursoPeer::CON_ID, $join_behavior);
  897. // symfony_behaviors behavior
  898. foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook)
  899. {
  900. call_user_func($sf_hook, 'BaseCheckinsPeer', $criteria, $con);
  901. }
  902. $stmt = BasePeer::doSelect($criteria, $con);
  903. $results = array();
  904. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  905. $key1 = CheckinsPeer::getPrimaryKeyHashFromRow($row, 0);
  906. if (null !== ($obj1 = CheckinsPeer::getInstanceFromPool($key1))) {
  907. // We no longer rehydrate the object, since this can cause data loss.
  908. // See http://propel.phpdb.org/trac/ticket/509
  909. // $obj1->hydrate($row, 0, true); // rehydrate
  910. } else {
  911. $cls = CheckinsPeer::getOMClass(false);
  912. $obj1 = new $cls();
  913. $obj1->hydrate($row);
  914. CheckinsPeer::addInstanceToPool($obj1, $key1);
  915. } // if obj1 already loaded
  916. // Add objects for joined Concurso rows
  917. $key2 = ConcursoPeer::getPrimaryKeyHashFromRow($row, $startcol2);
  918. if ($key2 !== null) {
  919. $obj2 = ConcursoPeer::getInstanceFromPool($key2);
  920. if (!$obj2) {
  921. $cls = ConcursoPeer::getOMClass(false);
  922. $obj2 = new $cls();
  923. $obj2->hydrate($row, $startcol2);
  924. ConcursoPeer::addInstanceToPool($obj2, $key2);
  925. } // if $obj2 already loaded
  926. // Add the $obj1 (Checkins) to the collection in $obj2 (Concurso)
  927. $obj2->addCheckins($obj1);
  928. } // if joined row is not null
  929. $results[] = $obj1;
  930. }
  931. $stmt->closeCursor();
  932. return $results;
  933. }
  934. /**
  935. * Returns the TableMap related to this peer.
  936. * This method is not needed for general use but a specific application could have a need.
  937. * @return TableMap
  938. * @throws PropelException Any exceptions caught during processing will be
  939. * rethrown wrapped into a PropelException.
  940. */
  941. public static function getTableMap()
  942. {
  943. return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
  944. }
  945. /**
  946. * Add a TableMap instance to the database for this peer class.
  947. */
  948. public static function buildTableMap()
  949. {
  950. $dbMap = Propel::getDatabaseMap(BaseCheckinsPeer::DATABASE_NAME);
  951. if (!$dbMap->hasTable(BaseCheckinsPeer::TABLE_NAME))
  952. {
  953. $dbMap->addTableObject(new CheckinsTableMap());
  954. }
  955. }
  956. /**
  957. * The class that the Peer will make instances of.
  958. *
  959. * If $withPrefix is true, the returned path
  960. * uses a dot-path notation which is tranalted into a path
  961. * relative to a location on the PHP include_path.
  962. * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
  963. *
  964. * @param boolean Whether or not to return the path wit hthe class name
  965. * @return string path.to.ClassName
  966. */
  967. public static function getOMClass($withPrefix = true)
  968. {
  969. return $withPrefix ? CheckinsPeer::CLASS_DEFAULT : CheckinsPeer::OM_CLASS;
  970. }
  971. /**
  972. * Method perform an INSERT on the database, given a Checkins or Criteria object.
  973. *
  974. * @param mixed $values Criteria or Checkins object containing data that is used to create the INSERT statement.
  975. * @param PropelPDO $con the PropelPDO connection to use
  976. * @return mixed The new primary key.
  977. * @throws PropelException Any exceptions caught during processing will be
  978. * rethrown wrapped into a PropelException.
  979. */
  980. public static function doInsert($values, PropelPDO $con = null)
  981. {
  982. // symfony_behaviors behavior
  983. foreach (sfMixer::getCallables('BaseCheckinsPeer:doInsert:pre') as $sf_hook)
  984. {
  985. if (false !== $sf_hook_retval = call_user_func($sf_hook, 'BaseCheckinsPeer', $values, $con))
  986. {
  987. return $sf_hook_retval;
  988. }
  989. }
  990. if ($con === null) {
  991. $con = Propel::getConnection(CheckinsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  992. }
  993. if ($values instanceof Criteria) {
  994. $criteria = clone $values; // rename for clarity
  995. } else {
  996. $criteria = $values->buildCriteria(); // build Criteria from Checkins object
  997. }
  998. if ($criteria->containsKey(CheckinsPeer::CHE_ID2) && $criteria->keyContainsValue(CheckinsPeer::CHE_ID2) ) {
  999. throw new PropelException('Cannot insert a value for auto-increment primary key ('.CheckinsPeer::CHE_ID2.')');
  1000. }
  1001. // Set the correct dbName
  1002. $criteria->setDbName(self::DATABASE_NAME);
  1003. try {
  1004. // use transaction because $criteria could contain info
  1005. // for more than one table (I guess, conceivably)
  1006. $con->beginTransaction();
  1007. $pk = BasePeer::doInsert($criteria, $con);
  1008. $con->commit();
  1009. } catch(PropelException $e) {
  1010. $con->rollBack();
  1011. throw $e;
  1012. }
  1013. // symfony_behaviors behavior
  1014. foreach (sfMixer::getCallables('BaseCheckinsPeer:doInsert:post') as $sf_hook)
  1015. {
  1016. call_user_func($sf_hook, 'BaseCheckinsPeer', $values, $con, $pk);
  1017. }
  1018. return $pk;
  1019. }
  1020. /**
  1021. * Method perform an UPDATE on the database, given a Checkins or Criteria object.
  1022. *
  1023. * @param mixed $values Criteria or Checkins object containing data that is used to create the UPDATE statement.
  1024. * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
  1025. * @return int The number of affected rows (if supported by underlying database driver).
  1026. * @throws PropelException Any exceptions caught during processing will be
  1027. * rethrown wrapped into a PropelException.
  1028. */
  1029. public static function doUpdate($values, PropelPDO $con = null)
  1030. {
  1031. // symfony_behaviors behavior
  1032. foreach (sfMixer::getCallables('BaseCheckinsPeer:doUpdate:pre') as $sf_hook)
  1033. {
  1034. if (false !== $sf_hook_retval = call_user_func($sf_hook, 'BaseCheckinsPeer', $values, $con))
  1035. {
  1036. return $sf_hook_retval;
  1037. }
  1038. }
  1039. if ($con === null) {
  1040. $con = Propel::getConnection(CheckinsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  1041. }
  1042. $selectCriteria = new Criteria(self::DATABASE_NAME);
  1043. if ($values instanceof Criteria) {
  1044. $criteria = clone $values; // rename for clarity
  1045. $comparison = $criteria->getComparison(CheckinsPeer::CHE_ID2);
  1046. $selectCriteria->add(CheckinsPeer::CHE_ID2, $criteria->remove(CheckinsPeer::CHE_ID2), $comparison);
  1047. } else { // $values is Checkins object
  1048. $criteria = $values->buildCriteria(); // gets full criteria
  1049. $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
  1050. }
  1051. // set the correct dbName
  1052. $criteria->setDbName(self::DATABASE_NAME);
  1053. $ret = BasePeer::doUpdate($selectCriteria, $criteria, $con);
  1054. // symfony_behaviors behavior
  1055. foreach (sfMixer::getCallables('BaseCheckinsPeer:doUpdate:post') as $sf_hook)
  1056. {
  1057. call_user_func($sf_hook, 'BaseCheckinsPeer', $values, $con, $ret);
  1058. }
  1059. return $ret;
  1060. }
  1061. /**
  1062. * Method to DELETE all rows from the checkins table.
  1063. *
  1064. * @return int The number of affected rows (if supported by underlying database driver).
  1065. */
  1066. public static function doDeleteAll($con = null)
  1067. {
  1068. if ($con === null) {
  1069. $con = Propel::getConnection(CheckinsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  1070. }
  1071. $affectedRows = 0; // initialize var to track total num of affected rows
  1072. try {
  1073. // use transaction because $criteria could contain info
  1074. // for more than one table or we could emulating ON DELETE CASCADE, etc.
  1075. $con->beginTransaction();
  1076. $affectedRows += BasePeer::doDeleteAll(CheckinsPeer::TABLE_NAME, $con);
  1077. // Because this db requires some delete cascade/set null emulation, we have to
  1078. // clear the cached instance *after* the emulation has happened (since
  1079. // instances get re-added by the select statement contained therein).
  1080. CheckinsPeer::clearInstancePool();
  1081. CheckinsPeer::clearRelatedInstancePool();
  1082. $con->commit();
  1083. return $affectedRows;
  1084. } catch (PropelException $e) {
  1085. $con->rollBack();
  1086. throw $e;
  1087. }
  1088. }
  1089. /**
  1090. * Method perform a DELETE on the database, given a Checkins or Criteria object OR a primary key value.
  1091. *
  1092. * @param mixed $values Criteria or Checkins object or primary key or array of primary keys
  1093. * which is used to create the DELETE statement
  1094. * @param PropelPDO $con the connection to use
  1095. * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
  1096. * if supported by native driver or if emulated using Propel.
  1097. * @throws PropelException Any exceptions caught during processing will be
  1098. * rethrown wrapped into a PropelException.
  1099. */
  1100. public static function doDelete($values, PropelPDO $con = null)
  1101. {
  1102. if ($con === null) {
  1103. $con = Propel::getConnection(CheckinsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  1104. }
  1105. if ($values instanceof Criteria) {
  1106. // invalidate the cache for all objects of this type, since we have no
  1107. // way of knowing (without running a query) what objects should be invalidated
  1108. // from the cache based on this Criteria.
  1109. CheckinsPeer::clearInstancePool();
  1110. // rename for clarity
  1111. $criteria = clone $values;
  1112. } elseif ($values instanceof Checkins) { // it's a model object
  1113. // invalidate the cache for this single object
  1114. CheckinsPeer::removeInstanceFromPool($values);
  1115. // create criteria based on pk values
  1116. $criteria = $values->buildPkeyCriteria();
  1117. } else { // it's a primary key, or an array of pks
  1118. $criteria = new Criteria(self::DATABASE_NAME);
  1119. $criteria->add(CheckinsPeer::CHE_ID2, (array) $values, Criteria::IN);
  1120. // invalidate the cache for this object(s)
  1121. foreach ((array) $values as $singleval) {
  1122. CheckinsPeer::removeInstanceFromPool($singleval);
  1123. }
  1124. }
  1125. // Set the correct dbName
  1126. $criteria->setDbName(self::DATABASE_NAME);
  1127. $affectedRows = 0; // initialize var to track total num of affected rows
  1128. try {
  1129. // use transaction because $criteria could contain info
  1130. // for more than one table or we could emulating ON DELETE CASCADE, etc.
  1131. $con->beginTransaction();
  1132. $affectedRows += BasePeer::doDelete($criteria, $con);
  1133. CheckinsPeer::clearRelatedInstancePool();
  1134. $con->commit();
  1135. return $affectedRows;
  1136. } catch (PropelException $e) {
  1137. $con->rollBack();
  1138. throw $e;
  1139. }
  1140. }
  1141. /**
  1142. * Validates all modified columns of given Checkins object.
  1143. * If parameter $columns is either a single column name or an array of column names
  1144. * than only those columns are validated.
  1145. *
  1146. * NOTICE: This does not apply to primary or foreign keys for now.
  1147. *
  1148. * @param Checkins $obj The object to validate.
  1149. * @param mixed $cols Column name or array of column names.
  1150. *
  1151. * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
  1152. */
  1153. public static function doValidate(Checkins $obj, $cols = null)
  1154. {
  1155. $columns = array();
  1156. if ($cols) {
  1157. $dbMap = Propel::getDatabaseMap(CheckinsPeer::DATABASE_NAME);
  1158. $tableMap = $dbMap->getTable(Checkins

Large files files are truncated, but you can click here to view the full file