BaseKataoSupplierInvoiceProductPeer.php 43 KB

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