BaseKataoMemberNodePeer.php 37 KB

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