BaseKataoInvoiceProduct.php 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614
  1. <?php
  2. /**
  3. * Base class that represents a row from the 'katao_invoice_product' table.
  4. *
  5. *
  6. *
  7. * @package lib.model.om
  8. */
  9. abstract class BaseKataoInvoiceProduct 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 KataoInvoiceProductPeer
  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_invoice_id field.
  24. * @var int
  25. */
  26. protected $katao_invoice_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 katao_cart_product_id field.
  34. * @var int
  35. */
  36. protected $katao_cart_product_id;
  37. /**
  38. * The value for the katao_order_product_id field.
  39. * @var int
  40. */
  41. protected $katao_order_product_id;
  42. /**
  43. * The value for the product_reference field.
  44. * @var string
  45. */
  46. protected $product_reference;
  47. /**
  48. * The value for the product_name field.
  49. * @var string
  50. */
  51. protected $product_name;
  52. /**
  53. * The value for the product_price_euro field.
  54. * @var double
  55. */
  56. protected $product_price_euro;
  57. /**
  58. * The value for the product_margin field.
  59. * @var double
  60. */
  61. protected $product_margin;
  62. /**
  63. * The value for the product_tva_rate field.
  64. * @var double
  65. */
  66. protected $product_tva_rate = 0;
  67. /**
  68. * The value for the quantity field.
  69. * @var int
  70. */
  71. protected $quantity = 1;
  72. /**
  73. * The value for the quantity_delivered field.
  74. * @var int
  75. */
  76. protected $quantity_delivered = 0;
  77. /**
  78. * The value for the sol_amount field.
  79. * @var int
  80. */
  81. protected $sol_amount = 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 KataoInvoice
  94. */
  95. protected $aKataoInvoice;
  96. /**
  97. * @var KataoProduct
  98. */
  99. protected $aKataoProduct;
  100. /**
  101. * @var KataoCartProduct
  102. */
  103. protected $aKataoCartProduct;
  104. /**
  105. * @var KataoOrderProduct
  106. */
  107. protected $aKataoOrderProduct;
  108. /**
  109. * Flag to prevent endless save loop, if this object is referenced
  110. * by another object which falls in this transaction.
  111. * @var boolean
  112. */
  113. protected $alreadyInSave = false;
  114. /**
  115. * Flag to prevent endless validation loop, if this object is referenced
  116. * by another object which falls in this transaction.
  117. * @var boolean
  118. */
  119. protected $alreadyInValidation = false;
  120. /**
  121. * Get the [id] column value.
  122. *
  123. * @return int
  124. */
  125. public function getId()
  126. {
  127. return $this->id;
  128. }
  129. /**
  130. * Get the [katao_invoice_id] column value.
  131. *
  132. * @return int
  133. */
  134. public function getKataoInvoiceId()
  135. {
  136. return $this->katao_invoice_id;
  137. }
  138. /**
  139. * Get the [katao_product_id] column value.
  140. *
  141. * @return int
  142. */
  143. public function getKataoProductId()
  144. {
  145. return $this->katao_product_id;
  146. }
  147. /**
  148. * Get the [katao_cart_product_id] column value.
  149. *
  150. * @return int
  151. */
  152. public function getKataoCartProductId()
  153. {
  154. return $this->katao_cart_product_id;
  155. }
  156. /**
  157. * Get the [katao_order_product_id] column value.
  158. *
  159. * @return int
  160. */
  161. public function getKataoOrderProductId()
  162. {
  163. return $this->katao_order_product_id;
  164. }
  165. /**
  166. * Get the [product_reference] column value.
  167. *
  168. * @return string
  169. */
  170. public function getProductReference()
  171. {
  172. return $this->product_reference;
  173. }
  174. /**
  175. * Get the [product_name] column value.
  176. *
  177. * @return string
  178. */
  179. public function getProductName()
  180. {
  181. return $this->product_name;
  182. }
  183. /**
  184. * Get the [product_price_euro] column value.
  185. *
  186. * @return double
  187. */
  188. public function getProductPriceEuro()
  189. {
  190. return $this->product_price_euro;
  191. }
  192. /**
  193. * Get the [product_margin] column value.
  194. *
  195. * @return double
  196. */
  197. public function getProductMargin()
  198. {
  199. return $this->product_margin;
  200. }
  201. /**
  202. * Get the [product_tva_rate] column value.
  203. *
  204. * @return double
  205. */
  206. public function getProductTvaRate()
  207. {
  208. return $this->product_tva_rate;
  209. }
  210. /**
  211. * Get the [quantity] column value.
  212. *
  213. * @return int
  214. */
  215. public function getQuantity()
  216. {
  217. return $this->quantity;
  218. }
  219. /**
  220. * Get the [quantity_delivered] column value.
  221. *
  222. * @return int
  223. */
  224. public function getQuantityDelivered()
  225. {
  226. return $this->quantity_delivered;
  227. }
  228. /**
  229. * Get the [sol_amount] column value.
  230. *
  231. * @return int
  232. */
  233. public function getSolAmount()
  234. {
  235. return $this->sol_amount;
  236. }
  237. /**
  238. * Get the [optionally formatted] [created_at] column value.
  239. *
  240. * @param string $format The date/time format string (either date()-style or strftime()-style).
  241. * If format is NULL, then the integer unix timestamp will be returned.
  242. * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
  243. * @throws PropelException - if unable to convert the date/time to timestamp.
  244. */
  245. public function getCreatedAt($format = 'Y-m-d H:i:s')
  246. {
  247. if ($this->created_at === null || $this->created_at === '') {
  248. return null;
  249. } elseif (!is_int($this->created_at)) {
  250. // a non-timestamp value was set externally, so we convert it
  251. $ts = strtotime($this->created_at);
  252. if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
  253. throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true));
  254. }
  255. } else {
  256. $ts = $this->created_at;
  257. }
  258. if ($format === null) {
  259. return $ts;
  260. } elseif (strpos($format, '%') !== false) {
  261. return strftime($format, $ts);
  262. } else {
  263. return date($format, $ts);
  264. }
  265. }
  266. /**
  267. * Get the [optionally formatted] [updated_at] column value.
  268. *
  269. * @param string $format The date/time format string (either date()-style or strftime()-style).
  270. * If format is NULL, then the integer unix timestamp will be returned.
  271. * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
  272. * @throws PropelException - if unable to convert the date/time to timestamp.
  273. */
  274. public function getUpdatedAt($format = 'Y-m-d H:i:s')
  275. {
  276. if ($this->updated_at === null || $this->updated_at === '') {
  277. return null;
  278. } elseif (!is_int($this->updated_at)) {
  279. // a non-timestamp value was set externally, so we convert it
  280. $ts = strtotime($this->updated_at);
  281. if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
  282. throw new PropelException("Unable to parse value of [updated_at] as date/time value: " . var_export($this->updated_at, true));
  283. }
  284. } else {
  285. $ts = $this->updated_at;
  286. }
  287. if ($format === null) {
  288. return $ts;
  289. } elseif (strpos($format, '%') !== false) {
  290. return strftime($format, $ts);
  291. } else {
  292. return date($format, $ts);
  293. }
  294. }
  295. /**
  296. * Set the value of [id] column.
  297. *
  298. * @param int $v new value
  299. * @return void
  300. */
  301. public function setId($v)
  302. {
  303. // Since the native PHP type for this column is integer,
  304. // we will cast the input value to an int (if it is not).
  305. if ($v !== null && !is_int($v) && is_numeric($v)) {
  306. $v = (int) $v;
  307. }
  308. if ($this->id !== $v) {
  309. $this->id = $v;
  310. $this->modifiedColumns[] = KataoInvoiceProductPeer::ID;
  311. }
  312. } // setId()
  313. /**
  314. * Set the value of [katao_invoice_id] column.
  315. *
  316. * @param int $v new value
  317. * @return void
  318. */
  319. public function setKataoInvoiceId($v)
  320. {
  321. // Since the native PHP type for this column is integer,
  322. // we will cast the input value to an int (if it is not).
  323. if ($v !== null && !is_int($v) && is_numeric($v)) {
  324. $v = (int) $v;
  325. }
  326. if ($this->katao_invoice_id !== $v) {
  327. $this->katao_invoice_id = $v;
  328. $this->modifiedColumns[] = KataoInvoiceProductPeer::KATAO_INVOICE_ID;
  329. }
  330. if ($this->aKataoInvoice !== null && $this->aKataoInvoice->getId() !== $v) {
  331. $this->aKataoInvoice = null;
  332. }
  333. } // setKataoInvoiceId()
  334. /**
  335. * Set the value of [katao_product_id] column.
  336. *
  337. * @param int $v new value
  338. * @return void
  339. */
  340. public function setKataoProductId($v)
  341. {
  342. // Since the native PHP type for this column is integer,
  343. // we will cast the input value to an int (if it is not).
  344. if ($v !== null && !is_int($v) && is_numeric($v)) {
  345. $v = (int) $v;
  346. }
  347. if ($this->katao_product_id !== $v) {
  348. $this->katao_product_id = $v;
  349. $this->modifiedColumns[] = KataoInvoiceProductPeer::KATAO_PRODUCT_ID;
  350. }
  351. if ($this->aKataoProduct !== null && $this->aKataoProduct->getId() !== $v) {
  352. $this->aKataoProduct = null;
  353. }
  354. } // setKataoProductId()
  355. /**
  356. * Set the value of [katao_cart_product_id] column.
  357. *
  358. * @param int $v new value
  359. * @return void
  360. */
  361. public function setKataoCartProductId($v)
  362. {
  363. // Since the native PHP type for this column is integer,
  364. // we will cast the input value to an int (if it is not).
  365. if ($v !== null && !is_int($v) && is_numeric($v)) {
  366. $v = (int) $v;
  367. }
  368. if ($this->katao_cart_product_id !== $v) {
  369. $this->katao_cart_product_id = $v;
  370. $this->modifiedColumns[] = KataoInvoiceProductPeer::KATAO_CART_PRODUCT_ID;
  371. }
  372. if ($this->aKataoCartProduct !== null && $this->aKataoCartProduct->getId() !== $v) {
  373. $this->aKataoCartProduct = null;
  374. }
  375. } // setKataoCartProductId()
  376. /**
  377. * Set the value of [katao_order_product_id] column.
  378. *
  379. * @param int $v new value
  380. * @return void
  381. */
  382. public function setKataoOrderProductId($v)
  383. {
  384. // Since the native PHP type for this column is integer,
  385. // we will cast the input value to an int (if it is not).
  386. if ($v !== null && !is_int($v) && is_numeric($v)) {
  387. $v = (int) $v;
  388. }
  389. if ($this->katao_order_product_id !== $v) {
  390. $this->katao_order_product_id = $v;
  391. $this->modifiedColumns[] = KataoInvoiceProductPeer::KATAO_ORDER_PRODUCT_ID;
  392. }
  393. if ($this->aKataoOrderProduct !== null && $this->aKataoOrderProduct->getId() !== $v) {
  394. $this->aKataoOrderProduct = null;
  395. }
  396. } // setKataoOrderProductId()
  397. /**
  398. * Set the value of [product_reference] column.
  399. *
  400. * @param string $v new value
  401. * @return void
  402. */
  403. public function setProductReference($v)
  404. {
  405. // Since the native PHP type for this column is string,
  406. // we will cast the input to a string (if it is not).
  407. if ($v !== null && !is_string($v)) {
  408. $v = (string) $v;
  409. }
  410. if ($this->product_reference !== $v) {
  411. $this->product_reference = $v;
  412. $this->modifiedColumns[] = KataoInvoiceProductPeer::PRODUCT_REFERENCE;
  413. }
  414. } // setProductReference()
  415. /**
  416. * Set the value of [product_name] column.
  417. *
  418. * @param string $v new value
  419. * @return void
  420. */
  421. public function setProductName($v)
  422. {
  423. // Since the native PHP type for this column is string,
  424. // we will cast the input to a string (if it is not).
  425. if ($v !== null && !is_string($v)) {
  426. $v = (string) $v;
  427. }
  428. if ($this->product_name !== $v) {
  429. $this->product_name = $v;
  430. $this->modifiedColumns[] = KataoInvoiceProductPeer::PRODUCT_NAME;
  431. }
  432. } // setProductName()
  433. /**
  434. * Set the value of [product_price_euro] column.
  435. *
  436. * @param double $v new value
  437. * @return void
  438. */
  439. public function setProductPriceEuro($v)
  440. {
  441. if ($this->product_price_euro !== $v) {
  442. $this->product_price_euro = $v;
  443. $this->modifiedColumns[] = KataoInvoiceProductPeer::PRODUCT_PRICE_EURO;
  444. }
  445. } // setProductPriceEuro()
  446. /**
  447. * Set the value of [product_margin] column.
  448. *
  449. * @param double $v new value
  450. * @return void
  451. */
  452. public function setProductMargin($v)
  453. {
  454. if ($this->product_margin !== $v) {
  455. $this->product_margin = $v;
  456. $this->modifiedColumns[] = KataoInvoiceProductPeer::PRODUCT_MARGIN;
  457. }
  458. } // setProductMargin()
  459. /**
  460. * Set the value of [product_tva_rate] column.
  461. *
  462. * @param double $v new value
  463. * @return void
  464. */
  465. public function setProductTvaRate($v)
  466. {
  467. if ($this->product_tva_rate !== $v || $v === 0) {
  468. $this->product_tva_rate = $v;
  469. $this->modifiedColumns[] = KataoInvoiceProductPeer::PRODUCT_TVA_RATE;
  470. }
  471. } // setProductTvaRate()
  472. /**
  473. * Set the value of [quantity] column.
  474. *
  475. * @param int $v new value
  476. * @return void
  477. */
  478. public function setQuantity($v)
  479. {
  480. // Since the native PHP type for this column is integer,
  481. // we will cast the input value to an int (if it is not).
  482. if ($v !== null && !is_int($v) && is_numeric($v)) {
  483. $v = (int) $v;
  484. }
  485. if ($this->quantity !== $v || $v === 1) {
  486. $this->quantity = $v;
  487. $this->modifiedColumns[] = KataoInvoiceProductPeer::QUANTITY;
  488. }
  489. } // setQuantity()
  490. /**
  491. * Set the value of [quantity_delivered] column.
  492. *
  493. * @param int $v new value
  494. * @return void
  495. */
  496. public function setQuantityDelivered($v)
  497. {
  498. // Since the native PHP type for this column is integer,
  499. // we will cast the input value to an int (if it is not).
  500. if ($v !== null && !is_int($v) && is_numeric($v)) {
  501. $v = (int) $v;
  502. }
  503. if ($this->quantity_delivered !== $v || $v === 0) {
  504. $this->quantity_delivered = $v;
  505. $this->modifiedColumns[] = KataoInvoiceProductPeer::QUANTITY_DELIVERED;
  506. }
  507. } // setQuantityDelivered()
  508. /**
  509. * Set the value of [sol_amount] column.
  510. *
  511. * @param int $v new value
  512. * @return void
  513. */
  514. public function setSolAmount($v)
  515. {
  516. // Since the native PHP type for this column is integer,
  517. // we will cast the input value to an int (if it is not).
  518. if ($v !== null && !is_int($v) && is_numeric($v)) {
  519. $v = (int) $v;
  520. }
  521. if ($this->sol_amount !== $v || $v === 0) {
  522. $this->sol_amount = $v;
  523. $this->modifiedColumns[] = KataoInvoiceProductPeer::SOL_AMOUNT;
  524. }
  525. } // setSolAmount()
  526. /**
  527. * Set the value of [created_at] column.
  528. *
  529. * @param int $v new value
  530. * @return void
  531. */
  532. public function setCreatedAt($v)
  533. {
  534. if ($v !== null && !is_int($v)) {
  535. $ts = strtotime($v);
  536. if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
  537. throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
  538. }
  539. } else {
  540. $ts = $v;
  541. }
  542. if ($this->created_at !== $ts) {
  543. $this->created_at = $ts;
  544. $this->modifiedColumns[] = KataoInvoiceProductPeer::CREATED_AT;
  545. }
  546. } // setCreatedAt()
  547. /**
  548. * Set the value of [updated_at] column.
  549. *
  550. * @param int $v new value
  551. * @return void
  552. */
  553. public function setUpdatedAt($v)
  554. {
  555. if ($v !== null && !is_int($v)) {
  556. $ts = strtotime($v);
  557. if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
  558. throw new PropelException("Unable to parse date/time value for [updated_at] from input: " . var_export($v, true));
  559. }
  560. } else {
  561. $ts = $v;
  562. }
  563. if ($this->updated_at !== $ts) {
  564. $this->updated_at = $ts;
  565. $this->modifiedColumns[] = KataoInvoiceProductPeer::UPDATED_AT;
  566. }
  567. } // setUpdatedAt()
  568. /**
  569. * Hydrates (populates) the object variables with values from the database resultset.
  570. *
  571. * An offset (1-based "start column") is specified so that objects can be hydrated
  572. * with a subset of the columns in the resultset rows. This is needed, for example,
  573. * for results of JOIN queries where the resultset row includes columns from two or
  574. * more tables.
  575. *
  576. * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
  577. * @param int $startcol 1-based offset column which indicates which restultset column to start with.
  578. * @return int next starting column
  579. * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
  580. */
  581. public function hydrate(ResultSet $rs, $startcol = 1)
  582. {
  583. try {
  584. $this->id = $rs->getInt($startcol + 0);
  585. $this->katao_invoice_id = $rs->getInt($startcol + 1);
  586. $this->katao_product_id = $rs->getInt($startcol + 2);
  587. $this->katao_cart_product_id = $rs->getInt($startcol + 3);
  588. $this->katao_order_product_id = $rs->getInt($startcol + 4);
  589. $this->product_reference = $rs->getString($startcol + 5);
  590. $this->product_name = $rs->getString($startcol + 6);
  591. $this->product_price_euro = $rs->getFloat($startcol + 7);
  592. $this->product_margin = $rs->getFloat($startcol + 8);
  593. $this->product_tva_rate = $rs->getFloat($startcol + 9);
  594. $this->quantity = $rs->getInt($startcol + 10);
  595. $this->quantity_delivered = $rs->getInt($startcol + 11);
  596. $this->sol_amount = $rs->getInt($startcol + 12);
  597. $this->created_at = $rs->getTimestamp($startcol + 13, null);
  598. $this->updated_at = $rs->getTimestamp($startcol + 14, null);
  599. $this->resetModified();
  600. $this->setNew(false);
  601. // FIXME - using NUM_COLUMNS may be clearer.
  602. return $startcol + 15; // 15 = KataoInvoiceProductPeer::NUM_COLUMNS - KataoInvoiceProductPeer::NUM_LAZY_LOAD_COLUMNS).
  603. } catch (Exception $e) {
  604. throw new PropelException("Error populating KataoInvoiceProduct object", $e);
  605. }
  606. }
  607. /**
  608. * Removes this object from datastore and sets delete attribute.
  609. *
  610. * @param Connection $con
  611. * @return void
  612. * @throws PropelException
  613. * @see BaseObject::setDeleted()
  614. * @see BaseObject::isDeleted()
  615. */
  616. public function delete($con = null)
  617. {
  618. foreach (sfMixer::getCallables('BaseKataoInvoiceProduct:delete:pre') as $callable)
  619. {
  620. $ret = call_user_func($callable, $this, $con);
  621. if ($ret)
  622. {
  623. return;
  624. }
  625. }
  626. if ($this->isDeleted()) {
  627. throw new PropelException("This object has already been deleted.");
  628. }
  629. if ($con === null) {
  630. $con = Propel::getConnection(KataoInvoiceProductPeer::DATABASE_NAME);
  631. }
  632. try {
  633. $con->begin();
  634. KataoInvoiceProductPeer::doDelete($this, $con);
  635. $this->setDeleted(true);
  636. $con->commit();
  637. } catch (PropelException $e) {
  638. $con->rollback();
  639. throw $e;
  640. }
  641. foreach (sfMixer::getCallables('BaseKataoInvoiceProduct:delete:post') as $callable)
  642. {
  643. call_user_func($callable, $this, $con);
  644. }
  645. }
  646. /**
  647. * Stores the object in the database. If the object is new,
  648. * it inserts it; otherwise an update is performed. This method
  649. * wraps the doSave() worker method in a transaction.
  650. *
  651. * @param Connection $con
  652. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  653. * @throws PropelException
  654. * @see doSave()
  655. */
  656. public function save($con = null)
  657. {
  658. foreach (sfMixer::getCallables('BaseKataoInvoiceProduct:save:pre') as $callable)
  659. {
  660. $affectedRows = call_user_func($callable, $this, $con);
  661. if (is_int($affectedRows))
  662. {
  663. return $affectedRows;
  664. }
  665. }
  666. if ($this->isNew() && !$this->isColumnModified(KataoInvoiceProductPeer::CREATED_AT))
  667. {
  668. $this->setCreatedAt(time());
  669. }
  670. if ($this->isModified() && !$this->isColumnModified(KataoInvoiceProductPeer::UPDATED_AT))
  671. {
  672. $this->setUpdatedAt(time());
  673. }
  674. if ($this->isDeleted()) {
  675. throw new PropelException("You cannot save an object that has been deleted.");
  676. }
  677. if ($con === null) {
  678. $con = Propel::getConnection(KataoInvoiceProductPeer::DATABASE_NAME);
  679. }
  680. try {
  681. $con->begin();
  682. $affectedRows = $this->doSave($con);
  683. $con->commit();
  684. foreach (sfMixer::getCallables('BaseKataoInvoiceProduct:save:post') as $callable)
  685. {
  686. call_user_func($callable, $this, $con, $affectedRows);
  687. }
  688. return $affectedRows;
  689. } catch (PropelException $e) {
  690. $con->rollback();
  691. throw $e;
  692. }
  693. }
  694. /**
  695. * Stores the object in the database.
  696. *
  697. * If the object is new, it inserts it; otherwise an update is performed.
  698. * All related objects are also updated in this method.
  699. *
  700. * @param Connection $con
  701. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  702. * @throws PropelException
  703. * @see save()
  704. */
  705. protected function doSave($con)
  706. {
  707. $affectedRows = 0; // initialize var to track total num of affected rows
  708. if (!$this->alreadyInSave) {
  709. $this->alreadyInSave = true;
  710. // We call the save method on the following object(s) if they
  711. // were passed to this object by their coresponding set
  712. // method. This object relates to these object(s) by a
  713. // foreign key reference.
  714. if ($this->aKataoInvoice !== null) {
  715. if ($this->aKataoInvoice->isModified()) {
  716. $affectedRows += $this->aKataoInvoice->save($con);
  717. }
  718. $this->setKataoInvoice($this->aKataoInvoice);
  719. }
  720. if ($this->aKataoProduct !== null) {
  721. if ($this->aKataoProduct->isModified()) {
  722. $affectedRows += $this->aKataoProduct->save($con);
  723. }
  724. $this->setKataoProduct($this->aKataoProduct);
  725. }
  726. if ($this->aKataoCartProduct !== null) {
  727. if ($this->aKataoCartProduct->isModified()) {
  728. $affectedRows += $this->aKataoCartProduct->save($con);
  729. }
  730. $this->setKataoCartProduct($this->aKataoCartProduct);
  731. }
  732. if ($this->aKataoOrderProduct !== null) {
  733. if ($this->aKataoOrderProduct->isModified()) {
  734. $affectedRows += $this->aKataoOrderProduct->save($con);
  735. }
  736. $this->setKataoOrderProduct($this->aKataoOrderProduct);
  737. }
  738. // If this object has been modified, then save it to the database.
  739. if ($this->isModified()) {
  740. if ($this->isNew()) {
  741. $pk = KataoInvoiceProductPeer::doInsert($this, $con);
  742. $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
  743. // should always be true here (even though technically
  744. // BasePeer::doInsert() can insert multiple rows).
  745. $this->setId($pk); //[IMV] update autoincrement primary key
  746. $this->setNew(false);
  747. } else {
  748. $affectedRows += KataoInvoiceProductPeer::doUpdate($this, $con);
  749. }
  750. $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
  751. }
  752. $this->alreadyInSave = false;
  753. }
  754. return $affectedRows;
  755. } // doSave()
  756. /**
  757. * Array of ValidationFailed objects.
  758. * @var array ValidationFailed[]
  759. */
  760. protected $validationFailures = array();
  761. /**
  762. * Gets any ValidationFailed objects that resulted from last call to validate().
  763. *
  764. *
  765. * @return array ValidationFailed[]
  766. * @see validate()
  767. */
  768. public function getValidationFailures()
  769. {
  770. return $this->validationFailures;
  771. }
  772. /**
  773. * Validates the objects modified field values and all objects related to this table.
  774. *
  775. * If $columns is either a column name or an array of column names
  776. * only those columns are validated.
  777. *
  778. * @param mixed $columns Column name or an array of column names.
  779. * @return boolean Whether all columns pass validation.
  780. * @see doValidate()
  781. * @see getValidationFailures()
  782. */
  783. public function validate($columns = null)
  784. {
  785. $res = $this->doValidate($columns);
  786. if ($res === true) {
  787. $this->validationFailures = array();
  788. return true;
  789. } else {
  790. $this->validationFailures = $res;
  791. return false;
  792. }
  793. }
  794. /**
  795. * This function performs the validation work for complex object models.
  796. *
  797. * In addition to checking the current object, all related objects will
  798. * also be validated. If all pass then <code>true</code> is returned; otherwise
  799. * an aggreagated array of ValidationFailed objects will be returned.
  800. *
  801. * @param array $columns Array of column names to validate.
  802. * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  803. */
  804. protected function doValidate($columns = null)
  805. {
  806. if (!$this->alreadyInValidation) {
  807. $this->alreadyInValidation = true;
  808. $retval = null;
  809. $failureMap = array();
  810. // We call the validate method on the following object(s) if they
  811. // were passed to this object by their coresponding set
  812. // method. This object relates to these object(s) by a
  813. // foreign key reference.
  814. if ($this->aKataoInvoice !== null) {
  815. if (!$this->aKataoInvoice->validate($columns)) {
  816. $failureMap = array_merge($failureMap, $this->aKataoInvoice->getValidationFailures());
  817. }
  818. }
  819. if ($this->aKataoProduct !== null) {
  820. if (!$this->aKataoProduct->validate($columns)) {
  821. $failureMap = array_merge($failureMap, $this->aKataoProduct->getValidationFailures());
  822. }
  823. }
  824. if ($this->aKataoCartProduct !== null) {
  825. if (!$this->aKataoCartProduct->validate($columns)) {
  826. $failureMap = array_merge($failureMap, $this->aKataoCartProduct->getValidationFailures());
  827. }
  828. }
  829. if ($this->aKataoOrderProduct !== null) {
  830. if (!$this->aKataoOrderProduct->validate($columns)) {
  831. $failureMap = array_merge($failureMap, $this->aKataoOrderProduct->getValidationFailures());
  832. }
  833. }
  834. if (($retval = KataoInvoiceProductPeer::doValidate($this, $columns)) !== true) {
  835. $failureMap = array_merge($failureMap, $retval);
  836. }
  837. $this->alreadyInValidation = false;
  838. }
  839. return (!empty($failureMap) ? $failureMap : true);
  840. }
  841. /**
  842. * Retrieves a field from the object by name passed in as a string.
  843. *
  844. * @param string $name name
  845. * @param string $type The type of fieldname the $name is of:
  846. * one of the class type constants TYPE_PHPNAME,
  847. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  848. * @return mixed Value of field.
  849. */
  850. public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
  851. {
  852. $pos = KataoInvoiceProductPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  853. return $this->getByPosition($pos);
  854. }
  855. /**
  856. * Retrieves a field from the object by Position as specified in the xml schema.
  857. * Zero-based.
  858. *
  859. * @param int $pos position in xml schema
  860. * @return mixed Value of field at $pos
  861. */
  862. public function getByPosition($pos)
  863. {
  864. switch($pos) {
  865. case 0:
  866. return $this->getId();
  867. break;
  868. case 1:
  869. return $this->getKataoInvoiceId();
  870. break;
  871. case 2:
  872. return $this->getKataoProductId();
  873. break;
  874. case 3:
  875. return $this->getKataoCartProductId();
  876. break;
  877. case 4:
  878. return $this->getKataoOrderProductId();
  879. break;
  880. case 5:
  881. return $this->getProductReference();
  882. break;
  883. case 6:
  884. return $this->getProductName();
  885. break;
  886. case 7:
  887. return $this->getProductPriceEuro();
  888. break;
  889. case 8:
  890. return $this->getProductMargin();
  891. break;
  892. case 9:
  893. return $this->getProductTvaRate();
  894. break;
  895. case 10:
  896. return $this->getQuantity();
  897. break;
  898. case 11:
  899. return $this->getQuantityDelivered();
  900. break;
  901. case 12:
  902. return $this->getSolAmount();
  903. break;
  904. case 13:
  905. return $this->getCreatedAt();
  906. break;
  907. case 14:
  908. return $this->getUpdatedAt();
  909. break;
  910. default:
  911. return null;
  912. break;
  913. } // switch()
  914. }
  915. /**
  916. * Exports the object as an array.
  917. *
  918. * You can specify the key type of the array by passing one of the class
  919. * type constants.
  920. *
  921. * @param string $keyType One of the class type constants TYPE_PHPNAME,
  922. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  923. * @return an associative array containing the field names (as keys) and field values
  924. */
  925. public function toArray($keyType = BasePeer::TYPE_PHPNAME)
  926. {
  927. $keys = KataoInvoiceProductPeer::getFieldNames($keyType);
  928. $result = array(
  929. $keys[0] => $this->getId(),
  930. $keys[1] => $this->getKataoInvoiceId(),
  931. $keys[2] => $this->getKataoProductId(),
  932. $keys[3] => $this->getKataoCartProductId(),
  933. $keys[4] => $this->getKataoOrderProductId(),
  934. $keys[5] => $this->getProductReference(),
  935. $keys[6] => $this->getProductName(),
  936. $keys[7] => $this->getProductPriceEuro(),
  937. $keys[8] => $this->getProductMargin(),
  938. $keys[9] => $this->getProductTvaRate(),
  939. $keys[10] => $this->getQuantity(),
  940. $keys[11] => $this->getQuantityDelivered(),
  941. $keys[12] => $this->getSolAmount(),
  942. $keys[13] => $this->getCreatedAt(),
  943. $keys[14] => $this->getUpdatedAt(),
  944. );
  945. return $result;
  946. }
  947. /**
  948. * Sets a field from the object by name passed in as a string.
  949. *
  950. * @param string $name peer name
  951. * @param mixed $value field value
  952. * @param string $type The type of fieldname the $name is of:
  953. * one of the class type constants TYPE_PHPNAME,
  954. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  955. * @return void
  956. */
  957. public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
  958. {
  959. $pos = KataoInvoiceProductPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  960. return $this->setByPosition($pos, $value);
  961. }
  962. /**
  963. * Sets a field from the object by Position as specified in the xml schema.
  964. * Zero-based.
  965. *
  966. * @param int $pos position in xml schema
  967. * @param mixed $value field value
  968. * @return void
  969. */
  970. public function setByPosition($pos, $value)
  971. {
  972. switch($pos) {
  973. case 0:
  974. $this->setId($value);
  975. break;
  976. case 1:
  977. $this->setKataoInvoiceId($value);
  978. break;
  979. case 2:
  980. $this->setKataoProductId($value);
  981. break;
  982. case 3:
  983. $this->setKataoCartProductId($value);
  984. break;
  985. case 4:
  986. $this->setKataoOrderProductId($value);
  987. break;
  988. case 5:
  989. $this->setProductReference($value);
  990. break;
  991. case 6:
  992. $this->setProductName($value);
  993. break;
  994. case 7:
  995. $this->setProductPriceEuro($value);
  996. break;
  997. case 8:
  998. $this->setProductMargin($value);
  999. break;
  1000. case 9:
  1001. $this->setProductTvaRate($value);
  1002. break;
  1003. case 10:
  1004. $this->setQuantity($value);
  1005. break;
  1006. case 11:
  1007. $this->setQuantityDelivered($value);
  1008. break;
  1009. case 12:
  1010. $this->setSolAmount($value);
  1011. break;
  1012. case 13:
  1013. $this->setCreatedAt($value);
  1014. break;
  1015. case 14:
  1016. $this->setUpdatedAt($value);
  1017. break;
  1018. } // switch()
  1019. }
  1020. /**
  1021. * Populates the object using an array.
  1022. *
  1023. * This is particularly useful when populating an object from one of the
  1024. * request arrays (e.g. $_POST). This method goes through the column
  1025. * names, checking to see whether a matching key exists in populated
  1026. * array. If so the setByName() method is called for that column.
  1027. *
  1028. * You can specify the key type of the array by additionally passing one
  1029. * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
  1030. * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
  1031. *
  1032. * @param array $arr An array to populate the object from.
  1033. * @param string $keyType The type of keys the array uses.
  1034. * @return void
  1035. */
  1036. public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
  1037. {
  1038. $keys = KataoInvoiceProductPeer::getFieldNames($keyType);
  1039. if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
  1040. if (array_key_exists($keys[1], $arr)) $this->setKataoInvoiceId($arr[$keys[1]]);
  1041. if (array_key_exists($keys[2], $arr)) $this->setKataoProductId($arr[$keys[2]]);
  1042. if (array_key_exists($keys[3], $arr)) $this->setKataoCartProductId($arr[$keys[3]]);
  1043. if (array_key_exists($keys[4], $arr)) $this->setKataoOrderProductId($arr[$keys[4]]);
  1044. if (array_key_exists($keys[5], $arr)) $this->setProductReference($arr[$keys[5]]);
  1045. if (array_key_exists($keys[6], $arr)) $this->setProductName($arr[$keys[6]]);
  1046. if (array_key_exists($keys[7], $arr)) $this->setProductPriceEuro($arr[$keys[7]]);
  1047. if (array_key_exists($keys[8], $arr)) $this->setProductMargin($arr[$keys[8]]);
  1048. if (array_key_exists($keys[9], $arr)) $this->setProductTvaRate($arr[$keys[9]]);
  1049. if (array_key_exists($keys[10], $arr)) $this->setQuantity($arr[$keys[10]]);
  1050. if (array_key_exists($keys[11], $arr)) $this->setQuantityDelivered($arr[$keys[11]]);
  1051. if (array_key_exists($keys[12], $arr)) $this->setSolAmount($arr[$keys[12]]);
  1052. if (array_key_exists($keys[13], $arr)) $this->setCreatedAt($arr[$keys[13]]);
  1053. if (array_key_exists($keys[14], $arr)) $this->setUpdatedAt($arr[$keys[14]]);
  1054. }
  1055. /**
  1056. * Build a Criteria object containing the values of all modified columns in this object.
  1057. *
  1058. * @return Criteria The Criteria object containing all modified values.
  1059. */
  1060. public function buildCriteria()
  1061. {
  1062. $criteria = new Criteria(KataoInvoiceProductPeer::DATABASE_NAME);
  1063. if ($this->isColumnModified(KataoInvoiceProductPeer::ID)) $criteria->add(KataoInvoiceProductPeer::ID, $this->id);
  1064. if ($this->isColumnModified(KataoInvoiceProductPeer::KATAO_INVOICE_ID)) $criteria->add(KataoInvoiceProductPeer::KATAO_INVOICE_ID, $this->katao_invoice_id);
  1065. if ($this->isColumnModified(KataoInvoiceProductPeer::KATAO_PRODUCT_ID)) $criteria->add(KataoInvoiceProductPeer::KATAO_PRODUCT_ID, $this->katao_product_id);
  1066. if ($this->isColumnModified(KataoInvoiceProductPeer::KATAO_CART_PRODUCT_ID)) $criteria->add(KataoInvoiceProductPeer::KATAO_CART_PRODUCT_ID, $this->katao_cart_product_id);
  1067. if ($this->isColumnModified(KataoInvoiceProductPeer::KATAO_ORDER_PRODUCT_ID)) $criteria->add(KataoInvoiceProductPeer::KATAO_ORDER_PRODUCT_ID, $this->katao_order_product_id);
  1068. if ($this->isColumnModified(KataoInvoiceProductPeer::PRODUCT_REFERENCE)) $criteria->add(KataoInvoiceProductPeer::PRODUCT_REFERENCE, $this->product_reference);
  1069. if ($this->isColumnModified(KataoInvoiceProductPeer::PRODUCT_NAME)) $criteria->add(KataoInvoiceProductPeer::PRODUCT_NAME, $this->product_name);
  1070. if ($this->isColumnModified(KataoInvoiceProductPeer::PRODUCT_PRICE_EURO)) $criteria->add(KataoInvoiceProductPeer::PRODUCT_PRICE_EURO, $this->product_price_euro);
  1071. if ($this->isColumnModified(KataoInvoiceProductPeer::PRODUCT_MARGIN)) $criteria->add(KataoInvoiceProductPeer::PRODUCT_MARGIN, $this->product_margin);
  1072. if ($this->isColumnModified(KataoInvoiceProductPeer::PRODUCT_TVA_RATE)) $criteria->add(KataoInvoiceProductPeer::PRODUCT_TVA_RATE, $this->product_tva_rate);
  1073. if ($this->isColumnModified(KataoInvoiceProductPeer::QUANTITY)) $criteria->add(KataoInvoiceProductPeer::QUANTITY, $this->quantity);
  1074. if ($this->isColumnModified(KataoInvoiceProductPeer::QUANTITY_DELIVERED)) $criteria->add(KataoInvoiceProductPeer::QUANTITY_DELIVERED, $this->quantity_delivered);
  1075. if ($this->isColumnModified(KataoInvoiceProductPeer::SOL_AMOUNT)) $criteria->add(KataoInvoiceProductPeer::SOL_AMOUNT, $this->sol_amount);
  1076. if ($this->isColumnModified(KataoInvoiceProductPeer::CREATED_AT)) $criteria->add(KataoInvoiceProductPeer::CREATED_AT, $this->created_at);
  1077. if ($this->isColumnModified(KataoInvoiceProductPeer::UPDATED_AT)) $criteria->add(KataoInvoiceProductPeer::UPDATED_AT, $this->updated_at);
  1078. return $criteria;
  1079. }
  1080. /**
  1081. * Builds a Criteria object containing the primary key for this object.
  1082. *
  1083. * Unlike buildCriteria() this method includes the primary key values regardless
  1084. * of whether or not they have been modified.
  1085. *
  1086. * @return Criteria The Criteria object containing value(s) for primary key(s).
  1087. */
  1088. public function buildPkeyCriteria()
  1089. {
  1090. $criteria = new Criteria(KataoInvoiceProductPeer::DATABASE_NAME);
  1091. $criteria->add(KataoInvoiceProductPeer::ID, $this->id);
  1092. return $criteria;
  1093. }
  1094. /**
  1095. * Returns the primary key for this object (row).
  1096. * @return int
  1097. */
  1098. public function getPrimaryKey()
  1099. {
  1100. return $this->getId();
  1101. }
  1102. /**
  1103. * Generic method to set the primary key (id column).
  1104. *
  1105. * @param int $key Primary key.
  1106. * @return void
  1107. */
  1108. public function setPrimaryKey($key)
  1109. {
  1110. $this->setId($key);
  1111. }
  1112. /**
  1113. * Sets contents of passed object to values from current object.
  1114. *
  1115. * If desired, this method can also make copies of all associated (fkey referrers)
  1116. * objects.
  1117. *
  1118. * @param object $copyObj An object of KataoInvoiceProduct (or compatible) type.
  1119. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  1120. * @throws PropelException
  1121. */
  1122. public function copyInto($copyObj, $deepCopy = false)
  1123. {
  1124. $copyObj->setKataoInvoiceId($this->katao_invoice_id);
  1125. $copyObj->setKataoProductId($this->katao_product_id);
  1126. $copyObj->setKataoCartProductId($this->katao_cart_product_id);
  1127. $copyObj->setKataoOrderProductId($this->katao_order_product_id);
  1128. $copyObj->setProductReference($this->product_reference);
  1129. $copyObj->setProductName($this->product_name);
  1130. $copyObj->setProductPriceEuro($this->product_price_euro);
  1131. $copyObj->setProductMargin($this->product_margin);
  1132. $copyObj->setProductTvaRate($this->product_tva_rate);
  1133. $copyObj->setQuantity($this->quantity);
  1134. $copyObj->setQuantityDelivered($this->quantity_delivered);
  1135. $copyObj->setSolAmount($this->sol_amount);
  1136. $copyObj->setCreatedAt($this->created_at);
  1137. $copyObj->setUpdatedAt($this->updated_at);
  1138. $copyObj->setNew(true);
  1139. $copyObj->setId(NULL); // this is a pkey column, so set to default value
  1140. }
  1141. /**
  1142. * Makes a copy of this object that will be inserted as a new row in table when saved.
  1143. * It creates a new object filling in the simple attributes, but skipping any primary
  1144. * keys that are defined for the table.
  1145. *
  1146. * If desired, this method can also make copies of all associated (fkey referrers)
  1147. * objects.
  1148. *
  1149. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  1150. * @return KataoInvoiceProduct Clone of current object.
  1151. * @throws PropelException
  1152. */
  1153. public function copy($deepCopy = false)
  1154. {
  1155. // we use get_class(), because this might be a subclass
  1156. $clazz = get_class($this);
  1157. $copyObj = new $clazz();
  1158. $this->copyInto($copyObj, $deepCopy);
  1159. return $copyObj;
  1160. }
  1161. /**
  1162. * Returns a peer instance associated with this om.
  1163. *
  1164. * Since Peer classes are not to have any instance attributes, this method returns the
  1165. * same instance for all member of this class. The method could therefore
  1166. * be static, but this would prevent one from overriding the behavior.
  1167. *
  1168. * @return KataoInvoiceProductPeer
  1169. */
  1170. public function getPeer()
  1171. {
  1172. if (self::$peer === null) {
  1173. self::$peer = new KataoInvoiceProductPeer();
  1174. }
  1175. return self::$peer;
  1176. }
  1177. /**
  1178. * Declares an association between this object and a KataoInvoice object.
  1179. *
  1180. * @param KataoInvoice $v
  1181. * @return void
  1182. * @throws PropelException
  1183. */
  1184. public function setKataoInvoice($v)
  1185. {
  1186. if ($v === null) {
  1187. $this->setKataoInvoiceId(NULL);
  1188. } else {
  1189. $this->setKataoInvoiceId($v->getId());
  1190. }
  1191. $this->aKataoInvoice = $v;
  1192. }
  1193. /**
  1194. * Get the associated KataoInvoice object
  1195. *
  1196. * @param Connection Optional Connection object.
  1197. * @return KataoInvoice The associated KataoInvoice object.
  1198. * @throws PropelException
  1199. */
  1200. public function getKataoInvoice($con = null)
  1201. {
  1202. if ($this->aKataoInvoice === null && ($this->katao_invoice_id !== null)) {
  1203. // include the related Peer class
  1204. $this->aKataoInvoice = KataoInvoicePeer::retrieveByPK($this->katao_invoice_id, $con);
  1205. /* The following can be used instead of the line above to
  1206. guarantee the related object contains a reference
  1207. to this object, but this level of coupling
  1208. may be undesirable in many circumstances.
  1209. As it can lead to a db query with many results that may
  1210. never be used.
  1211. $obj = KataoInvoicePeer::retrieveByPK($this->katao_invoice_id, $con);
  1212. $obj->addKataoInvoices($this);
  1213. */
  1214. }
  1215. return $this->aKataoInvoice;
  1216. }
  1217. /**
  1218. * Declares an association between this object and a KataoProduct object.
  1219. *
  1220. * @param KataoProduct $v
  1221. * @return void
  1222. * @throws PropelException
  1223. */
  1224. public function setKataoProduct($v)
  1225. {
  1226. if ($v === null) {
  1227. $this->setKataoProductId(NULL);
  1228. } else {
  1229. $this->setKataoProductId($v->getId());
  1230. }
  1231. $this->aKataoProduct = $v;
  1232. }
  1233. /**
  1234. * Get the associated KataoProduct object
  1235. *
  1236. * @param Connection Optional Connection object.
  1237. * @return KataoProduct The associated KataoProduct object.
  1238. * @throws PropelException
  1239. */
  1240. public function getKataoProduct($con = null)
  1241. {
  1242. if ($this->aKataoProduct === null && ($this->katao_product_id !== null)) {
  1243. // include the related Peer class
  1244. $this->aKataoProduct = KataoProductPeer::retrieveByPK($this->katao_product_id, $con);
  1245. /* The following can be used instead of the line above to
  1246. guarantee the related object contains a reference
  1247. to this object, but this level of coupling
  1248. may be undesirable in many circumstances.
  1249. As it can lead to a db query with many results that may
  1250. never be used.
  1251. $obj = KataoProductPeer::retrieveByPK($this->katao_product_id, $con);
  1252. $obj->addKataoProducts($this);
  1253. */
  1254. }
  1255. return $this->aKataoProduct;
  1256. }
  1257. /**
  1258. * Declares an association between this object and a KataoCartProduct object.
  1259. *
  1260. * @param KataoCartProduct $v
  1261. * @return void
  1262. * @throws PropelException
  1263. */
  1264. public function setKataoCartProduct($v)
  1265. {
  1266. if ($v === null) {
  1267. $this->setKataoCartProductId(NULL);
  1268. } else {
  1269. $this->setKataoCartProductId($v->getId());
  1270. }
  1271. $this->aKataoCartProduct = $v;
  1272. }
  1273. /**
  1274. * Get the associated KataoCartProduct object
  1275. *
  1276. * @param Connection Optional Connection object.
  1277. * @return KataoCartProduct The associated KataoCartProduct object.
  1278. * @throws PropelException
  1279. */
  1280. public function getKataoCartProduct($con = null)
  1281. {
  1282. if ($this->aKataoCartProduct === null && ($this->katao_cart_product_id !== null)) {
  1283. // include the related Peer class
  1284. $this->aKataoCartProduct = KataoCartProductPeer::retrieveByPK($this->katao_cart_product_id, $con);
  1285. /* The following can be used instead of the line above to
  1286. guarantee the related object contains a reference
  1287. to this object, but this level of coupling
  1288. may be undesirable in many circumstances.
  1289. As it can lead to a db query with many results that may
  1290. never be used.
  1291. $obj = KataoCartProductPeer::retrieveByPK($this->katao_cart_product_id, $con);
  1292. $obj->addKataoCartProducts($this);
  1293. */
  1294. }
  1295. return $this->aKataoCartProduct;
  1296. }
  1297. /**
  1298. * Declares an association between this object and a KataoOrderProduct object.
  1299. *
  1300. * @param KataoOrderProduct $v
  1301. * @return void
  1302. * @throws PropelException
  1303. */
  1304. public function setKataoOrderProduct($v)
  1305. {
  1306. if ($v === null) {
  1307. $this->setKataoOrderProductId(NULL);
  1308. } else {
  1309. $this->setKataoOrderProductId($v->getId());
  1310. }
  1311. $this->aKataoOrderProduct = $v;
  1312. }
  1313. /**
  1314. * Get the associated KataoOrderProduct object
  1315. *
  1316. * @param Connection Optional Connection object.
  1317. * @return KataoOrderProduct The associated KataoOrderProduct object.
  1318. * @throws PropelException
  1319. */
  1320. public function getKataoOrderProduct($con = null)
  1321. {
  1322. if ($this->aKataoOrderProduct === null && ($this->katao_order_product_id !== null)) {
  1323. // include the related Peer class
  1324. $this->aKataoOrderProduct = KataoOrderProductPeer::retrieveByPK($this->katao_order_product_id, $con);
  1325. /* The following can be used instead of the line above to
  1326. guarantee the related object contains a reference
  1327. to this object, but this level of coupling
  1328. may be undesirable in many circumstances.
  1329. As it can lead to a db query with many results that may
  1330. never be used.
  1331. $obj = KataoOrderProductPeer::retrieveByPK($this->katao_order_product_id, $con);
  1332. $obj->addKataoOrderProducts($this);
  1333. */
  1334. }
  1335. return $this->aKataoOrderProduct;
  1336. }
  1337. public function __call($method, $arguments)
  1338. {
  1339. if (!$callable = sfMixer::getCallable('BaseKataoInvoiceProduct:'.$method))
  1340. {
  1341. throw new sfException(sprintf('Call to undefined method BaseKataoInvoiceProduct::%s', $method));
  1342. }
  1343. array_unshift($arguments, $this);
  1344. return call_user_func_array($callable, $arguments);
  1345. }
  1346. } // BaseKataoInvoiceProduct