BaseKataoProduct.php 83 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996
  1. <?php
  2. /**
  3. * Base class that represents a row from the 'katao_product' table.
  4. *
  5. *
  6. *
  7. * @package lib.model.om
  8. */
  9. abstract class BaseKataoProduct 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 KataoProductPeer
  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 reference field.
  24. * @var string
  25. */
  26. protected $reference;
  27. /**
  28. * The value for the name field.
  29. * @var string
  30. */
  31. protected $name;
  32. /**
  33. * The value for the url_identifier field.
  34. * @var string
  35. */
  36. protected $url_identifier;
  37. /**
  38. * The value for the description field.
  39. * @var string
  40. */
  41. protected $description;
  42. /**
  43. * The value for the katao_product_family_id field.
  44. * @var int
  45. */
  46. protected $katao_product_family_id;
  47. /**
  48. * The value for the katao_supplier_id field.
  49. * @var int
  50. */
  51. protected $katao_supplier_id;
  52. /**
  53. * The value for the max_sol_amount field.
  54. * @var int
  55. */
  56. protected $max_sol_amount;
  57. /**
  58. * The value for the unit_price_euro field.
  59. * @var double
  60. */
  61. protected $unit_price_euro;
  62. /**
  63. * The value for the margin field.
  64. * @var double
  65. */
  66. protected $margin;
  67. /**
  68. * The value for the tva_rate field.
  69. * @var double
  70. */
  71. protected $tva_rate = 0;
  72. /**
  73. * The value for the min_order_number field.
  74. * @var int
  75. */
  76. protected $min_order_number = 1;
  77. /**
  78. * The value for the picture field.
  79. * @var string
  80. */
  81. protected $picture;
  82. /**
  83. * The value for the delivery_delay field.
  84. * @var int
  85. */
  86. protected $delivery_delay;
  87. /**
  88. * The value for the is_archived field.
  89. * @var int
  90. */
  91. protected $is_archived = 0;
  92. /**
  93. * The value for the accounting_code_purchase field.
  94. * @var string
  95. */
  96. protected $accounting_code_purchase;
  97. /**
  98. * The value for the accounting_code_sell field.
  99. * @var string
  100. */
  101. protected $accounting_code_sell;
  102. /**
  103. * The value for the created_at field.
  104. * @var int
  105. */
  106. protected $created_at;
  107. /**
  108. * The value for the updated_at field.
  109. * @var int
  110. */
  111. protected $updated_at;
  112. /**
  113. * @var KataoProductFamily
  114. */
  115. protected $aKataoProductFamily;
  116. /**
  117. * @var KataoSupplier
  118. */
  119. protected $aKataoSupplier;
  120. /**
  121. * Collection to store aggregation of collKataoNodeProducts.
  122. * @var array
  123. */
  124. protected $collKataoNodeProducts;
  125. /**
  126. * The criteria used to select the current contents of collKataoNodeProducts.
  127. * @var Criteria
  128. */
  129. protected $lastKataoNodeProductCriteria = null;
  130. /**
  131. * Collection to store aggregation of collKataoPeriodProducts.
  132. * @var array
  133. */
  134. protected $collKataoPeriodProducts;
  135. /**
  136. * The criteria used to select the current contents of collKataoPeriodProducts.
  137. * @var Criteria
  138. */
  139. protected $lastKataoPeriodProductCriteria = null;
  140. /**
  141. * Collection to store aggregation of collKataoCartProducts.
  142. * @var array
  143. */
  144. protected $collKataoCartProducts;
  145. /**
  146. * The criteria used to select the current contents of collKataoCartProducts.
  147. * @var Criteria
  148. */
  149. protected $lastKataoCartProductCriteria = null;
  150. /**
  151. * Collection to store aggregation of collKataoOrderProducts.
  152. * @var array
  153. */
  154. protected $collKataoOrderProducts;
  155. /**
  156. * The criteria used to select the current contents of collKataoOrderProducts.
  157. * @var Criteria
  158. */
  159. protected $lastKataoOrderProductCriteria = null;
  160. /**
  161. * Collection to store aggregation of collKataoInvoiceProducts.
  162. * @var array
  163. */
  164. protected $collKataoInvoiceProducts;
  165. /**
  166. * The criteria used to select the current contents of collKataoInvoiceProducts.
  167. * @var Criteria
  168. */
  169. protected $lastKataoInvoiceProductCriteria = null;
  170. /**
  171. * Collection to store aggregation of collKataoSupplierInvoiceProducts.
  172. * @var array
  173. */
  174. protected $collKataoSupplierInvoiceProducts;
  175. /**
  176. * The criteria used to select the current contents of collKataoSupplierInvoiceProducts.
  177. * @var Criteria
  178. */
  179. protected $lastKataoSupplierInvoiceProductCriteria = null;
  180. /**
  181. * Flag to prevent endless save loop, if this object is referenced
  182. * by another object which falls in this transaction.
  183. * @var boolean
  184. */
  185. protected $alreadyInSave = false;
  186. /**
  187. * Flag to prevent endless validation loop, if this object is referenced
  188. * by another object which falls in this transaction.
  189. * @var boolean
  190. */
  191. protected $alreadyInValidation = false;
  192. /**
  193. * Get the [id] column value.
  194. *
  195. * @return int
  196. */
  197. public function getId()
  198. {
  199. return $this->id;
  200. }
  201. /**
  202. * Get the [reference] column value.
  203. *
  204. * @return string
  205. */
  206. public function getReference()
  207. {
  208. return $this->reference;
  209. }
  210. /**
  211. * Get the [name] column value.
  212. *
  213. * @return string
  214. */
  215. public function getName()
  216. {
  217. return $this->name;
  218. }
  219. /**
  220. * Get the [url_identifier] column value.
  221. *
  222. * @return string
  223. */
  224. public function getUrlIdentifier()
  225. {
  226. return $this->url_identifier;
  227. }
  228. /**
  229. * Get the [description] column value.
  230. *
  231. * @return string
  232. */
  233. public function getDescription()
  234. {
  235. return $this->description;
  236. }
  237. /**
  238. * Get the [katao_product_family_id] column value.
  239. *
  240. * @return int
  241. */
  242. public function getKataoProductFamilyId()
  243. {
  244. return $this->katao_product_family_id;
  245. }
  246. /**
  247. * Get the [katao_supplier_id] column value.
  248. *
  249. * @return int
  250. */
  251. public function getKataoSupplierId()
  252. {
  253. return $this->katao_supplier_id;
  254. }
  255. /**
  256. * Get the [max_sol_amount] column value.
  257. *
  258. * @return int
  259. */
  260. public function getMaxSolAmount()
  261. {
  262. return $this->max_sol_amount;
  263. }
  264. /**
  265. * Get the [unit_price_euro] column value.
  266. *
  267. * @return double
  268. */
  269. public function getUnitPriceEuro()
  270. {
  271. return $this->unit_price_euro;
  272. }
  273. /**
  274. * Get the [margin] column value.
  275. *
  276. * @return double
  277. */
  278. public function getMargin()
  279. {
  280. return $this->margin;
  281. }
  282. /**
  283. * Get the [tva_rate] column value.
  284. *
  285. * @return double
  286. */
  287. public function getTvaRate()
  288. {
  289. return $this->tva_rate;
  290. }
  291. /**
  292. * Get the [min_order_number] column value.
  293. *
  294. * @return int
  295. */
  296. public function getMinOrderNumber()
  297. {
  298. return $this->min_order_number;
  299. }
  300. /**
  301. * Get the [picture] column value.
  302. *
  303. * @return string
  304. */
  305. public function getPicture()
  306. {
  307. return $this->picture;
  308. }
  309. /**
  310. * Get the [delivery_delay] column value.
  311. *
  312. * @return int
  313. */
  314. public function getDeliveryDelay()
  315. {
  316. return $this->delivery_delay;
  317. }
  318. /**
  319. * Get the [is_archived] column value.
  320. *
  321. * @return int
  322. */
  323. public function getIsArchived()
  324. {
  325. return $this->is_archived;
  326. }
  327. /**
  328. * Get the [accounting_code_purchase] column value.
  329. *
  330. * @return string
  331. */
  332. public function getAccountingCodePurchase()
  333. {
  334. return $this->accounting_code_purchase;
  335. }
  336. /**
  337. * Get the [accounting_code_sell] column value.
  338. *
  339. * @return string
  340. */
  341. public function getAccountingCodeSell()
  342. {
  343. return $this->accounting_code_sell;
  344. }
  345. /**
  346. * Get the [optionally formatted] [created_at] column value.
  347. *
  348. * @param string $format The date/time format string (either date()-style or strftime()-style).
  349. * If format is NULL, then the integer unix timestamp will be returned.
  350. * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
  351. * @throws PropelException - if unable to convert the date/time to timestamp.
  352. */
  353. public function getCreatedAt($format = 'Y-m-d H:i:s')
  354. {
  355. if ($this->created_at === null || $this->created_at === '') {
  356. return null;
  357. } elseif (!is_int($this->created_at)) {
  358. // a non-timestamp value was set externally, so we convert it
  359. $ts = strtotime($this->created_at);
  360. if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
  361. throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true));
  362. }
  363. } else {
  364. $ts = $this->created_at;
  365. }
  366. if ($format === null) {
  367. return $ts;
  368. } elseif (strpos($format, '%') !== false) {
  369. return strftime($format, $ts);
  370. } else {
  371. return date($format, $ts);
  372. }
  373. }
  374. /**
  375. * Get the [optionally formatted] [updated_at] column value.
  376. *
  377. * @param string $format The date/time format string (either date()-style or strftime()-style).
  378. * If format is NULL, then the integer unix timestamp will be returned.
  379. * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
  380. * @throws PropelException - if unable to convert the date/time to timestamp.
  381. */
  382. public function getUpdatedAt($format = 'Y-m-d H:i:s')
  383. {
  384. if ($this->updated_at === null || $this->updated_at === '') {
  385. return null;
  386. } elseif (!is_int($this->updated_at)) {
  387. // a non-timestamp value was set externally, so we convert it
  388. $ts = strtotime($this->updated_at);
  389. if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
  390. throw new PropelException("Unable to parse value of [updated_at] as date/time value: " . var_export($this->updated_at, true));
  391. }
  392. } else {
  393. $ts = $this->updated_at;
  394. }
  395. if ($format === null) {
  396. return $ts;
  397. } elseif (strpos($format, '%') !== false) {
  398. return strftime($format, $ts);
  399. } else {
  400. return date($format, $ts);
  401. }
  402. }
  403. /**
  404. * Set the value of [id] column.
  405. *
  406. * @param int $v new value
  407. * @return void
  408. */
  409. public function setId($v)
  410. {
  411. // Since the native PHP type for this column is integer,
  412. // we will cast the input value to an int (if it is not).
  413. if ($v !== null && !is_int($v) && is_numeric($v)) {
  414. $v = (int) $v;
  415. }
  416. if ($this->id !== $v) {
  417. $this->id = $v;
  418. $this->modifiedColumns[] = KataoProductPeer::ID;
  419. }
  420. } // setId()
  421. /**
  422. * Set the value of [reference] column.
  423. *
  424. * @param string $v new value
  425. * @return void
  426. */
  427. public function setReference($v)
  428. {
  429. // Since the native PHP type for this column is string,
  430. // we will cast the input to a string (if it is not).
  431. if ($v !== null && !is_string($v)) {
  432. $v = (string) $v;
  433. }
  434. if ($this->reference !== $v) {
  435. $this->reference = $v;
  436. $this->modifiedColumns[] = KataoProductPeer::REFERENCE;
  437. }
  438. } // setReference()
  439. /**
  440. * Set the value of [name] column.
  441. *
  442. * @param string $v new value
  443. * @return void
  444. */
  445. public function setName($v)
  446. {
  447. // Since the native PHP type for this column is string,
  448. // we will cast the input to a string (if it is not).
  449. if ($v !== null && !is_string($v)) {
  450. $v = (string) $v;
  451. }
  452. if ($this->name !== $v) {
  453. $this->name = $v;
  454. $this->modifiedColumns[] = KataoProductPeer::NAME;
  455. }
  456. } // setName()
  457. /**
  458. * Set the value of [url_identifier] column.
  459. *
  460. * @param string $v new value
  461. * @return void
  462. */
  463. public function setUrlIdentifier($v)
  464. {
  465. // Since the native PHP type for this column is string,
  466. // we will cast the input to a string (if it is not).
  467. if ($v !== null && !is_string($v)) {
  468. $v = (string) $v;
  469. }
  470. if ($this->url_identifier !== $v) {
  471. $this->url_identifier = $v;
  472. $this->modifiedColumns[] = KataoProductPeer::URL_IDENTIFIER;
  473. }
  474. } // setUrlIdentifier()
  475. /**
  476. * Set the value of [description] column.
  477. *
  478. * @param string $v new value
  479. * @return void
  480. */
  481. public function setDescription($v)
  482. {
  483. // Since the native PHP type for this column is string,
  484. // we will cast the input to a string (if it is not).
  485. if ($v !== null && !is_string($v)) {
  486. $v = (string) $v;
  487. }
  488. if ($this->description !== $v) {
  489. $this->description = $v;
  490. $this->modifiedColumns[] = KataoProductPeer::DESCRIPTION;
  491. }
  492. } // setDescription()
  493. /**
  494. * Set the value of [katao_product_family_id] column.
  495. *
  496. * @param int $v new value
  497. * @return void
  498. */
  499. public function setKataoProductFamilyId($v)
  500. {
  501. // Since the native PHP type for this column is integer,
  502. // we will cast the input value to an int (if it is not).
  503. if ($v !== null && !is_int($v) && is_numeric($v)) {
  504. $v = (int) $v;
  505. }
  506. if ($this->katao_product_family_id !== $v) {
  507. $this->katao_product_family_id = $v;
  508. $this->modifiedColumns[] = KataoProductPeer::KATAO_PRODUCT_FAMILY_ID;
  509. }
  510. if ($this->aKataoProductFamily !== null && $this->aKataoProductFamily->getId() !== $v) {
  511. $this->aKataoProductFamily = null;
  512. }
  513. } // setKataoProductFamilyId()
  514. /**
  515. * Set the value of [katao_supplier_id] column.
  516. *
  517. * @param int $v new value
  518. * @return void
  519. */
  520. public function setKataoSupplierId($v)
  521. {
  522. // Since the native PHP type for this column is integer,
  523. // we will cast the input value to an int (if it is not).
  524. if ($v !== null && !is_int($v) && is_numeric($v)) {
  525. $v = (int) $v;
  526. }
  527. if ($this->katao_supplier_id !== $v) {
  528. $this->katao_supplier_id = $v;
  529. $this->modifiedColumns[] = KataoProductPeer::KATAO_SUPPLIER_ID;
  530. }
  531. if ($this->aKataoSupplier !== null && $this->aKataoSupplier->getId() !== $v) {
  532. $this->aKataoSupplier = null;
  533. }
  534. } // setKataoSupplierId()
  535. /**
  536. * Set the value of [max_sol_amount] column.
  537. *
  538. * @param int $v new value
  539. * @return void
  540. */
  541. public function setMaxSolAmount($v)
  542. {
  543. // Since the native PHP type for this column is integer,
  544. // we will cast the input value to an int (if it is not).
  545. if ($v !== null && !is_int($v) && is_numeric($v)) {
  546. $v = (int) $v;
  547. }
  548. if ($this->max_sol_amount !== $v) {
  549. $this->max_sol_amount = $v;
  550. $this->modifiedColumns[] = KataoProductPeer::MAX_SOL_AMOUNT;
  551. }
  552. } // setMaxSolAmount()
  553. /**
  554. * Set the value of [unit_price_euro] column.
  555. *
  556. * @param double $v new value
  557. * @return void
  558. */
  559. public function setUnitPriceEuro($v)
  560. {
  561. if ($this->unit_price_euro !== $v) {
  562. $this->unit_price_euro = $v;
  563. $this->modifiedColumns[] = KataoProductPeer::UNIT_PRICE_EURO;
  564. }
  565. } // setUnitPriceEuro()
  566. /**
  567. * Set the value of [margin] column.
  568. *
  569. * @param double $v new value
  570. * @return void
  571. */
  572. public function setMargin($v)
  573. {
  574. if ($this->margin !== $v) {
  575. $this->margin = $v;
  576. $this->modifiedColumns[] = KataoProductPeer::MARGIN;
  577. }
  578. } // setMargin()
  579. /**
  580. * Set the value of [tva_rate] column.
  581. *
  582. * @param double $v new value
  583. * @return void
  584. */
  585. public function setTvaRate($v)
  586. {
  587. if ($this->tva_rate !== $v || $v === 0) {
  588. $this->tva_rate = $v;
  589. $this->modifiedColumns[] = KataoProductPeer::TVA_RATE;
  590. }
  591. } // setTvaRate()
  592. /**
  593. * Set the value of [min_order_number] column.
  594. *
  595. * @param int $v new value
  596. * @return void
  597. */
  598. public function setMinOrderNumber($v)
  599. {
  600. // Since the native PHP type for this column is integer,
  601. // we will cast the input value to an int (if it is not).
  602. if ($v !== null && !is_int($v) && is_numeric($v)) {
  603. $v = (int) $v;
  604. }
  605. if ($this->min_order_number !== $v || $v === 1) {
  606. $this->min_order_number = $v;
  607. $this->modifiedColumns[] = KataoProductPeer::MIN_ORDER_NUMBER;
  608. }
  609. } // setMinOrderNumber()
  610. /**
  611. * Set the value of [picture] column.
  612. *
  613. * @param string $v new value
  614. * @return void
  615. */
  616. public function setPicture($v)
  617. {
  618. // Since the native PHP type for this column is string,
  619. // we will cast the input to a string (if it is not).
  620. if ($v !== null && !is_string($v)) {
  621. $v = (string) $v;
  622. }
  623. if ($this->picture !== $v) {
  624. $this->picture = $v;
  625. $this->modifiedColumns[] = KataoProductPeer::PICTURE;
  626. }
  627. } // setPicture()
  628. /**
  629. * Set the value of [delivery_delay] column.
  630. *
  631. * @param int $v new value
  632. * @return void
  633. */
  634. public function setDeliveryDelay($v)
  635. {
  636. // Since the native PHP type for this column is integer,
  637. // we will cast the input value to an int (if it is not).
  638. if ($v !== null && !is_int($v) && is_numeric($v)) {
  639. $v = (int) $v;
  640. }
  641. if ($this->delivery_delay !== $v) {
  642. $this->delivery_delay = $v;
  643. $this->modifiedColumns[] = KataoProductPeer::DELIVERY_DELAY;
  644. }
  645. } // setDeliveryDelay()
  646. /**
  647. * Set the value of [is_archived] column.
  648. *
  649. * @param int $v new value
  650. * @return void
  651. */
  652. public function setIsArchived($v)
  653. {
  654. // Since the native PHP type for this column is integer,
  655. // we will cast the input value to an int (if it is not).
  656. if ($v !== null && !is_int($v) && is_numeric($v)) {
  657. $v = (int) $v;
  658. }
  659. if ($this->is_archived !== $v || $v === 0) {
  660. $this->is_archived = $v;
  661. $this->modifiedColumns[] = KataoProductPeer::IS_ARCHIVED;
  662. }
  663. } // setIsArchived()
  664. /**
  665. * Set the value of [accounting_code_purchase] column.
  666. *
  667. * @param string $v new value
  668. * @return void
  669. */
  670. public function setAccountingCodePurchase($v)
  671. {
  672. // Since the native PHP type for this column is string,
  673. // we will cast the input to a string (if it is not).
  674. if ($v !== null && !is_string($v)) {
  675. $v = (string) $v;
  676. }
  677. if ($this->accounting_code_purchase !== $v) {
  678. $this->accounting_code_purchase = $v;
  679. $this->modifiedColumns[] = KataoProductPeer::ACCOUNTING_CODE_PURCHASE;
  680. }
  681. } // setAccountingCodePurchase()
  682. /**
  683. * Set the value of [accounting_code_sell] column.
  684. *
  685. * @param string $v new value
  686. * @return void
  687. */
  688. public function setAccountingCodeSell($v)
  689. {
  690. // Since the native PHP type for this column is string,
  691. // we will cast the input to a string (if it is not).
  692. if ($v !== null && !is_string($v)) {
  693. $v = (string) $v;
  694. }
  695. if ($this->accounting_code_sell !== $v) {
  696. $this->accounting_code_sell = $v;
  697. $this->modifiedColumns[] = KataoProductPeer::ACCOUNTING_CODE_SELL;
  698. }
  699. } // setAccountingCodeSell()
  700. /**
  701. * Set the value of [created_at] column.
  702. *
  703. * @param int $v new value
  704. * @return void
  705. */
  706. public function setCreatedAt($v)
  707. {
  708. if ($v !== null && !is_int($v)) {
  709. $ts = strtotime($v);
  710. if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
  711. throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
  712. }
  713. } else {
  714. $ts = $v;
  715. }
  716. if ($this->created_at !== $ts) {
  717. $this->created_at = $ts;
  718. $this->modifiedColumns[] = KataoProductPeer::CREATED_AT;
  719. }
  720. } // setCreatedAt()
  721. /**
  722. * Set the value of [updated_at] column.
  723. *
  724. * @param int $v new value
  725. * @return void
  726. */
  727. public function setUpdatedAt($v)
  728. {
  729. if ($v !== null && !is_int($v)) {
  730. $ts = strtotime($v);
  731. if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
  732. throw new PropelException("Unable to parse date/time value for [updated_at] from input: " . var_export($v, true));
  733. }
  734. } else {
  735. $ts = $v;
  736. }
  737. if ($this->updated_at !== $ts) {
  738. $this->updated_at = $ts;
  739. $this->modifiedColumns[] = KataoProductPeer::UPDATED_AT;
  740. }
  741. } // setUpdatedAt()
  742. /**
  743. * Hydrates (populates) the object variables with values from the database resultset.
  744. *
  745. * An offset (1-based "start column") is specified so that objects can be hydrated
  746. * with a subset of the columns in the resultset rows. This is needed, for example,
  747. * for results of JOIN queries where the resultset row includes columns from two or
  748. * more tables.
  749. *
  750. * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
  751. * @param int $startcol 1-based offset column which indicates which restultset column to start with.
  752. * @return int next starting column
  753. * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
  754. */
  755. public function hydrate(ResultSet $rs, $startcol = 1)
  756. {
  757. try {
  758. $this->id = $rs->getInt($startcol + 0);
  759. $this->reference = $rs->getString($startcol + 1);
  760. $this->name = $rs->getString($startcol + 2);
  761. $this->url_identifier = $rs->getString($startcol + 3);
  762. $this->description = $rs->getString($startcol + 4);
  763. $this->katao_product_family_id = $rs->getInt($startcol + 5);
  764. $this->katao_supplier_id = $rs->getInt($startcol + 6);
  765. $this->max_sol_amount = $rs->getInt($startcol + 7);
  766. $this->unit_price_euro = $rs->getFloat($startcol + 8);
  767. $this->margin = $rs->getFloat($startcol + 9);
  768. $this->tva_rate = $rs->getFloat($startcol + 10);
  769. $this->min_order_number = $rs->getInt($startcol + 11);
  770. $this->picture = $rs->getString($startcol + 12);
  771. $this->delivery_delay = $rs->getInt($startcol + 13);
  772. $this->is_archived = $rs->getInt($startcol + 14);
  773. $this->accounting_code_purchase = $rs->getString($startcol + 15);
  774. $this->accounting_code_sell = $rs->getString($startcol + 16);
  775. $this->created_at = $rs->getTimestamp($startcol + 17, null);
  776. $this->updated_at = $rs->getTimestamp($startcol + 18, null);
  777. $this->resetModified();
  778. $this->setNew(false);
  779. // FIXME - using NUM_COLUMNS may be clearer.
  780. return $startcol + 19; // 19 = KataoProductPeer::NUM_COLUMNS - KataoProductPeer::NUM_LAZY_LOAD_COLUMNS).
  781. } catch (Exception $e) {
  782. throw new PropelException("Error populating KataoProduct object", $e);
  783. }
  784. }
  785. /**
  786. * Removes this object from datastore and sets delete attribute.
  787. *
  788. * @param Connection $con
  789. * @return void
  790. * @throws PropelException
  791. * @see BaseObject::setDeleted()
  792. * @see BaseObject::isDeleted()
  793. */
  794. public function delete($con = null)
  795. {
  796. foreach (sfMixer::getCallables('BaseKataoProduct:delete:pre') as $callable)
  797. {
  798. $ret = call_user_func($callable, $this, $con);
  799. if ($ret)
  800. {
  801. return;
  802. }
  803. }
  804. if ($this->isDeleted()) {
  805. throw new PropelException("This object has already been deleted.");
  806. }
  807. if ($con === null) {
  808. $con = Propel::getConnection(KataoProductPeer::DATABASE_NAME);
  809. }
  810. try {
  811. $con->begin();
  812. KataoProductPeer::doDelete($this, $con);
  813. $this->setDeleted(true);
  814. $con->commit();
  815. } catch (PropelException $e) {
  816. $con->rollback();
  817. throw $e;
  818. }
  819. foreach (sfMixer::getCallables('BaseKataoProduct:delete:post') as $callable)
  820. {
  821. call_user_func($callable, $this, $con);
  822. }
  823. }
  824. /**
  825. * Stores the object in the database. If the object is new,
  826. * it inserts it; otherwise an update is performed. This method
  827. * wraps the doSave() worker method in a transaction.
  828. *
  829. * @param Connection $con
  830. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  831. * @throws PropelException
  832. * @see doSave()
  833. */
  834. public function save($con = null)
  835. {
  836. foreach (sfMixer::getCallables('BaseKataoProduct:save:pre') as $callable)
  837. {
  838. $affectedRows = call_user_func($callable, $this, $con);
  839. if (is_int($affectedRows))
  840. {
  841. return $affectedRows;
  842. }
  843. }
  844. if ($this->isNew() && !$this->isColumnModified(KataoProductPeer::CREATED_AT))
  845. {
  846. $this->setCreatedAt(time());
  847. }
  848. if ($this->isModified() && !$this->isColumnModified(KataoProductPeer::UPDATED_AT))
  849. {
  850. $this->setUpdatedAt(time());
  851. }
  852. if ($this->isDeleted()) {
  853. throw new PropelException("You cannot save an object that has been deleted.");
  854. }
  855. if ($con === null) {
  856. $con = Propel::getConnection(KataoProductPeer::DATABASE_NAME);
  857. }
  858. try {
  859. $con->begin();
  860. $affectedRows = $this->doSave($con);
  861. $con->commit();
  862. foreach (sfMixer::getCallables('BaseKataoProduct:save:post') as $callable)
  863. {
  864. call_user_func($callable, $this, $con, $affectedRows);
  865. }
  866. return $affectedRows;
  867. } catch (PropelException $e) {
  868. $con->rollback();
  869. throw $e;
  870. }
  871. }
  872. /**
  873. * Stores the object in the database.
  874. *
  875. * If the object is new, it inserts it; otherwise an update is performed.
  876. * All related objects are also updated in this method.
  877. *
  878. * @param Connection $con
  879. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  880. * @throws PropelException
  881. * @see save()
  882. */
  883. protected function doSave($con)
  884. {
  885. $affectedRows = 0; // initialize var to track total num of affected rows
  886. if (!$this->alreadyInSave) {
  887. $this->alreadyInSave = true;
  888. // We call the save method on the following object(s) if they
  889. // were passed to this object by their coresponding set
  890. // method. This object relates to these object(s) by a
  891. // foreign key reference.
  892. if ($this->aKataoProductFamily !== null) {
  893. if ($this->aKataoProductFamily->isModified()) {
  894. $affectedRows += $this->aKataoProductFamily->save($con);
  895. }
  896. $this->setKataoProductFamily($this->aKataoProductFamily);
  897. }
  898. if ($this->aKataoSupplier !== null) {
  899. if ($this->aKataoSupplier->isModified()) {
  900. $affectedRows += $this->aKataoSupplier->save($con);
  901. }
  902. $this->setKataoSupplier($this->aKataoSupplier);
  903. }
  904. // If this object has been modified, then save it to the database.
  905. if ($this->isModified()) {
  906. if ($this->isNew()) {
  907. $pk = KataoProductPeer::doInsert($this, $con);
  908. $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
  909. // should always be true here (even though technically
  910. // BasePeer::doInsert() can insert multiple rows).
  911. $this->setId($pk); //[IMV] update autoincrement primary key
  912. $this->setNew(false);
  913. } else {
  914. $affectedRows += KataoProductPeer::doUpdate($this, $con);
  915. }
  916. $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
  917. }
  918. if ($this->collKataoNodeProducts !== null) {
  919. foreach($this->collKataoNodeProducts as $referrerFK) {
  920. if (!$referrerFK->isDeleted()) {
  921. $affectedRows += $referrerFK->save($con);
  922. }
  923. }
  924. }
  925. if ($this->collKataoPeriodProducts !== null) {
  926. foreach($this->collKataoPeriodProducts as $referrerFK) {
  927. if (!$referrerFK->isDeleted()) {
  928. $affectedRows += $referrerFK->save($con);
  929. }
  930. }
  931. }
  932. if ($this->collKataoCartProducts !== null) {
  933. foreach($this->collKataoCartProducts as $referrerFK) {
  934. if (!$referrerFK->isDeleted()) {
  935. $affectedRows += $referrerFK->save($con);
  936. }
  937. }
  938. }
  939. if ($this->collKataoOrderProducts !== null) {
  940. foreach($this->collKataoOrderProducts as $referrerFK) {
  941. if (!$referrerFK->isDeleted()) {
  942. $affectedRows += $referrerFK->save($con);
  943. }
  944. }
  945. }
  946. if ($this->collKataoInvoiceProducts !== null) {
  947. foreach($this->collKataoInvoiceProducts as $referrerFK) {
  948. if (!$referrerFK->isDeleted()) {
  949. $affectedRows += $referrerFK->save($con);
  950. }
  951. }
  952. }
  953. if ($this->collKataoSupplierInvoiceProducts !== null) {
  954. foreach($this->collKataoSupplierInvoiceProducts as $referrerFK) {
  955. if (!$referrerFK->isDeleted()) {
  956. $affectedRows += $referrerFK->save($con);
  957. }
  958. }
  959. }
  960. $this->alreadyInSave = false;
  961. }
  962. return $affectedRows;
  963. } // doSave()
  964. /**
  965. * Array of ValidationFailed objects.
  966. * @var array ValidationFailed[]
  967. */
  968. protected $validationFailures = array();
  969. /**
  970. * Gets any ValidationFailed objects that resulted from last call to validate().
  971. *
  972. *
  973. * @return array ValidationFailed[]
  974. * @see validate()
  975. */
  976. public function getValidationFailures()
  977. {
  978. return $this->validationFailures;
  979. }
  980. /**
  981. * Validates the objects modified field values and all objects related to this table.
  982. *
  983. * If $columns is either a column name or an array of column names
  984. * only those columns are validated.
  985. *
  986. * @param mixed $columns Column name or an array of column names.
  987. * @return boolean Whether all columns pass validation.
  988. * @see doValidate()
  989. * @see getValidationFailures()
  990. */
  991. public function validate($columns = null)
  992. {
  993. $res = $this->doValidate($columns);
  994. if ($res === true) {
  995. $this->validationFailures = array();
  996. return true;
  997. } else {
  998. $this->validationFailures = $res;
  999. return false;
  1000. }
  1001. }
  1002. /**
  1003. * This function performs the validation work for complex object models.
  1004. *
  1005. * In addition to checking the current object, all related objects will
  1006. * also be validated. If all pass then <code>true</code> is returned; otherwise
  1007. * an aggreagated array of ValidationFailed objects will be returned.
  1008. *
  1009. * @param array $columns Array of column names to validate.
  1010. * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  1011. */
  1012. protected function doValidate($columns = null)
  1013. {
  1014. if (!$this->alreadyInValidation) {
  1015. $this->alreadyInValidation = true;
  1016. $retval = null;
  1017. $failureMap = array();
  1018. // We call the validate method on the following object(s) if they
  1019. // were passed to this object by their coresponding set
  1020. // method. This object relates to these object(s) by a
  1021. // foreign key reference.
  1022. if ($this->aKataoProductFamily !== null) {
  1023. if (!$this->aKataoProductFamily->validate($columns)) {
  1024. $failureMap = array_merge($failureMap, $this->aKataoProductFamily->getValidationFailures());
  1025. }
  1026. }
  1027. if ($this->aKataoSupplier !== null) {
  1028. if (!$this->aKataoSupplier->validate($columns)) {
  1029. $failureMap = array_merge($failureMap, $this->aKataoSupplier->getValidationFailures());
  1030. }
  1031. }
  1032. if (($retval = KataoProductPeer::doValidate($this, $columns)) !== true) {
  1033. $failureMap = array_merge($failureMap, $retval);
  1034. }
  1035. if ($this->collKataoNodeProducts !== null) {
  1036. foreach($this->collKataoNodeProducts as $referrerFK) {
  1037. if (!$referrerFK->validate($columns)) {
  1038. $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
  1039. }
  1040. }
  1041. }
  1042. if ($this->collKataoPeriodProducts !== null) {
  1043. foreach($this->collKataoPeriodProducts as $referrerFK) {
  1044. if (!$referrerFK->validate($columns)) {
  1045. $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
  1046. }
  1047. }
  1048. }
  1049. if ($this->collKataoCartProducts !== null) {
  1050. foreach($this->collKataoCartProducts as $referrerFK) {
  1051. if (!$referrerFK->validate($columns)) {
  1052. $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
  1053. }
  1054. }
  1055. }
  1056. if ($this->collKataoOrderProducts !== null) {
  1057. foreach($this->collKataoOrderProducts as $referrerFK) {
  1058. if (!$referrerFK->validate($columns)) {
  1059. $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
  1060. }
  1061. }
  1062. }
  1063. if ($this->collKataoInvoiceProducts !== null) {
  1064. foreach($this->collKataoInvoiceProducts as $referrerFK) {
  1065. if (!$referrerFK->validate($columns)) {
  1066. $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
  1067. }
  1068. }
  1069. }
  1070. if ($this->collKataoSupplierInvoiceProducts !== null) {
  1071. foreach($this->collKataoSupplierInvoiceProducts as $referrerFK) {
  1072. if (!$referrerFK->validate($columns)) {
  1073. $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
  1074. }
  1075. }
  1076. }
  1077. $this->alreadyInValidation = false;
  1078. }
  1079. return (!empty($failureMap) ? $failureMap : true);
  1080. }
  1081. /**
  1082. * Retrieves a field from the object by name passed in as a string.
  1083. *
  1084. * @param string $name name
  1085. * @param string $type The type of fieldname the $name is of:
  1086. * one of the class type constants TYPE_PHPNAME,
  1087. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  1088. * @return mixed Value of field.
  1089. */
  1090. public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
  1091. {
  1092. $pos = KataoProductPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  1093. return $this->getByPosition($pos);
  1094. }
  1095. /**
  1096. * Retrieves a field from the object by Position as specified in the xml schema.
  1097. * Zero-based.
  1098. *
  1099. * @param int $pos position in xml schema
  1100. * @return mixed Value of field at $pos
  1101. */
  1102. public function getByPosition($pos)
  1103. {
  1104. switch($pos) {
  1105. case 0:
  1106. return $this->getId();
  1107. break;
  1108. case 1:
  1109. return $this->getReference();
  1110. break;
  1111. case 2:
  1112. return $this->getName();
  1113. break;
  1114. case 3:
  1115. return $this->getUrlIdentifier();
  1116. break;
  1117. case 4:
  1118. return $this->getDescription();
  1119. break;
  1120. case 5:
  1121. return $this->getKataoProductFamilyId();
  1122. break;
  1123. case 6:
  1124. return $this->getKataoSupplierId();
  1125. break;
  1126. case 7:
  1127. return $this->getMaxSolAmount();
  1128. break;
  1129. case 8:
  1130. return $this->getUnitPriceEuro();
  1131. break;
  1132. case 9:
  1133. return $this->getMargin();
  1134. break;
  1135. case 10:
  1136. return $this->getTvaRate();
  1137. break;
  1138. case 11:
  1139. return $this->getMinOrderNumber();
  1140. break;
  1141. case 12:
  1142. return $this->getPicture();
  1143. break;
  1144. case 13:
  1145. return $this->getDeliveryDelay();
  1146. break;
  1147. case 14:
  1148. return $this->getIsArchived();
  1149. break;
  1150. case 15:
  1151. return $this->getAccountingCodePurchase();
  1152. break;
  1153. case 16:
  1154. return $this->getAccountingCodeSell();
  1155. break;
  1156. case 17:
  1157. return $this->getCreatedAt();
  1158. break;
  1159. case 18:
  1160. return $this->getUpdatedAt();
  1161. break;
  1162. default:
  1163. return null;
  1164. break;
  1165. } // switch()
  1166. }
  1167. /**
  1168. * Exports the object as an array.
  1169. *
  1170. * You can specify the key type of the array by passing one of the class
  1171. * type constants.
  1172. *
  1173. * @param string $keyType One of the class type constants TYPE_PHPNAME,
  1174. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  1175. * @return an associative array containing the field names (as keys) and field values
  1176. */
  1177. public function toArray($keyType = BasePeer::TYPE_PHPNAME)
  1178. {
  1179. $keys = KataoProductPeer::getFieldNames($keyType);
  1180. $result = array(
  1181. $keys[0] => $this->getId(),
  1182. $keys[1] => $this->getReference(),
  1183. $keys[2] => $this->getName(),
  1184. $keys[3] => $this->getUrlIdentifier(),
  1185. $keys[4] => $this->getDescription(),
  1186. $keys[5] => $this->getKataoProductFamilyId(),
  1187. $keys[6] => $this->getKataoSupplierId(),
  1188. $keys[7] => $this->getMaxSolAmount(),
  1189. $keys[8] => $this->getUnitPriceEuro(),
  1190. $keys[9] => $this->getMargin(),
  1191. $keys[10] => $this->getTvaRate(),
  1192. $keys[11] => $this->getMinOrderNumber(),
  1193. $keys[12] => $this->getPicture(),
  1194. $keys[13] => $this->getDeliveryDelay(),
  1195. $keys[14] => $this->getIsArchived(),
  1196. $keys[15] => $this->getAccountingCodePurchase(),
  1197. $keys[16] => $this->getAccountingCodeSell(),
  1198. $keys[17] => $this->getCreatedAt(),
  1199. $keys[18] => $this->getUpdatedAt(),
  1200. );
  1201. return $result;
  1202. }
  1203. /**
  1204. * Sets a field from the object by name passed in as a string.
  1205. *
  1206. * @param string $name peer name
  1207. * @param mixed $value field value
  1208. * @param string $type The type of fieldname the $name is of:
  1209. * one of the class type constants TYPE_PHPNAME,
  1210. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  1211. * @return void
  1212. */
  1213. public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
  1214. {
  1215. $pos = KataoProductPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  1216. return $this->setByPosition($pos, $value);
  1217. }
  1218. /**
  1219. * Sets a field from the object by Position as specified in the xml schema.
  1220. * Zero-based.
  1221. *
  1222. * @param int $pos position in xml schema
  1223. * @param mixed $value field value
  1224. * @return void
  1225. */
  1226. public function setByPosition($pos, $value)
  1227. {
  1228. switch($pos) {
  1229. case 0:
  1230. $this->setId($value);
  1231. break;
  1232. case 1:
  1233. $this->setReference($value);
  1234. break;
  1235. case 2:
  1236. $this->setName($value);
  1237. break;
  1238. case 3:
  1239. $this->setUrlIdentifier($value);
  1240. break;
  1241. case 4:
  1242. $this->setDescription($value);
  1243. break;
  1244. case 5:
  1245. $this->setKataoProductFamilyId($value);
  1246. break;
  1247. case 6:
  1248. $this->setKataoSupplierId($value);
  1249. break;
  1250. case 7:
  1251. $this->setMaxSolAmount($value);
  1252. break;
  1253. case 8:
  1254. $this->setUnitPriceEuro($value);
  1255. break;
  1256. case 9:
  1257. $this->setMargin($value);
  1258. break;
  1259. case 10:
  1260. $this->setTvaRate($value);
  1261. break;
  1262. case 11:
  1263. $this->setMinOrderNumber($value);
  1264. break;
  1265. case 12:
  1266. $this->setPicture($value);
  1267. break;
  1268. case 13:
  1269. $this->setDeliveryDelay($value);
  1270. break;
  1271. case 14:
  1272. $this->setIsArchived($value);
  1273. break;
  1274. case 15:
  1275. $this->setAccountingCodePurchase($value);
  1276. break;
  1277. case 16:
  1278. $this->setAccountingCodeSell($value);
  1279. break;
  1280. case 17:
  1281. $this->setCreatedAt($value);
  1282. break;
  1283. case 18:
  1284. $this->setUpdatedAt($value);
  1285. break;
  1286. } // switch()
  1287. }
  1288. /**
  1289. * Populates the object using an array.
  1290. *
  1291. * This is particularly useful when populating an object from one of the
  1292. * request arrays (e.g. $_POST). This method goes through the column
  1293. * names, checking to see whether a matching key exists in populated
  1294. * array. If so the setByName() method is called for that column.
  1295. *
  1296. * You can specify the key type of the array by additionally passing one
  1297. * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
  1298. * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
  1299. *
  1300. * @param array $arr An array to populate the object from.
  1301. * @param string $keyType The type of keys the array uses.
  1302. * @return void
  1303. */
  1304. public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
  1305. {
  1306. $keys = KataoProductPeer::getFieldNames($keyType);
  1307. if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
  1308. if (array_key_exists($keys[1], $arr)) $this->setReference($arr[$keys[1]]);
  1309. if (array_key_exists($keys[2], $arr)) $this->setName($arr[$keys[2]]);
  1310. if (array_key_exists($keys[3], $arr)) $this->setUrlIdentifier($arr[$keys[3]]);
  1311. if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]);
  1312. if (array_key_exists($keys[5], $arr)) $this->setKataoProductFamilyId($arr[$keys[5]]);
  1313. if (array_key_exists($keys[6], $arr)) $this->setKataoSupplierId($arr[$keys[6]]);
  1314. if (array_key_exists($keys[7], $arr)) $this->setMaxSolAmount($arr[$keys[7]]);
  1315. if (array_key_exists($keys[8], $arr)) $this->setUnitPriceEuro($arr[$keys[8]]);
  1316. if (array_key_exists($keys[9], $arr)) $this->setMargin($arr[$keys[9]]);
  1317. if (array_key_exists($keys[10], $arr)) $this->setTvaRate($arr[$keys[10]]);
  1318. if (array_key_exists($keys[11], $arr)) $this->setMinOrderNumber($arr[$keys[11]]);
  1319. if (array_key_exists($keys[12], $arr)) $this->setPicture($arr[$keys[12]]);
  1320. if (array_key_exists($keys[13], $arr)) $this->setDeliveryDelay($arr[$keys[13]]);
  1321. if (array_key_exists($keys[14], $arr)) $this->setIsArchived($arr[$keys[14]]);
  1322. if (array_key_exists($keys[15], $arr)) $this->setAccountingCodePurchase($arr[$keys[15]]);
  1323. if (array_key_exists($keys[16], $arr)) $this->setAccountingCodeSell($arr[$keys[16]]);
  1324. if (array_key_exists($keys[17], $arr)) $this->setCreatedAt($arr[$keys[17]]);
  1325. if (array_key_exists($keys[18], $arr)) $this->setUpdatedAt($arr[$keys[18]]);
  1326. }
  1327. /**
  1328. * Build a Criteria object containing the values of all modified columns in this object.
  1329. *
  1330. * @return Criteria The Criteria object containing all modified values.
  1331. */
  1332. public function buildCriteria()
  1333. {
  1334. $criteria = new Criteria(KataoProductPeer::DATABASE_NAME);
  1335. if ($this->isColumnModified(KataoProductPeer::ID)) $criteria->add(KataoProductPeer::ID, $this->id);
  1336. if ($this->isColumnModified(KataoProductPeer::REFERENCE)) $criteria->add(KataoProductPeer::REFERENCE, $this->reference);
  1337. if ($this->isColumnModified(KataoProductPeer::NAME)) $criteria->add(KataoProductPeer::NAME, $this->name);
  1338. if ($this->isColumnModified(KataoProductPeer::URL_IDENTIFIER)) $criteria->add(KataoProductPeer::URL_IDENTIFIER, $this->url_identifier);
  1339. if ($this->isColumnModified(KataoProductPeer::DESCRIPTION)) $criteria->add(KataoProductPeer::DESCRIPTION, $this->description);
  1340. if ($this->isColumnModified(KataoProductPeer::KATAO_PRODUCT_FAMILY_ID)) $criteria->add(KataoProductPeer::KATAO_PRODUCT_FAMILY_ID, $this->katao_product_family_id);
  1341. if ($this->isColumnModified(KataoProductPeer::KATAO_SUPPLIER_ID)) $criteria->add(KataoProductPeer::KATAO_SUPPLIER_ID, $this->katao_supplier_id);
  1342. if ($this->isColumnModified(KataoProductPeer::MAX_SOL_AMOUNT)) $criteria->add(KataoProductPeer::MAX_SOL_AMOUNT, $this->max_sol_amount);
  1343. if ($this->isColumnModified(KataoProductPeer::UNIT_PRICE_EURO)) $criteria->add(KataoProductPeer::UNIT_PRICE_EURO, $this->unit_price_euro);
  1344. if ($this->isColumnModified(KataoProductPeer::MARGIN)) $criteria->add(KataoProductPeer::MARGIN, $this->margin);
  1345. if ($this->isColumnModified(KataoProductPeer::TVA_RATE)) $criteria->add(KataoProductPeer::TVA_RATE, $this->tva_rate);
  1346. if ($this->isColumnModified(KataoProductPeer::MIN_ORDER_NUMBER)) $criteria->add(KataoProductPeer::MIN_ORDER_NUMBER, $this->min_order_number);
  1347. if ($this->isColumnModified(KataoProductPeer::PICTURE)) $criteria->add(KataoProductPeer::PICTURE, $this->picture);
  1348. if ($this->isColumnModified(KataoProductPeer::DELIVERY_DELAY)) $criteria->add(KataoProductPeer::DELIVERY_DELAY, $this->delivery_delay);
  1349. if ($this->isColumnModified(KataoProductPeer::IS_ARCHIVED)) $criteria->add(KataoProductPeer::IS_ARCHIVED, $this->is_archived);
  1350. if ($this->isColumnModified(KataoProductPeer::ACCOUNTING_CODE_PURCHASE)) $criteria->add(KataoProductPeer::ACCOUNTING_CODE_PURCHASE, $this->accounting_code_purchase);
  1351. if ($this->isColumnModified(KataoProductPeer::ACCOUNTING_CODE_SELL)) $criteria->add(KataoProductPeer::ACCOUNTING_CODE_SELL, $this->accounting_code_sell);
  1352. if ($this->isColumnModified(KataoProductPeer::CREATED_AT)) $criteria->add(KataoProductPeer::CREATED_AT, $this->created_at);
  1353. if ($this->isColumnModified(KataoProductPeer::UPDATED_AT)) $criteria->add(KataoProductPeer::UPDATED_AT, $this->updated_at);
  1354. return $criteria;
  1355. }
  1356. /**
  1357. * Builds a Criteria object containing the primary key for this object.
  1358. *
  1359. * Unlike buildCriteria() this method includes the primary key values regardless
  1360. * of whether or not they have been modified.
  1361. *
  1362. * @return Criteria The Criteria object containing value(s) for primary key(s).
  1363. */
  1364. public function buildPkeyCriteria()
  1365. {
  1366. $criteria = new Criteria(KataoProductPeer::DATABASE_NAME);
  1367. $criteria->add(KataoProductPeer::ID, $this->id);
  1368. return $criteria;
  1369. }
  1370. /**
  1371. * Returns the primary key for this object (row).
  1372. * @return int
  1373. */
  1374. public function getPrimaryKey()
  1375. {
  1376. return $this->getId();
  1377. }
  1378. /**
  1379. * Generic method to set the primary key (id column).
  1380. *
  1381. * @param int $key Primary key.
  1382. * @return void
  1383. */
  1384. public function setPrimaryKey($key)
  1385. {
  1386. $this->setId($key);
  1387. }
  1388. /**
  1389. * Sets contents of passed object to values from current object.
  1390. *
  1391. * If desired, this method can also make copies of all associated (fkey referrers)
  1392. * objects.
  1393. *
  1394. * @param object $copyObj An object of KataoProduct (or compatible) type.
  1395. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  1396. * @throws PropelException
  1397. */
  1398. public function copyInto($copyObj, $deepCopy = false)
  1399. {
  1400. $copyObj->setReference($this->reference);
  1401. $copyObj->setName($this->name);
  1402. $copyObj->setUrlIdentifier($this->url_identifier);
  1403. $copyObj->setDescription($this->description);
  1404. $copyObj->setKataoProductFamilyId($this->katao_product_family_id);
  1405. $copyObj->setKataoSupplierId($this->katao_supplier_id);
  1406. $copyObj->setMaxSolAmount($this->max_sol_amount);
  1407. $copyObj->setUnitPriceEuro($this->unit_price_euro);
  1408. $copyObj->setMargin($this->margin);
  1409. $copyObj->setTvaRate($this->tva_rate);
  1410. $copyObj->setMinOrderNumber($this->min_order_number);
  1411. $copyObj->setPicture($this->picture);
  1412. $copyObj->setDeliveryDelay($this->delivery_delay);
  1413. $copyObj->setIsArchived($this->is_archived);
  1414. $copyObj->setAccountingCodePurchase($this->accounting_code_purchase);
  1415. $copyObj->setAccountingCodeSell($this->accounting_code_sell);
  1416. $copyObj->setCreatedAt($this->created_at);
  1417. $copyObj->setUpdatedAt($this->updated_at);
  1418. if ($deepCopy) {
  1419. // important: temporarily setNew(false) because this affects the behavior of
  1420. // the getter/setter methods for fkey referrer objects.
  1421. $copyObj->setNew(false);
  1422. foreach($this->getKataoNodeProducts() as $relObj) {
  1423. $copyObj->addKataoNodeProduct($relObj->copy($deepCopy));
  1424. }
  1425. foreach($this->getKataoPeriodProducts() as $relObj) {
  1426. $copyObj->addKataoPeriodProduct($relObj->copy($deepCopy));
  1427. }
  1428. foreach($this->getKataoCartProducts() as $relObj) {
  1429. $copyObj->addKataoCartProduct($relObj->copy($deepCopy));
  1430. }
  1431. foreach($this->getKataoOrderProducts() as $relObj) {
  1432. $copyObj->addKataoOrderProduct($relObj->copy($deepCopy));
  1433. }
  1434. foreach($this->getKataoInvoiceProducts() as $relObj) {
  1435. $copyObj->addKataoInvoiceProduct($relObj->copy($deepCopy));
  1436. }
  1437. foreach($this->getKataoSupplierInvoiceProducts() as $relObj) {
  1438. $copyObj->addKataoSupplierInvoiceProduct($relObj->copy($deepCopy));
  1439. }
  1440. } // if ($deepCopy)
  1441. $copyObj->setNew(true);
  1442. $copyObj->setId(NULL); // this is a pkey column, so set to default value
  1443. }
  1444. /**
  1445. * Makes a copy of this object that will be inserted as a new row in table when saved.
  1446. * It creates a new object filling in the simple attributes, but skipping any primary
  1447. * keys that are defined for the table.
  1448. *
  1449. * If desired, this method can also make copies of all associated (fkey referrers)
  1450. * objects.
  1451. *
  1452. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  1453. * @return KataoProduct Clone of current object.
  1454. * @throws PropelException
  1455. */
  1456. public function copy($deepCopy = false)
  1457. {
  1458. // we use get_class(), because this might be a subclass
  1459. $clazz = get_class($this);
  1460. $copyObj = new $clazz();
  1461. $this->copyInto($copyObj, $deepCopy);
  1462. return $copyObj;
  1463. }
  1464. /**
  1465. * Returns a peer instance associated with this om.
  1466. *
  1467. * Since Peer classes are not to have any instance attributes, this method returns the
  1468. * same instance for all member of this class. The method could therefore
  1469. * be static, but this would prevent one from overriding the behavior.
  1470. *
  1471. * @return KataoProductPeer
  1472. */
  1473. public function getPeer()
  1474. {
  1475. if (self::$peer === null) {
  1476. self::$peer = new KataoProductPeer();
  1477. }
  1478. return self::$peer;
  1479. }
  1480. /**
  1481. * Declares an association between this object and a KataoProductFamily object.
  1482. *
  1483. * @param KataoProductFamily $v
  1484. * @return void
  1485. * @throws PropelException
  1486. */
  1487. public function setKataoProductFamily($v)
  1488. {
  1489. if ($v === null) {
  1490. $this->setKataoProductFamilyId(NULL);
  1491. } else {
  1492. $this->setKataoProductFamilyId($v->getId());
  1493. }
  1494. $this->aKataoProductFamily = $v;
  1495. }
  1496. /**
  1497. * Get the associated KataoProductFamily object
  1498. *
  1499. * @param Connection Optional Connection object.
  1500. * @return KataoProductFamily The associated KataoProductFamily object.
  1501. * @throws PropelException
  1502. */
  1503. public function getKataoProductFamily($con = null)
  1504. {
  1505. if ($this->aKataoProductFamily === null && ($this->katao_product_family_id !== null)) {
  1506. // include the related Peer class
  1507. $this->aKataoProductFamily = KataoProductFamilyPeer::retrieveByPK($this->katao_product_family_id, $con);
  1508. /* The following can be used instead of the line above to
  1509. guarantee the related object contains a reference
  1510. to this object, but this level of coupling
  1511. may be undesirable in many circumstances.
  1512. As it can lead to a db query with many results that may
  1513. never be used.
  1514. $obj = KataoProductFamilyPeer::retrieveByPK($this->katao_product_family_id, $con);
  1515. $obj->addKataoProductFamilys($this);
  1516. */
  1517. }
  1518. return $this->aKataoProductFamily;
  1519. }
  1520. /**
  1521. * Declares an association between this object and a KataoSupplier object.
  1522. *
  1523. * @param KataoSupplier $v
  1524. * @return void
  1525. * @throws PropelException
  1526. */
  1527. public function setKataoSupplier($v)
  1528. {
  1529. if ($v === null) {
  1530. $this->setKataoSupplierId(NULL);
  1531. } else {
  1532. $this->setKataoSupplierId($v->getId());
  1533. }
  1534. $this->aKataoSupplier = $v;
  1535. }
  1536. /**
  1537. * Get the associated KataoSupplier object
  1538. *
  1539. * @param Connection Optional Connection object.
  1540. * @return KataoSupplier The associated KataoSupplier object.
  1541. * @throws PropelException
  1542. */
  1543. public function getKataoSupplier($con = null)
  1544. {
  1545. if ($this->aKataoSupplier === null && ($this->katao_supplier_id !== null)) {
  1546. // include the related Peer class
  1547. $this->aKataoSupplier = KataoSupplierPeer::retrieveByPK($this->katao_supplier_id, $con);
  1548. /* The following can be used instead of the line above to
  1549. guarantee the related object contains a reference
  1550. to this object, but this level of coupling
  1551. may be undesirable in many circumstances.
  1552. As it can lead to a db query with many results that may
  1553. never be used.
  1554. $obj = KataoSupplierPeer::retrieveByPK($this->katao_supplier_id, $con);
  1555. $obj->addKataoSuppliers($this);
  1556. */
  1557. }
  1558. return $this->aKataoSupplier;
  1559. }
  1560. /**
  1561. * Temporary storage of collKataoNodeProducts to save a possible db hit in
  1562. * the event objects are add to the collection, but the
  1563. * complete collection is never requested.
  1564. * @return void
  1565. */
  1566. public function initKataoNodeProducts()
  1567. {
  1568. if ($this->collKataoNodeProducts === null) {
  1569. $this->collKataoNodeProducts = array();
  1570. }
  1571. }
  1572. /**
  1573. * If this collection has already been initialized with
  1574. * an identical criteria, it returns the collection.
  1575. * Otherwise if this KataoProduct has previously
  1576. * been saved, it will retrieve related KataoNodeProducts from storage.
  1577. * If this KataoProduct is new, it will return
  1578. * an empty collection or the current collection, the criteria
  1579. * is ignored on a new object.
  1580. *
  1581. * @param Connection $con
  1582. * @param Criteria $criteria
  1583. * @throws PropelException
  1584. */
  1585. public function getKataoNodeProducts($criteria = null, $con = null)
  1586. {
  1587. // include the Peer class
  1588. if ($criteria === null) {
  1589. $criteria = new Criteria();
  1590. }
  1591. elseif ($criteria instanceof Criteria)
  1592. {
  1593. $criteria = clone $criteria;
  1594. }
  1595. if ($this->collKataoNodeProducts === null) {
  1596. if ($this->isNew()) {
  1597. $this->collKataoNodeProducts = array();
  1598. } else {
  1599. $criteria->add(KataoNodeProductPeer::KATAO_PRODUCT_ID, $this->getId());
  1600. KataoNodeProductPeer::addSelectColumns($criteria);
  1601. $this->collKataoNodeProducts = KataoNodeProductPeer::doSelect($criteria, $con);
  1602. }
  1603. } else {
  1604. // criteria has no effect for a new object
  1605. if (!$this->isNew()) {
  1606. // the following code is to determine if a new query is
  1607. // called for. If the criteria is the same as the last
  1608. // one, just return the collection.
  1609. $criteria->add(KataoNodeProductPeer::KATAO_PRODUCT_ID, $this->getId());
  1610. KataoNodeProductPeer::addSelectColumns($criteria);
  1611. if (!isset($this->lastKataoNodeProductCriteria) || !$this->lastKataoNodeProductCriteria->equals($criteria)) {
  1612. $this->collKataoNodeProducts = KataoNodeProductPeer::doSelect($criteria, $con);
  1613. }
  1614. }
  1615. }
  1616. $this->lastKataoNodeProductCriteria = $criteria;
  1617. return $this->collKataoNodeProducts;
  1618. }
  1619. /**
  1620. * Returns the number of related KataoNodeProducts.
  1621. *
  1622. * @param Criteria $criteria
  1623. * @param boolean $distinct
  1624. * @param Connection $con
  1625. * @throws PropelException
  1626. */
  1627. public function countKataoNodeProducts($criteria = null, $distinct = false, $con = null)
  1628. {
  1629. // include the Peer class
  1630. if ($criteria === null) {
  1631. $criteria = new Criteria();
  1632. }
  1633. elseif ($criteria instanceof Criteria)
  1634. {
  1635. $criteria = clone $criteria;
  1636. }
  1637. $criteria->add(KataoNodeProductPeer::KATAO_PRODUCT_ID, $this->getId());
  1638. return KataoNodeProductPeer::doCount($criteria, $distinct, $con);
  1639. }
  1640. /**
  1641. * Method called to associate a KataoNodeProduct object to this object
  1642. * through the KataoNodeProduct foreign key attribute
  1643. *
  1644. * @param KataoNodeProduct $l KataoNodeProduct
  1645. * @return void
  1646. * @throws PropelException
  1647. */
  1648. public function addKataoNodeProduct(KataoNodeProduct $l)
  1649. {
  1650. $this->collKataoNodeProducts[] = $l;
  1651. $l->setKataoProduct($this);
  1652. }
  1653. /**
  1654. * If this collection has already been initialized with
  1655. * an identical criteria, it returns the collection.
  1656. * Otherwise if this KataoProduct is new, it will return
  1657. * an empty collection; or if this KataoProduct has previously
  1658. * been saved, it will retrieve related KataoNodeProducts from storage.
  1659. *
  1660. * This method is protected by default in order to keep the public
  1661. * api reasonable. You can provide public methods for those you
  1662. * actually need in KataoProduct.
  1663. */
  1664. public function getKataoNodeProductsJoinKataoNode($criteria = null, $con = null)
  1665. {
  1666. // include the Peer class
  1667. if ($criteria === null) {
  1668. $criteria = new Criteria();
  1669. }
  1670. elseif ($criteria instanceof Criteria)
  1671. {
  1672. $criteria = clone $criteria;
  1673. }
  1674. if ($this->collKataoNodeProducts === null) {
  1675. if ($this->isNew()) {
  1676. $this->collKataoNodeProducts = array();
  1677. } else {
  1678. $criteria->add(KataoNodeProductPeer::KATAO_PRODUCT_ID, $this->getId());
  1679. $this->collKataoNodeProducts = KataoNodeProductPeer::doSelectJoinKataoNode($criteria, $con);
  1680. }
  1681. } else {
  1682. // the following code is to determine if a new query is
  1683. // called for. If the criteria is the same as the last
  1684. // one, just return the collection.
  1685. $criteria->add(KataoNodeProductPeer::KATAO_PRODUCT_ID, $this->getId());
  1686. if (!isset($this->lastKataoNodeProductCriteria) || !$this->lastKataoNodeProductCriteria->equals($criteria)) {
  1687. $this->collKataoNodeProducts = KataoNodeProductPeer::doSelectJoinKataoNode($criteria, $con);
  1688. }
  1689. }
  1690. $this->lastKataoNodeProductCriteria = $criteria;
  1691. return $this->collKataoNodeProducts;
  1692. }
  1693. /**
  1694. * If this collection has already been initialized with
  1695. * an identical criteria, it returns the collection.
  1696. * Otherwise if this KataoProduct is new, it will return
  1697. * an empty collection; or if this KataoProduct has previously
  1698. * been saved, it will retrieve related KataoNodeProducts from storage.
  1699. *
  1700. * This method is protected by default in order to keep the public
  1701. * api reasonable. You can provide public methods for those you
  1702. * actually need in KataoProduct.
  1703. */
  1704. public function getKataoNodeProductsJoinKataoPeriod($criteria = null, $con = null)
  1705. {
  1706. // include the Peer class
  1707. if ($criteria === null) {
  1708. $criteria = new Criteria();
  1709. }
  1710. elseif ($criteria instanceof Criteria)
  1711. {
  1712. $criteria = clone $criteria;
  1713. }
  1714. if ($this->collKataoNodeProducts === null) {
  1715. if ($this->isNew()) {
  1716. $this->collKataoNodeProducts = array();
  1717. } else {
  1718. $criteria->add(KataoNodeProductPeer::KATAO_PRODUCT_ID, $this->getId());
  1719. $this->collKataoNodeProducts = KataoNodeProductPeer::doSelectJoinKataoPeriod($criteria, $con);
  1720. }
  1721. } else {
  1722. // the following code is to determine if a new query is
  1723. // called for. If the criteria is the same as the last
  1724. // one, just return the collection.
  1725. $criteria->add(KataoNodeProductPeer::KATAO_PRODUCT_ID, $this->getId());
  1726. if (!isset($this->lastKataoNodeProductCriteria) || !$this->lastKataoNodeProductCriteria->equals($criteria)) {
  1727. $this->collKataoNodeProducts = KataoNodeProductPeer::doSelectJoinKataoPeriod($criteria, $con);
  1728. }
  1729. }
  1730. $this->lastKataoNodeProductCriteria = $criteria;
  1731. return $this->collKataoNodeProducts;
  1732. }
  1733. /**
  1734. * Temporary storage of collKataoPeriodProducts to save a possible db hit in
  1735. * the event objects are add to the collection, but the
  1736. * complete collection is never requested.
  1737. * @return void
  1738. */
  1739. public function initKataoPeriodProducts()
  1740. {
  1741. if ($this->collKataoPeriodProducts === null) {
  1742. $this->collKataoPeriodProducts = array();
  1743. }
  1744. }
  1745. /**
  1746. * If this collection has already been initialized with
  1747. * an identical criteria, it returns the collection.
  1748. * Otherwise if this KataoProduct has previously
  1749. * been saved, it will retrieve related KataoPeriodProducts from storage.
  1750. * If this KataoProduct is new, it will return
  1751. * an empty collection or the current collection, the criteria
  1752. * is ignored on a new object.
  1753. *
  1754. * @param Connection $con
  1755. * @param Criteria $criteria
  1756. * @throws PropelException
  1757. */
  1758. public function getKataoPeriodProducts($criteria = null, $con = null)
  1759. {
  1760. // include the Peer class
  1761. if ($criteria === null) {
  1762. $criteria = new Criteria();
  1763. }
  1764. elseif ($criteria instanceof Criteria)
  1765. {
  1766. $criteria = clone $criteria;
  1767. }
  1768. if ($this->collKataoPeriodProducts === null) {
  1769. if ($this->isNew()) {
  1770. $this->collKataoPeriodProducts = array();
  1771. } else {
  1772. $criteria->add(KataoPeriodProductPeer::KATAO_PRODUCT_ID, $this->getId());
  1773. KataoPeriodProductPeer::addSelectColumns($criteria);
  1774. $this->collKataoPeriodProducts = KataoPeriodProductPeer::doSelect($criteria, $con);
  1775. }
  1776. } else {
  1777. // criteria has no effect for a new object
  1778. if (!$this->isNew()) {
  1779. // the following code is to determine if a new query is
  1780. // called for. If the criteria is the same as the last
  1781. // one, just return the collection.
  1782. $criteria->add(KataoPeriodProductPeer::KATAO_PRODUCT_ID, $this->getId());
  1783. KataoPeriodProductPeer::addSelectColumns($criteria);
  1784. if (!isset($this->lastKataoPeriodProductCriteria) || !$this->lastKataoPeriodProductCriteria->equals($criteria)) {
  1785. $this->collKataoPeriodProducts = KataoPeriodProductPeer::doSelect($criteria, $con);
  1786. }
  1787. }
  1788. }
  1789. $this->lastKataoPeriodProductCriteria = $criteria;
  1790. return $this->collKataoPeriodProducts;
  1791. }
  1792. /**
  1793. * Returns the number of related KataoPeriodProducts.
  1794. *
  1795. * @param Criteria $criteria
  1796. * @param boolean $distinct
  1797. * @param Connection $con
  1798. * @throws PropelException
  1799. */
  1800. public function countKataoPeriodProducts($criteria = null, $distinct = false, $con = null)
  1801. {
  1802. // include the Peer class
  1803. if ($criteria === null) {
  1804. $criteria = new Criteria();
  1805. }
  1806. elseif ($criteria instanceof Criteria)
  1807. {
  1808. $criteria = clone $criteria;
  1809. }
  1810. $criteria->add(KataoPeriodProductPeer::KATAO_PRODUCT_ID, $this->getId());
  1811. return KataoPeriodProductPeer::doCount($criteria, $distinct, $con);
  1812. }
  1813. /**
  1814. * Method called to associate a KataoPeriodProduct object to this object
  1815. * through the KataoPeriodProduct foreign key attribute
  1816. *
  1817. * @param KataoPeriodProduct $l KataoPeriodProduct
  1818. * @return void
  1819. * @throws PropelException
  1820. */
  1821. public function addKataoPeriodProduct(KataoPeriodProduct $l)
  1822. {
  1823. $this->collKataoPeriodProducts[] = $l;
  1824. $l->setKataoProduct($this);
  1825. }
  1826. /**
  1827. * If this collection has already been initialized with
  1828. * an identical criteria, it returns the collection.
  1829. * Otherwise if this KataoProduct is new, it will return
  1830. * an empty collection; or if this KataoProduct has previously
  1831. * been saved, it will retrieve related KataoPeriodProducts from storage.
  1832. *
  1833. * This method is protected by default in order to keep the public
  1834. * api reasonable. You can provide public methods for those you
  1835. * actually need in KataoProduct.
  1836. */
  1837. public function getKataoPeriodProductsJoinKataoPeriod($criteria = null, $con = null)
  1838. {
  1839. // include the Peer class
  1840. if ($criteria === null) {
  1841. $criteria = new Criteria();
  1842. }
  1843. elseif ($criteria instanceof Criteria)
  1844. {
  1845. $criteria = clone $criteria;
  1846. }
  1847. if ($this->collKataoPeriodProducts === null) {
  1848. if ($this->isNew()) {
  1849. $this->collKataoPeriodProducts = array();
  1850. } else {
  1851. $criteria->add(KataoPeriodProductPeer::KATAO_PRODUCT_ID, $this->getId());
  1852. $this->collKataoPeriodProducts = KataoPeriodProductPeer::doSelectJoinKataoPeriod($criteria, $con);
  1853. }
  1854. } else {
  1855. // the following code is to determine if a new query is
  1856. // called for. If the criteria is the same as the last
  1857. // one, just return the collection.
  1858. $criteria->add(KataoPeriodProductPeer::KATAO_PRODUCT_ID, $this->getId());
  1859. if (!isset($this->lastKataoPeriodProductCriteria) || !$this->lastKataoPeriodProductCriteria->equals($criteria)) {
  1860. $this->collKataoPeriodProducts = KataoPeriodProductPeer::doSelectJoinKataoPeriod($criteria, $con);
  1861. }
  1862. }
  1863. $this->lastKataoPeriodProductCriteria = $criteria;
  1864. return $this->collKataoPeriodProducts;
  1865. }
  1866. /**
  1867. * Temporary storage of collKataoCartProducts to save a possible db hit in
  1868. * the event objects are add to the collection, but the
  1869. * complete collection is never requested.
  1870. * @return void
  1871. */
  1872. public function initKataoCartProducts()
  1873. {
  1874. if ($this->collKataoCartProducts === null) {
  1875. $this->collKataoCartProducts = array();
  1876. }
  1877. }
  1878. /**
  1879. * If this collection has already been initialized with
  1880. * an identical criteria, it returns the collection.
  1881. * Otherwise if this KataoProduct has previously
  1882. * been saved, it will retrieve related KataoCartProducts from storage.
  1883. * If this KataoProduct is new, it will return
  1884. * an empty collection or the current collection, the criteria
  1885. * is ignored on a new object.
  1886. *
  1887. * @param Connection $con
  1888. * @param Criteria $criteria
  1889. * @throws PropelException
  1890. */
  1891. public function getKataoCartProducts($criteria = null, $con = null)
  1892. {
  1893. // include the Peer class
  1894. if ($criteria === null) {
  1895. $criteria = new Criteria();
  1896. }
  1897. elseif ($criteria instanceof Criteria)
  1898. {
  1899. $criteria = clone $criteria;
  1900. }
  1901. if ($this->collKataoCartProducts === null) {
  1902. if ($this->isNew()) {
  1903. $this->collKataoCartProducts = array();
  1904. } else {
  1905. $criteria->add(KataoCartProductPeer::KATAO_PRODUCT_ID, $this->getId());
  1906. KataoCartProductPeer::addSelectColumns($criteria);
  1907. $this->collKataoCartProducts = KataoCartProductPeer::doSelect($criteria, $con);
  1908. }
  1909. } else {
  1910. // criteria has no effect for a new object
  1911. if (!$this->isNew()) {
  1912. // the following code is to determine if a new query is
  1913. // called for. If the criteria is the same as the last
  1914. // one, just return the collection.
  1915. $criteria->add(KataoCartProductPeer::KATAO_PRODUCT_ID, $this->getId());
  1916. KataoCartProductPeer::addSelectColumns($criteria);
  1917. if (!isset($this->lastKataoCartProductCriteria) || !$this->lastKataoCartProductCriteria->equals($criteria)) {
  1918. $this->collKataoCartProducts = KataoCartProductPeer::doSelect($criteria, $con);
  1919. }
  1920. }
  1921. }
  1922. $this->lastKataoCartProductCriteria = $criteria;
  1923. return $this->collKataoCartProducts;
  1924. }
  1925. /**
  1926. * Returns the number of related KataoCartProducts.
  1927. *
  1928. * @param Criteria $criteria
  1929. * @param boolean $distinct
  1930. * @param Connection $con
  1931. * @throws PropelException
  1932. */
  1933. public function countKataoCartProducts($criteria = null, $distinct = false, $con = null)
  1934. {
  1935. // include the Peer class
  1936. if ($criteria === null) {
  1937. $criteria = new Criteria();
  1938. }
  1939. elseif ($criteria instanceof Criteria)
  1940. {
  1941. $criteria = clone $criteria;
  1942. }
  1943. $criteria->add(KataoCartProductPeer::KATAO_PRODUCT_ID, $this->getId());
  1944. return KataoCartProductPeer::doCount($criteria, $distinct, $con);
  1945. }
  1946. /**
  1947. * Method called to associate a KataoCartProduct object to this object
  1948. * through the KataoCartProduct foreign key attribute
  1949. *
  1950. * @param KataoCartProduct $l KataoCartProduct
  1951. * @return void
  1952. * @throws PropelException
  1953. */
  1954. public function addKataoCartProduct(KataoCartProduct $l)
  1955. {
  1956. $this->collKataoCartProducts[] = $l;
  1957. $l->setKataoProduct($this);
  1958. }
  1959. /**
  1960. * If this collection has already been initialized with
  1961. * an identical criteria, it returns the collection.
  1962. * Otherwise if this KataoProduct is new, it will return
  1963. * an empty collection; or if this KataoProduct has previously
  1964. * been saved, it will retrieve related KataoCartProducts from storage.
  1965. *
  1966. * This method is protected by default in order to keep the public
  1967. * api reasonable. You can provide public methods for those you
  1968. * actually need in KataoProduct.
  1969. */
  1970. public function getKataoCartProductsJoinKataoCart($criteria = null, $con = null)
  1971. {
  1972. // include the Peer class
  1973. if ($criteria === null) {
  1974. $criteria = new Criteria();
  1975. }
  1976. elseif ($criteria instanceof Criteria)
  1977. {
  1978. $criteria = clone $criteria;
  1979. }
  1980. if ($this->collKataoCartProducts === null) {
  1981. if ($this->isNew()) {
  1982. $this->collKataoCartProducts = array();
  1983. } else {
  1984. $criteria->add(KataoCartProductPeer::KATAO_PRODUCT_ID, $this->getId());
  1985. $this->collKataoCartProducts = KataoCartProductPeer::doSelectJoinKataoCart($criteria, $con);
  1986. }
  1987. } else {
  1988. // the following code is to determine if a new query is
  1989. // called for. If the criteria is the same as the last
  1990. // one, just return the collection.
  1991. $criteria->add(KataoCartProductPeer::KATAO_PRODUCT_ID, $this->getId());
  1992. if (!isset($this->lastKataoCartProductCriteria) || !$this->lastKataoCartProductCriteria->equals($criteria)) {
  1993. $this->collKataoCartProducts = KataoCartProductPeer::doSelectJoinKataoCart($criteria, $con);
  1994. }
  1995. }
  1996. $this->lastKataoCartProductCriteria = $criteria;
  1997. return $this->collKataoCartProducts;
  1998. }
  1999. /**
  2000. * If this collection has already been initialized with
  2001. * an identical criteria, it returns the collection.
  2002. * Otherwise if this KataoProduct is new, it will return
  2003. * an empty collection; or if this KataoProduct has previously
  2004. * been saved, it will retrieve related KataoCartProducts from storage.
  2005. *
  2006. * This method is protected by default in order to keep the public
  2007. * api reasonable. You can provide public methods for those you
  2008. * actually need in KataoProduct.
  2009. */
  2010. public function getKataoCartProductsJoinKataoOrderProduct($criteria = null, $con = null)
  2011. {
  2012. // include the Peer class
  2013. if ($criteria === null) {
  2014. $criteria = new Criteria();
  2015. }
  2016. elseif ($criteria instanceof Criteria)
  2017. {
  2018. $criteria = clone $criteria;
  2019. }
  2020. if ($this->collKataoCartProducts === null) {
  2021. if ($this->isNew()) {
  2022. $this->collKataoCartProducts = array();
  2023. } else {
  2024. $criteria->add(KataoCartProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2025. $this->collKataoCartProducts = KataoCartProductPeer::doSelectJoinKataoOrderProduct($criteria, $con);
  2026. }
  2027. } else {
  2028. // the following code is to determine if a new query is
  2029. // called for. If the criteria is the same as the last
  2030. // one, just return the collection.
  2031. $criteria->add(KataoCartProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2032. if (!isset($this->lastKataoCartProductCriteria) || !$this->lastKataoCartProductCriteria->equals($criteria)) {
  2033. $this->collKataoCartProducts = KataoCartProductPeer::doSelectJoinKataoOrderProduct($criteria, $con);
  2034. }
  2035. }
  2036. $this->lastKataoCartProductCriteria = $criteria;
  2037. return $this->collKataoCartProducts;
  2038. }
  2039. /**
  2040. * Temporary storage of collKataoOrderProducts to save a possible db hit in
  2041. * the event objects are add to the collection, but the
  2042. * complete collection is never requested.
  2043. * @return void
  2044. */
  2045. public function initKataoOrderProducts()
  2046. {
  2047. if ($this->collKataoOrderProducts === null) {
  2048. $this->collKataoOrderProducts = array();
  2049. }
  2050. }
  2051. /**
  2052. * If this collection has already been initialized with
  2053. * an identical criteria, it returns the collection.
  2054. * Otherwise if this KataoProduct has previously
  2055. * been saved, it will retrieve related KataoOrderProducts from storage.
  2056. * If this KataoProduct is new, it will return
  2057. * an empty collection or the current collection, the criteria
  2058. * is ignored on a new object.
  2059. *
  2060. * @param Connection $con
  2061. * @param Criteria $criteria
  2062. * @throws PropelException
  2063. */
  2064. public function getKataoOrderProducts($criteria = null, $con = null)
  2065. {
  2066. // include the Peer class
  2067. if ($criteria === null) {
  2068. $criteria = new Criteria();
  2069. }
  2070. elseif ($criteria instanceof Criteria)
  2071. {
  2072. $criteria = clone $criteria;
  2073. }
  2074. if ($this->collKataoOrderProducts === null) {
  2075. if ($this->isNew()) {
  2076. $this->collKataoOrderProducts = array();
  2077. } else {
  2078. $criteria->add(KataoOrderProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2079. KataoOrderProductPeer::addSelectColumns($criteria);
  2080. $this->collKataoOrderProducts = KataoOrderProductPeer::doSelect($criteria, $con);
  2081. }
  2082. } else {
  2083. // criteria has no effect for a new object
  2084. if (!$this->isNew()) {
  2085. // the following code is to determine if a new query is
  2086. // called for. If the criteria is the same as the last
  2087. // one, just return the collection.
  2088. $criteria->add(KataoOrderProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2089. KataoOrderProductPeer::addSelectColumns($criteria);
  2090. if (!isset($this->lastKataoOrderProductCriteria) || !$this->lastKataoOrderProductCriteria->equals($criteria)) {
  2091. $this->collKataoOrderProducts = KataoOrderProductPeer::doSelect($criteria, $con);
  2092. }
  2093. }
  2094. }
  2095. $this->lastKataoOrderProductCriteria = $criteria;
  2096. return $this->collKataoOrderProducts;
  2097. }
  2098. /**
  2099. * Returns the number of related KataoOrderProducts.
  2100. *
  2101. * @param Criteria $criteria
  2102. * @param boolean $distinct
  2103. * @param Connection $con
  2104. * @throws PropelException
  2105. */
  2106. public function countKataoOrderProducts($criteria = null, $distinct = false, $con = null)
  2107. {
  2108. // include the Peer class
  2109. if ($criteria === null) {
  2110. $criteria = new Criteria();
  2111. }
  2112. elseif ($criteria instanceof Criteria)
  2113. {
  2114. $criteria = clone $criteria;
  2115. }
  2116. $criteria->add(KataoOrderProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2117. return KataoOrderProductPeer::doCount($criteria, $distinct, $con);
  2118. }
  2119. /**
  2120. * Method called to associate a KataoOrderProduct object to this object
  2121. * through the KataoOrderProduct foreign key attribute
  2122. *
  2123. * @param KataoOrderProduct $l KataoOrderProduct
  2124. * @return void
  2125. * @throws PropelException
  2126. */
  2127. public function addKataoOrderProduct(KataoOrderProduct $l)
  2128. {
  2129. $this->collKataoOrderProducts[] = $l;
  2130. $l->setKataoProduct($this);
  2131. }
  2132. /**
  2133. * If this collection has already been initialized with
  2134. * an identical criteria, it returns the collection.
  2135. * Otherwise if this KataoProduct is new, it will return
  2136. * an empty collection; or if this KataoProduct has previously
  2137. * been saved, it will retrieve related KataoOrderProducts from storage.
  2138. *
  2139. * This method is protected by default in order to keep the public
  2140. * api reasonable. You can provide public methods for those you
  2141. * actually need in KataoProduct.
  2142. */
  2143. public function getKataoOrderProductsJoinKataoOrder($criteria = null, $con = null)
  2144. {
  2145. // include the Peer class
  2146. if ($criteria === null) {
  2147. $criteria = new Criteria();
  2148. }
  2149. elseif ($criteria instanceof Criteria)
  2150. {
  2151. $criteria = clone $criteria;
  2152. }
  2153. if ($this->collKataoOrderProducts === null) {
  2154. if ($this->isNew()) {
  2155. $this->collKataoOrderProducts = array();
  2156. } else {
  2157. $criteria->add(KataoOrderProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2158. $this->collKataoOrderProducts = KataoOrderProductPeer::doSelectJoinKataoOrder($criteria, $con);
  2159. }
  2160. } else {
  2161. // the following code is to determine if a new query is
  2162. // called for. If the criteria is the same as the last
  2163. // one, just return the collection.
  2164. $criteria->add(KataoOrderProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2165. if (!isset($this->lastKataoOrderProductCriteria) || !$this->lastKataoOrderProductCriteria->equals($criteria)) {
  2166. $this->collKataoOrderProducts = KataoOrderProductPeer::doSelectJoinKataoOrder($criteria, $con);
  2167. }
  2168. }
  2169. $this->lastKataoOrderProductCriteria = $criteria;
  2170. return $this->collKataoOrderProducts;
  2171. }
  2172. /**
  2173. * Temporary storage of collKataoInvoiceProducts to save a possible db hit in
  2174. * the event objects are add to the collection, but the
  2175. * complete collection is never requested.
  2176. * @return void
  2177. */
  2178. public function initKataoInvoiceProducts()
  2179. {
  2180. if ($this->collKataoInvoiceProducts === null) {
  2181. $this->collKataoInvoiceProducts = array();
  2182. }
  2183. }
  2184. /**
  2185. * If this collection has already been initialized with
  2186. * an identical criteria, it returns the collection.
  2187. * Otherwise if this KataoProduct has previously
  2188. * been saved, it will retrieve related KataoInvoiceProducts from storage.
  2189. * If this KataoProduct is new, it will return
  2190. * an empty collection or the current collection, the criteria
  2191. * is ignored on a new object.
  2192. *
  2193. * @param Connection $con
  2194. * @param Criteria $criteria
  2195. * @throws PropelException
  2196. */
  2197. public function getKataoInvoiceProducts($criteria = null, $con = null)
  2198. {
  2199. // include the Peer class
  2200. if ($criteria === null) {
  2201. $criteria = new Criteria();
  2202. }
  2203. elseif ($criteria instanceof Criteria)
  2204. {
  2205. $criteria = clone $criteria;
  2206. }
  2207. if ($this->collKataoInvoiceProducts === null) {
  2208. if ($this->isNew()) {
  2209. $this->collKataoInvoiceProducts = array();
  2210. } else {
  2211. $criteria->add(KataoInvoiceProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2212. KataoInvoiceProductPeer::addSelectColumns($criteria);
  2213. $this->collKataoInvoiceProducts = KataoInvoiceProductPeer::doSelect($criteria, $con);
  2214. }
  2215. } else {
  2216. // criteria has no effect for a new object
  2217. if (!$this->isNew()) {
  2218. // the following code is to determine if a new query is
  2219. // called for. If the criteria is the same as the last
  2220. // one, just return the collection.
  2221. $criteria->add(KataoInvoiceProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2222. KataoInvoiceProductPeer::addSelectColumns($criteria);
  2223. if (!isset($this->lastKataoInvoiceProductCriteria) || !$this->lastKataoInvoiceProductCriteria->equals($criteria)) {
  2224. $this->collKataoInvoiceProducts = KataoInvoiceProductPeer::doSelect($criteria, $con);
  2225. }
  2226. }
  2227. }
  2228. $this->lastKataoInvoiceProductCriteria = $criteria;
  2229. return $this->collKataoInvoiceProducts;
  2230. }
  2231. /**
  2232. * Returns the number of related KataoInvoiceProducts.
  2233. *
  2234. * @param Criteria $criteria
  2235. * @param boolean $distinct
  2236. * @param Connection $con
  2237. * @throws PropelException
  2238. */
  2239. public function countKataoInvoiceProducts($criteria = null, $distinct = false, $con = null)
  2240. {
  2241. // include the Peer class
  2242. if ($criteria === null) {
  2243. $criteria = new Criteria();
  2244. }
  2245. elseif ($criteria instanceof Criteria)
  2246. {
  2247. $criteria = clone $criteria;
  2248. }
  2249. $criteria->add(KataoInvoiceProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2250. return KataoInvoiceProductPeer::doCount($criteria, $distinct, $con);
  2251. }
  2252. /**
  2253. * Method called to associate a KataoInvoiceProduct object to this object
  2254. * through the KataoInvoiceProduct foreign key attribute
  2255. *
  2256. * @param KataoInvoiceProduct $l KataoInvoiceProduct
  2257. * @return void
  2258. * @throws PropelException
  2259. */
  2260. public function addKataoInvoiceProduct(KataoInvoiceProduct $l)
  2261. {
  2262. $this->collKataoInvoiceProducts[] = $l;
  2263. $l->setKataoProduct($this);
  2264. }
  2265. /**
  2266. * If this collection has already been initialized with
  2267. * an identical criteria, it returns the collection.
  2268. * Otherwise if this KataoProduct is new, it will return
  2269. * an empty collection; or if this KataoProduct has previously
  2270. * been saved, it will retrieve related KataoInvoiceProducts from storage.
  2271. *
  2272. * This method is protected by default in order to keep the public
  2273. * api reasonable. You can provide public methods for those you
  2274. * actually need in KataoProduct.
  2275. */
  2276. public function getKataoInvoiceProductsJoinKataoInvoice($criteria = null, $con = null)
  2277. {
  2278. // include the Peer class
  2279. if ($criteria === null) {
  2280. $criteria = new Criteria();
  2281. }
  2282. elseif ($criteria instanceof Criteria)
  2283. {
  2284. $criteria = clone $criteria;
  2285. }
  2286. if ($this->collKataoInvoiceProducts === null) {
  2287. if ($this->isNew()) {
  2288. $this->collKataoInvoiceProducts = array();
  2289. } else {
  2290. $criteria->add(KataoInvoiceProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2291. $this->collKataoInvoiceProducts = KataoInvoiceProductPeer::doSelectJoinKataoInvoice($criteria, $con);
  2292. }
  2293. } else {
  2294. // the following code is to determine if a new query is
  2295. // called for. If the criteria is the same as the last
  2296. // one, just return the collection.
  2297. $criteria->add(KataoInvoiceProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2298. if (!isset($this->lastKataoInvoiceProductCriteria) || !$this->lastKataoInvoiceProductCriteria->equals($criteria)) {
  2299. $this->collKataoInvoiceProducts = KataoInvoiceProductPeer::doSelectJoinKataoInvoice($criteria, $con);
  2300. }
  2301. }
  2302. $this->lastKataoInvoiceProductCriteria = $criteria;
  2303. return $this->collKataoInvoiceProducts;
  2304. }
  2305. /**
  2306. * If this collection has already been initialized with
  2307. * an identical criteria, it returns the collection.
  2308. * Otherwise if this KataoProduct is new, it will return
  2309. * an empty collection; or if this KataoProduct has previously
  2310. * been saved, it will retrieve related KataoInvoiceProducts from storage.
  2311. *
  2312. * This method is protected by default in order to keep the public
  2313. * api reasonable. You can provide public methods for those you
  2314. * actually need in KataoProduct.
  2315. */
  2316. public function getKataoInvoiceProductsJoinKataoCartProduct($criteria = null, $con = null)
  2317. {
  2318. // include the Peer class
  2319. if ($criteria === null) {
  2320. $criteria = new Criteria();
  2321. }
  2322. elseif ($criteria instanceof Criteria)
  2323. {
  2324. $criteria = clone $criteria;
  2325. }
  2326. if ($this->collKataoInvoiceProducts === null) {
  2327. if ($this->isNew()) {
  2328. $this->collKataoInvoiceProducts = array();
  2329. } else {
  2330. $criteria->add(KataoInvoiceProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2331. $this->collKataoInvoiceProducts = KataoInvoiceProductPeer::doSelectJoinKataoCartProduct($criteria, $con);
  2332. }
  2333. } else {
  2334. // the following code is to determine if a new query is
  2335. // called for. If the criteria is the same as the last
  2336. // one, just return the collection.
  2337. $criteria->add(KataoInvoiceProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2338. if (!isset($this->lastKataoInvoiceProductCriteria) || !$this->lastKataoInvoiceProductCriteria->equals($criteria)) {
  2339. $this->collKataoInvoiceProducts = KataoInvoiceProductPeer::doSelectJoinKataoCartProduct($criteria, $con);
  2340. }
  2341. }
  2342. $this->lastKataoInvoiceProductCriteria = $criteria;
  2343. return $this->collKataoInvoiceProducts;
  2344. }
  2345. /**
  2346. * If this collection has already been initialized with
  2347. * an identical criteria, it returns the collection.
  2348. * Otherwise if this KataoProduct is new, it will return
  2349. * an empty collection; or if this KataoProduct has previously
  2350. * been saved, it will retrieve related KataoInvoiceProducts from storage.
  2351. *
  2352. * This method is protected by default in order to keep the public
  2353. * api reasonable. You can provide public methods for those you
  2354. * actually need in KataoProduct.
  2355. */
  2356. public function getKataoInvoiceProductsJoinKataoOrderProduct($criteria = null, $con = null)
  2357. {
  2358. // include the Peer class
  2359. if ($criteria === null) {
  2360. $criteria = new Criteria();
  2361. }
  2362. elseif ($criteria instanceof Criteria)
  2363. {
  2364. $criteria = clone $criteria;
  2365. }
  2366. if ($this->collKataoInvoiceProducts === null) {
  2367. if ($this->isNew()) {
  2368. $this->collKataoInvoiceProducts = array();
  2369. } else {
  2370. $criteria->add(KataoInvoiceProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2371. $this->collKataoInvoiceProducts = KataoInvoiceProductPeer::doSelectJoinKataoOrderProduct($criteria, $con);
  2372. }
  2373. } else {
  2374. // the following code is to determine if a new query is
  2375. // called for. If the criteria is the same as the last
  2376. // one, just return the collection.
  2377. $criteria->add(KataoInvoiceProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2378. if (!isset($this->lastKataoInvoiceProductCriteria) || !$this->lastKataoInvoiceProductCriteria->equals($criteria)) {
  2379. $this->collKataoInvoiceProducts = KataoInvoiceProductPeer::doSelectJoinKataoOrderProduct($criteria, $con);
  2380. }
  2381. }
  2382. $this->lastKataoInvoiceProductCriteria = $criteria;
  2383. return $this->collKataoInvoiceProducts;
  2384. }
  2385. /**
  2386. * Temporary storage of collKataoSupplierInvoiceProducts to save a possible db hit in
  2387. * the event objects are add to the collection, but the
  2388. * complete collection is never requested.
  2389. * @return void
  2390. */
  2391. public function initKataoSupplierInvoiceProducts()
  2392. {
  2393. if ($this->collKataoSupplierInvoiceProducts === null) {
  2394. $this->collKataoSupplierInvoiceProducts = array();
  2395. }
  2396. }
  2397. /**
  2398. * If this collection has already been initialized with
  2399. * an identical criteria, it returns the collection.
  2400. * Otherwise if this KataoProduct has previously
  2401. * been saved, it will retrieve related KataoSupplierInvoiceProducts from storage.
  2402. * If this KataoProduct is new, it will return
  2403. * an empty collection or the current collection, the criteria
  2404. * is ignored on a new object.
  2405. *
  2406. * @param Connection $con
  2407. * @param Criteria $criteria
  2408. * @throws PropelException
  2409. */
  2410. public function getKataoSupplierInvoiceProducts($criteria = null, $con = null)
  2411. {
  2412. // include the Peer class
  2413. if ($criteria === null) {
  2414. $criteria = new Criteria();
  2415. }
  2416. elseif ($criteria instanceof Criteria)
  2417. {
  2418. $criteria = clone $criteria;
  2419. }
  2420. if ($this->collKataoSupplierInvoiceProducts === null) {
  2421. if ($this->isNew()) {
  2422. $this->collKataoSupplierInvoiceProducts = array();
  2423. } else {
  2424. $criteria->add(KataoSupplierInvoiceProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2425. KataoSupplierInvoiceProductPeer::addSelectColumns($criteria);
  2426. $this->collKataoSupplierInvoiceProducts = KataoSupplierInvoiceProductPeer::doSelect($criteria, $con);
  2427. }
  2428. } else {
  2429. // criteria has no effect for a new object
  2430. if (!$this->isNew()) {
  2431. // the following code is to determine if a new query is
  2432. // called for. If the criteria is the same as the last
  2433. // one, just return the collection.
  2434. $criteria->add(KataoSupplierInvoiceProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2435. KataoSupplierInvoiceProductPeer::addSelectColumns($criteria);
  2436. if (!isset($this->lastKataoSupplierInvoiceProductCriteria) || !$this->lastKataoSupplierInvoiceProductCriteria->equals($criteria)) {
  2437. $this->collKataoSupplierInvoiceProducts = KataoSupplierInvoiceProductPeer::doSelect($criteria, $con);
  2438. }
  2439. }
  2440. }
  2441. $this->lastKataoSupplierInvoiceProductCriteria = $criteria;
  2442. return $this->collKataoSupplierInvoiceProducts;
  2443. }
  2444. /**
  2445. * Returns the number of related KataoSupplierInvoiceProducts.
  2446. *
  2447. * @param Criteria $criteria
  2448. * @param boolean $distinct
  2449. * @param Connection $con
  2450. * @throws PropelException
  2451. */
  2452. public function countKataoSupplierInvoiceProducts($criteria = null, $distinct = false, $con = null)
  2453. {
  2454. // include the Peer class
  2455. if ($criteria === null) {
  2456. $criteria = new Criteria();
  2457. }
  2458. elseif ($criteria instanceof Criteria)
  2459. {
  2460. $criteria = clone $criteria;
  2461. }
  2462. $criteria->add(KataoSupplierInvoiceProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2463. return KataoSupplierInvoiceProductPeer::doCount($criteria, $distinct, $con);
  2464. }
  2465. /**
  2466. * Method called to associate a KataoSupplierInvoiceProduct object to this object
  2467. * through the KataoSupplierInvoiceProduct foreign key attribute
  2468. *
  2469. * @param KataoSupplierInvoiceProduct $l KataoSupplierInvoiceProduct
  2470. * @return void
  2471. * @throws PropelException
  2472. */
  2473. public function addKataoSupplierInvoiceProduct(KataoSupplierInvoiceProduct $l)
  2474. {
  2475. $this->collKataoSupplierInvoiceProducts[] = $l;
  2476. $l->setKataoProduct($this);
  2477. }
  2478. /**
  2479. * If this collection has already been initialized with
  2480. * an identical criteria, it returns the collection.
  2481. * Otherwise if this KataoProduct is new, it will return
  2482. * an empty collection; or if this KataoProduct has previously
  2483. * been saved, it will retrieve related KataoSupplierInvoiceProducts from storage.
  2484. *
  2485. * This method is protected by default in order to keep the public
  2486. * api reasonable. You can provide public methods for those you
  2487. * actually need in KataoProduct.
  2488. */
  2489. public function getKataoSupplierInvoiceProductsJoinKataoSupplierInvoice($criteria = null, $con = null)
  2490. {
  2491. // include the Peer class
  2492. if ($criteria === null) {
  2493. $criteria = new Criteria();
  2494. }
  2495. elseif ($criteria instanceof Criteria)
  2496. {
  2497. $criteria = clone $criteria;
  2498. }
  2499. if ($this->collKataoSupplierInvoiceProducts === null) {
  2500. if ($this->isNew()) {
  2501. $this->collKataoSupplierInvoiceProducts = array();
  2502. } else {
  2503. $criteria->add(KataoSupplierInvoiceProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2504. $this->collKataoSupplierInvoiceProducts = KataoSupplierInvoiceProductPeer::doSelectJoinKataoSupplierInvoice($criteria, $con);
  2505. }
  2506. } else {
  2507. // the following code is to determine if a new query is
  2508. // called for. If the criteria is the same as the last
  2509. // one, just return the collection.
  2510. $criteria->add(KataoSupplierInvoiceProductPeer::KATAO_PRODUCT_ID, $this->getId());
  2511. if (!isset($this->lastKataoSupplierInvoiceProductCriteria) || !$this->lastKataoSupplierInvoiceProductCriteria->equals($criteria)) {
  2512. $this->collKataoSupplierInvoiceProducts = KataoSupplierInvoiceProductPeer::doSelectJoinKataoSupplierInvoice($criteria, $con);
  2513. }
  2514. }
  2515. $this->lastKataoSupplierInvoiceProductCriteria = $criteria;
  2516. return $this->collKataoSupplierInvoiceProducts;
  2517. }
  2518. public function __call($method, $arguments)
  2519. {
  2520. if (!$callable = sfMixer::getCallable('BaseKataoProduct:'.$method))
  2521. {
  2522. throw new sfException(sprintf('Call to undefined method BaseKataoProduct::%s', $method));
  2523. }
  2524. array_unshift($arguments, $this);
  2525. return call_user_func_array($callable, $arguments);
  2526. }
  2527. } // BaseKataoProduct