BaseKataoMemberDeposit.php 37 KB

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