BaseKataoOrderProduct.php 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978
  1. <?php
  2. /**
  3. * Base class that represents a row from the 'katao_order_product' table.
  4. *
  5. *
  6. *
  7. * @package lib.model.om
  8. */
  9. abstract class BaseKataoOrderProduct extends BaseObject implements Persistent {
  10. /**
  11. * The Peer class.
  12. * Instance provides a convenient way of calling static methods on a class
  13. * that calling code may not be able to identify.
  14. * @var KataoOrderProductPeer
  15. */
  16. protected static $peer;
  17. /**
  18. * The value for the id field.
  19. * @var int
  20. */
  21. protected $id;
  22. /**
  23. * The value for the katao_order_id field.
  24. * @var int
  25. */
  26. protected $katao_order_id;
  27. /**
  28. * The value for the katao_product_id field.
  29. * @var int
  30. */
  31. protected $katao_product_id;
  32. /**
  33. * The value for the product_reference field.
  34. * @var string
  35. */
  36. protected $product_reference;
  37. /**
  38. * The value for the product_name field.
  39. * @var string
  40. */
  41. protected $product_name;
  42. /**
  43. * The value for the product_price_euro field.
  44. * @var double
  45. */
  46. protected $product_price_euro;
  47. /**
  48. * The value for the product_margin field.
  49. * @var double
  50. */
  51. protected $product_margin;
  52. /**
  53. * The value for the product_tva_rate field.
  54. * @var double
  55. */
  56. protected $product_tva_rate = 0;
  57. /**
  58. * The value for the quantity field.
  59. * @var double
  60. */
  61. protected $quantity = 1;
  62. /**
  63. * The value for the quantity_received field.
  64. * @var double
  65. */
  66. protected $quantity_received = 0;
  67. /**
  68. * The value for the quantity_delivered field.
  69. * @var double
  70. */
  71. protected $quantity_delivered = 0;
  72. /**
  73. * The value for the has_been_received field.
  74. * @var int
  75. */
  76. protected $has_been_received = 0;
  77. /**
  78. * The value for the has_been_delivered field.
  79. * @var int
  80. */
  81. protected $has_been_delivered = 0;
  82. /**
  83. * The value for the created_at field.
  84. * @var int
  85. */
  86. protected $created_at;
  87. /**
  88. * The value for the updated_at field.
  89. * @var int
  90. */
  91. protected $updated_at;
  92. /**
  93. * @var KataoOrder
  94. */
  95. protected $aKataoOrder;
  96. /**
  97. * @var KataoProduct
  98. */
  99. protected $aKataoProduct;
  100. /**
  101. * Collection to store aggregation of collKataoCartProducts.
  102. * @var array
  103. */
  104. protected $collKataoCartProducts;
  105. /**
  106. * The criteria used to select the current contents of collKataoCartProducts.
  107. * @var Criteria
  108. */
  109. protected $lastKataoCartProductCriteria = null;
  110. /**
  111. * Collection to store aggregation of collKataoInvoiceProducts.
  112. * @var array
  113. */
  114. protected $collKataoInvoiceProducts;
  115. /**
  116. * The criteria used to select the current contents of collKataoInvoiceProducts.
  117. * @var Criteria
  118. */
  119. protected $lastKataoInvoiceProductCriteria = null;
  120. /**
  121. * Flag to prevent endless save loop, if this object is referenced
  122. * by another object which falls in this transaction.
  123. * @var boolean
  124. */
  125. protected $alreadyInSave = false;
  126. /**
  127. * Flag to prevent endless validation loop, if this object is referenced
  128. * by another object which falls in this transaction.
  129. * @var boolean
  130. */
  131. protected $alreadyInValidation = false;
  132. /**
  133. * Get the [id] column value.
  134. *
  135. * @return int
  136. */
  137. public function getId()
  138. {
  139. return $this->id;
  140. }
  141. /**
  142. * Get the [katao_order_id] column value.
  143. *
  144. * @return int
  145. */
  146. public function getKataoOrderId()
  147. {
  148. return $this->katao_order_id;
  149. }
  150. /**
  151. * Get the [katao_product_id] column value.
  152. *
  153. * @return int
  154. */
  155. public function getKataoProductId()
  156. {
  157. return $this->katao_product_id;
  158. }
  159. /**
  160. * Get the [product_reference] column value.
  161. *
  162. * @return string
  163. */
  164. public function getProductReference()
  165. {
  166. return $this->product_reference;
  167. }
  168. /**
  169. * Get the [product_name] column value.
  170. *
  171. * @return string
  172. */
  173. public function getProductName()
  174. {
  175. return $this->product_name;
  176. }
  177. /**
  178. * Get the [product_price_euro] column value.
  179. *
  180. * @return double
  181. */
  182. public function getProductPriceEuro()
  183. {
  184. return $this->product_price_euro;
  185. }
  186. /**
  187. * Get the [product_margin] column value.
  188. *
  189. * @return double
  190. */
  191. public function getProductMargin()
  192. {
  193. return $this->product_margin;
  194. }
  195. /**
  196. * Get the [product_tva_rate] column value.
  197. *
  198. * @return double
  199. */
  200. public function getProductTvaRate()
  201. {
  202. return $this->product_tva_rate;
  203. }
  204. /**
  205. * Get the [quantity] column value.
  206. *
  207. * @return double
  208. */
  209. public function getQuantity()
  210. {
  211. return $this->quantity;
  212. }
  213. /**
  214. * Get the [quantity_received] column value.
  215. *
  216. * @return double
  217. */
  218. public function getQuantityReceived()
  219. {
  220. return $this->quantity_received;
  221. }
  222. /**
  223. * Get the [quantity_delivered] column value.
  224. *
  225. * @return double
  226. */
  227. public function getQuantityDelivered()
  228. {
  229. return $this->quantity_delivered;
  230. }
  231. /**
  232. * Get the [has_been_received] column value.
  233. *
  234. * @return int
  235. */
  236. public function getHasBeenReceived()
  237. {
  238. return $this->has_been_received;
  239. }
  240. /**
  241. * Get the [has_been_delivered] column value.
  242. *
  243. * @return int
  244. */
  245. public function getHasBeenDelivered()
  246. {
  247. return $this->has_been_delivered;
  248. }
  249. /**
  250. * Get the [optionally formatted] [created_at] column value.
  251. *
  252. * @param string $format The date/time format string (either date()-style or strftime()-style).
  253. * If format is NULL, then the integer unix timestamp will be returned.
  254. * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
  255. * @throws PropelException - if unable to convert the date/time to timestamp.
  256. */
  257. public function getCreatedAt($format = 'Y-m-d H:i:s')
  258. {
  259. if ($this->created_at === null || $this->created_at === '') {
  260. return null;
  261. } elseif (!is_int($this->created_at)) {
  262. // a non-timestamp value was set externally, so we convert it
  263. $ts = strtotime($this->created_at);
  264. if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
  265. throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true));
  266. }
  267. } else {
  268. $ts = $this->created_at;
  269. }
  270. if ($format === null) {
  271. return $ts;
  272. } elseif (strpos($format, '%') !== false) {
  273. return strftime($format, $ts);
  274. } else {
  275. return date($format, $ts);
  276. }
  277. }
  278. /**
  279. * Get the [optionally formatted] [updated_at] column value.
  280. *
  281. * @param string $format The date/time format string (either date()-style or strftime()-style).
  282. * If format is NULL, then the integer unix timestamp will be returned.
  283. * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
  284. * @throws PropelException - if unable to convert the date/time to timestamp.
  285. */
  286. public function getUpdatedAt($format = 'Y-m-d H:i:s')
  287. {
  288. if ($this->updated_at === null || $this->updated_at === '') {
  289. return null;
  290. } elseif (!is_int($this->updated_at)) {
  291. // a non-timestamp value was set externally, so we convert it
  292. $ts = strtotime($this->updated_at);
  293. if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
  294. throw new PropelException("Unable to parse value of [updated_at] as date/time value: " . var_export($this->updated_at, true));
  295. }
  296. } else {
  297. $ts = $this->updated_at;
  298. }
  299. if ($format === null) {
  300. return $ts;
  301. } elseif (strpos($format, '%') !== false) {
  302. return strftime($format, $ts);
  303. } else {
  304. return date($format, $ts);
  305. }
  306. }
  307. /**
  308. * Set the value of [id] column.
  309. *
  310. * @param int $v new value
  311. * @return void
  312. */
  313. public function setId($v)
  314. {
  315. // Since the native PHP type for this column is integer,
  316. // we will cast the input value to an int (if it is not).
  317. if ($v !== null && !is_int($v) && is_numeric($v)) {
  318. $v = (int) $v;
  319. }
  320. if ($this->id !== $v) {
  321. $this->id = $v;
  322. $this->modifiedColumns[] = KataoOrderProductPeer::ID;
  323. }
  324. } // setId()
  325. /**
  326. * Set the value of [katao_order_id] column.
  327. *
  328. * @param int $v new value
  329. * @return void
  330. */
  331. public function setKataoOrderId($v)
  332. {
  333. // Since the native PHP type for this column is integer,
  334. // we will cast the input value to an int (if it is not).
  335. if ($v !== null && !is_int($v) && is_numeric($v)) {
  336. $v = (int) $v;
  337. }
  338. if ($this->katao_order_id !== $v) {
  339. $this->katao_order_id = $v;
  340. $this->modifiedColumns[] = KataoOrderProductPeer::KATAO_ORDER_ID;
  341. }
  342. if ($this->aKataoOrder !== null && $this->aKataoOrder->getId() !== $v) {
  343. $this->aKataoOrder = null;
  344. }
  345. } // setKataoOrderId()
  346. /**
  347. * Set the value of [katao_product_id] column.
  348. *
  349. * @param int $v new value
  350. * @return void
  351. */
  352. public function setKataoProductId($v)
  353. {
  354. // Since the native PHP type for this column is integer,
  355. // we will cast the input value to an int (if it is not).
  356. if ($v !== null && !is_int($v) && is_numeric($v)) {
  357. $v = (int) $v;
  358. }
  359. if ($this->katao_product_id !== $v) {
  360. $this->katao_product_id = $v;
  361. $this->modifiedColumns[] = KataoOrderProductPeer::KATAO_PRODUCT_ID;
  362. }
  363. if ($this->aKataoProduct !== null && $this->aKataoProduct->getId() !== $v) {
  364. $this->aKataoProduct = null;
  365. }
  366. } // setKataoProductId()
  367. /**
  368. * Set the value of [product_reference] column.
  369. *
  370. * @param string $v new value
  371. * @return void
  372. */
  373. public function setProductReference($v)
  374. {
  375. // Since the native PHP type for this column is string,
  376. // we will cast the input to a string (if it is not).
  377. if ($v !== null && !is_string($v)) {
  378. $v = (string) $v;
  379. }
  380. if ($this->product_reference !== $v) {
  381. $this->product_reference = $v;
  382. $this->modifiedColumns[] = KataoOrderProductPeer::PRODUCT_REFERENCE;
  383. }
  384. } // setProductReference()
  385. /**
  386. * Set the value of [product_name] column.
  387. *
  388. * @param string $v new value
  389. * @return void
  390. */
  391. public function setProductName($v)
  392. {
  393. // Since the native PHP type for this column is string,
  394. // we will cast the input to a string (if it is not).
  395. if ($v !== null && !is_string($v)) {
  396. $v = (string) $v;
  397. }
  398. if ($this->product_name !== $v) {
  399. $this->product_name = $v;
  400. $this->modifiedColumns[] = KataoOrderProductPeer::PRODUCT_NAME;
  401. }
  402. } // setProductName()
  403. /**
  404. * Set the value of [product_price_euro] column.
  405. *
  406. * @param double $v new value
  407. * @return void
  408. */
  409. public function setProductPriceEuro($v)
  410. {
  411. if ($this->product_price_euro !== $v) {
  412. $this->product_price_euro = $v;
  413. $this->modifiedColumns[] = KataoOrderProductPeer::PRODUCT_PRICE_EURO;
  414. }
  415. } // setProductPriceEuro()
  416. /**
  417. * Set the value of [product_margin] column.
  418. *
  419. * @param double $v new value
  420. * @return void
  421. */
  422. public function setProductMargin($v)
  423. {
  424. if ($this->product_margin !== $v) {
  425. $this->product_margin = $v;
  426. $this->modifiedColumns[] = KataoOrderProductPeer::PRODUCT_MARGIN;
  427. }
  428. } // setProductMargin()
  429. /**
  430. * Set the value of [product_tva_rate] column.
  431. *
  432. * @param double $v new value
  433. * @return void
  434. */
  435. public function setProductTvaRate($v)
  436. {
  437. if ($this->product_tva_rate !== $v || $v === 0) {
  438. $this->product_tva_rate = $v;
  439. $this->modifiedColumns[] = KataoOrderProductPeer::PRODUCT_TVA_RATE;
  440. }
  441. } // setProductTvaRate()
  442. /**
  443. * Set the value of [quantity] column.
  444. *
  445. * @param double $v new value
  446. * @return void
  447. */
  448. public function setQuantity($v)
  449. {
  450. if ($this->quantity !== $v || $v === 1) {
  451. $this->quantity = $v;
  452. $this->modifiedColumns[] = KataoOrderProductPeer::QUANTITY;
  453. }
  454. } // setQuantity()
  455. /**
  456. * Set the value of [quantity_received] column.
  457. *
  458. * @param double $v new value
  459. * @return void
  460. */
  461. public function setQuantityReceived($v)
  462. {
  463. if ($this->quantity_received !== $v || $v === 0) {
  464. $this->quantity_received = $v;
  465. $this->modifiedColumns[] = KataoOrderProductPeer::QUANTITY_RECEIVED;
  466. }
  467. } // setQuantityReceived()
  468. /**
  469. * Set the value of [quantity_delivered] column.
  470. *
  471. * @param double $v new value
  472. * @return void
  473. */
  474. public function setQuantityDelivered($v)
  475. {
  476. if ($this->quantity_delivered !== $v || $v === 0) {
  477. $this->quantity_delivered = $v;
  478. $this->modifiedColumns[] = KataoOrderProductPeer::QUANTITY_DELIVERED;
  479. }
  480. } // setQuantityDelivered()
  481. /**
  482. * Set the value of [has_been_received] column.
  483. *
  484. * @param int $v new value
  485. * @return void
  486. */
  487. public function setHasBeenReceived($v)
  488. {
  489. // Since the native PHP type for this column is integer,
  490. // we will cast the input value to an int (if it is not).
  491. if ($v !== null && !is_int($v) && is_numeric($v)) {
  492. $v = (int) $v;
  493. }
  494. if ($this->has_been_received !== $v || $v === 0) {
  495. $this->has_been_received = $v;
  496. $this->modifiedColumns[] = KataoOrderProductPeer::HAS_BEEN_RECEIVED;
  497. }
  498. } // setHasBeenReceived()
  499. /**
  500. * Set the value of [has_been_delivered] column.
  501. *
  502. * @param int $v new value
  503. * @return void
  504. */
  505. public function setHasBeenDelivered($v)
  506. {
  507. // Since the native PHP type for this column is integer,
  508. // we will cast the input value to an int (if it is not).
  509. if ($v !== null && !is_int($v) && is_numeric($v)) {
  510. $v = (int) $v;
  511. }
  512. if ($this->has_been_delivered !== $v || $v === 0) {
  513. $this->has_been_delivered = $v;
  514. $this->modifiedColumns[] = KataoOrderProductPeer::HAS_BEEN_DELIVERED;
  515. }
  516. } // setHasBeenDelivered()
  517. /**
  518. * Set the value of [created_at] column.
  519. *
  520. * @param int $v new value
  521. * @return void
  522. */
  523. public function setCreatedAt($v)
  524. {
  525. if ($v !== null && !is_int($v)) {
  526. $ts = strtotime($v);
  527. if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
  528. throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
  529. }
  530. } else {
  531. $ts = $v;
  532. }
  533. if ($this->created_at !== $ts) {
  534. $this->created_at = $ts;
  535. $this->modifiedColumns[] = KataoOrderProductPeer::CREATED_AT;
  536. }
  537. } // setCreatedAt()
  538. /**
  539. * Set the value of [updated_at] column.
  540. *
  541. * @param int $v new value
  542. * @return void
  543. */
  544. public function setUpdatedAt($v)
  545. {
  546. if ($v !== null && !is_int($v)) {
  547. $ts = strtotime($v);
  548. if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
  549. throw new PropelException("Unable to parse date/time value for [updated_at] from input: " . var_export($v, true));
  550. }
  551. } else {
  552. $ts = $v;
  553. }
  554. if ($this->updated_at !== $ts) {
  555. $this->updated_at = $ts;
  556. $this->modifiedColumns[] = KataoOrderProductPeer::UPDATED_AT;
  557. }
  558. } // setUpdatedAt()
  559. /**
  560. * Hydrates (populates) the object variables with values from the database resultset.
  561. *
  562. * An offset (1-based "start column") is specified so that objects can be hydrated
  563. * with a subset of the columns in the resultset rows. This is needed, for example,
  564. * for results of JOIN queries where the resultset row includes columns from two or
  565. * more tables.
  566. *
  567. * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
  568. * @param int $startcol 1-based offset column which indicates which restultset column to start with.
  569. * @return int next starting column
  570. * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
  571. */
  572. public function hydrate(ResultSet $rs, $startcol = 1)
  573. {
  574. try {
  575. $this->id = $rs->getInt($startcol + 0);
  576. $this->katao_order_id = $rs->getInt($startcol + 1);
  577. $this->katao_product_id = $rs->getInt($startcol + 2);
  578. $this->product_reference = $rs->getString($startcol + 3);
  579. $this->product_name = $rs->getString($startcol + 4);
  580. $this->product_price_euro = $rs->getFloat($startcol + 5);
  581. $this->product_margin = $rs->getFloat($startcol + 6);
  582. $this->product_tva_rate = $rs->getFloat($startcol + 7);
  583. $this->quantity = $rs->getFloat($startcol + 8);
  584. $this->quantity_received = $rs->getFloat($startcol + 9);
  585. $this->quantity_delivered = $rs->getFloat($startcol + 10);
  586. $this->has_been_received = $rs->getInt($startcol + 11);
  587. $this->has_been_delivered = $rs->getInt($startcol + 12);
  588. $this->created_at = $rs->getTimestamp($startcol + 13, null);
  589. $this->updated_at = $rs->getTimestamp($startcol + 14, null);
  590. $this->resetModified();
  591. $this->setNew(false);
  592. // FIXME - using NUM_COLUMNS may be clearer.
  593. return $startcol + 15; // 15 = KataoOrderProductPeer::NUM_COLUMNS - KataoOrderProductPeer::NUM_LAZY_LOAD_COLUMNS).
  594. } catch (Exception $e) {
  595. throw new PropelException("Error populating KataoOrderProduct object", $e);
  596. }
  597. }
  598. /**
  599. * Removes this object from datastore and sets delete attribute.
  600. *
  601. * @param Connection $con
  602. * @return void
  603. * @throws PropelException
  604. * @see BaseObject::setDeleted()
  605. * @see BaseObject::isDeleted()
  606. */
  607. public function delete($con = null)
  608. {
  609. foreach (sfMixer::getCallables('BaseKataoOrderProduct:delete:pre') as $callable)
  610. {
  611. $ret = call_user_func($callable, $this, $con);
  612. if ($ret)
  613. {
  614. return;
  615. }
  616. }
  617. if ($this->isDeleted()) {
  618. throw new PropelException("This object has already been deleted.");
  619. }
  620. if ($con === null) {
  621. $con = Propel::getConnection(KataoOrderProductPeer::DATABASE_NAME);
  622. }
  623. try {
  624. $con->begin();
  625. KataoOrderProductPeer::doDelete($this, $con);
  626. $this->setDeleted(true);
  627. $con->commit();
  628. } catch (PropelException $e) {
  629. $con->rollback();
  630. throw $e;
  631. }
  632. foreach (sfMixer::getCallables('BaseKataoOrderProduct:delete:post') as $callable)
  633. {
  634. call_user_func($callable, $this, $con);
  635. }
  636. }
  637. /**
  638. * Stores the object in the database. If the object is new,
  639. * it inserts it; otherwise an update is performed. This method
  640. * wraps the doSave() worker method in a transaction.
  641. *
  642. * @param Connection $con
  643. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  644. * @throws PropelException
  645. * @see doSave()
  646. */
  647. public function save($con = null)
  648. {
  649. foreach (sfMixer::getCallables('BaseKataoOrderProduct:save:pre') as $callable)
  650. {
  651. $affectedRows = call_user_func($callable, $this, $con);
  652. if (is_int($affectedRows))
  653. {
  654. return $affectedRows;
  655. }
  656. }
  657. if ($this->isNew() && !$this->isColumnModified(KataoOrderProductPeer::CREATED_AT))
  658. {
  659. $this->setCreatedAt(time());
  660. }
  661. if ($this->isModified() && !$this->isColumnModified(KataoOrderProductPeer::UPDATED_AT))
  662. {
  663. $this->setUpdatedAt(time());
  664. }
  665. if ($this->isDeleted()) {
  666. throw new PropelException("You cannot save an object that has been deleted.");
  667. }
  668. if ($con === null) {
  669. $con = Propel::getConnection(KataoOrderProductPeer::DATABASE_NAME);
  670. }
  671. try {
  672. $con->begin();
  673. $affectedRows = $this->doSave($con);
  674. $con->commit();
  675. foreach (sfMixer::getCallables('BaseKataoOrderProduct:save:post') as $callable)
  676. {
  677. call_user_func($callable, $this, $con, $affectedRows);
  678. }
  679. return $affectedRows;
  680. } catch (PropelException $e) {
  681. $con->rollback();
  682. throw $e;
  683. }
  684. }
  685. /**
  686. * Stores the object in the database.
  687. *
  688. * If the object is new, it inserts it; otherwise an update is performed.
  689. * All related objects are also updated in this method.
  690. *
  691. * @param Connection $con
  692. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  693. * @throws PropelException
  694. * @see save()
  695. */
  696. protected function doSave($con)
  697. {
  698. $affectedRows = 0; // initialize var to track total num of affected rows
  699. if (!$this->alreadyInSave) {
  700. $this->alreadyInSave = true;
  701. // We call the save method on the following object(s) if they
  702. // were passed to this object by their coresponding set
  703. // method. This object relates to these object(s) by a
  704. // foreign key reference.
  705. if ($this->aKataoOrder !== null) {
  706. if ($this->aKataoOrder->isModified()) {
  707. $affectedRows += $this->aKataoOrder->save($con);
  708. }
  709. $this->setKataoOrder($this->aKataoOrder);
  710. }
  711. if ($this->aKataoProduct !== null) {
  712. if ($this->aKataoProduct->isModified()) {
  713. $affectedRows += $this->aKataoProduct->save($con);
  714. }
  715. $this->setKataoProduct($this->aKataoProduct);
  716. }
  717. // If this object has been modified, then save it to the database.
  718. if ($this->isModified()) {
  719. if ($this->isNew()) {
  720. $pk = KataoOrderProductPeer::doInsert($this, $con);
  721. $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
  722. // should always be true here (even though technically
  723. // BasePeer::doInsert() can insert multiple rows).
  724. $this->setId($pk); //[IMV] update autoincrement primary key
  725. $this->setNew(false);
  726. } else {
  727. $affectedRows += KataoOrderProductPeer::doUpdate($this, $con);
  728. }
  729. $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
  730. }
  731. if ($this->collKataoCartProducts !== null) {
  732. foreach($this->collKataoCartProducts as $referrerFK) {
  733. if (!$referrerFK->isDeleted()) {
  734. $affectedRows += $referrerFK->save($con);
  735. }
  736. }
  737. }
  738. if ($this->collKataoInvoiceProducts !== null) {
  739. foreach($this->collKataoInvoiceProducts as $referrerFK) {
  740. if (!$referrerFK->isDeleted()) {
  741. $affectedRows += $referrerFK->save($con);
  742. }
  743. }
  744. }
  745. $this->alreadyInSave = false;
  746. }
  747. return $affectedRows;
  748. } // doSave()
  749. /**
  750. * Array of ValidationFailed objects.
  751. * @var array ValidationFailed[]
  752. */
  753. protected $validationFailures = array();
  754. /**
  755. * Gets any ValidationFailed objects that resulted from last call to validate().
  756. *
  757. *
  758. * @return array ValidationFailed[]
  759. * @see validate()
  760. */
  761. public function getValidationFailures()
  762. {
  763. return $this->validationFailures;
  764. }
  765. /**
  766. * Validates the objects modified field values and all objects related to this table.
  767. *
  768. * If $columns is either a column name or an array of column names
  769. * only those columns are validated.
  770. *
  771. * @param mixed $columns Column name or an array of column names.
  772. * @return boolean Whether all columns pass validation.
  773. * @see doValidate()
  774. * @see getValidationFailures()
  775. */
  776. public function validate($columns = null)
  777. {
  778. $res = $this->doValidate($columns);
  779. if ($res === true) {
  780. $this->validationFailures = array();
  781. return true;
  782. } else {
  783. $this->validationFailures = $res;
  784. return false;
  785. }
  786. }
  787. /**
  788. * This function performs the validation work for complex object models.
  789. *
  790. * In addition to checking the current object, all related objects will
  791. * also be validated. If all pass then <code>true</code> is returned; otherwise
  792. * an aggreagated array of ValidationFailed objects will be returned.
  793. *
  794. * @param array $columns Array of column names to validate.
  795. * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  796. */
  797. protected function doValidate($columns = null)
  798. {
  799. if (!$this->alreadyInValidation) {
  800. $this->alreadyInValidation = true;
  801. $retval = null;
  802. $failureMap = array();
  803. // We call the validate method on the following object(s) if they
  804. // were passed to this object by their coresponding set
  805. // method. This object relates to these object(s) by a
  806. // foreign key reference.
  807. if ($this->aKataoOrder !== null) {
  808. if (!$this->aKataoOrder->validate($columns)) {
  809. $failureMap = array_merge($failureMap, $this->aKataoOrder->getValidationFailures());
  810. }
  811. }
  812. if ($this->aKataoProduct !== null) {
  813. if (!$this->aKataoProduct->validate($columns)) {
  814. $failureMap = array_merge($failureMap, $this->aKataoProduct->getValidationFailures());
  815. }
  816. }
  817. if (($retval = KataoOrderProductPeer::doValidate($this, $columns)) !== true) {
  818. $failureMap = array_merge($failureMap, $retval);
  819. }
  820. if ($this->collKataoCartProducts !== null) {
  821. foreach($this->collKataoCartProducts as $referrerFK) {
  822. if (!$referrerFK->validate($columns)) {
  823. $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
  824. }
  825. }
  826. }
  827. if ($this->collKataoInvoiceProducts !== null) {
  828. foreach($this->collKataoInvoiceProducts as $referrerFK) {
  829. if (!$referrerFK->validate($columns)) {
  830. $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
  831. }
  832. }
  833. }
  834. $this->alreadyInValidation = false;
  835. }
  836. return (!empty($failureMap) ? $failureMap : true);
  837. }
  838. /**
  839. * Retrieves a field from the object by name passed in as a string.
  840. *
  841. * @param string $name name
  842. * @param string $type The type of fieldname the $name is of:
  843. * one of the class type constants TYPE_PHPNAME,
  844. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  845. * @return mixed Value of field.
  846. */
  847. public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
  848. {
  849. $pos = KataoOrderProductPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  850. return $this->getByPosition($pos);
  851. }
  852. /**
  853. * Retrieves a field from the object by Position as specified in the xml schema.
  854. * Zero-based.
  855. *
  856. * @param int $pos position in xml schema
  857. * @return mixed Value of field at $pos
  858. */
  859. public function getByPosition($pos)
  860. {
  861. switch($pos) {
  862. case 0:
  863. return $this->getId();
  864. break;
  865. case 1:
  866. return $this->getKataoOrderId();
  867. break;
  868. case 2:
  869. return $this->getKataoProductId();
  870. break;
  871. case 3:
  872. return $this->getProductReference();
  873. break;
  874. case 4:
  875. return $this->getProductName();
  876. break;
  877. case 5:
  878. return $this->getProductPriceEuro();
  879. break;
  880. case 6:
  881. return $this->getProductMargin();
  882. break;
  883. case 7:
  884. return $this->getProductTvaRate();
  885. break;
  886. case 8:
  887. return $this->getQuantity();
  888. break;
  889. case 9:
  890. return $this->getQuantityReceived();
  891. break;
  892. case 10:
  893. return $this->getQuantityDelivered();
  894. break;
  895. case 11:
  896. return $this->getHasBeenReceived();
  897. break;
  898. case 12:
  899. return $this->getHasBeenDelivered();
  900. break;
  901. case 13:
  902. return $this->getCreatedAt();
  903. break;
  904. case 14:
  905. return $this->getUpdatedAt();
  906. break;
  907. default:
  908. return null;
  909. break;
  910. } // switch()
  911. }
  912. /**
  913. * Exports the object as an array.
  914. *
  915. * You can specify the key type of the array by passing one of the class
  916. * type constants.
  917. *
  918. * @param string $keyType One of the class type constants TYPE_PHPNAME,
  919. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  920. * @return an associative array containing the field names (as keys) and field values
  921. */
  922. public function toArray($keyType = BasePeer::TYPE_PHPNAME)
  923. {
  924. $keys = KataoOrderProductPeer::getFieldNames($keyType);
  925. $result = array(
  926. $keys[0] => $this->getId(),
  927. $keys[1] => $this->getKataoOrderId(),
  928. $keys[2] => $this->getKataoProductId(),
  929. $keys[3] => $this->getProductReference(),
  930. $keys[4] => $this->getProductName(),
  931. $keys[5] => $this->getProductPriceEuro(),
  932. $keys[6] => $this->getProductMargin(),
  933. $keys[7] => $this->getProductTvaRate(),
  934. $keys[8] => $this->getQuantity(),
  935. $keys[9] => $this->getQuantityReceived(),
  936. $keys[10] => $this->getQuantityDelivered(),
  937. $keys[11] => $this->getHasBeenReceived(),
  938. $keys[12] => $this->getHasBeenDelivered(),
  939. $keys[13] => $this->getCreatedAt(),
  940. $keys[14] => $this->getUpdatedAt(),
  941. );
  942. return $result;
  943. }
  944. /**
  945. * Sets a field from the object by name passed in as a string.
  946. *
  947. * @param string $name peer name
  948. * @param mixed $value field value
  949. * @param string $type The type of fieldname the $name is of:
  950. * one of the class type constants TYPE_PHPNAME,
  951. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  952. * @return void
  953. */
  954. public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
  955. {
  956. $pos = KataoOrderProductPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  957. return $this->setByPosition($pos, $value);
  958. }
  959. /**
  960. * Sets a field from the object by Position as specified in the xml schema.
  961. * Zero-based.
  962. *
  963. * @param int $pos position in xml schema
  964. * @param mixed $value field value
  965. * @return void
  966. */
  967. public function setByPosition($pos, $value)
  968. {
  969. switch($pos) {
  970. case 0:
  971. $this->setId($value);
  972. break;
  973. case 1:
  974. $this->setKataoOrderId($value);
  975. break;
  976. case 2:
  977. $this->setKataoProductId($value);
  978. break;
  979. case 3:
  980. $this->setProductReference($value);
  981. break;
  982. case 4:
  983. $this->setProductName($value);
  984. break;
  985. case 5:
  986. $this->setProductPriceEuro($value);
  987. break;
  988. case 6:
  989. $this->setProductMargin($value);
  990. break;
  991. case 7:
  992. $this->setProductTvaRate($value);
  993. break;
  994. case 8:
  995. $this->setQuantity($value);
  996. break;
  997. case 9:
  998. $this->setQuantityReceived($value);
  999. break;
  1000. case 10:
  1001. $this->setQuantityDelivered($value);
  1002. break;
  1003. case 11:
  1004. $this->setHasBeenReceived($value);
  1005. break;
  1006. case 12:
  1007. $this->setHasBeenDelivered($value);
  1008. break;
  1009. case 13:
  1010. $this->setCreatedAt($value);
  1011. break;
  1012. case 14:
  1013. $this->setUpdatedAt($value);
  1014. break;
  1015. } // switch()
  1016. }
  1017. /**
  1018. * Populates the object using an array.
  1019. *
  1020. * This is particularly useful when populating an object from one of the
  1021. * request arrays (e.g. $_POST). This method goes through the column
  1022. * names, checking to see whether a matching key exists in populated
  1023. * array. If so the setByName() method is called for that column.
  1024. *
  1025. * You can specify the key type of the array by additionally passing one
  1026. * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
  1027. * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
  1028. *
  1029. * @param array $arr An array to populate the object from.
  1030. * @param string $keyType The type of keys the array uses.
  1031. * @return void
  1032. */
  1033. public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
  1034. {
  1035. $keys = KataoOrderProductPeer::getFieldNames($keyType);
  1036. if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
  1037. if (array_key_exists($keys[1], $arr)) $this->setKataoOrderId($arr[$keys[1]]);
  1038. if (array_key_exists($keys[2], $arr)) $this->setKataoProductId($arr[$keys[2]]);
  1039. if (array_key_exists($keys[3], $arr)) $this->setProductReference($arr[$keys[3]]);
  1040. if (array_key_exists($keys[4], $arr)) $this->setProductName($arr[$keys[4]]);
  1041. if (array_key_exists($keys[5], $arr)) $this->setProductPriceEuro($arr[$keys[5]]);
  1042. if (array_key_exists($keys[6], $arr)) $this->setProductMargin($arr[$keys[6]]);
  1043. if (array_key_exists($keys[7], $arr)) $this->setProductTvaRate($arr[$keys[7]]);
  1044. if (array_key_exists($keys[8], $arr)) $this->setQuantity($arr[$keys[8]]);
  1045. if (array_key_exists($keys[9], $arr)) $this->setQuantityReceived($arr[$keys[9]]);
  1046. if (array_key_exists($keys[10], $arr)) $this->setQuantityDelivered($arr[$keys[10]]);
  1047. if (array_key_exists($keys[11], $arr)) $this->setHasBeenReceived($arr[$keys[11]]);
  1048. if (array_key_exists($keys[12], $arr)) $this->setHasBeenDelivered($arr[$keys[12]]);
  1049. if (array_key_exists($keys[13], $arr)) $this->setCreatedAt($arr[$keys[13]]);
  1050. if (array_key_exists($keys[14], $arr)) $this->setUpdatedAt($arr[$keys[14]]);
  1051. }
  1052. /**
  1053. * Build a Criteria object containing the values of all modified columns in this object.
  1054. *
  1055. * @return Criteria The Criteria object containing all modified values.
  1056. */
  1057. public function buildCriteria()
  1058. {
  1059. $criteria = new Criteria(KataoOrderProductPeer::DATABASE_NAME);
  1060. if ($this->isColumnModified(KataoOrderProductPeer::ID)) $criteria->add(KataoOrderProductPeer::ID, $this->id);
  1061. if ($this->isColumnModified(KataoOrderProductPeer::KATAO_ORDER_ID)) $criteria->add(KataoOrderProductPeer::KATAO_ORDER_ID, $this->katao_order_id);
  1062. if ($this->isColumnModified(KataoOrderProductPeer::KATAO_PRODUCT_ID)) $criteria->add(KataoOrderProductPeer::KATAO_PRODUCT_ID, $this->katao_product_id);
  1063. if ($this->isColumnModified(KataoOrderProductPeer::PRODUCT_REFERENCE)) $criteria->add(KataoOrderProductPeer::PRODUCT_REFERENCE, $this->product_reference);
  1064. if ($this->isColumnModified(KataoOrderProductPeer::PRODUCT_NAME)) $criteria->add(KataoOrderProductPeer::PRODUCT_NAME, $this->product_name);
  1065. if ($this->isColumnModified(KataoOrderProductPeer::PRODUCT_PRICE_EURO)) $criteria->add(KataoOrderProductPeer::PRODUCT_PRICE_EURO, $this->product_price_euro);
  1066. if ($this->isColumnModified(KataoOrderProductPeer::PRODUCT_MARGIN)) $criteria->add(KataoOrderProductPeer::PRODUCT_MARGIN, $this->product_margin);
  1067. if ($this->isColumnModified(KataoOrderProductPeer::PRODUCT_TVA_RATE)) $criteria->add(KataoOrderProductPeer::PRODUCT_TVA_RATE, $this->product_tva_rate);
  1068. if ($this->isColumnModified(KataoOrderProductPeer::QUANTITY)) $criteria->add(KataoOrderProductPeer::QUANTITY, $this->quantity);
  1069. if ($this->isColumnModified(KataoOrderProductPeer::QUANTITY_RECEIVED)) $criteria->add(KataoOrderProductPeer::QUANTITY_RECEIVED, $this->quantity_received);
  1070. if ($this->isColumnModified(KataoOrderProductPeer::QUANTITY_DELIVERED)) $criteria->add(KataoOrderProductPeer::QUANTITY_DELIVERED, $this->quantity_delivered);
  1071. if ($this->isColumnModified(KataoOrderProductPeer::HAS_BEEN_RECEIVED)) $criteria->add(KataoOrderProductPeer::HAS_BEEN_RECEIVED, $this->has_been_received);
  1072. if ($this->isColumnModified(KataoOrderProductPeer::HAS_BEEN_DELIVERED)) $criteria->add(KataoOrderProductPeer::HAS_BEEN_DELIVERED, $this->has_been_delivered);
  1073. if ($this->isColumnModified(KataoOrderProductPeer::CREATED_AT)) $criteria->add(KataoOrderProductPeer::CREATED_AT, $this->created_at);
  1074. if ($this->isColumnModified(KataoOrderProductPeer::UPDATED_AT)) $criteria->add(KataoOrderProductPeer::UPDATED_AT, $this->updated_at);
  1075. return $criteria;
  1076. }
  1077. /**
  1078. * Builds a Criteria object containing the primary key for this object.
  1079. *
  1080. * Unlike buildCriteria() this method includes the primary key values regardless
  1081. * of whether or not they have been modified.
  1082. *
  1083. * @return Criteria The Criteria object containing value(s) for primary key(s).
  1084. */
  1085. public function buildPkeyCriteria()
  1086. {
  1087. $criteria = new Criteria(KataoOrderProductPeer::DATABASE_NAME);
  1088. $criteria->add(KataoOrderProductPeer::ID, $this->id);
  1089. return $criteria;
  1090. }
  1091. /**
  1092. * Returns the primary key for this object (row).
  1093. * @return int
  1094. */
  1095. public function getPrimaryKey()
  1096. {
  1097. return $this->getId();
  1098. }
  1099. /**
  1100. * Generic method to set the primary key (id column).
  1101. *
  1102. * @param int $key Primary key.
  1103. * @return void
  1104. */
  1105. public function setPrimaryKey($key)
  1106. {
  1107. $this->setId($key);
  1108. }
  1109. /**
  1110. * Sets contents of passed object to values from current object.
  1111. *
  1112. * If desired, this method can also make copies of all associated (fkey referrers)
  1113. * objects.
  1114. *
  1115. * @param object $copyObj An object of KataoOrderProduct (or compatible) type.
  1116. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  1117. * @throws PropelException
  1118. */
  1119. public function copyInto($copyObj, $deepCopy = false)
  1120. {
  1121. $copyObj->setKataoOrderId($this->katao_order_id);
  1122. $copyObj->setKataoProductId($this->katao_product_id);
  1123. $copyObj->setProductReference($this->product_reference);
  1124. $copyObj->setProductName($this->product_name);
  1125. $copyObj->setProductPriceEuro($this->product_price_euro);
  1126. $copyObj->setProductMargin($this->product_margin);
  1127. $copyObj->setProductTvaRate($this->product_tva_rate);
  1128. $copyObj->setQuantity($this->quantity);
  1129. $copyObj->setQuantityReceived($this->quantity_received);
  1130. $copyObj->setQuantityDelivered($this->quantity_delivered);
  1131. $copyObj->setHasBeenReceived($this->has_been_received);
  1132. $copyObj->setHasBeenDelivered($this->has_been_delivered);
  1133. $copyObj->setCreatedAt($this->created_at);
  1134. $copyObj->setUpdatedAt($this->updated_at);
  1135. if ($deepCopy) {
  1136. // important: temporarily setNew(false) because this affects the behavior of
  1137. // the getter/setter methods for fkey referrer objects.
  1138. $copyObj->setNew(false);
  1139. foreach($this->getKataoCartProducts() as $relObj) {
  1140. $copyObj->addKataoCartProduct($relObj->copy($deepCopy));
  1141. }
  1142. foreach($this->getKataoInvoiceProducts() as $relObj) {
  1143. $copyObj->addKataoInvoiceProduct($relObj->copy($deepCopy));
  1144. }
  1145. } // if ($deepCopy)
  1146. $copyObj->setNew(true);
  1147. $copyObj->setId(NULL); // this is a pkey column, so set to default value
  1148. }
  1149. /**
  1150. * Makes a copy of this object that will be inserted as a new row in table when saved.
  1151. * It creates a new object filling in the simple attributes, but skipping any primary
  1152. * keys that are defined for the table.
  1153. *
  1154. * If desired, this method can also make copies of all associated (fkey referrers)
  1155. * objects.
  1156. *
  1157. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  1158. * @return KataoOrderProduct Clone of current object.
  1159. * @throws PropelException
  1160. */
  1161. public function copy($deepCopy = false)
  1162. {
  1163. // we use get_class(), because this might be a subclass
  1164. $clazz = get_class($this);
  1165. $copyObj = new $clazz();
  1166. $this->copyInto($copyObj, $deepCopy);
  1167. return $copyObj;
  1168. }
  1169. /**
  1170. * Returns a peer instance associated with this om.
  1171. *
  1172. * Since Peer classes are not to have any instance attributes, this method returns the
  1173. * same instance for all member of this class. The method could therefore
  1174. * be static, but this would prevent one from overriding the behavior.
  1175. *
  1176. * @return KataoOrderProductPeer
  1177. */
  1178. public function getPeer()
  1179. {
  1180. if (self::$peer === null) {
  1181. self::$peer = new KataoOrderProductPeer();
  1182. }
  1183. return self::$peer;
  1184. }
  1185. /**
  1186. * Declares an association between this object and a KataoOrder object.
  1187. *
  1188. * @param KataoOrder $v
  1189. * @return void
  1190. * @throws PropelException
  1191. */
  1192. public function setKataoOrder($v)
  1193. {
  1194. if ($v === null) {
  1195. $this->setKataoOrderId(NULL);
  1196. } else {
  1197. $this->setKataoOrderId($v->getId());
  1198. }
  1199. $this->aKataoOrder = $v;
  1200. }
  1201. /**
  1202. * Get the associated KataoOrder object
  1203. *
  1204. * @param Connection Optional Connection object.
  1205. * @return KataoOrder The associated KataoOrder object.
  1206. * @throws PropelException
  1207. */
  1208. public function getKataoOrder($con = null)
  1209. {
  1210. if ($this->aKataoOrder === null && ($this->katao_order_id !== null)) {
  1211. // include the related Peer class
  1212. $this->aKataoOrder = KataoOrderPeer::retrieveByPK($this->katao_order_id, $con);
  1213. /* The following can be used instead of the line above to
  1214. guarantee the related object contains a reference
  1215. to this object, but this level of coupling
  1216. may be undesirable in many circumstances.
  1217. As it can lead to a db query with many results that may
  1218. never be used.
  1219. $obj = KataoOrderPeer::retrieveByPK($this->katao_order_id, $con);
  1220. $obj->addKataoOrders($this);
  1221. */
  1222. }
  1223. return $this->aKataoOrder;
  1224. }
  1225. /**
  1226. * Declares an association between this object and a KataoProduct object.
  1227. *
  1228. * @param KataoProduct $v
  1229. * @return void
  1230. * @throws PropelException
  1231. */
  1232. public function setKataoProduct($v)
  1233. {
  1234. if ($v === null) {
  1235. $this->setKataoProductId(NULL);
  1236. } else {
  1237. $this->setKataoProductId($v->getId());
  1238. }
  1239. $this->aKataoProduct = $v;
  1240. }
  1241. /**
  1242. * Get the associated KataoProduct object
  1243. *
  1244. * @param Connection Optional Connection object.
  1245. * @return KataoProduct The associated KataoProduct object.
  1246. * @throws PropelException
  1247. */
  1248. public function getKataoProduct($con = null)
  1249. {
  1250. if ($this->aKataoProduct === null && ($this->katao_product_id !== null)) {
  1251. // include the related Peer class
  1252. $this->aKataoProduct = KataoProductPeer::retrieveByPK($this->katao_product_id, $con);
  1253. /* The following can be used instead of the line above to
  1254. guarantee the related object contains a reference
  1255. to this object, but this level of coupling
  1256. may be undesirable in many circumstances.
  1257. As it can lead to a db query with many results that may
  1258. never be used.
  1259. $obj = KataoProductPeer::retrieveByPK($this->katao_product_id, $con);
  1260. $obj->addKataoProducts($this);
  1261. */
  1262. }
  1263. return $this->aKataoProduct;
  1264. }
  1265. /**
  1266. * Temporary storage of collKataoCartProducts to save a possible db hit in
  1267. * the event objects are add to the collection, but the
  1268. * complete collection is never requested.
  1269. * @return void
  1270. */
  1271. public function initKataoCartProducts()
  1272. {
  1273. if ($this->collKataoCartProducts === null) {
  1274. $this->collKataoCartProducts = array();
  1275. }
  1276. }
  1277. /**
  1278. * If this collection has already been initialized with
  1279. * an identical criteria, it returns the collection.
  1280. * Otherwise if this KataoOrderProduct has previously
  1281. * been saved, it will retrieve related KataoCartProducts from storage.
  1282. * If this KataoOrderProduct is new, it will return
  1283. * an empty collection or the current collection, the criteria
  1284. * is ignored on a new object.
  1285. *
  1286. * @param Connection $con
  1287. * @param Criteria $criteria
  1288. * @throws PropelException
  1289. */
  1290. public function getKataoCartProducts($criteria = null, $con = null)
  1291. {
  1292. // include the Peer class
  1293. if ($criteria === null) {
  1294. $criteria = new Criteria();
  1295. }
  1296. elseif ($criteria instanceof Criteria)
  1297. {
  1298. $criteria = clone $criteria;
  1299. }
  1300. if ($this->collKataoCartProducts === null) {
  1301. if ($this->isNew()) {
  1302. $this->collKataoCartProducts = array();
  1303. } else {
  1304. $criteria->add(KataoCartProductPeer::KATAO_ORDER_PRODUCT_ID, $this->getId());
  1305. KataoCartProductPeer::addSelectColumns($criteria);
  1306. $this->collKataoCartProducts = KataoCartProductPeer::doSelect($criteria, $con);
  1307. }
  1308. } else {
  1309. // criteria has no effect for a new object
  1310. if (!$this->isNew()) {
  1311. // the following code is to determine if a new query is
  1312. // called for. If the criteria is the same as the last
  1313. // one, just return the collection.
  1314. $criteria->add(KataoCartProductPeer::KATAO_ORDER_PRODUCT_ID, $this->getId());
  1315. KataoCartProductPeer::addSelectColumns($criteria);
  1316. if (!isset($this->lastKataoCartProductCriteria) || !$this->lastKataoCartProductCriteria->equals($criteria)) {
  1317. $this->collKataoCartProducts = KataoCartProductPeer::doSelect($criteria, $con);
  1318. }
  1319. }
  1320. }
  1321. $this->lastKataoCartProductCriteria = $criteria;
  1322. return $this->collKataoCartProducts;
  1323. }
  1324. /**
  1325. * Returns the number of related KataoCartProducts.
  1326. *
  1327. * @param Criteria $criteria
  1328. * @param boolean $distinct
  1329. * @param Connection $con
  1330. * @throws PropelException
  1331. */
  1332. public function countKataoCartProducts($criteria = null, $distinct = false, $con = null)
  1333. {
  1334. // include the Peer class
  1335. if ($criteria === null) {
  1336. $criteria = new Criteria();
  1337. }
  1338. elseif ($criteria instanceof Criteria)
  1339. {
  1340. $criteria = clone $criteria;
  1341. }
  1342. $criteria->add(KataoCartProductPeer::KATAO_ORDER_PRODUCT_ID, $this->getId());
  1343. return KataoCartProductPeer::doCount($criteria, $distinct, $con);
  1344. }
  1345. /**
  1346. * Method called to associate a KataoCartProduct object to this object
  1347. * through the KataoCartProduct foreign key attribute
  1348. *
  1349. * @param KataoCartProduct $l KataoCartProduct
  1350. * @return void
  1351. * @throws PropelException
  1352. */
  1353. public function addKataoCartProduct(KataoCartProduct $l)
  1354. {
  1355. $this->collKataoCartProducts[] = $l;
  1356. $l->setKataoOrderProduct($this);
  1357. }
  1358. /**
  1359. * If this collection has already been initialized with
  1360. * an identical criteria, it returns the collection.
  1361. * Otherwise if this KataoOrderProduct is new, it will return
  1362. * an empty collection; or if this KataoOrderProduct has previously
  1363. * been saved, it will retrieve related KataoCartProducts from storage.
  1364. *
  1365. * This method is protected by default in order to keep the public
  1366. * api reasonable. You can provide public methods for those you
  1367. * actually need in KataoOrderProduct.
  1368. */
  1369. public function getKataoCartProductsJoinKataoCart($criteria = null, $con = null)
  1370. {
  1371. // include the Peer class
  1372. if ($criteria === null) {
  1373. $criteria = new Criteria();
  1374. }
  1375. elseif ($criteria instanceof Criteria)
  1376. {
  1377. $criteria = clone $criteria;
  1378. }
  1379. if ($this->collKataoCartProducts === null) {
  1380. if ($this->isNew()) {
  1381. $this->collKataoCartProducts = array();
  1382. } else {
  1383. $criteria->add(KataoCartProductPeer::KATAO_ORDER_PRODUCT_ID, $this->getId());
  1384. $this->collKataoCartProducts = KataoCartProductPeer::doSelectJoinKataoCart($criteria, $con);
  1385. }
  1386. } else {
  1387. // the following code is to determine if a new query is
  1388. // called for. If the criteria is the same as the last
  1389. // one, just return the collection.
  1390. $criteria->add(KataoCartProductPeer::KATAO_ORDER_PRODUCT_ID, $this->getId());
  1391. if (!isset($this->lastKataoCartProductCriteria) || !$this->lastKataoCartProductCriteria->equals($criteria)) {
  1392. $this->collKataoCartProducts = KataoCartProductPeer::doSelectJoinKataoCart($criteria, $con);
  1393. }
  1394. }
  1395. $this->lastKataoCartProductCriteria = $criteria;
  1396. return $this->collKataoCartProducts;
  1397. }
  1398. /**
  1399. * If this collection has already been initialized with
  1400. * an identical criteria, it returns the collection.
  1401. * Otherwise if this KataoOrderProduct is new, it will return
  1402. * an empty collection; or if this KataoOrderProduct has previously
  1403. * been saved, it will retrieve related KataoCartProducts from storage.
  1404. *
  1405. * This method is protected by default in order to keep the public
  1406. * api reasonable. You can provide public methods for those you
  1407. * actually need in KataoOrderProduct.
  1408. */
  1409. public function getKataoCartProductsJoinKataoProduct($criteria = null, $con = null)
  1410. {
  1411. // include the Peer class
  1412. if ($criteria === null) {
  1413. $criteria = new Criteria();
  1414. }
  1415. elseif ($criteria instanceof Criteria)
  1416. {
  1417. $criteria = clone $criteria;
  1418. }
  1419. if ($this->collKataoCartProducts === null) {
  1420. if ($this->isNew()) {
  1421. $this->collKataoCartProducts = array();
  1422. } else {
  1423. $criteria->add(KataoCartProductPeer::KATAO_ORDER_PRODUCT_ID, $this->getId());
  1424. $this->collKataoCartProducts = KataoCartProductPeer::doSelectJoinKataoProduct($criteria, $con);
  1425. }
  1426. } else {
  1427. // the following code is to determine if a new query is
  1428. // called for. If the criteria is the same as the last
  1429. // one, just return the collection.
  1430. $criteria->add(KataoCartProductPeer::KATAO_ORDER_PRODUCT_ID, $this->getId());
  1431. if (!isset($this->lastKataoCartProductCriteria) || !$this->lastKataoCartProductCriteria->equals($criteria)) {
  1432. $this->collKataoCartProducts = KataoCartProductPeer::doSelectJoinKataoProduct($criteria, $con);
  1433. }
  1434. }
  1435. $this->lastKataoCartProductCriteria = $criteria;
  1436. return $this->collKataoCartProducts;
  1437. }
  1438. /**
  1439. * Temporary storage of collKataoInvoiceProducts to save a possible db hit in
  1440. * the event objects are add to the collection, but the
  1441. * complete collection is never requested.
  1442. * @return void
  1443. */
  1444. public function initKataoInvoiceProducts()
  1445. {
  1446. if ($this->collKataoInvoiceProducts === null) {
  1447. $this->collKataoInvoiceProducts = array();
  1448. }
  1449. }
  1450. /**
  1451. * If this collection has already been initialized with
  1452. * an identical criteria, it returns the collection.
  1453. * Otherwise if this KataoOrderProduct has previously
  1454. * been saved, it will retrieve related KataoInvoiceProducts from storage.
  1455. * If this KataoOrderProduct is new, it will return
  1456. * an empty collection or the current collection, the criteria
  1457. * is ignored on a new object.
  1458. *
  1459. * @param Connection $con
  1460. * @param Criteria $criteria
  1461. * @throws PropelException
  1462. */
  1463. public function getKataoInvoiceProducts($criteria = null, $con = null)
  1464. {
  1465. // include the Peer class
  1466. if ($criteria === null) {
  1467. $criteria = new Criteria();
  1468. }
  1469. elseif ($criteria instanceof Criteria)
  1470. {
  1471. $criteria = clone $criteria;
  1472. }
  1473. if ($this->collKataoInvoiceProducts === null) {
  1474. if ($this->isNew()) {
  1475. $this->collKataoInvoiceProducts = array();
  1476. } else {
  1477. $criteria->add(KataoInvoiceProductPeer::KATAO_ORDER_PRODUCT_ID, $this->getId());
  1478. KataoInvoiceProductPeer::addSelectColumns($criteria);
  1479. $this->collKataoInvoiceProducts = KataoInvoiceProductPeer::doSelect($criteria, $con);
  1480. }
  1481. } else {
  1482. // criteria has no effect for a new object
  1483. if (!$this->isNew()) {
  1484. // the following code is to determine if a new query is
  1485. // called for. If the criteria is the same as the last
  1486. // one, just return the collection.
  1487. $criteria->add(KataoInvoiceProductPeer::KATAO_ORDER_PRODUCT_ID, $this->getId());
  1488. KataoInvoiceProductPeer::addSelectColumns($criteria);
  1489. if (!isset($this->lastKataoInvoiceProductCriteria) || !$this->lastKataoInvoiceProductCriteria->equals($criteria)) {
  1490. $this->collKataoInvoiceProducts = KataoInvoiceProductPeer::doSelect($criteria, $con);
  1491. }
  1492. }
  1493. }
  1494. $this->lastKataoInvoiceProductCriteria = $criteria;
  1495. return $this->collKataoInvoiceProducts;
  1496. }
  1497. /**
  1498. * Returns the number of related KataoInvoiceProducts.
  1499. *
  1500. * @param Criteria $criteria
  1501. * @param boolean $distinct
  1502. * @param Connection $con
  1503. * @throws PropelException
  1504. */
  1505. public function countKataoInvoiceProducts($criteria = null, $distinct = false, $con = null)
  1506. {
  1507. // include the Peer class
  1508. if ($criteria === null) {
  1509. $criteria = new Criteria();
  1510. }
  1511. elseif ($criteria instanceof Criteria)
  1512. {
  1513. $criteria = clone $criteria;
  1514. }
  1515. $criteria->add(KataoInvoiceProductPeer::KATAO_ORDER_PRODUCT_ID, $this->getId());
  1516. return KataoInvoiceProductPeer::doCount($criteria, $distinct, $con);
  1517. }
  1518. /**
  1519. * Method called to associate a KataoInvoiceProduct object to this object
  1520. * through the KataoInvoiceProduct foreign key attribute
  1521. *
  1522. * @param KataoInvoiceProduct $l KataoInvoiceProduct
  1523. * @return void
  1524. * @throws PropelException
  1525. */
  1526. public function addKataoInvoiceProduct(KataoInvoiceProduct $l)
  1527. {
  1528. $this->collKataoInvoiceProducts[] = $l;
  1529. $l->setKataoOrderProduct($this);
  1530. }
  1531. /**
  1532. * If this collection has already been initialized with
  1533. * an identical criteria, it returns the collection.
  1534. * Otherwise if this KataoOrderProduct is new, it will return
  1535. * an empty collection; or if this KataoOrderProduct has previously
  1536. * been saved, it will retrieve related KataoInvoiceProducts from storage.
  1537. *
  1538. * This method is protected by default in order to keep the public
  1539. * api reasonable. You can provide public methods for those you
  1540. * actually need in KataoOrderProduct.
  1541. */
  1542. public function getKataoInvoiceProductsJoinKataoInvoice($criteria = null, $con = null)
  1543. {
  1544. // include the Peer class
  1545. if ($criteria === null) {
  1546. $criteria = new Criteria();
  1547. }
  1548. elseif ($criteria instanceof Criteria)
  1549. {
  1550. $criteria = clone $criteria;
  1551. }
  1552. if ($this->collKataoInvoiceProducts === null) {
  1553. if ($this->isNew()) {
  1554. $this->collKataoInvoiceProducts = array();
  1555. } else {
  1556. $criteria->add(KataoInvoiceProductPeer::KATAO_ORDER_PRODUCT_ID, $this->getId());
  1557. $this->collKataoInvoiceProducts = KataoInvoiceProductPeer::doSelectJoinKataoInvoice($criteria, $con);
  1558. }
  1559. } else {
  1560. // the following code is to determine if a new query is
  1561. // called for. If the criteria is the same as the last
  1562. // one, just return the collection.
  1563. $criteria->add(KataoInvoiceProductPeer::KATAO_ORDER_PRODUCT_ID, $this->getId());
  1564. if (!isset($this->lastKataoInvoiceProductCriteria) || !$this->lastKataoInvoiceProductCriteria->equals($criteria)) {
  1565. $this->collKataoInvoiceProducts = KataoInvoiceProductPeer::doSelectJoinKataoInvoice($criteria, $con);
  1566. }
  1567. }
  1568. $this->lastKataoInvoiceProductCriteria = $criteria;
  1569. return $this->collKataoInvoiceProducts;
  1570. }
  1571. /**
  1572. * If this collection has already been initialized with
  1573. * an identical criteria, it returns the collection.
  1574. * Otherwise if this KataoOrderProduct is new, it will return
  1575. * an empty collection; or if this KataoOrderProduct has previously
  1576. * been saved, it will retrieve related KataoInvoiceProducts from storage.
  1577. *
  1578. * This method is protected by default in order to keep the public
  1579. * api reasonable. You can provide public methods for those you
  1580. * actually need in KataoOrderProduct.
  1581. */
  1582. public function getKataoInvoiceProductsJoinKataoProduct($criteria = null, $con = null)
  1583. {
  1584. // include the Peer class
  1585. if ($criteria === null) {
  1586. $criteria = new Criteria();
  1587. }
  1588. elseif ($criteria instanceof Criteria)
  1589. {
  1590. $criteria = clone $criteria;
  1591. }
  1592. if ($this->collKataoInvoiceProducts === null) {
  1593. if ($this->isNew()) {
  1594. $this->collKataoInvoiceProducts = array();
  1595. } else {
  1596. $criteria->add(KataoInvoiceProductPeer::KATAO_ORDER_PRODUCT_ID, $this->getId());
  1597. $this->collKataoInvoiceProducts = KataoInvoiceProductPeer::doSelectJoinKataoProduct($criteria, $con);
  1598. }
  1599. } else {
  1600. // the following code is to determine if a new query is
  1601. // called for. If the criteria is the same as the last
  1602. // one, just return the collection.
  1603. $criteria->add(KataoInvoiceProductPeer::KATAO_ORDER_PRODUCT_ID, $this->getId());
  1604. if (!isset($this->lastKataoInvoiceProductCriteria) || !$this->lastKataoInvoiceProductCriteria->equals($criteria)) {
  1605. $this->collKataoInvoiceProducts = KataoInvoiceProductPeer::doSelectJoinKataoProduct($criteria, $con);
  1606. }
  1607. }
  1608. $this->lastKataoInvoiceProductCriteria = $criteria;
  1609. return $this->collKataoInvoiceProducts;
  1610. }
  1611. /**
  1612. * If this collection has already been initialized with
  1613. * an identical criteria, it returns the collection.
  1614. * Otherwise if this KataoOrderProduct is new, it will return
  1615. * an empty collection; or if this KataoOrderProduct has previously
  1616. * been saved, it will retrieve related KataoInvoiceProducts from storage.
  1617. *
  1618. * This method is protected by default in order to keep the public
  1619. * api reasonable. You can provide public methods for those you
  1620. * actually need in KataoOrderProduct.
  1621. */
  1622. public function getKataoInvoiceProductsJoinKataoCartProduct($criteria = null, $con = null)
  1623. {
  1624. // include the Peer class
  1625. if ($criteria === null) {
  1626. $criteria = new Criteria();
  1627. }
  1628. elseif ($criteria instanceof Criteria)
  1629. {
  1630. $criteria = clone $criteria;
  1631. }
  1632. if ($this->collKataoInvoiceProducts === null) {
  1633. if ($this->isNew()) {
  1634. $this->collKataoInvoiceProducts = array();
  1635. } else {
  1636. $criteria->add(KataoInvoiceProductPeer::KATAO_ORDER_PRODUCT_ID, $this->getId());
  1637. $this->collKataoInvoiceProducts = KataoInvoiceProductPeer::doSelectJoinKataoCartProduct($criteria, $con);
  1638. }
  1639. } else {
  1640. // the following code is to determine if a new query is
  1641. // called for. If the criteria is the same as the last
  1642. // one, just return the collection.
  1643. $criteria->add(KataoInvoiceProductPeer::KATAO_ORDER_PRODUCT_ID, $this->getId());
  1644. if (!isset($this->lastKataoInvoiceProductCriteria) || !$this->lastKataoInvoiceProductCriteria->equals($criteria)) {
  1645. $this->collKataoInvoiceProducts = KataoInvoiceProductPeer::doSelectJoinKataoCartProduct($criteria, $con);
  1646. }
  1647. }
  1648. $this->lastKataoInvoiceProductCriteria = $criteria;
  1649. return $this->collKataoInvoiceProducts;
  1650. }
  1651. public function __call($method, $arguments)
  1652. {
  1653. if (!$callable = sfMixer::getCallable('BaseKataoOrderProduct:'.$method))
  1654. {
  1655. throw new sfException(sprintf('Call to undefined method BaseKataoOrderProduct::%s', $method));
  1656. }
  1657. array_unshift($arguments, $this);
  1658. return call_user_func_array($callable, $arguments);
  1659. }
  1660. } // BaseKataoOrderProduct