PageRenderTime 63ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/model/om/BaseGroupsPeer.php

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

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