PageRenderTime 67ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 1ms

/lib/model/om/BaseStatusesPeer.php

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

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