BaseKataoNodeProductPeer.php 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552
  1. <?php
  2. /**
  3. * Base static class for performing query and update operations on the 'katao_node_product' table.
  4. *
  5. *
  6. *
  7. * @package lib.model.om
  8. */
  9. abstract class BaseKataoNodeProductPeer {
  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_node_product';
  14. /** A class that can be returned by this peer. */
  15. const CLASS_DEFAULT = 'lib.model.KataoNodeProduct';
  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_node_product.ID';
  22. /** the column name for the KATAO_NODE_ID field */
  23. const KATAO_NODE_ID = 'katao_node_product.KATAO_NODE_ID';
  24. /** the column name for the KATAO_PERIOD_ID field */
  25. const KATAO_PERIOD_ID = 'katao_node_product.KATAO_PERIOD_ID';
  26. /** the column name for the KATAO_PRODUCT_ID field */
  27. const KATAO_PRODUCT_ID = 'katao_node_product.KATAO_PRODUCT_ID';
  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', 'KataoNodeId', 'KataoPeriodId', 'KataoProductId', ),
  38. BasePeer::TYPE_COLNAME => array (KataoNodeProductPeer::ID, KataoNodeProductPeer::KATAO_NODE_ID, KataoNodeProductPeer::KATAO_PERIOD_ID, KataoNodeProductPeer::KATAO_PRODUCT_ID, ),
  39. BasePeer::TYPE_FIELDNAME => array ('id', 'katao_node_id', 'katao_period_id', 'katao_product_id', ),
  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, 'KataoNodeId' => 1, 'KataoPeriodId' => 2, 'KataoProductId' => 3, ),
  50. BasePeer::TYPE_COLNAME => array (KataoNodeProductPeer::ID => 0, KataoNodeProductPeer::KATAO_NODE_ID => 1, KataoNodeProductPeer::KATAO_PERIOD_ID => 2, KataoNodeProductPeer::KATAO_PRODUCT_ID => 3, ),
  51. BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'katao_node_id' => 1, 'katao_period_id' => 2, 'katao_product_id' => 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.KataoNodeProductMapBuilder');
  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 = KataoNodeProductPeer::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. KataoNodeProductPeer::COLUMN_NAME).
  127. * @return string
  128. */
  129. public static function alias($alias, $column)
  130. {
  131. return str_replace(KataoNodeProductPeer::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(KataoNodeProductPeer::ID);
  147. $criteria->addSelectColumn(KataoNodeProductPeer::KATAO_NODE_ID);
  148. $criteria->addSelectColumn(KataoNodeProductPeer::KATAO_PERIOD_ID);
  149. $criteria->addSelectColumn(KataoNodeProductPeer::KATAO_PRODUCT_ID);
  150. }
  151. const COUNT = 'COUNT(katao_node_product.ID)';
  152. const COUNT_DISTINCT = 'COUNT(DISTINCT katao_node_product.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(KataoNodeProductPeer::COUNT_DISTINCT);
  169. } else {
  170. $criteria->addSelectColumn(KataoNodeProductPeer::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 = KataoNodeProductPeer::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 KataoNodeProduct
  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 = KataoNodeProductPeer::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 KataoNodeProductPeer::populateObjects(KataoNodeProductPeer::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('BaseKataoNodeProductPeer:doSelectRS:doSelectRS') as $callable)
  234. {
  235. call_user_func($callable, 'BaseKataoNodeProductPeer', $criteria, $con);
  236. }
  237. if ($con === null) {
  238. $con = Propel::getConnection(self::DATABASE_NAME);
  239. }
  240. if (!$criteria->getSelectColumns()) {
  241. $criteria = clone $criteria;
  242. KataoNodeProductPeer::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 = KataoNodeProductPeer::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 KataoNode 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 doCountJoinKataoNode(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(KataoNodeProductPeer::COUNT_DISTINCT);
  287. } else {
  288. $criteria->addSelectColumn(KataoNodeProductPeer::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(KataoNodeProductPeer::KATAO_NODE_ID, KataoNodePeer::ID);
  296. $rs = KataoNodeProductPeer::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 KataoPeriod 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 doCountJoinKataoPeriod(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(KataoNodeProductPeer::COUNT_DISTINCT);
  320. } else {
  321. $criteria->addSelectColumn(KataoNodeProductPeer::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(KataoNodeProductPeer::KATAO_PERIOD_ID, KataoPeriodPeer::ID);
  329. $rs = KataoNodeProductPeer::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. * Returns the number of rows matching criteria, joining the related KataoProduct table
  339. *
  340. * @param Criteria $c
  341. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  342. * @param Connection $con
  343. * @return int Number of matching rows.
  344. */
  345. public static function doCountJoinKataoProduct(Criteria $criteria, $distinct = false, $con = null)
  346. {
  347. // we're going to modify criteria, so copy it first
  348. $criteria = clone $criteria;
  349. // clear out anything that might confuse the ORDER BY clause
  350. $criteria->clearSelectColumns()->clearOrderByColumns();
  351. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  352. $criteria->addSelectColumn(KataoNodeProductPeer::COUNT_DISTINCT);
  353. } else {
  354. $criteria->addSelectColumn(KataoNodeProductPeer::COUNT);
  355. }
  356. // just in case we're grouping: add those columns to the select statement
  357. foreach($criteria->getGroupByColumns() as $column)
  358. {
  359. $criteria->addSelectColumn($column);
  360. }
  361. $criteria->addJoin(KataoNodeProductPeer::KATAO_PRODUCT_ID, KataoProductPeer::ID);
  362. $rs = KataoNodeProductPeer::doSelectRS($criteria, $con);
  363. if ($rs->next()) {
  364. return $rs->getInt(1);
  365. } else {
  366. // no rows returned; we infer that means 0 matches.
  367. return 0;
  368. }
  369. }
  370. /**
  371. * Selects a collection of KataoNodeProduct objects pre-filled with their KataoNode objects.
  372. *
  373. * @return array Array of KataoNodeProduct objects.
  374. * @throws PropelException Any exceptions caught during processing will be
  375. * rethrown wrapped into a PropelException.
  376. */
  377. public static function doSelectJoinKataoNode(Criteria $c, $con = null)
  378. {
  379. foreach (sfMixer::getCallables('BaseKataoNodeProductPeer:doSelectJoin:doSelectJoin') as $callable)
  380. {
  381. call_user_func($callable, 'BaseKataoNodeProductPeer', $c, $con);
  382. }
  383. $c = clone $c;
  384. // Set the correct dbName if it has not been overridden
  385. if ($c->getDbName() == Propel::getDefaultDB()) {
  386. $c->setDbName(self::DATABASE_NAME);
  387. }
  388. KataoNodeProductPeer::addSelectColumns($c);
  389. $startcol = (KataoNodeProductPeer::NUM_COLUMNS - KataoNodeProductPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  390. KataoNodePeer::addSelectColumns($c);
  391. $c->addJoin(KataoNodeProductPeer::KATAO_NODE_ID, KataoNodePeer::ID);
  392. $rs = BasePeer::doSelect($c, $con);
  393. $results = array();
  394. while($rs->next()) {
  395. $omClass = KataoNodeProductPeer::getOMClass();
  396. $cls = sfPropel::import($omClass);
  397. $obj1 = new $cls();
  398. $obj1->hydrate($rs);
  399. $omClass = KataoNodePeer::getOMClass();
  400. $cls = sfPropel::import($omClass);
  401. $obj2 = new $cls();
  402. $obj2->hydrate($rs, $startcol);
  403. $newObject = true;
  404. foreach($results as $temp_obj1) {
  405. $temp_obj2 = $temp_obj1->getKataoNode(); //CHECKME
  406. if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
  407. $newObject = false;
  408. // e.g. $author->addBookRelatedByBookId()
  409. $temp_obj2->addKataoNodeProduct($obj1); //CHECKME
  410. break;
  411. }
  412. }
  413. if ($newObject) {
  414. $obj2->initKataoNodeProducts();
  415. $obj2->addKataoNodeProduct($obj1); //CHECKME
  416. }
  417. $results[] = $obj1;
  418. }
  419. return $results;
  420. }
  421. /**
  422. * Selects a collection of KataoNodeProduct objects pre-filled with their KataoPeriod objects.
  423. *
  424. * @return array Array of KataoNodeProduct objects.
  425. * @throws PropelException Any exceptions caught during processing will be
  426. * rethrown wrapped into a PropelException.
  427. */
  428. public static function doSelectJoinKataoPeriod(Criteria $c, $con = null)
  429. {
  430. foreach (sfMixer::getCallables('BaseKataoNodeProductPeer:doSelectJoin:doSelectJoin') as $callable)
  431. {
  432. call_user_func($callable, 'BaseKataoNodeProductPeer', $c, $con);
  433. }
  434. $c = clone $c;
  435. // Set the correct dbName if it has not been overridden
  436. if ($c->getDbName() == Propel::getDefaultDB()) {
  437. $c->setDbName(self::DATABASE_NAME);
  438. }
  439. KataoNodeProductPeer::addSelectColumns($c);
  440. $startcol = (KataoNodeProductPeer::NUM_COLUMNS - KataoNodeProductPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  441. KataoPeriodPeer::addSelectColumns($c);
  442. $c->addJoin(KataoNodeProductPeer::KATAO_PERIOD_ID, KataoPeriodPeer::ID);
  443. $rs = BasePeer::doSelect($c, $con);
  444. $results = array();
  445. while($rs->next()) {
  446. $omClass = KataoNodeProductPeer::getOMClass();
  447. $cls = sfPropel::import($omClass);
  448. $obj1 = new $cls();
  449. $obj1->hydrate($rs);
  450. $omClass = KataoPeriodPeer::getOMClass();
  451. $cls = sfPropel::import($omClass);
  452. $obj2 = new $cls();
  453. $obj2->hydrate($rs, $startcol);
  454. $newObject = true;
  455. foreach($results as $temp_obj1) {
  456. $temp_obj2 = $temp_obj1->getKataoPeriod(); //CHECKME
  457. if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
  458. $newObject = false;
  459. // e.g. $author->addBookRelatedByBookId()
  460. $temp_obj2->addKataoNodeProduct($obj1); //CHECKME
  461. break;
  462. }
  463. }
  464. if ($newObject) {
  465. $obj2->initKataoNodeProducts();
  466. $obj2->addKataoNodeProduct($obj1); //CHECKME
  467. }
  468. $results[] = $obj1;
  469. }
  470. return $results;
  471. }
  472. /**
  473. * Selects a collection of KataoNodeProduct objects pre-filled with their KataoProduct objects.
  474. *
  475. * @return array Array of KataoNodeProduct objects.
  476. * @throws PropelException Any exceptions caught during processing will be
  477. * rethrown wrapped into a PropelException.
  478. */
  479. public static function doSelectJoinKataoProduct(Criteria $c, $con = null)
  480. {
  481. foreach (sfMixer::getCallables('BaseKataoNodeProductPeer:doSelectJoin:doSelectJoin') as $callable)
  482. {
  483. call_user_func($callable, 'BaseKataoNodeProductPeer', $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. KataoNodeProductPeer::addSelectColumns($c);
  491. $startcol = (KataoNodeProductPeer::NUM_COLUMNS - KataoNodeProductPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  492. KataoProductPeer::addSelectColumns($c);
  493. $c->addJoin(KataoNodeProductPeer::KATAO_PRODUCT_ID, KataoProductPeer::ID);
  494. $rs = BasePeer::doSelect($c, $con);
  495. $results = array();
  496. while($rs->next()) {
  497. $omClass = KataoNodeProductPeer::getOMClass();
  498. $cls = sfPropel::import($omClass);
  499. $obj1 = new $cls();
  500. $obj1->hydrate($rs);
  501. $omClass = KataoProductPeer::getOMClass();
  502. $cls = sfPropel::import($omClass);
  503. $obj2 = new $cls();
  504. $obj2->hydrate($rs, $startcol);
  505. $newObject = true;
  506. foreach($results as $temp_obj1) {
  507. $temp_obj2 = $temp_obj1->getKataoProduct(); //CHECKME
  508. if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
  509. $newObject = false;
  510. // e.g. $author->addBookRelatedByBookId()
  511. $temp_obj2->addKataoNodeProduct($obj1); //CHECKME
  512. break;
  513. }
  514. }
  515. if ($newObject) {
  516. $obj2->initKataoNodeProducts();
  517. $obj2->addKataoNodeProduct($obj1); //CHECKME
  518. }
  519. $results[] = $obj1;
  520. }
  521. return $results;
  522. }
  523. /**
  524. * Returns the number of rows matching criteria, joining all related tables
  525. *
  526. * @param Criteria $c
  527. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  528. * @param Connection $con
  529. * @return int Number of matching rows.
  530. */
  531. public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
  532. {
  533. $criteria = clone $criteria;
  534. // clear out anything that might confuse the ORDER BY clause
  535. $criteria->clearSelectColumns()->clearOrderByColumns();
  536. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  537. $criteria->addSelectColumn(KataoNodeProductPeer::COUNT_DISTINCT);
  538. } else {
  539. $criteria->addSelectColumn(KataoNodeProductPeer::COUNT);
  540. }
  541. // just in case we're grouping: add those columns to the select statement
  542. foreach($criteria->getGroupByColumns() as $column)
  543. {
  544. $criteria->addSelectColumn($column);
  545. }
  546. $criteria->addJoin(KataoNodeProductPeer::KATAO_NODE_ID, KataoNodePeer::ID);
  547. $criteria->addJoin(KataoNodeProductPeer::KATAO_PERIOD_ID, KataoPeriodPeer::ID);
  548. $criteria->addJoin(KataoNodeProductPeer::KATAO_PRODUCT_ID, KataoProductPeer::ID);
  549. $rs = KataoNodeProductPeer::doSelectRS($criteria, $con);
  550. if ($rs->next()) {
  551. return $rs->getInt(1);
  552. } else {
  553. // no rows returned; we infer that means 0 matches.
  554. return 0;
  555. }
  556. }
  557. /**
  558. * Selects a collection of KataoNodeProduct objects pre-filled with all related objects.
  559. *
  560. * @return array Array of KataoNodeProduct objects.
  561. * @throws PropelException Any exceptions caught during processing will be
  562. * rethrown wrapped into a PropelException.
  563. */
  564. public static function doSelectJoinAll(Criteria $c, $con = null)
  565. {
  566. foreach (sfMixer::getCallables('BaseKataoNodeProductPeer:doSelectJoinAll:doSelectJoinAll') as $callable)
  567. {
  568. call_user_func($callable, 'BaseKataoNodeProductPeer', $c, $con);
  569. }
  570. $c = clone $c;
  571. // Set the correct dbName if it has not been overridden
  572. if ($c->getDbName() == Propel::getDefaultDB()) {
  573. $c->setDbName(self::DATABASE_NAME);
  574. }
  575. KataoNodeProductPeer::addSelectColumns($c);
  576. $startcol2 = (KataoNodeProductPeer::NUM_COLUMNS - KataoNodeProductPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  577. KataoNodePeer::addSelectColumns($c);
  578. $startcol3 = $startcol2 + KataoNodePeer::NUM_COLUMNS;
  579. KataoPeriodPeer::addSelectColumns($c);
  580. $startcol4 = $startcol3 + KataoPeriodPeer::NUM_COLUMNS;
  581. KataoProductPeer::addSelectColumns($c);
  582. $startcol5 = $startcol4 + KataoProductPeer::NUM_COLUMNS;
  583. $c->addJoin(KataoNodeProductPeer::KATAO_NODE_ID, KataoNodePeer::ID);
  584. $c->addJoin(KataoNodeProductPeer::KATAO_PERIOD_ID, KataoPeriodPeer::ID);
  585. $c->addJoin(KataoNodeProductPeer::KATAO_PRODUCT_ID, KataoProductPeer::ID);
  586. $rs = BasePeer::doSelect($c, $con);
  587. $results = array();
  588. while($rs->next()) {
  589. $omClass = KataoNodeProductPeer::getOMClass();
  590. $cls = sfPropel::import($omClass);
  591. $obj1 = new $cls();
  592. $obj1->hydrate($rs);
  593. // Add objects for joined KataoNode rows
  594. $omClass = KataoNodePeer::getOMClass();
  595. $cls = sfPropel::import($omClass);
  596. $obj2 = new $cls();
  597. $obj2->hydrate($rs, $startcol2);
  598. $newObject = true;
  599. for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
  600. $temp_obj1 = $results[$j];
  601. $temp_obj2 = $temp_obj1->getKataoNode(); // CHECKME
  602. if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
  603. $newObject = false;
  604. $temp_obj2->addKataoNodeProduct($obj1); // CHECKME
  605. break;
  606. }
  607. }
  608. if ($newObject) {
  609. $obj2->initKataoNodeProducts();
  610. $obj2->addKataoNodeProduct($obj1);
  611. }
  612. // Add objects for joined KataoPeriod rows
  613. $omClass = KataoPeriodPeer::getOMClass();
  614. $cls = sfPropel::import($omClass);
  615. $obj3 = new $cls();
  616. $obj3->hydrate($rs, $startcol3);
  617. $newObject = true;
  618. for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
  619. $temp_obj1 = $results[$j];
  620. $temp_obj3 = $temp_obj1->getKataoPeriod(); // CHECKME
  621. if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
  622. $newObject = false;
  623. $temp_obj3->addKataoNodeProduct($obj1); // CHECKME
  624. break;
  625. }
  626. }
  627. if ($newObject) {
  628. $obj3->initKataoNodeProducts();
  629. $obj3->addKataoNodeProduct($obj1);
  630. }
  631. // Add objects for joined KataoProduct rows
  632. $omClass = KataoProductPeer::getOMClass();
  633. $cls = sfPropel::import($omClass);
  634. $obj4 = new $cls();
  635. $obj4->hydrate($rs, $startcol4);
  636. $newObject = true;
  637. for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
  638. $temp_obj1 = $results[$j];
  639. $temp_obj4 = $temp_obj1->getKataoProduct(); // CHECKME
  640. if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
  641. $newObject = false;
  642. $temp_obj4->addKataoNodeProduct($obj1); // CHECKME
  643. break;
  644. }
  645. }
  646. if ($newObject) {
  647. $obj4->initKataoNodeProducts();
  648. $obj4->addKataoNodeProduct($obj1);
  649. }
  650. $results[] = $obj1;
  651. }
  652. return $results;
  653. }
  654. /**
  655. * Returns the number of rows matching criteria, joining the related KataoNode table
  656. *
  657. * @param Criteria $c
  658. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  659. * @param Connection $con
  660. * @return int Number of matching rows.
  661. */
  662. public static function doCountJoinAllExceptKataoNode(Criteria $criteria, $distinct = false, $con = null)
  663. {
  664. // we're going to modify criteria, so copy it first
  665. $criteria = clone $criteria;
  666. // clear out anything that might confuse the ORDER BY clause
  667. $criteria->clearSelectColumns()->clearOrderByColumns();
  668. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  669. $criteria->addSelectColumn(KataoNodeProductPeer::COUNT_DISTINCT);
  670. } else {
  671. $criteria->addSelectColumn(KataoNodeProductPeer::COUNT);
  672. }
  673. // just in case we're grouping: add those columns to the select statement
  674. foreach($criteria->getGroupByColumns() as $column)
  675. {
  676. $criteria->addSelectColumn($column);
  677. }
  678. $criteria->addJoin(KataoNodeProductPeer::KATAO_PERIOD_ID, KataoPeriodPeer::ID);
  679. $criteria->addJoin(KataoNodeProductPeer::KATAO_PRODUCT_ID, KataoProductPeer::ID);
  680. $rs = KataoNodeProductPeer::doSelectRS($criteria, $con);
  681. if ($rs->next()) {
  682. return $rs->getInt(1);
  683. } else {
  684. // no rows returned; we infer that means 0 matches.
  685. return 0;
  686. }
  687. }
  688. /**
  689. * Returns the number of rows matching criteria, joining the related KataoPeriod table
  690. *
  691. * @param Criteria $c
  692. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  693. * @param Connection $con
  694. * @return int Number of matching rows.
  695. */
  696. public static function doCountJoinAllExceptKataoPeriod(Criteria $criteria, $distinct = false, $con = null)
  697. {
  698. // we're going to modify criteria, so copy it first
  699. $criteria = clone $criteria;
  700. // clear out anything that might confuse the ORDER BY clause
  701. $criteria->clearSelectColumns()->clearOrderByColumns();
  702. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  703. $criteria->addSelectColumn(KataoNodeProductPeer::COUNT_DISTINCT);
  704. } else {
  705. $criteria->addSelectColumn(KataoNodeProductPeer::COUNT);
  706. }
  707. // just in case we're grouping: add those columns to the select statement
  708. foreach($criteria->getGroupByColumns() as $column)
  709. {
  710. $criteria->addSelectColumn($column);
  711. }
  712. $criteria->addJoin(KataoNodeProductPeer::KATAO_NODE_ID, KataoNodePeer::ID);
  713. $criteria->addJoin(KataoNodeProductPeer::KATAO_PRODUCT_ID, KataoProductPeer::ID);
  714. $rs = KataoNodeProductPeer::doSelectRS($criteria, $con);
  715. if ($rs->next()) {
  716. return $rs->getInt(1);
  717. } else {
  718. // no rows returned; we infer that means 0 matches.
  719. return 0;
  720. }
  721. }
  722. /**
  723. * Returns the number of rows matching criteria, joining the related KataoProduct table
  724. *
  725. * @param Criteria $c
  726. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  727. * @param Connection $con
  728. * @return int Number of matching rows.
  729. */
  730. public static function doCountJoinAllExceptKataoProduct(Criteria $criteria, $distinct = false, $con = null)
  731. {
  732. // we're going to modify criteria, so copy it first
  733. $criteria = clone $criteria;
  734. // clear out anything that might confuse the ORDER BY clause
  735. $criteria->clearSelectColumns()->clearOrderByColumns();
  736. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  737. $criteria->addSelectColumn(KataoNodeProductPeer::COUNT_DISTINCT);
  738. } else {
  739. $criteria->addSelectColumn(KataoNodeProductPeer::COUNT);
  740. }
  741. // just in case we're grouping: add those columns to the select statement
  742. foreach($criteria->getGroupByColumns() as $column)
  743. {
  744. $criteria->addSelectColumn($column);
  745. }
  746. $criteria->addJoin(KataoNodeProductPeer::KATAO_NODE_ID, KataoNodePeer::ID);
  747. $criteria->addJoin(KataoNodeProductPeer::KATAO_PERIOD_ID, KataoPeriodPeer::ID);
  748. $rs = KataoNodeProductPeer::doSelectRS($criteria, $con);
  749. if ($rs->next()) {
  750. return $rs->getInt(1);
  751. } else {
  752. // no rows returned; we infer that means 0 matches.
  753. return 0;
  754. }
  755. }
  756. /**
  757. * Selects a collection of KataoNodeProduct objects pre-filled with all related objects except KataoNode.
  758. *
  759. * @return array Array of KataoNodeProduct objects.
  760. * @throws PropelException Any exceptions caught during processing will be
  761. * rethrown wrapped into a PropelException.
  762. */
  763. public static function doSelectJoinAllExceptKataoNode(Criteria $c, $con = null)
  764. {
  765. foreach (sfMixer::getCallables('BaseKataoNodeProductPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable)
  766. {
  767. call_user_func($callable, 'BaseKataoNodeProductPeer', $c, $con);
  768. }
  769. $c = clone $c;
  770. // Set the correct dbName if it has not been overridden
  771. // $c->getDbName() will return the same object if not set to another value
  772. // so == check is okay and faster
  773. if ($c->getDbName() == Propel::getDefaultDB()) {
  774. $c->setDbName(self::DATABASE_NAME);
  775. }
  776. KataoNodeProductPeer::addSelectColumns($c);
  777. $startcol2 = (KataoNodeProductPeer::NUM_COLUMNS - KataoNodeProductPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  778. KataoPeriodPeer::addSelectColumns($c);
  779. $startcol3 = $startcol2 + KataoPeriodPeer::NUM_COLUMNS;
  780. KataoProductPeer::addSelectColumns($c);
  781. $startcol4 = $startcol3 + KataoProductPeer::NUM_COLUMNS;
  782. $c->addJoin(KataoNodeProductPeer::KATAO_PERIOD_ID, KataoPeriodPeer::ID);
  783. $c->addJoin(KataoNodeProductPeer::KATAO_PRODUCT_ID, KataoProductPeer::ID);
  784. $rs = BasePeer::doSelect($c, $con);
  785. $results = array();
  786. while($rs->next()) {
  787. $omClass = KataoNodeProductPeer::getOMClass();
  788. $cls = sfPropel::import($omClass);
  789. $obj1 = new $cls();
  790. $obj1->hydrate($rs);
  791. $omClass = KataoPeriodPeer::getOMClass();
  792. $cls = sfPropel::import($omClass);
  793. $obj2 = new $cls();
  794. $obj2->hydrate($rs, $startcol2);
  795. $newObject = true;
  796. for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
  797. $temp_obj1 = $results[$j];
  798. $temp_obj2 = $temp_obj1->getKataoPeriod(); //CHECKME
  799. if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
  800. $newObject = false;
  801. $temp_obj2->addKataoNodeProduct($obj1);
  802. break;
  803. }
  804. }
  805. if ($newObject) {
  806. $obj2->initKataoNodeProducts();
  807. $obj2->addKataoNodeProduct($obj1);
  808. }
  809. $omClass = KataoProductPeer::getOMClass();
  810. $cls = sfPropel::import($omClass);
  811. $obj3 = new $cls();
  812. $obj3->hydrate($rs, $startcol3);
  813. $newObject = true;
  814. for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
  815. $temp_obj1 = $results[$j];
  816. $temp_obj3 = $temp_obj1->getKataoProduct(); //CHECKME
  817. if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
  818. $newObject = false;
  819. $temp_obj3->addKataoNodeProduct($obj1);
  820. break;
  821. }
  822. }
  823. if ($newObject) {
  824. $obj3->initKataoNodeProducts();
  825. $obj3->addKataoNodeProduct($obj1);
  826. }
  827. $results[] = $obj1;
  828. }
  829. return $results;
  830. }
  831. /**
  832. * Selects a collection of KataoNodeProduct objects pre-filled with all related objects except KataoPeriod.
  833. *
  834. * @return array Array of KataoNodeProduct objects.
  835. * @throws PropelException Any exceptions caught during processing will be
  836. * rethrown wrapped into a PropelException.
  837. */
  838. public static function doSelectJoinAllExceptKataoPeriod(Criteria $c, $con = null)
  839. {
  840. foreach (sfMixer::getCallables('BaseKataoNodeProductPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable)
  841. {
  842. call_user_func($callable, 'BaseKataoNodeProductPeer', $c, $con);
  843. }
  844. $c = clone $c;
  845. // Set the correct dbName if it has not been overridden
  846. // $c->getDbName() will return the same object if not set to another value
  847. // so == check is okay and faster
  848. if ($c->getDbName() == Propel::getDefaultDB()) {
  849. $c->setDbName(self::DATABASE_NAME);
  850. }
  851. KataoNodeProductPeer::addSelectColumns($c);
  852. $startcol2 = (KataoNodeProductPeer::NUM_COLUMNS - KataoNodeProductPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  853. KataoNodePeer::addSelectColumns($c);
  854. $startcol3 = $startcol2 + KataoNodePeer::NUM_COLUMNS;
  855. KataoProductPeer::addSelectColumns($c);
  856. $startcol4 = $startcol3 + KataoProductPeer::NUM_COLUMNS;
  857. $c->addJoin(KataoNodeProductPeer::KATAO_NODE_ID, KataoNodePeer::ID);
  858. $c->addJoin(KataoNodeProductPeer::KATAO_PRODUCT_ID, KataoProductPeer::ID);
  859. $rs = BasePeer::doSelect($c, $con);
  860. $results = array();
  861. while($rs->next()) {
  862. $omClass = KataoNodeProductPeer::getOMClass();
  863. $cls = sfPropel::import($omClass);
  864. $obj1 = new $cls();
  865. $obj1->hydrate($rs);
  866. $omClass = KataoNodePeer::getOMClass();
  867. $cls = sfPropel::import($omClass);
  868. $obj2 = new $cls();
  869. $obj2->hydrate($rs, $startcol2);
  870. $newObject = true;
  871. for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
  872. $temp_obj1 = $results[$j];
  873. $temp_obj2 = $temp_obj1->getKataoNode(); //CHECKME
  874. if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
  875. $newObject = false;
  876. $temp_obj2->addKataoNodeProduct($obj1);
  877. break;
  878. }
  879. }
  880. if ($newObject) {
  881. $obj2->initKataoNodeProducts();
  882. $obj2->addKataoNodeProduct($obj1);
  883. }
  884. $omClass = KataoProductPeer::getOMClass();
  885. $cls = sfPropel::import($omClass);
  886. $obj3 = new $cls();
  887. $obj3->hydrate($rs, $startcol3);
  888. $newObject = true;
  889. for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
  890. $temp_obj1 = $results[$j];
  891. $temp_obj3 = $temp_obj1->getKataoProduct(); //CHECKME
  892. if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
  893. $newObject = false;
  894. $temp_obj3->addKataoNodeProduct($obj1);
  895. break;
  896. }
  897. }
  898. if ($newObject) {
  899. $obj3->initKataoNodeProducts();
  900. $obj3->addKataoNodeProduct($obj1);
  901. }
  902. $results[] = $obj1;
  903. }
  904. return $results;
  905. }
  906. /**
  907. * Selects a collection of KataoNodeProduct objects pre-filled with all related objects except KataoProduct.
  908. *
  909. * @return array Array of KataoNodeProduct objects.
  910. * @throws PropelException Any exceptions caught during processing will be
  911. * rethrown wrapped into a PropelException.
  912. */
  913. public static function doSelectJoinAllExceptKataoProduct(Criteria $c, $con = null)
  914. {
  915. foreach (sfMixer::getCallables('BaseKataoNodeProductPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable)
  916. {
  917. call_user_func($callable, 'BaseKataoNodeProductPeer', $c, $con);
  918. }
  919. $c = clone $c;
  920. // Set the correct dbName if it has not been overridden
  921. // $c->getDbName() will return the same object if not set to another value
  922. // so == check is okay and faster
  923. if ($c->getDbName() == Propel::getDefaultDB()) {
  924. $c->setDbName(self::DATABASE_NAME);
  925. }
  926. KataoNodeProductPeer::addSelectColumns($c);
  927. $startcol2 = (KataoNodeProductPeer::NUM_COLUMNS - KataoNodeProductPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  928. KataoNodePeer::addSelectColumns($c);
  929. $startcol3 = $startcol2 + KataoNodePeer::NUM_COLUMNS;
  930. KataoPeriodPeer::addSelectColumns($c);
  931. $startcol4 = $startcol3 + KataoPeriodPeer::NUM_COLUMNS;
  932. $c->addJoin(KataoNodeProductPeer::KATAO_NODE_ID, KataoNodePeer::ID);
  933. $c->addJoin(KataoNodeProductPeer::KATAO_PERIOD_ID, KataoPeriodPeer::ID);
  934. $rs = BasePeer::doSelect($c, $con);
  935. $results = array();
  936. while($rs->next()) {
  937. $omClass = KataoNodeProductPeer::getOMClass();
  938. $cls = sfPropel::import($omClass);
  939. $obj1 = new $cls();
  940. $obj1->hydrate($rs);
  941. $omClass = KataoNodePeer::getOMClass();
  942. $cls = sfPropel::import($omClass);
  943. $obj2 = new $cls();
  944. $obj2->hydrate($rs, $startcol2);
  945. $newObject = true;
  946. for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
  947. $temp_obj1 = $results[$j];
  948. $temp_obj2 = $temp_obj1->getKataoNode(); //CHECKME
  949. if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
  950. $newObject = false;
  951. $temp_obj2->addKataoNodeProduct($obj1);
  952. break;
  953. }
  954. }
  955. if ($newObject) {
  956. $obj2->initKataoNodeProducts();
  957. $obj2->addKataoNodeProduct($obj1);
  958. }
  959. $omClass = KataoPeriodPeer::getOMClass();
  960. $cls = sfPropel::import($omClass);
  961. $obj3 = new $cls();
  962. $obj3->hydrate($rs, $startcol3);
  963. $newObject = true;
  964. for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
  965. $temp_obj1 = $results[$j];
  966. $temp_obj3 = $temp_obj1->getKataoPeriod(); //CHECKME
  967. if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
  968. $newObject = false;
  969. $temp_obj3->addKataoNodeProduct($obj1);
  970. break;
  971. }
  972. }
  973. if ($newObject) {
  974. $obj3->initKataoNodeProducts();
  975. $obj3->addKataoNodeProduct($obj1);
  976. }
  977. $results[] = $obj1;
  978. }
  979. return $results;
  980. }
  981. static public function getUniqueColumnNames()
  982. {
  983. return array();
  984. }
  985. /**
  986. * Returns the TableMap related to this peer.
  987. * This method is not needed for general use but a specific application could have a need.
  988. * @return TableMap
  989. * @throws PropelException Any exceptions caught during processing will be
  990. * rethrown wrapped into a PropelException.
  991. */
  992. public static function getTableMap()
  993. {
  994. return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
  995. }
  996. /**
  997. * The class that the Peer will make instances of.
  998. *
  999. * This uses a dot-path notation which is tranalted into a path
  1000. * relative to a location on the PHP include_path.
  1001. * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
  1002. *
  1003. * @return string path.to.ClassName
  1004. */
  1005. public static function getOMClass()
  1006. {
  1007. return KataoNodeProductPeer::CLASS_DEFAULT;
  1008. }
  1009. /**
  1010. * Method perform an INSERT on the database, given a KataoNodeProduct or Criteria object.
  1011. *
  1012. * @param mixed $values Criteria or KataoNodeProduct object containing data that is used to create the INSERT statement.
  1013. * @param Connection $con the connection to use
  1014. * @return mixed The new primary key.
  1015. * @throws PropelException Any exceptions caught during processing will be
  1016. * rethrown wrapped into a PropelException.
  1017. */
  1018. public static function doInsert($values, $con = null)
  1019. {
  1020. foreach (sfMixer::getCallables('BaseKataoNodeProductPeer:doInsert:pre') as $callable)
  1021. {
  1022. $ret = call_user_func($callable, 'BaseKataoNodeProductPeer', $values, $con);
  1023. if (false !== $ret)
  1024. {
  1025. return $ret;
  1026. }
  1027. }
  1028. if ($con === null) {
  1029. $con = Propel::getConnection(self::DATABASE_NAME);
  1030. }
  1031. if ($values instanceof Criteria) {
  1032. $criteria = clone $values; // rename for clarity
  1033. } else {
  1034. $criteria = $values->buildCriteria(); // build Criteria from KataoNodeProduct object
  1035. }
  1036. $criteria->remove(KataoNodeProductPeer::ID); // remove pkey col since this table uses auto-increment
  1037. // Set the correct dbName
  1038. $criteria->setDbName(self::DATABASE_NAME);
  1039. try {
  1040. // use transaction because $criteria could contain info
  1041. // for more than one table (I guess, conceivably)
  1042. $con->begin();
  1043. $pk = BasePeer::doInsert($criteria, $con);
  1044. $con->commit();
  1045. } catch(PropelException $e) {
  1046. $con->rollback();
  1047. throw $e;
  1048. }
  1049. foreach (sfMixer::getCallables('BaseKataoNodeProductPeer:doInsert:post') as $callable)
  1050. {
  1051. call_user_func($callable, 'BaseKataoNodeProductPeer', $values, $con, $pk);
  1052. }
  1053. return $pk;
  1054. }
  1055. /**
  1056. * Method perform an UPDATE on the database, given a KataoNodeProduct or Criteria object.
  1057. *
  1058. * @param mixed $values Criteria or KataoNodeProduct object containing data that is used to create the UPDATE statement.
  1059. * @param Connection $con The connection to use (specify Connection object to exert more control over transactions).
  1060. * @return int The number of affected rows (if supported by underlying database driver).
  1061. * @throws PropelException Any exceptions caught during processing will be
  1062. * rethrown wrapped into a PropelException.
  1063. */
  1064. public static function doUpdate($values, $con = null)
  1065. {
  1066. foreach (sfMixer::getCallables('BaseKataoNodeProductPeer:doUpdate:pre') as $callable)
  1067. {
  1068. $ret = call_user_func($callable, 'BaseKataoNodeProductPeer', $values, $con);
  1069. if (false !== $ret)
  1070. {
  1071. return $ret;
  1072. }
  1073. }
  1074. if ($con === null) {
  1075. $con = Propel::getConnection(self::DATABASE_NAME);
  1076. }
  1077. $selectCriteria = new Criteria(self::DATABASE_NAME);
  1078. if ($values instanceof Criteria) {
  1079. $criteria = clone $values; // rename for clarity
  1080. $comparison = $criteria->getComparison(KataoNodeProductPeer::ID);
  1081. $selectCriteria->add(KataoNodeProductPeer::ID, $criteria->remove(KataoNodeProductPeer::ID), $comparison);
  1082. } else { // $values is KataoNodeProduct object
  1083. $criteria = $values->buildCriteria(); // gets full criteria
  1084. $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
  1085. }
  1086. // set the correct dbName
  1087. $criteria->setDbName(self::DATABASE_NAME);
  1088. $ret = BasePeer::doUpdate($selectCriteria, $criteria, $con);
  1089. foreach (sfMixer::getCallables('BaseKataoNodeProductPeer:doUpdate:post') as $callable)
  1090. {
  1091. call_user_func($callable, 'BaseKataoNodeProductPeer', $values, $con, $ret);
  1092. }
  1093. return $ret;
  1094. }
  1095. /**
  1096. * Method to DELETE all rows from the katao_node_product table.
  1097. *
  1098. * @return int The number of affected rows (if supported by underlying database driver).
  1099. */
  1100. public static function doDeleteAll($con = null)
  1101. {
  1102. if ($con === null) {
  1103. $con = Propel::getConnection(self::DATABASE_NAME);
  1104. }
  1105. $affectedRows = 0; // initialize var to track total num of affected rows
  1106. try {
  1107. // use transaction because $criteria could contain info
  1108. // for more than one table or we could emulating ON DELETE CASCADE, etc.
  1109. $con->begin();
  1110. $affectedRows += BasePeer::doDeleteAll(KataoNodeProductPeer::TABLE_NAME, $con);
  1111. $con->commit();
  1112. return $affectedRows;
  1113. } catch (PropelException $e) {
  1114. $con->rollback();
  1115. throw $e;
  1116. }
  1117. }
  1118. /**
  1119. * Method perform a DELETE on the database, given a KataoNodeProduct or Criteria object OR a primary key value.
  1120. *
  1121. * @param mixed $values Criteria or KataoNodeProduct object or primary key or array of primary keys
  1122. * which is used to create the DELETE statement
  1123. * @param Connection $con the connection to use
  1124. * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
  1125. * if supported by native driver or if emulated using Propel.
  1126. * @throws PropelException Any exceptions caught during processing will be
  1127. * rethrown wrapped into a PropelException.
  1128. */
  1129. public static function doDelete($values, $con = null)
  1130. {
  1131. if ($con === null) {
  1132. $con = Propel::getConnection(KataoNodeProductPeer::DATABASE_NAME);
  1133. }
  1134. if ($values instanceof Criteria) {
  1135. $criteria = clone $values; // rename for clarity
  1136. } elseif ($values instanceof KataoNodeProduct) {
  1137. $criteria = $values->buildPkeyCriteria();
  1138. } else {
  1139. // it must be the primary key
  1140. $criteria = new Criteria(self::DATABASE_NAME);
  1141. $criteria->add(KataoNodeProductPeer::ID, (array) $values, Criteria::IN);
  1142. }
  1143. // Set the correct dbName
  1144. $criteria->setDbName(self::DATABASE_NAME);
  1145. $affectedRows = 0; // initialize var to track total num of affected rows
  1146. try {
  1147. // use transaction because $criteria could contain info
  1148. // for more than one table or we could emulating ON DELETE CASCADE, etc.
  1149. $con->begin();
  1150. $affectedRows += BasePeer::doDelete($criteria, $con);
  1151. $con->commit();
  1152. return $affectedRows;
  1153. } catch (PropelException $e) {
  1154. $con->rollback();
  1155. throw $e;
  1156. }
  1157. }
  1158. /**
  1159. * Validates all modified columns of given KataoNodeProduct object.
  1160. * If parameter $columns is either a single column name or an array of column names
  1161. * than only those columns are validated.
  1162. *
  1163. * NOTICE: This does not apply to primary or foreign keys for now.
  1164. *
  1165. * @param KataoNodeProduct $obj The object to validate.
  1166. * @param mixed $cols Column name or array of column names.
  1167. *
  1168. * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
  1169. */
  1170. public static function doValidate(KataoNodeProduct $obj, $cols = null)
  1171. {
  1172. $columns = array();
  1173. if ($cols) {
  1174. $dbMap = Propel::getDatabaseMap(KataoNodeProductPeer::DATABASE_NAME);
  1175. $tableMap = $dbMap->getTable(KataoNodeProductPeer::TABLE_NAME);
  1176. if (! is_array($cols)) {
  1177. $cols = array($cols);
  1178. }
  1179. foreach($cols as $colName) {
  1180. if ($tableMap->containsColumn($colName)) {
  1181. $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
  1182. $columns[$colName] = $obj->$get();
  1183. }
  1184. }
  1185. } else {
  1186. }
  1187. $res = BasePeer::doValidate(KataoNodeProductPeer::DATABASE_NAME, KataoNodeProductPeer::TABLE_NAME, $columns);
  1188. if ($res !== true) {
  1189. $request = sfContext::getInstance()->getRequest();
  1190. foreach ($res as $failed) {
  1191. $col = KataoNodeProductPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
  1192. $request->setError($col, $failed->getMessage());
  1193. }
  1194. }
  1195. return $res;
  1196. }
  1197. /**
  1198. * Retrieve a single object by pkey.
  1199. *
  1200. * @param mixed $pk the primary key.
  1201. * @param Connection $con the connection to use
  1202. * @return KataoNodeProduct
  1203. */
  1204. public static function retrieveByPK($pk, $con = null)
  1205. {
  1206. if ($con === null) {
  1207. $con = Propel::getConnection(self::DATABASE_NAME);
  1208. }
  1209. $criteria = new Criteria(KataoNodeProductPeer::DATABASE_NAME);
  1210. $criteria->add(KataoNodeProductPeer::ID, $pk);
  1211. $v = KataoNodeProductPeer::doSelect($criteria, $con);
  1212. return !empty($v) > 0 ? $v[0] : null;
  1213. }
  1214. /**
  1215. * Retrieve multiple objects by pkey.
  1216. *
  1217. * @param array $pks List of primary keys
  1218. * @param Connection $con the connection to use
  1219. * @throws PropelException Any exceptions caught during processing will be
  1220. * rethrown wrapped into a PropelException.
  1221. */
  1222. public static function retrieveByPKs($pks, $con = null)
  1223. {
  1224. if ($con === null) {
  1225. $con = Propel::getConnection(self::DATABASE_NAME);
  1226. }
  1227. $objs = null;
  1228. if (empty($pks)) {
  1229. $objs = array();
  1230. } else {
  1231. $criteria = new Criteria();
  1232. $criteria->add(KataoNodeProductPeer::ID, $pks, Criteria::IN);
  1233. $objs = KataoNodeProductPeer::doSelect($criteria, $con);
  1234. }
  1235. return $objs;
  1236. }
  1237. } // BaseKataoNodeProductPeer
  1238. // static code to register the map builder for this Peer with the main Propel class
  1239. if (Propel::isInit()) {
  1240. // the MapBuilder classes register themselves with Propel during initialization
  1241. // so we need to load them here.
  1242. try {
  1243. BaseKataoNodeProductPeer::getMapBuilder();
  1244. } catch (Exception $e) {
  1245. Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
  1246. }
  1247. } else {
  1248. // even if Propel is not yet initialized, the map builder class can be registered
  1249. // now and then it will be loaded when Propel initializes.
  1250. Propel::registerMapBuilder('lib.model.map.KataoNodeProductMapBuilder');
  1251. }