BaseKataoCartProductPeer.php 51 KB

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