BaseKataoInvoiceProduct.php 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602
  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 double
  70. */
  71. protected $quantity = 1;
  72. /**
  73. * The value for the quantity_delivered field.
  74. * @var double
  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 double
  214. */
  215. public function getQuantity()
  216. {
  217. return $this->quantity;
  218. }
  219. /**
  220. * Get the [quantity_delivered] column value.
  221. *
  222. * @return double
  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 double $v new value
  476. * @return void
  477. */
  478. public function setQuantity($v)
  479. {
  480. if ($this->quantity !== $v || $v === 1) {
  481. $this->quantity = $v;
  482. $this->modifiedColumns[] = KataoInvoiceProductPeer::QUANTITY;
  483. }
  484. } // setQuantity()
  485. /**
  486. * Set the value of [quantity_delivered] column.
  487. *
  488. * @param double $v new value
  489. * @return void
  490. */
  491. public function setQuantityDelivered($v)
  492. {
  493. if ($this->quantity_delivered !== $v || $v === 0) {
  494. $this->quantity_delivered = $v;
  495. $this->modifiedColumns[] = KataoInvoiceProductPeer::QUANTITY_DELIVERED;
  496. }
  497. } // setQuantityDelivered()
  498. /**
  499. * Set the value of [sol_amount] column.
  500. *
  501. * @param int $v new value
  502. * @return void
  503. */
  504. public function setSolAmount($v)
  505. {
  506. // Since the native PHP type for this column is integer,
  507. // we will cast the input value to an int (if it is not).
  508. if ($v !== null && !is_int($v) && is_numeric($v)) {
  509. $v = (int) $v;
  510. }
  511. if ($this->sol_amount !== $v || $v === 0) {
  512. $this->sol_amount = $v;
  513. $this->modifiedColumns[] = KataoInvoiceProductPeer::SOL_AMOUNT;
  514. }
  515. } // setSolAmount()
  516. /**
  517. * Set the value of [created_at] column.
  518. *
  519. * @param int $v new value
  520. * @return void
  521. */
  522. public function setCreatedAt($v)
  523. {
  524. if ($v !== null && !is_int($v)) {
  525. $ts = strtotime($v);
  526. if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
  527. throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
  528. }
  529. } else {
  530. $ts = $v;
  531. }
  532. if ($this->created_at !== $ts) {
  533. $this->created_at = $ts;
  534. $this->modifiedColumns[] = KataoInvoiceProductPeer::CREATED_AT;
  535. }
  536. } // setCreatedAt()
  537. /**
  538. * Set the value of [updated_at] column.
  539. *
  540. * @param int $v new value
  541. * @return void
  542. */
  543. public function setUpdatedAt($v)
  544. {
  545. if ($v !== null && !is_int($v)) {
  546. $ts = strtotime($v);
  547. if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
  548. throw new PropelException("Unable to parse date/time value for [updated_at] from input: " . var_export($v, true));
  549. }
  550. } else {
  551. $ts = $v;
  552. }
  553. if ($this->updated_at !== $ts) {
  554. $this->updated_at = $ts;
  555. $this->modifiedColumns[] = KataoInvoiceProductPeer::UPDATED_AT;
  556. }
  557. } // setUpdatedAt()
  558. /**
  559. * Hydrates (populates) the object variables with values from the database resultset.
  560. *
  561. * An offset (1-based "start column") is specified so that objects can be hydrated
  562. * with a subset of the columns in the resultset rows. This is needed, for example,
  563. * for results of JOIN queries where the resultset row includes columns from two or
  564. * more tables.
  565. *
  566. * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
  567. * @param int $startcol 1-based offset column which indicates which restultset column to start with.
  568. * @return int next starting column
  569. * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
  570. */
  571. public function hydrate(ResultSet $rs, $startcol = 1)
  572. {
  573. try {
  574. $this->id = $rs->getInt($startcol + 0);
  575. $this->katao_invoice_id = $rs->getInt($startcol + 1);
  576. $this->katao_product_id = $rs->getInt($startcol + 2);
  577. $this->katao_cart_product_id = $rs->getInt($startcol + 3);
  578. $this->katao_order_product_id = $rs->getInt($startcol + 4);
  579. $this->product_reference = $rs->getString($startcol + 5);
  580. $this->product_name = $rs->getString($startcol + 6);
  581. $this->product_price_euro = $rs->getFloat($startcol + 7);
  582. $this->product_margin = $rs->getFloat($startcol + 8);
  583. $this->product_tva_rate = $rs->getFloat($startcol + 9);
  584. $this->quantity = $rs->getFloat($startcol + 10);
  585. $this->quantity_delivered = $rs->getFloat($startcol + 11);
  586. $this->sol_amount = $rs->getInt($startcol + 12);
  587. $this->created_at = $rs->getTimestamp($startcol + 13, null);
  588. $this->updated_at = $rs->getTimestamp($startcol + 14, null);
  589. $this->resetModified();
  590. $this->setNew(false);
  591. // FIXME - using NUM_COLUMNS may be clearer.
  592. return $startcol + 15; // 15 = KataoInvoiceProductPeer::NUM_COLUMNS - KataoInvoiceProductPeer::NUM_LAZY_LOAD_COLUMNS).
  593. } catch (Exception $e) {
  594. throw new PropelException("Error populating KataoInvoiceProduct object", $e);
  595. }
  596. }
  597. /**
  598. * Removes this object from datastore and sets delete attribute.
  599. *
  600. * @param Connection $con
  601. * @return void
  602. * @throws PropelException
  603. * @see BaseObject::setDeleted()
  604. * @see BaseObject::isDeleted()
  605. */
  606. public function delete($con = null)
  607. {
  608. foreach (sfMixer::getCallables('BaseKataoInvoiceProduct:delete:pre') as $callable)
  609. {
  610. $ret = call_user_func($callable, $this, $con);
  611. if ($ret)
  612. {
  613. return;
  614. }
  615. }
  616. if ($this->isDeleted()) {
  617. throw new PropelException("This object has already been deleted.");
  618. }
  619. if ($con === null) {
  620. $con = Propel::getConnection(KataoInvoiceProductPeer::DATABASE_NAME);
  621. }
  622. try {
  623. $con->begin();
  624. KataoInvoiceProductPeer::doDelete($this, $con);
  625. $this->setDeleted(true);
  626. $con->commit();
  627. } catch (PropelException $e) {
  628. $con->rollback();
  629. throw $e;
  630. }
  631. foreach (sfMixer::getCallables('BaseKataoInvoiceProduct:delete:post') as $callable)
  632. {
  633. call_user_func($callable, $this, $con);
  634. }
  635. }
  636. /**
  637. * Stores the object in the database. If the object is new,
  638. * it inserts it; otherwise an update is performed. This method
  639. * wraps the doSave() worker method in a transaction.
  640. *
  641. * @param Connection $con
  642. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  643. * @throws PropelException
  644. * @see doSave()
  645. */
  646. public function save($con = null)
  647. {
  648. foreach (sfMixer::getCallables('BaseKataoInvoiceProduct:save:pre') as $callable)
  649. {
  650. $affectedRows = call_user_func($callable, $this, $con);
  651. if (is_int($affectedRows))
  652. {
  653. return $affectedRows;
  654. }
  655. }
  656. if ($this->isNew() && !$this->isColumnModified(KataoInvoiceProductPeer::CREATED_AT))
  657. {
  658. $this->setCreatedAt(time());
  659. }
  660. if ($this->isModified() && !$this->isColumnModified(KataoInvoiceProductPeer::UPDATED_AT))
  661. {
  662. $this->setUpdatedAt(time());
  663. }
  664. if ($this->isDeleted()) {
  665. throw new PropelException("You cannot save an object that has been deleted.");
  666. }
  667. if ($con === null) {
  668. $con = Propel::getConnection(KataoInvoiceProductPeer::DATABASE_NAME);
  669. }
  670. try {
  671. $con->begin();
  672. $affectedRows = $this->doSave($con);
  673. $con->commit();
  674. foreach (sfMixer::getCallables('BaseKataoInvoiceProduct:save:post') as $callable)
  675. {
  676. call_user_func($callable, $this, $con, $affectedRows);
  677. }
  678. return $affectedRows;
  679. } catch (PropelException $e) {
  680. $con->rollback();
  681. throw $e;
  682. }
  683. }
  684. /**
  685. * Stores the object in the database.
  686. *
  687. * If the object is new, it inserts it; otherwise an update is performed.
  688. * All related objects are also updated in this method.
  689. *
  690. * @param Connection $con
  691. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  692. * @throws PropelException
  693. * @see save()
  694. */
  695. protected function doSave($con)
  696. {
  697. $affectedRows = 0; // initialize var to track total num of affected rows
  698. if (!$this->alreadyInSave) {
  699. $this->alreadyInSave = true;
  700. // We call the save method on the following object(s) if they
  701. // were passed to this object by their coresponding set
  702. // method. This object relates to these object(s) by a
  703. // foreign key reference.
  704. if ($this->aKataoInvoice !== null) {
  705. if ($this->aKataoInvoice->isModified()) {
  706. $affectedRows += $this->aKataoInvoice->save($con);
  707. }
  708. $this->setKataoInvoice($this->aKataoInvoice);
  709. }
  710. if ($this->aKataoProduct !== null) {
  711. if ($this->aKataoProduct->isModified()) {
  712. $affectedRows += $this->aKataoProduct->save($con);
  713. }
  714. $this->setKataoProduct($this->aKataoProduct);
  715. }
  716. if ($this->aKataoCartProduct !== null) {
  717. if ($this->aKataoCartProduct->isModified()) {
  718. $affectedRows += $this->aKataoCartProduct->save($con);
  719. }
  720. $this->setKataoCartProduct($this->aKataoCartProduct);
  721. }
  722. if ($this->aKataoOrderProduct !== null) {
  723. if ($this->aKataoOrderProduct->isModified()) {
  724. $affectedRows += $this->aKataoOrderProduct->save($con);
  725. }
  726. $this->setKataoOrderProduct($this->aKataoOrderProduct);
  727. }
  728. // If this object has been modified, then save it to the database.
  729. if ($this->isModified()) {
  730. if ($this->isNew()) {
  731. $pk = KataoInvoiceProductPeer::doInsert($this, $con);
  732. $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
  733. // should always be true here (even though technically
  734. // BasePeer::doInsert() can insert multiple rows).
  735. $this->setId($pk); //[IMV] update autoincrement primary key
  736. $this->setNew(false);
  737. } else {
  738. $affectedRows += KataoInvoiceProductPeer::doUpdate($this, $con);
  739. }
  740. $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
  741. }
  742. $this->alreadyInSave = false;
  743. }
  744. return $affectedRows;
  745. } // doSave()
  746. /**
  747. * Array of ValidationFailed objects.
  748. * @var array ValidationFailed[]
  749. */
  750. protected $validationFailures = array();
  751. /**
  752. * Gets any ValidationFailed objects that resulted from last call to validate().
  753. *
  754. *
  755. * @return array ValidationFailed[]
  756. * @see validate()
  757. */
  758. public function getValidationFailures()
  759. {
  760. return $this->validationFailures;
  761. }
  762. /**
  763. * Validates the objects modified field values and all objects related to this table.
  764. *
  765. * If $columns is either a column name or an array of column names
  766. * only those columns are validated.
  767. *
  768. * @param mixed $columns Column name or an array of column names.
  769. * @return boolean Whether all columns pass validation.
  770. * @see doValidate()
  771. * @see getValidationFailures()
  772. */
  773. public function validate($columns = null)
  774. {
  775. $res = $this->doValidate($columns);
  776. if ($res === true) {
  777. $this->validationFailures = array();
  778. return true;
  779. } else {
  780. $this->validationFailures = $res;
  781. return false;
  782. }
  783. }
  784. /**
  785. * This function performs the validation work for complex object models.
  786. *
  787. * In addition to checking the current object, all related objects will
  788. * also be validated. If all pass then <code>true</code> is returned; otherwise
  789. * an aggreagated array of ValidationFailed objects will be returned.
  790. *
  791. * @param array $columns Array of column names to validate.
  792. * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  793. */
  794. protected function doValidate($columns = null)
  795. {
  796. if (!$this->alreadyInValidation) {
  797. $this->alreadyInValidation = true;
  798. $retval = null;
  799. $failureMap = array();
  800. // We call the validate method on the following object(s) if they
  801. // were passed to this object by their coresponding set
  802. // method. This object relates to these object(s) by a
  803. // foreign key reference.
  804. if ($this->aKataoInvoice !== null) {
  805. if (!$this->aKataoInvoice->validate($columns)) {
  806. $failureMap = array_merge($failureMap, $this->aKataoInvoice->getValidationFailures());
  807. }
  808. }
  809. if ($this->aKataoProduct !== null) {
  810. if (!$this->aKataoProduct->validate($columns)) {
  811. $failureMap = array_merge($failureMap, $this->aKataoProduct->getValidationFailures());
  812. }
  813. }
  814. if ($this->aKataoCartProduct !== null) {
  815. if (!$this->aKataoCartProduct->validate($columns)) {
  816. $failureMap = array_merge($failureMap, $this->aKataoCartProduct->getValidationFailures());
  817. }
  818. }
  819. if ($this->aKataoOrderProduct !== null) {
  820. if (!$this->aKataoOrderProduct->validate($columns)) {
  821. $failureMap = array_merge($failureMap, $this->aKataoOrderProduct->getValidationFailures());
  822. }
  823. }
  824. if (($retval = KataoInvoiceProductPeer::doValidate($this, $columns)) !== true) {
  825. $failureMap = array_merge($failureMap, $retval);
  826. }
  827. $this->alreadyInValidation = false;
  828. }
  829. return (!empty($failureMap) ? $failureMap : true);
  830. }
  831. /**
  832. * Retrieves a field from the object by name passed in as a string.
  833. *
  834. * @param string $name name
  835. * @param string $type The type of fieldname the $name is of:
  836. * one of the class type constants TYPE_PHPNAME,
  837. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  838. * @return mixed Value of field.
  839. */
  840. public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
  841. {
  842. $pos = KataoInvoiceProductPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  843. return $this->getByPosition($pos);
  844. }
  845. /**
  846. * Retrieves a field from the object by Position as specified in the xml schema.
  847. * Zero-based.
  848. *
  849. * @param int $pos position in xml schema
  850. * @return mixed Value of field at $pos
  851. */
  852. public function getByPosition($pos)
  853. {
  854. switch($pos) {
  855. case 0:
  856. return $this->getId();
  857. break;
  858. case 1:
  859. return $this->getKataoInvoiceId();
  860. break;
  861. case 2:
  862. return $this->getKataoProductId();
  863. break;
  864. case 3:
  865. return $this->getKataoCartProductId();
  866. break;
  867. case 4:
  868. return $this->getKataoOrderProductId();
  869. break;
  870. case 5:
  871. return $this->getProductReference();
  872. break;
  873. case 6:
  874. return $this->getProductName();
  875. break;
  876. case 7:
  877. return $this->getProductPriceEuro();
  878. break;
  879. case 8:
  880. return $this->getProductMargin();
  881. break;
  882. case 9:
  883. return $this->getProductTvaRate();
  884. break;
  885. case 10:
  886. return $this->getQuantity();
  887. break;
  888. case 11:
  889. return $this->getQuantityDelivered();
  890. break;
  891. case 12:
  892. return $this->getSolAmount();
  893. break;
  894. case 13:
  895. return $this->getCreatedAt();
  896. break;
  897. case 14:
  898. return $this->getUpdatedAt();
  899. break;
  900. default:
  901. return null;
  902. break;
  903. } // switch()
  904. }
  905. /**
  906. * Exports the object as an array.
  907. *
  908. * You can specify the key type of the array by passing one of the class
  909. * type constants.
  910. *
  911. * @param string $keyType One of the class type constants TYPE_PHPNAME,
  912. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  913. * @return an associative array containing the field names (as keys) and field values
  914. */
  915. public function toArray($keyType = BasePeer::TYPE_PHPNAME)
  916. {
  917. $keys = KataoInvoiceProductPeer::getFieldNames($keyType);
  918. $result = array(
  919. $keys[0] => $this->getId(),
  920. $keys[1] => $this->getKataoInvoiceId(),
  921. $keys[2] => $this->getKataoProductId(),
  922. $keys[3] => $this->getKataoCartProductId(),
  923. $keys[4] => $this->getKataoOrderProductId(),
  924. $keys[5] => $this->getProductReference(),
  925. $keys[6] => $this->getProductName(),
  926. $keys[7] => $this->getProductPriceEuro(),
  927. $keys[8] => $this->getProductMargin(),
  928. $keys[9] => $this->getProductTvaRate(),
  929. $keys[10] => $this->getQuantity(),
  930. $keys[11] => $this->getQuantityDelivered(),
  931. $keys[12] => $this->getSolAmount(),
  932. $keys[13] => $this->getCreatedAt(),
  933. $keys[14] => $this->getUpdatedAt(),
  934. );
  935. return $result;
  936. }
  937. /**
  938. * Sets a field from the object by name passed in as a string.
  939. *
  940. * @param string $name peer name
  941. * @param mixed $value field value
  942. * @param string $type The type of fieldname the $name is of:
  943. * one of the class type constants TYPE_PHPNAME,
  944. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  945. * @return void
  946. */
  947. public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
  948. {
  949. $pos = KataoInvoiceProductPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  950. return $this->setByPosition($pos, $value);
  951. }
  952. /**
  953. * Sets a field from the object by Position as specified in the xml schema.
  954. * Zero-based.
  955. *
  956. * @param int $pos position in xml schema
  957. * @param mixed $value field value
  958. * @return void
  959. */
  960. public function setByPosition($pos, $value)
  961. {
  962. switch($pos) {
  963. case 0:
  964. $this->setId($value);
  965. break;
  966. case 1:
  967. $this->setKataoInvoiceId($value);
  968. break;
  969. case 2:
  970. $this->setKataoProductId($value);
  971. break;
  972. case 3:
  973. $this->setKataoCartProductId($value);
  974. break;
  975. case 4:
  976. $this->setKataoOrderProductId($value);
  977. break;
  978. case 5:
  979. $this->setProductReference($value);
  980. break;
  981. case 6:
  982. $this->setProductName($value);
  983. break;
  984. case 7:
  985. $this->setProductPriceEuro($value);
  986. break;
  987. case 8:
  988. $this->setProductMargin($value);
  989. break;
  990. case 9:
  991. $this->setProductTvaRate($value);
  992. break;
  993. case 10:
  994. $this->setQuantity($value);
  995. break;
  996. case 11:
  997. $this->setQuantityDelivered($value);
  998. break;
  999. case 12:
  1000. $this->setSolAmount($value);
  1001. break;
  1002. case 13:
  1003. $this->setCreatedAt($value);
  1004. break;
  1005. case 14:
  1006. $this->setUpdatedAt($value);
  1007. break;
  1008. } // switch()
  1009. }
  1010. /**
  1011. * Populates the object using an array.
  1012. *
  1013. * This is particularly useful when populating an object from one of the
  1014. * request arrays (e.g. $_POST). This method goes through the column
  1015. * names, checking to see whether a matching key exists in populated
  1016. * array. If so the setByName() method is called for that column.
  1017. *
  1018. * You can specify the key type of the array by additionally passing one
  1019. * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
  1020. * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
  1021. *
  1022. * @param array $arr An array to populate the object from.
  1023. * @param string $keyType The type of keys the array uses.
  1024. * @return void
  1025. */
  1026. public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
  1027. {
  1028. $keys = KataoInvoiceProductPeer::getFieldNames($keyType);
  1029. if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
  1030. if (array_key_exists($keys[1], $arr)) $this->setKataoInvoiceId($arr[$keys[1]]);
  1031. if (array_key_exists($keys[2], $arr)) $this->setKataoProductId($arr[$keys[2]]);
  1032. if (array_key_exists($keys[3], $arr)) $this->setKataoCartProductId($arr[$keys[3]]);
  1033. if (array_key_exists($keys[4], $arr)) $this->setKataoOrderProductId($arr[$keys[4]]);
  1034. if (array_key_exists($keys[5], $arr)) $this->setProductReference($arr[$keys[5]]);
  1035. if (array_key_exists($keys[6], $arr)) $this->setProductName($arr[$keys[6]]);
  1036. if (array_key_exists($keys[7], $arr)) $this->setProductPriceEuro($arr[$keys[7]]);
  1037. if (array_key_exists($keys[8], $arr)) $this->setProductMargin($arr[$keys[8]]);
  1038. if (array_key_exists($keys[9], $arr)) $this->setProductTvaRate($arr[$keys[9]]);
  1039. if (array_key_exists($keys[10], $arr)) $this->setQuantity($arr[$keys[10]]);
  1040. if (array_key_exists($keys[11], $arr)) $this->setQuantityDelivered($arr[$keys[11]]);
  1041. if (array_key_exists($keys[12], $arr)) $this->setSolAmount($arr[$keys[12]]);
  1042. if (array_key_exists($keys[13], $arr)) $this->setCreatedAt($arr[$keys[13]]);
  1043. if (array_key_exists($keys[14], $arr)) $this->setUpdatedAt($arr[$keys[14]]);
  1044. }
  1045. /**
  1046. * Build a Criteria object containing the values of all modified columns in this object.
  1047. *
  1048. * @return Criteria The Criteria object containing all modified values.
  1049. */
  1050. public function buildCriteria()
  1051. {
  1052. $criteria = new Criteria(KataoInvoiceProductPeer::DATABASE_NAME);
  1053. if ($this->isColumnModified(KataoInvoiceProductPeer::ID)) $criteria->add(KataoInvoiceProductPeer::ID, $this->id);
  1054. if ($this->isColumnModified(KataoInvoiceProductPeer::KATAO_INVOICE_ID)) $criteria->add(KataoInvoiceProductPeer::KATAO_INVOICE_ID, $this->katao_invoice_id);
  1055. if ($this->isColumnModified(KataoInvoiceProductPeer::KATAO_PRODUCT_ID)) $criteria->add(KataoInvoiceProductPeer::KATAO_PRODUCT_ID, $this->katao_product_id);
  1056. if ($this->isColumnModified(KataoInvoiceProductPeer::KATAO_CART_PRODUCT_ID)) $criteria->add(KataoInvoiceProductPeer::KATAO_CART_PRODUCT_ID, $this->katao_cart_product_id);
  1057. if ($this->isColumnModified(KataoInvoiceProductPeer::KATAO_ORDER_PRODUCT_ID)) $criteria->add(KataoInvoiceProductPeer::KATAO_ORDER_PRODUCT_ID, $this->katao_order_product_id);
  1058. if ($this->isColumnModified(KataoInvoiceProductPeer::PRODUCT_REFERENCE)) $criteria->add(KataoInvoiceProductPeer::PRODUCT_REFERENCE, $this->product_reference);
  1059. if ($this->isColumnModified(KataoInvoiceProductPeer::PRODUCT_NAME)) $criteria->add(KataoInvoiceProductPeer::PRODUCT_NAME, $this->product_name);
  1060. if ($this->isColumnModified(KataoInvoiceProductPeer::PRODUCT_PRICE_EURO)) $criteria->add(KataoInvoiceProductPeer::PRODUCT_PRICE_EURO, $this->product_price_euro);
  1061. if ($this->isColumnModified(KataoInvoiceProductPeer::PRODUCT_MARGIN)) $criteria->add(KataoInvoiceProductPeer::PRODUCT_MARGIN, $this->product_margin);
  1062. if ($this->isColumnModified(KataoInvoiceProductPeer::PRODUCT_TVA_RATE)) $criteria->add(KataoInvoiceProductPeer::PRODUCT_TVA_RATE, $this->product_tva_rate);
  1063. if ($this->isColumnModified(KataoInvoiceProductPeer::QUANTITY)) $criteria->add(KataoInvoiceProductPeer::QUANTITY, $this->quantity);
  1064. if ($this->isColumnModified(KataoInvoiceProductPeer::QUANTITY_DELIVERED)) $criteria->add(KataoInvoiceProductPeer::QUANTITY_DELIVERED, $this->quantity_delivered);
  1065. if ($this->isColumnModified(KataoInvoiceProductPeer::SOL_AMOUNT)) $criteria->add(KataoInvoiceProductPeer::SOL_AMOUNT, $this->sol_amount);
  1066. if ($this->isColumnModified(KataoInvoiceProductPeer::CREATED_AT)) $criteria->add(KataoInvoiceProductPeer::CREATED_AT, $this->created_at);
  1067. if ($this->isColumnModified(KataoInvoiceProductPeer::UPDATED_AT)) $criteria->add(KataoInvoiceProductPeer::UPDATED_AT, $this->updated_at);
  1068. return $criteria;
  1069. }
  1070. /**
  1071. * Builds a Criteria object containing the primary key for this object.
  1072. *
  1073. * Unlike buildCriteria() this method includes the primary key values regardless
  1074. * of whether or not they have been modified.
  1075. *
  1076. * @return Criteria The Criteria object containing value(s) for primary key(s).
  1077. */
  1078. public function buildPkeyCriteria()
  1079. {
  1080. $criteria = new Criteria(KataoInvoiceProductPeer::DATABASE_NAME);
  1081. $criteria->add(KataoInvoiceProductPeer::ID, $this->id);
  1082. return $criteria;
  1083. }
  1084. /**
  1085. * Returns the primary key for this object (row).
  1086. * @return int
  1087. */
  1088. public function getPrimaryKey()
  1089. {
  1090. return $this->getId();
  1091. }
  1092. /**
  1093. * Generic method to set the primary key (id column).
  1094. *
  1095. * @param int $key Primary key.
  1096. * @return void
  1097. */
  1098. public function setPrimaryKey($key)
  1099. {
  1100. $this->setId($key);
  1101. }
  1102. /**
  1103. * Sets contents of passed object to values from current object.
  1104. *
  1105. * If desired, this method can also make copies of all associated (fkey referrers)
  1106. * objects.
  1107. *
  1108. * @param object $copyObj An object of KataoInvoiceProduct (or compatible) type.
  1109. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  1110. * @throws PropelException
  1111. */
  1112. public function copyInto($copyObj, $deepCopy = false)
  1113. {
  1114. $copyObj->setKataoInvoiceId($this->katao_invoice_id);
  1115. $copyObj->setKataoProductId($this->katao_product_id);
  1116. $copyObj->setKataoCartProductId($this->katao_cart_product_id);
  1117. $copyObj->setKataoOrderProductId($this->katao_order_product_id);
  1118. $copyObj->setProductReference($this->product_reference);
  1119. $copyObj->setProductName($this->product_name);
  1120. $copyObj->setProductPriceEuro($this->product_price_euro);
  1121. $copyObj->setProductMargin($this->product_margin);
  1122. $copyObj->setProductTvaRate($this->product_tva_rate);
  1123. $copyObj->setQuantity($this->quantity);
  1124. $copyObj->setQuantityDelivered($this->quantity_delivered);
  1125. $copyObj->setSolAmount($this->sol_amount);
  1126. $copyObj->setCreatedAt($this->created_at);
  1127. $copyObj->setUpdatedAt($this->updated_at);
  1128. $copyObj->setNew(true);
  1129. $copyObj->setId(NULL); // this is a pkey column, so set to default value
  1130. }
  1131. /**
  1132. * Makes a copy of this object that will be inserted as a new row in table when saved.
  1133. * It creates a new object filling in the simple attributes, but skipping any primary
  1134. * keys that are defined for the table.
  1135. *
  1136. * If desired, this method can also make copies of all associated (fkey referrers)
  1137. * objects.
  1138. *
  1139. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  1140. * @return KataoInvoiceProduct Clone of current object.
  1141. * @throws PropelException
  1142. */
  1143. public function copy($deepCopy = false)
  1144. {
  1145. // we use get_class(), because this might be a subclass
  1146. $clazz = get_class($this);
  1147. $copyObj = new $clazz();
  1148. $this->copyInto($copyObj, $deepCopy);
  1149. return $copyObj;
  1150. }
  1151. /**
  1152. * Returns a peer instance associated with this om.
  1153. *
  1154. * Since Peer classes are not to have any instance attributes, this method returns the
  1155. * same instance for all member of this class. The method could therefore
  1156. * be static, but this would prevent one from overriding the behavior.
  1157. *
  1158. * @return KataoInvoiceProductPeer
  1159. */
  1160. public function getPeer()
  1161. {
  1162. if (self::$peer === null) {
  1163. self::$peer = new KataoInvoiceProductPeer();
  1164. }
  1165. return self::$peer;
  1166. }
  1167. /**
  1168. * Declares an association between this object and a KataoInvoice object.
  1169. *
  1170. * @param KataoInvoice $v
  1171. * @return void
  1172. * @throws PropelException
  1173. */
  1174. public function setKataoInvoice($v)
  1175. {
  1176. if ($v === null) {
  1177. $this->setKataoInvoiceId(NULL);
  1178. } else {
  1179. $this->setKataoInvoiceId($v->getId());
  1180. }
  1181. $this->aKataoInvoice = $v;
  1182. }
  1183. /**
  1184. * Get the associated KataoInvoice object
  1185. *
  1186. * @param Connection Optional Connection object.
  1187. * @return KataoInvoice The associated KataoInvoice object.
  1188. * @throws PropelException
  1189. */
  1190. public function getKataoInvoice($con = null)
  1191. {
  1192. if ($this->aKataoInvoice === null && ($this->katao_invoice_id !== null)) {
  1193. // include the related Peer class
  1194. $this->aKataoInvoice = KataoInvoicePeer::retrieveByPK($this->katao_invoice_id, $con);
  1195. /* The following can be used instead of the line above to
  1196. guarantee the related object contains a reference
  1197. to this object, but this level of coupling
  1198. may be undesirable in many circumstances.
  1199. As it can lead to a db query with many results that may
  1200. never be used.
  1201. $obj = KataoInvoicePeer::retrieveByPK($this->katao_invoice_id, $con);
  1202. $obj->addKataoInvoices($this);
  1203. */
  1204. }
  1205. return $this->aKataoInvoice;
  1206. }
  1207. /**
  1208. * Declares an association between this object and a KataoProduct object.
  1209. *
  1210. * @param KataoProduct $v
  1211. * @return void
  1212. * @throws PropelException
  1213. */
  1214. public function setKataoProduct($v)
  1215. {
  1216. if ($v === null) {
  1217. $this->setKataoProductId(NULL);
  1218. } else {
  1219. $this->setKataoProductId($v->getId());
  1220. }
  1221. $this->aKataoProduct = $v;
  1222. }
  1223. /**
  1224. * Get the associated KataoProduct object
  1225. *
  1226. * @param Connection Optional Connection object.
  1227. * @return KataoProduct The associated KataoProduct object.
  1228. * @throws PropelException
  1229. */
  1230. public function getKataoProduct($con = null)
  1231. {
  1232. if ($this->aKataoProduct === null && ($this->katao_product_id !== null)) {
  1233. // include the related Peer class
  1234. $this->aKataoProduct = KataoProductPeer::retrieveByPK($this->katao_product_id, $con);
  1235. /* The following can be used instead of the line above to
  1236. guarantee the related object contains a reference
  1237. to this object, but this level of coupling
  1238. may be undesirable in many circumstances.
  1239. As it can lead to a db query with many results that may
  1240. never be used.
  1241. $obj = KataoProductPeer::retrieveByPK($this->katao_product_id, $con);
  1242. $obj->addKataoProducts($this);
  1243. */
  1244. }
  1245. return $this->aKataoProduct;
  1246. }
  1247. /**
  1248. * Declares an association between this object and a KataoCartProduct object.
  1249. *
  1250. * @param KataoCartProduct $v
  1251. * @return void
  1252. * @throws PropelException
  1253. */
  1254. public function setKataoCartProduct($v)
  1255. {
  1256. if ($v === null) {
  1257. $this->setKataoCartProductId(NULL);
  1258. } else {
  1259. $this->setKataoCartProductId($v->getId());
  1260. }
  1261. $this->aKataoCartProduct = $v;
  1262. }
  1263. /**
  1264. * Get the associated KataoCartProduct object
  1265. *
  1266. * @param Connection Optional Connection object.
  1267. * @return KataoCartProduct The associated KataoCartProduct object.
  1268. * @throws PropelException
  1269. */
  1270. public function getKataoCartProduct($con = null)
  1271. {
  1272. if ($this->aKataoCartProduct === null && ($this->katao_cart_product_id !== null)) {
  1273. // include the related Peer class
  1274. $this->aKataoCartProduct = KataoCartProductPeer::retrieveByPK($this->katao_cart_product_id, $con);
  1275. /* The following can be used instead of the line above to
  1276. guarantee the related object contains a reference
  1277. to this object, but this level of coupling
  1278. may be undesirable in many circumstances.
  1279. As it can lead to a db query with many results that may
  1280. never be used.
  1281. $obj = KataoCartProductPeer::retrieveByPK($this->katao_cart_product_id, $con);
  1282. $obj->addKataoCartProducts($this);
  1283. */
  1284. }
  1285. return $this->aKataoCartProduct;
  1286. }
  1287. /**
  1288. * Declares an association between this object and a KataoOrderProduct object.
  1289. *
  1290. * @param KataoOrderProduct $v
  1291. * @return void
  1292. * @throws PropelException
  1293. */
  1294. public function setKataoOrderProduct($v)
  1295. {
  1296. if ($v === null) {
  1297. $this->setKataoOrderProductId(NULL);
  1298. } else {
  1299. $this->setKataoOrderProductId($v->getId());
  1300. }
  1301. $this->aKataoOrderProduct = $v;
  1302. }
  1303. /**
  1304. * Get the associated KataoOrderProduct object
  1305. *
  1306. * @param Connection Optional Connection object.
  1307. * @return KataoOrderProduct The associated KataoOrderProduct object.
  1308. * @throws PropelException
  1309. */
  1310. public function getKataoOrderProduct($con = null)
  1311. {
  1312. if ($this->aKataoOrderProduct === null && ($this->katao_order_product_id !== null)) {
  1313. // include the related Peer class
  1314. $this->aKataoOrderProduct = KataoOrderProductPeer::retrieveByPK($this->katao_order_product_id, $con);
  1315. /* The following can be used instead of the line above to
  1316. guarantee the related object contains a reference
  1317. to this object, but this level of coupling
  1318. may be undesirable in many circumstances.
  1319. As it can lead to a db query with many results that may
  1320. never be used.
  1321. $obj = KataoOrderProductPeer::retrieveByPK($this->katao_order_product_id, $con);
  1322. $obj->addKataoOrderProducts($this);
  1323. */
  1324. }
  1325. return $this->aKataoOrderProduct;
  1326. }
  1327. public function __call($method, $arguments)
  1328. {
  1329. if (!$callable = sfMixer::getCallable('BaseKataoInvoiceProduct:'.$method))
  1330. {
  1331. throw new sfException(sprintf('Call to undefined method BaseKataoInvoiceProduct::%s', $method));
  1332. }
  1333. array_unshift($arguments, $this);
  1334. return call_user_func_array($callable, $arguments);
  1335. }
  1336. } // BaseKataoInvoiceProduct