BaseKataoInvoice.php 58 KB

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