BaseKataoAssocMemberGroupPeer.php 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191
  1. <?php
  2. /**
  3. * Base static class for performing query and update operations on the 'katao_assoc_member_group' table.
  4. *
  5. *
  6. *
  7. * @package lib.model.om
  8. */
  9. abstract class BaseKataoAssocMemberGroupPeer {
  10. /** the default database name for this class */
  11. const DATABASE_NAME = 'propel';
  12. /** the table name for this class */
  13. const TABLE_NAME = 'katao_assoc_member_group';
  14. /** A class that can be returned by this peer. */
  15. const CLASS_DEFAULT = 'lib.model.KataoAssocMemberGroup';
  16. /** The total number of columns. */
  17. const NUM_COLUMNS = 2;
  18. /** The number of lazy-loaded columns. */
  19. const NUM_LAZY_LOAD_COLUMNS = 0;
  20. /** the column name for the MEMBER_ID field */
  21. const MEMBER_ID = 'katao_assoc_member_group.MEMBER_ID';
  22. /** the column name for the GROUP_ID field */
  23. const GROUP_ID = 'katao_assoc_member_group.GROUP_ID';
  24. /** The PHP to DB Name Mapping */
  25. private static $phpNameMap = null;
  26. /**
  27. * holds an array of fieldnames
  28. *
  29. * first dimension keys are the type constants
  30. * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
  31. */
  32. private static $fieldNames = array (
  33. BasePeer::TYPE_PHPNAME => array ('MemberId', 'GroupId', ),
  34. BasePeer::TYPE_COLNAME => array (KataoAssocMemberGroupPeer::MEMBER_ID, KataoAssocMemberGroupPeer::GROUP_ID, ),
  35. BasePeer::TYPE_FIELDNAME => array ('member_id', 'group_id', ),
  36. BasePeer::TYPE_NUM => array (0, 1, )
  37. );
  38. /**
  39. * holds an array of keys for quick access to the fieldnames array
  40. *
  41. * first dimension keys are the type constants
  42. * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
  43. */
  44. private static $fieldKeys = array (
  45. BasePeer::TYPE_PHPNAME => array ('MemberId' => 0, 'GroupId' => 1, ),
  46. BasePeer::TYPE_COLNAME => array (KataoAssocMemberGroupPeer::MEMBER_ID => 0, KataoAssocMemberGroupPeer::GROUP_ID => 1, ),
  47. BasePeer::TYPE_FIELDNAME => array ('member_id' => 0, 'group_id' => 1, ),
  48. BasePeer::TYPE_NUM => array (0, 1, )
  49. );
  50. /**
  51. * @return MapBuilder the map builder for this peer
  52. * @throws PropelException Any exceptions caught during processing will be
  53. * rethrown wrapped into a PropelException.
  54. */
  55. public static function getMapBuilder()
  56. {
  57. return BasePeer::getMapBuilder('lib.model.map.KataoAssocMemberGroupMapBuilder');
  58. }
  59. /**
  60. * Gets a map (hash) of PHP names to DB column names.
  61. *
  62. * @return array The PHP to DB name map for this peer
  63. * @throws PropelException Any exceptions caught during processing will be
  64. * rethrown wrapped into a PropelException.
  65. * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
  66. */
  67. public static function getPhpNameMap()
  68. {
  69. if (self::$phpNameMap === null) {
  70. $map = KataoAssocMemberGroupPeer::getTableMap();
  71. $columns = $map->getColumns();
  72. $nameMap = array();
  73. foreach ($columns as $column) {
  74. $nameMap[$column->getPhpName()] = $column->getColumnName();
  75. }
  76. self::$phpNameMap = $nameMap;
  77. }
  78. return self::$phpNameMap;
  79. }
  80. /**
  81. * Translates a fieldname to another type
  82. *
  83. * @param string $name field name
  84. * @param string $fromType One of the class type constants TYPE_PHPNAME,
  85. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  86. * @param string $toType One of the class type constants
  87. * @return string translated name of the field.
  88. */
  89. static public function translateFieldName($name, $fromType, $toType)
  90. {
  91. $toNames = self::getFieldNames($toType);
  92. $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
  93. if ($key === null) {
  94. throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
  95. }
  96. return $toNames[$key];
  97. }
  98. /**
  99. * Returns an array of of field names.
  100. *
  101. * @param string $type The type of fieldnames to return:
  102. * One of the class type constants TYPE_PHPNAME,
  103. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  104. * @return array A list of field names
  105. */
  106. static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
  107. {
  108. if (!array_key_exists($type, self::$fieldNames)) {
  109. throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
  110. }
  111. return self::$fieldNames[$type];
  112. }
  113. /**
  114. * Convenience method which changes table.column to alias.column.
  115. *
  116. * Using this method you can maintain SQL abstraction while using column aliases.
  117. * <code>
  118. * $c->addAlias("alias1", TablePeer::TABLE_NAME);
  119. * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
  120. * </code>
  121. * @param string $alias The alias for the current table.
  122. * @param string $column The column name for current table. (i.e. KataoAssocMemberGroupPeer::COLUMN_NAME).
  123. * @return string
  124. */
  125. public static function alias($alias, $column)
  126. {
  127. return str_replace(KataoAssocMemberGroupPeer::TABLE_NAME.'.', $alias.'.', $column);
  128. }
  129. /**
  130. * Add all the columns needed to create a new object.
  131. *
  132. * Note: any columns that were marked with lazyLoad="true" in the
  133. * XML schema will not be added to the select list and only loaded
  134. * on demand.
  135. *
  136. * @param criteria object containing the columns to add.
  137. * @throws PropelException Any exceptions caught during processing will be
  138. * rethrown wrapped into a PropelException.
  139. */
  140. public static function addSelectColumns(Criteria $criteria)
  141. {
  142. $criteria->addSelectColumn(KataoAssocMemberGroupPeer::MEMBER_ID);
  143. $criteria->addSelectColumn(KataoAssocMemberGroupPeer::GROUP_ID);
  144. }
  145. const COUNT = 'COUNT(katao_assoc_member_group.MEMBER_ID)';
  146. const COUNT_DISTINCT = 'COUNT(DISTINCT katao_assoc_member_group.MEMBER_ID)';
  147. /**
  148. * Returns the number of rows matching criteria.
  149. *
  150. * @param Criteria $criteria
  151. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  152. * @param Connection $con
  153. * @return int Number of matching rows.
  154. */
  155. public static function doCount(Criteria $criteria, $distinct = false, $con = null)
  156. {
  157. // we're going to modify criteria, so copy it first
  158. $criteria = clone $criteria;
  159. // clear out anything that might confuse the ORDER BY clause
  160. $criteria->clearSelectColumns()->clearOrderByColumns();
  161. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  162. $criteria->addSelectColumn(KataoAssocMemberGroupPeer::COUNT_DISTINCT);
  163. } else {
  164. $criteria->addSelectColumn(KataoAssocMemberGroupPeer::COUNT);
  165. }
  166. // just in case we're grouping: add those columns to the select statement
  167. foreach($criteria->getGroupByColumns() as $column)
  168. {
  169. $criteria->addSelectColumn($column);
  170. }
  171. $rs = KataoAssocMemberGroupPeer::doSelectRS($criteria, $con);
  172. if ($rs->next()) {
  173. return $rs->getInt(1);
  174. } else {
  175. // no rows returned; we infer that means 0 matches.
  176. return 0;
  177. }
  178. }
  179. /**
  180. * Method to select one object from the DB.
  181. *
  182. * @param Criteria $criteria object used to create the SELECT statement.
  183. * @param Connection $con
  184. * @return KataoAssocMemberGroup
  185. * @throws PropelException Any exceptions caught during processing will be
  186. * rethrown wrapped into a PropelException.
  187. */
  188. public static function doSelectOne(Criteria $criteria, $con = null)
  189. {
  190. $critcopy = clone $criteria;
  191. $critcopy->setLimit(1);
  192. $objects = KataoAssocMemberGroupPeer::doSelect($critcopy, $con);
  193. if ($objects) {
  194. return $objects[0];
  195. }
  196. return null;
  197. }
  198. /**
  199. * Method to do selects.
  200. *
  201. * @param Criteria $criteria The Criteria object used to build the SELECT statement.
  202. * @param Connection $con
  203. * @return array Array of selected Objects
  204. * @throws PropelException Any exceptions caught during processing will be
  205. * rethrown wrapped into a PropelException.
  206. */
  207. public static function doSelect(Criteria $criteria, $con = null)
  208. {
  209. return KataoAssocMemberGroupPeer::populateObjects(KataoAssocMemberGroupPeer::doSelectRS($criteria, $con));
  210. }
  211. /**
  212. * Prepares the Criteria object and uses the parent doSelect()
  213. * method to get a ResultSet.
  214. *
  215. * Use this method directly if you want to just get the resultset
  216. * (instead of an array of objects).
  217. *
  218. * @param Criteria $criteria The Criteria object used to build the SELECT statement.
  219. * @param Connection $con the connection to use
  220. * @throws PropelException Any exceptions caught during processing will be
  221. * rethrown wrapped into a PropelException.
  222. * @return ResultSet The resultset object with numerically-indexed fields.
  223. * @see BasePeer::doSelect()
  224. */
  225. public static function doSelectRS(Criteria $criteria, $con = null)
  226. {
  227. foreach (sfMixer::getCallables('BaseKataoAssocMemberGroupPeer:doSelectRS:doSelectRS') as $callable)
  228. {
  229. call_user_func($callable, 'BaseKataoAssocMemberGroupPeer', $criteria, $con);
  230. }
  231. if ($con === null) {
  232. $con = Propel::getConnection(self::DATABASE_NAME);
  233. }
  234. if (!$criteria->getSelectColumns()) {
  235. $criteria = clone $criteria;
  236. KataoAssocMemberGroupPeer::addSelectColumns($criteria);
  237. }
  238. // Set the correct dbName
  239. $criteria->setDbName(self::DATABASE_NAME);
  240. // BasePeer returns a Creole ResultSet, set to return
  241. // rows indexed numerically.
  242. return BasePeer::doSelect($criteria, $con);
  243. }
  244. /**
  245. * The returned array will contain objects of the default type or
  246. * objects that inherit from the default.
  247. *
  248. * @throws PropelException Any exceptions caught during processing will be
  249. * rethrown wrapped into a PropelException.
  250. */
  251. public static function populateObjects(ResultSet $rs)
  252. {
  253. $results = array();
  254. // set the class once to avoid overhead in the loop
  255. $cls = KataoAssocMemberGroupPeer::getOMClass();
  256. $cls = sfPropel::import($cls);
  257. // populate the object(s)
  258. while($rs->next()) {
  259. $obj = new $cls();
  260. $obj->hydrate($rs);
  261. $results[] = $obj;
  262. }
  263. return $results;
  264. }
  265. /**
  266. * Returns the number of rows matching criteria, joining the related KataoMember table
  267. *
  268. * @param Criteria $c
  269. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  270. * @param Connection $con
  271. * @return int Number of matching rows.
  272. */
  273. public static function doCountJoinKataoMember(Criteria $criteria, $distinct = false, $con = null)
  274. {
  275. // we're going to modify criteria, so copy it first
  276. $criteria = clone $criteria;
  277. // clear out anything that might confuse the ORDER BY clause
  278. $criteria->clearSelectColumns()->clearOrderByColumns();
  279. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  280. $criteria->addSelectColumn(KataoAssocMemberGroupPeer::COUNT_DISTINCT);
  281. } else {
  282. $criteria->addSelectColumn(KataoAssocMemberGroupPeer::COUNT);
  283. }
  284. // just in case we're grouping: add those columns to the select statement
  285. foreach($criteria->getGroupByColumns() as $column)
  286. {
  287. $criteria->addSelectColumn($column);
  288. }
  289. $criteria->addJoin(KataoAssocMemberGroupPeer::MEMBER_ID, KataoMemberPeer::ID);
  290. $rs = KataoAssocMemberGroupPeer::doSelectRS($criteria, $con);
  291. if ($rs->next()) {
  292. return $rs->getInt(1);
  293. } else {
  294. // no rows returned; we infer that means 0 matches.
  295. return 0;
  296. }
  297. }
  298. /**
  299. * Returns the number of rows matching criteria, joining the related KataoMemberGroup table
  300. *
  301. * @param Criteria $c
  302. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  303. * @param Connection $con
  304. * @return int Number of matching rows.
  305. */
  306. public static function doCountJoinKataoMemberGroup(Criteria $criteria, $distinct = false, $con = null)
  307. {
  308. // we're going to modify criteria, so copy it first
  309. $criteria = clone $criteria;
  310. // clear out anything that might confuse the ORDER BY clause
  311. $criteria->clearSelectColumns()->clearOrderByColumns();
  312. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  313. $criteria->addSelectColumn(KataoAssocMemberGroupPeer::COUNT_DISTINCT);
  314. } else {
  315. $criteria->addSelectColumn(KataoAssocMemberGroupPeer::COUNT);
  316. }
  317. // just in case we're grouping: add those columns to the select statement
  318. foreach($criteria->getGroupByColumns() as $column)
  319. {
  320. $criteria->addSelectColumn($column);
  321. }
  322. $criteria->addJoin(KataoAssocMemberGroupPeer::GROUP_ID, KataoMemberGroupPeer::ID);
  323. $rs = KataoAssocMemberGroupPeer::doSelectRS($criteria, $con);
  324. if ($rs->next()) {
  325. return $rs->getInt(1);
  326. } else {
  327. // no rows returned; we infer that means 0 matches.
  328. return 0;
  329. }
  330. }
  331. /**
  332. * Selects a collection of KataoAssocMemberGroup objects pre-filled with their KataoMember objects.
  333. *
  334. * @return array Array of KataoAssocMemberGroup objects.
  335. * @throws PropelException Any exceptions caught during processing will be
  336. * rethrown wrapped into a PropelException.
  337. */
  338. public static function doSelectJoinKataoMember(Criteria $c, $con = null)
  339. {
  340. foreach (sfMixer::getCallables('BaseKataoAssocMemberGroupPeer:doSelectJoin:doSelectJoin') as $callable)
  341. {
  342. call_user_func($callable, 'BaseKataoAssocMemberGroupPeer', $c, $con);
  343. }
  344. $c = clone $c;
  345. // Set the correct dbName if it has not been overridden
  346. if ($c->getDbName() == Propel::getDefaultDB()) {
  347. $c->setDbName(self::DATABASE_NAME);
  348. }
  349. KataoAssocMemberGroupPeer::addSelectColumns($c);
  350. $startcol = (KataoAssocMemberGroupPeer::NUM_COLUMNS - KataoAssocMemberGroupPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  351. KataoMemberPeer::addSelectColumns($c);
  352. $c->addJoin(KataoAssocMemberGroupPeer::MEMBER_ID, KataoMemberPeer::ID);
  353. $rs = BasePeer::doSelect($c, $con);
  354. $results = array();
  355. while($rs->next()) {
  356. $omClass = KataoAssocMemberGroupPeer::getOMClass();
  357. $cls = sfPropel::import($omClass);
  358. $obj1 = new $cls();
  359. $obj1->hydrate($rs);
  360. $omClass = KataoMemberPeer::getOMClass();
  361. $cls = sfPropel::import($omClass);
  362. $obj2 = new $cls();
  363. $obj2->hydrate($rs, $startcol);
  364. $newObject = true;
  365. foreach($results as $temp_obj1) {
  366. $temp_obj2 = $temp_obj1->getKataoMember(); //CHECKME
  367. if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
  368. $newObject = false;
  369. // e.g. $author->addBookRelatedByBookId()
  370. $temp_obj2->addKataoAssocMemberGroup($obj1); //CHECKME
  371. break;
  372. }
  373. }
  374. if ($newObject) {
  375. $obj2->initKataoAssocMemberGroups();
  376. $obj2->addKataoAssocMemberGroup($obj1); //CHECKME
  377. }
  378. $results[] = $obj1;
  379. }
  380. return $results;
  381. }
  382. /**
  383. * Selects a collection of KataoAssocMemberGroup objects pre-filled with their KataoMemberGroup objects.
  384. *
  385. * @return array Array of KataoAssocMemberGroup objects.
  386. * @throws PropelException Any exceptions caught during processing will be
  387. * rethrown wrapped into a PropelException.
  388. */
  389. public static function doSelectJoinKataoMemberGroup(Criteria $c, $con = null)
  390. {
  391. foreach (sfMixer::getCallables('BaseKataoAssocMemberGroupPeer:doSelectJoin:doSelectJoin') as $callable)
  392. {
  393. call_user_func($callable, 'BaseKataoAssocMemberGroupPeer', $c, $con);
  394. }
  395. $c = clone $c;
  396. // Set the correct dbName if it has not been overridden
  397. if ($c->getDbName() == Propel::getDefaultDB()) {
  398. $c->setDbName(self::DATABASE_NAME);
  399. }
  400. KataoAssocMemberGroupPeer::addSelectColumns($c);
  401. $startcol = (KataoAssocMemberGroupPeer::NUM_COLUMNS - KataoAssocMemberGroupPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  402. KataoMemberGroupPeer::addSelectColumns($c);
  403. $c->addJoin(KataoAssocMemberGroupPeer::GROUP_ID, KataoMemberGroupPeer::ID);
  404. $rs = BasePeer::doSelect($c, $con);
  405. $results = array();
  406. while($rs->next()) {
  407. $omClass = KataoAssocMemberGroupPeer::getOMClass();
  408. $cls = sfPropel::import($omClass);
  409. $obj1 = new $cls();
  410. $obj1->hydrate($rs);
  411. $omClass = KataoMemberGroupPeer::getOMClass();
  412. $cls = sfPropel::import($omClass);
  413. $obj2 = new $cls();
  414. $obj2->hydrate($rs, $startcol);
  415. $newObject = true;
  416. foreach($results as $temp_obj1) {
  417. $temp_obj2 = $temp_obj1->getKataoMemberGroup(); //CHECKME
  418. if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
  419. $newObject = false;
  420. // e.g. $author->addBookRelatedByBookId()
  421. $temp_obj2->addKataoAssocMemberGroup($obj1); //CHECKME
  422. break;
  423. }
  424. }
  425. if ($newObject) {
  426. $obj2->initKataoAssocMemberGroups();
  427. $obj2->addKataoAssocMemberGroup($obj1); //CHECKME
  428. }
  429. $results[] = $obj1;
  430. }
  431. return $results;
  432. }
  433. /**
  434. * Returns the number of rows matching criteria, joining all related tables
  435. *
  436. * @param Criteria $c
  437. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  438. * @param Connection $con
  439. * @return int Number of matching rows.
  440. */
  441. public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
  442. {
  443. $criteria = clone $criteria;
  444. // clear out anything that might confuse the ORDER BY clause
  445. $criteria->clearSelectColumns()->clearOrderByColumns();
  446. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  447. $criteria->addSelectColumn(KataoAssocMemberGroupPeer::COUNT_DISTINCT);
  448. } else {
  449. $criteria->addSelectColumn(KataoAssocMemberGroupPeer::COUNT);
  450. }
  451. // just in case we're grouping: add those columns to the select statement
  452. foreach($criteria->getGroupByColumns() as $column)
  453. {
  454. $criteria->addSelectColumn($column);
  455. }
  456. $criteria->addJoin(KataoAssocMemberGroupPeer::MEMBER_ID, KataoMemberPeer::ID);
  457. $criteria->addJoin(KataoAssocMemberGroupPeer::GROUP_ID, KataoMemberGroupPeer::ID);
  458. $rs = KataoAssocMemberGroupPeer::doSelectRS($criteria, $con);
  459. if ($rs->next()) {
  460. return $rs->getInt(1);
  461. } else {
  462. // no rows returned; we infer that means 0 matches.
  463. return 0;
  464. }
  465. }
  466. /**
  467. * Selects a collection of KataoAssocMemberGroup objects pre-filled with all related objects.
  468. *
  469. * @return array Array of KataoAssocMemberGroup objects.
  470. * @throws PropelException Any exceptions caught during processing will be
  471. * rethrown wrapped into a PropelException.
  472. */
  473. public static function doSelectJoinAll(Criteria $c, $con = null)
  474. {
  475. foreach (sfMixer::getCallables('BaseKataoAssocMemberGroupPeer:doSelectJoinAll:doSelectJoinAll') as $callable)
  476. {
  477. call_user_func($callable, 'BaseKataoAssocMemberGroupPeer', $c, $con);
  478. }
  479. $c = clone $c;
  480. // Set the correct dbName if it has not been overridden
  481. if ($c->getDbName() == Propel::getDefaultDB()) {
  482. $c->setDbName(self::DATABASE_NAME);
  483. }
  484. KataoAssocMemberGroupPeer::addSelectColumns($c);
  485. $startcol2 = (KataoAssocMemberGroupPeer::NUM_COLUMNS - KataoAssocMemberGroupPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  486. KataoMemberPeer::addSelectColumns($c);
  487. $startcol3 = $startcol2 + KataoMemberPeer::NUM_COLUMNS;
  488. KataoMemberGroupPeer::addSelectColumns($c);
  489. $startcol4 = $startcol3 + KataoMemberGroupPeer::NUM_COLUMNS;
  490. $c->addJoin(KataoAssocMemberGroupPeer::MEMBER_ID, KataoMemberPeer::ID);
  491. $c->addJoin(KataoAssocMemberGroupPeer::GROUP_ID, KataoMemberGroupPeer::ID);
  492. $rs = BasePeer::doSelect($c, $con);
  493. $results = array();
  494. while($rs->next()) {
  495. $omClass = KataoAssocMemberGroupPeer::getOMClass();
  496. $cls = sfPropel::import($omClass);
  497. $obj1 = new $cls();
  498. $obj1->hydrate($rs);
  499. // Add objects for joined KataoMember rows
  500. $omClass = KataoMemberPeer::getOMClass();
  501. $cls = sfPropel::import($omClass);
  502. $obj2 = new $cls();
  503. $obj2->hydrate($rs, $startcol2);
  504. $newObject = true;
  505. for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
  506. $temp_obj1 = $results[$j];
  507. $temp_obj2 = $temp_obj1->getKataoMember(); // CHECKME
  508. if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
  509. $newObject = false;
  510. $temp_obj2->addKataoAssocMemberGroup($obj1); // CHECKME
  511. break;
  512. }
  513. }
  514. if ($newObject) {
  515. $obj2->initKataoAssocMemberGroups();
  516. $obj2->addKataoAssocMemberGroup($obj1);
  517. }
  518. // Add objects for joined KataoMemberGroup rows
  519. $omClass = KataoMemberGroupPeer::getOMClass();
  520. $cls = sfPropel::import($omClass);
  521. $obj3 = new $cls();
  522. $obj3->hydrate($rs, $startcol3);
  523. $newObject = true;
  524. for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
  525. $temp_obj1 = $results[$j];
  526. $temp_obj3 = $temp_obj1->getKataoMemberGroup(); // CHECKME
  527. if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
  528. $newObject = false;
  529. $temp_obj3->addKataoAssocMemberGroup($obj1); // CHECKME
  530. break;
  531. }
  532. }
  533. if ($newObject) {
  534. $obj3->initKataoAssocMemberGroups();
  535. $obj3->addKataoAssocMemberGroup($obj1);
  536. }
  537. $results[] = $obj1;
  538. }
  539. return $results;
  540. }
  541. /**
  542. * Returns the number of rows matching criteria, joining the related KataoMember table
  543. *
  544. * @param Criteria $c
  545. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  546. * @param Connection $con
  547. * @return int Number of matching rows.
  548. */
  549. public static function doCountJoinAllExceptKataoMember(Criteria $criteria, $distinct = false, $con = null)
  550. {
  551. // we're going to modify criteria, so copy it first
  552. $criteria = clone $criteria;
  553. // clear out anything that might confuse the ORDER BY clause
  554. $criteria->clearSelectColumns()->clearOrderByColumns();
  555. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  556. $criteria->addSelectColumn(KataoAssocMemberGroupPeer::COUNT_DISTINCT);
  557. } else {
  558. $criteria->addSelectColumn(KataoAssocMemberGroupPeer::COUNT);
  559. }
  560. // just in case we're grouping: add those columns to the select statement
  561. foreach($criteria->getGroupByColumns() as $column)
  562. {
  563. $criteria->addSelectColumn($column);
  564. }
  565. $criteria->addJoin(KataoAssocMemberGroupPeer::GROUP_ID, KataoMemberGroupPeer::ID);
  566. $rs = KataoAssocMemberGroupPeer::doSelectRS($criteria, $con);
  567. if ($rs->next()) {
  568. return $rs->getInt(1);
  569. } else {
  570. // no rows returned; we infer that means 0 matches.
  571. return 0;
  572. }
  573. }
  574. /**
  575. * Returns the number of rows matching criteria, joining the related KataoMemberGroup table
  576. *
  577. * @param Criteria $c
  578. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  579. * @param Connection $con
  580. * @return int Number of matching rows.
  581. */
  582. public static function doCountJoinAllExceptKataoMemberGroup(Criteria $criteria, $distinct = false, $con = null)
  583. {
  584. // we're going to modify criteria, so copy it first
  585. $criteria = clone $criteria;
  586. // clear out anything that might confuse the ORDER BY clause
  587. $criteria->clearSelectColumns()->clearOrderByColumns();
  588. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  589. $criteria->addSelectColumn(KataoAssocMemberGroupPeer::COUNT_DISTINCT);
  590. } else {
  591. $criteria->addSelectColumn(KataoAssocMemberGroupPeer::COUNT);
  592. }
  593. // just in case we're grouping: add those columns to the select statement
  594. foreach($criteria->getGroupByColumns() as $column)
  595. {
  596. $criteria->addSelectColumn($column);
  597. }
  598. $criteria->addJoin(KataoAssocMemberGroupPeer::MEMBER_ID, KataoMemberPeer::ID);
  599. $rs = KataoAssocMemberGroupPeer::doSelectRS($criteria, $con);
  600. if ($rs->next()) {
  601. return $rs->getInt(1);
  602. } else {
  603. // no rows returned; we infer that means 0 matches.
  604. return 0;
  605. }
  606. }
  607. /**
  608. * Selects a collection of KataoAssocMemberGroup objects pre-filled with all related objects except KataoMember.
  609. *
  610. * @return array Array of KataoAssocMemberGroup objects.
  611. * @throws PropelException Any exceptions caught during processing will be
  612. * rethrown wrapped into a PropelException.
  613. */
  614. public static function doSelectJoinAllExceptKataoMember(Criteria $c, $con = null)
  615. {
  616. foreach (sfMixer::getCallables('BaseKataoAssocMemberGroupPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable)
  617. {
  618. call_user_func($callable, 'BaseKataoAssocMemberGroupPeer', $c, $con);
  619. }
  620. $c = clone $c;
  621. // Set the correct dbName if it has not been overridden
  622. // $c->getDbName() will return the same object if not set to another value
  623. // so == check is okay and faster
  624. if ($c->getDbName() == Propel::getDefaultDB()) {
  625. $c->setDbName(self::DATABASE_NAME);
  626. }
  627. KataoAssocMemberGroupPeer::addSelectColumns($c);
  628. $startcol2 = (KataoAssocMemberGroupPeer::NUM_COLUMNS - KataoAssocMemberGroupPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  629. KataoMemberGroupPeer::addSelectColumns($c);
  630. $startcol3 = $startcol2 + KataoMemberGroupPeer::NUM_COLUMNS;
  631. $c->addJoin(KataoAssocMemberGroupPeer::GROUP_ID, KataoMemberGroupPeer::ID);
  632. $rs = BasePeer::doSelect($c, $con);
  633. $results = array();
  634. while($rs->next()) {
  635. $omClass = KataoAssocMemberGroupPeer::getOMClass();
  636. $cls = sfPropel::import($omClass);
  637. $obj1 = new $cls();
  638. $obj1->hydrate($rs);
  639. $omClass = KataoMemberGroupPeer::getOMClass();
  640. $cls = sfPropel::import($omClass);
  641. $obj2 = new $cls();
  642. $obj2->hydrate($rs, $startcol2);
  643. $newObject = true;
  644. for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
  645. $temp_obj1 = $results[$j];
  646. $temp_obj2 = $temp_obj1->getKataoMemberGroup(); //CHECKME
  647. if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
  648. $newObject = false;
  649. $temp_obj2->addKataoAssocMemberGroup($obj1);
  650. break;
  651. }
  652. }
  653. if ($newObject) {
  654. $obj2->initKataoAssocMemberGroups();
  655. $obj2->addKataoAssocMemberGroup($obj1);
  656. }
  657. $results[] = $obj1;
  658. }
  659. return $results;
  660. }
  661. /**
  662. * Selects a collection of KataoAssocMemberGroup objects pre-filled with all related objects except KataoMemberGroup.
  663. *
  664. * @return array Array of KataoAssocMemberGroup objects.
  665. * @throws PropelException Any exceptions caught during processing will be
  666. * rethrown wrapped into a PropelException.
  667. */
  668. public static function doSelectJoinAllExceptKataoMemberGroup(Criteria $c, $con = null)
  669. {
  670. foreach (sfMixer::getCallables('BaseKataoAssocMemberGroupPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable)
  671. {
  672. call_user_func($callable, 'BaseKataoAssocMemberGroupPeer', $c, $con);
  673. }
  674. $c = clone $c;
  675. // Set the correct dbName if it has not been overridden
  676. // $c->getDbName() will return the same object if not set to another value
  677. // so == check is okay and faster
  678. if ($c->getDbName() == Propel::getDefaultDB()) {
  679. $c->setDbName(self::DATABASE_NAME);
  680. }
  681. KataoAssocMemberGroupPeer::addSelectColumns($c);
  682. $startcol2 = (KataoAssocMemberGroupPeer::NUM_COLUMNS - KataoAssocMemberGroupPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  683. KataoMemberPeer::addSelectColumns($c);
  684. $startcol3 = $startcol2 + KataoMemberPeer::NUM_COLUMNS;
  685. $c->addJoin(KataoAssocMemberGroupPeer::MEMBER_ID, KataoMemberPeer::ID);
  686. $rs = BasePeer::doSelect($c, $con);
  687. $results = array();
  688. while($rs->next()) {
  689. $omClass = KataoAssocMemberGroupPeer::getOMClass();
  690. $cls = sfPropel::import($omClass);
  691. $obj1 = new $cls();
  692. $obj1->hydrate($rs);
  693. $omClass = KataoMemberPeer::getOMClass();
  694. $cls = sfPropel::import($omClass);
  695. $obj2 = new $cls();
  696. $obj2->hydrate($rs, $startcol2);
  697. $newObject = true;
  698. for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
  699. $temp_obj1 = $results[$j];
  700. $temp_obj2 = $temp_obj1->getKataoMember(); //CHECKME
  701. if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
  702. $newObject = false;
  703. $temp_obj2->addKataoAssocMemberGroup($obj1);
  704. break;
  705. }
  706. }
  707. if ($newObject) {
  708. $obj2->initKataoAssocMemberGroups();
  709. $obj2->addKataoAssocMemberGroup($obj1);
  710. }
  711. $results[] = $obj1;
  712. }
  713. return $results;
  714. }
  715. static public function getUniqueColumnNames()
  716. {
  717. return array();
  718. }
  719. /**
  720. * Returns the TableMap related to this peer.
  721. * This method is not needed for general use but a specific application could have a need.
  722. * @return TableMap
  723. * @throws PropelException Any exceptions caught during processing will be
  724. * rethrown wrapped into a PropelException.
  725. */
  726. public static function getTableMap()
  727. {
  728. return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
  729. }
  730. /**
  731. * The class that the Peer will make instances of.
  732. *
  733. * This uses a dot-path notation which is tranalted into a path
  734. * relative to a location on the PHP include_path.
  735. * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
  736. *
  737. * @return string path.to.ClassName
  738. */
  739. public static function getOMClass()
  740. {
  741. return KataoAssocMemberGroupPeer::CLASS_DEFAULT;
  742. }
  743. /**
  744. * Method perform an INSERT on the database, given a KataoAssocMemberGroup or Criteria object.
  745. *
  746. * @param mixed $values Criteria or KataoAssocMemberGroup object containing data that is used to create the INSERT statement.
  747. * @param Connection $con the connection to use
  748. * @return mixed The new primary key.
  749. * @throws PropelException Any exceptions caught during processing will be
  750. * rethrown wrapped into a PropelException.
  751. */
  752. public static function doInsert($values, $con = null)
  753. {
  754. foreach (sfMixer::getCallables('BaseKataoAssocMemberGroupPeer:doInsert:pre') as $callable)
  755. {
  756. $ret = call_user_func($callable, 'BaseKataoAssocMemberGroupPeer', $values, $con);
  757. if (false !== $ret)
  758. {
  759. return $ret;
  760. }
  761. }
  762. if ($con === null) {
  763. $con = Propel::getConnection(self::DATABASE_NAME);
  764. }
  765. if ($values instanceof Criteria) {
  766. $criteria = clone $values; // rename for clarity
  767. } else {
  768. $criteria = $values->buildCriteria(); // build Criteria from KataoAssocMemberGroup object
  769. }
  770. // Set the correct dbName
  771. $criteria->setDbName(self::DATABASE_NAME);
  772. try {
  773. // use transaction because $criteria could contain info
  774. // for more than one table (I guess, conceivably)
  775. $con->begin();
  776. $pk = BasePeer::doInsert($criteria, $con);
  777. $con->commit();
  778. } catch(PropelException $e) {
  779. $con->rollback();
  780. throw $e;
  781. }
  782. foreach (sfMixer::getCallables('BaseKataoAssocMemberGroupPeer:doInsert:post') as $callable)
  783. {
  784. call_user_func($callable, 'BaseKataoAssocMemberGroupPeer', $values, $con, $pk);
  785. }
  786. return $pk;
  787. }
  788. /**
  789. * Method perform an UPDATE on the database, given a KataoAssocMemberGroup or Criteria object.
  790. *
  791. * @param mixed $values Criteria or KataoAssocMemberGroup object containing data that is used to create the UPDATE statement.
  792. * @param Connection $con The connection to use (specify Connection object to exert more control over transactions).
  793. * @return int The number of affected rows (if supported by underlying database driver).
  794. * @throws PropelException Any exceptions caught during processing will be
  795. * rethrown wrapped into a PropelException.
  796. */
  797. public static function doUpdate($values, $con = null)
  798. {
  799. foreach (sfMixer::getCallables('BaseKataoAssocMemberGroupPeer:doUpdate:pre') as $callable)
  800. {
  801. $ret = call_user_func($callable, 'BaseKataoAssocMemberGroupPeer', $values, $con);
  802. if (false !== $ret)
  803. {
  804. return $ret;
  805. }
  806. }
  807. if ($con === null) {
  808. $con = Propel::getConnection(self::DATABASE_NAME);
  809. }
  810. $selectCriteria = new Criteria(self::DATABASE_NAME);
  811. if ($values instanceof Criteria) {
  812. $criteria = clone $values; // rename for clarity
  813. $comparison = $criteria->getComparison(KataoAssocMemberGroupPeer::MEMBER_ID);
  814. $selectCriteria->add(KataoAssocMemberGroupPeer::MEMBER_ID, $criteria->remove(KataoAssocMemberGroupPeer::MEMBER_ID), $comparison);
  815. $comparison = $criteria->getComparison(KataoAssocMemberGroupPeer::GROUP_ID);
  816. $selectCriteria->add(KataoAssocMemberGroupPeer::GROUP_ID, $criteria->remove(KataoAssocMemberGroupPeer::GROUP_ID), $comparison);
  817. } else { // $values is KataoAssocMemberGroup object
  818. $criteria = $values->buildCriteria(); // gets full criteria
  819. $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
  820. }
  821. // set the correct dbName
  822. $criteria->setDbName(self::DATABASE_NAME);
  823. $ret = BasePeer::doUpdate($selectCriteria, $criteria, $con);
  824. foreach (sfMixer::getCallables('BaseKataoAssocMemberGroupPeer:doUpdate:post') as $callable)
  825. {
  826. call_user_func($callable, 'BaseKataoAssocMemberGroupPeer', $values, $con, $ret);
  827. }
  828. return $ret;
  829. }
  830. /**
  831. * Method to DELETE all rows from the katao_assoc_member_group table.
  832. *
  833. * @return int The number of affected rows (if supported by underlying database driver).
  834. */
  835. public static function doDeleteAll($con = null)
  836. {
  837. if ($con === null) {
  838. $con = Propel::getConnection(self::DATABASE_NAME);
  839. }
  840. $affectedRows = 0; // initialize var to track total num of affected rows
  841. try {
  842. // use transaction because $criteria could contain info
  843. // for more than one table or we could emulating ON DELETE CASCADE, etc.
  844. $con->begin();
  845. $affectedRows += BasePeer::doDeleteAll(KataoAssocMemberGroupPeer::TABLE_NAME, $con);
  846. $con->commit();
  847. return $affectedRows;
  848. } catch (PropelException $e) {
  849. $con->rollback();
  850. throw $e;
  851. }
  852. }
  853. /**
  854. * Method perform a DELETE on the database, given a KataoAssocMemberGroup or Criteria object OR a primary key value.
  855. *
  856. * @param mixed $values Criteria or KataoAssocMemberGroup object or primary key or array of primary keys
  857. * which is used to create the DELETE statement
  858. * @param Connection $con the connection to use
  859. * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
  860. * if supported by native driver or if emulated using Propel.
  861. * @throws PropelException Any exceptions caught during processing will be
  862. * rethrown wrapped into a PropelException.
  863. */
  864. public static function doDelete($values, $con = null)
  865. {
  866. if ($con === null) {
  867. $con = Propel::getConnection(KataoAssocMemberGroupPeer::DATABASE_NAME);
  868. }
  869. if ($values instanceof Criteria) {
  870. $criteria = clone $values; // rename for clarity
  871. } elseif ($values instanceof KataoAssocMemberGroup) {
  872. $criteria = $values->buildPkeyCriteria();
  873. } else {
  874. // it must be the primary key
  875. $criteria = new Criteria(self::DATABASE_NAME);
  876. // primary key is composite; we therefore, expect
  877. // the primary key passed to be an array of pkey
  878. // values
  879. if(count($values) == count($values, COUNT_RECURSIVE))
  880. {
  881. // array is not multi-dimensional
  882. $values = array($values);
  883. }
  884. $vals = array();
  885. foreach($values as $value)
  886. {
  887. $vals[0][] = $value[0];
  888. $vals[1][] = $value[1];
  889. }
  890. $criteria->add(KataoAssocMemberGroupPeer::MEMBER_ID, $vals[0], Criteria::IN);
  891. $criteria->add(KataoAssocMemberGroupPeer::GROUP_ID, $vals[1], Criteria::IN);
  892. }
  893. // Set the correct dbName
  894. $criteria->setDbName(self::DATABASE_NAME);
  895. $affectedRows = 0; // initialize var to track total num of affected rows
  896. try {
  897. // use transaction because $criteria could contain info
  898. // for more than one table or we could emulating ON DELETE CASCADE, etc.
  899. $con->begin();
  900. $affectedRows += BasePeer::doDelete($criteria, $con);
  901. $con->commit();
  902. return $affectedRows;
  903. } catch (PropelException $e) {
  904. $con->rollback();
  905. throw $e;
  906. }
  907. }
  908. /**
  909. * Validates all modified columns of given KataoAssocMemberGroup object.
  910. * If parameter $columns is either a single column name or an array of column names
  911. * than only those columns are validated.
  912. *
  913. * NOTICE: This does not apply to primary or foreign keys for now.
  914. *
  915. * @param KataoAssocMemberGroup $obj The object to validate.
  916. * @param mixed $cols Column name or array of column names.
  917. *
  918. * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
  919. */
  920. public static function doValidate(KataoAssocMemberGroup $obj, $cols = null)
  921. {
  922. $columns = array();
  923. if ($cols) {
  924. $dbMap = Propel::getDatabaseMap(KataoAssocMemberGroupPeer::DATABASE_NAME);
  925. $tableMap = $dbMap->getTable(KataoAssocMemberGroupPeer::TABLE_NAME);
  926. if (! is_array($cols)) {
  927. $cols = array($cols);
  928. }
  929. foreach($cols as $colName) {
  930. if ($tableMap->containsColumn($colName)) {
  931. $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
  932. $columns[$colName] = $obj->$get();
  933. }
  934. }
  935. } else {
  936. }
  937. $res = BasePeer::doValidate(KataoAssocMemberGroupPeer::DATABASE_NAME, KataoAssocMemberGroupPeer::TABLE_NAME, $columns);
  938. if ($res !== true) {
  939. $request = sfContext::getInstance()->getRequest();
  940. foreach ($res as $failed) {
  941. $col = KataoAssocMemberGroupPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
  942. $request->setError($col, $failed->getMessage());
  943. }
  944. }
  945. return $res;
  946. }
  947. /**
  948. * Retrieve object using using composite pkey values.
  949. * @param int $member_id
  950. @param int $group_id
  951. * @param Connection $con
  952. * @return KataoAssocMemberGroup
  953. */
  954. public static function retrieveByPK( $member_id, $group_id, $con = null) {
  955. if ($con === null) {
  956. $con = Propel::getConnection(self::DATABASE_NAME);
  957. }
  958. $criteria = new Criteria();
  959. $criteria->add(KataoAssocMemberGroupPeer::MEMBER_ID, $member_id);
  960. $criteria->add(KataoAssocMemberGroupPeer::GROUP_ID, $group_id);
  961. $v = KataoAssocMemberGroupPeer::doSelect($criteria, $con);
  962. return !empty($v) ? $v[0] : null;
  963. }
  964. } // BaseKataoAssocMemberGroupPeer
  965. // static code to register the map builder for this Peer with the main Propel class
  966. if (Propel::isInit()) {
  967. // the MapBuilder classes register themselves with Propel during initialization
  968. // so we need to load them here.
  969. try {
  970. BaseKataoAssocMemberGroupPeer::getMapBuilder();
  971. } catch (Exception $e) {
  972. Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
  973. }
  974. } else {
  975. // even if Propel is not yet initialized, the map builder class can be registered
  976. // now and then it will be loaded when Propel initializes.
  977. Propel::registerMapBuilder('lib.model.map.KataoAssocMemberGroupMapBuilder');
  978. }