BaseKataoCartPeer.php 46 KB

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