BaseKataoMemberAdhesion.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960
  1. <?php
  2. /**
  3. * Base class that represents a row from the 'katao_member_adhesion' table.
  4. *
  5. *
  6. *
  7. * @package lib.model.om
  8. */
  9. abstract class BaseKataoMemberAdhesion 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 KataoMemberAdhesionPeer
  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_user_id field.
  24. * @var int
  25. */
  26. protected $katao_user_id;
  27. /**
  28. * The value for the year field.
  29. * @var int
  30. */
  31. protected $year;
  32. /**
  33. * The value for the amount field.
  34. * @var double
  35. */
  36. protected $amount;
  37. /**
  38. * The value for the type field.
  39. * @var int
  40. */
  41. protected $type;
  42. /**
  43. * The value for the payment_kind field.
  44. * @var int
  45. */
  46. protected $payment_kind;
  47. /**
  48. * The value for the check_no field.
  49. * @var string
  50. */
  51. protected $check_no;
  52. /**
  53. * @var KataoUser
  54. */
  55. protected $aKataoUser;
  56. /**
  57. * Flag to prevent endless save loop, if this object is referenced
  58. * by another object which falls in this transaction.
  59. * @var boolean
  60. */
  61. protected $alreadyInSave = false;
  62. /**
  63. * Flag to prevent endless validation loop, if this object is referenced
  64. * by another object which falls in this transaction.
  65. * @var boolean
  66. */
  67. protected $alreadyInValidation = false;
  68. /**
  69. * Get the [id] column value.
  70. *
  71. * @return int
  72. */
  73. public function getId()
  74. {
  75. return $this->id;
  76. }
  77. /**
  78. * Get the [katao_user_id] column value.
  79. *
  80. * @return int
  81. */
  82. public function getKataoUserId()
  83. {
  84. return $this->katao_user_id;
  85. }
  86. /**
  87. * Get the [optionally formatted] [year] column value.
  88. *
  89. * @param string $format The date/time format string (either date()-style or strftime()-style).
  90. * If format is NULL, then the integer unix timestamp will be returned.
  91. * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
  92. * @throws PropelException - if unable to convert the date/time to timestamp.
  93. */
  94. public function getYear($format = 'Y-m-d')
  95. {
  96. if ($this->year === null || $this->year === '') {
  97. return null;
  98. } elseif (!is_int($this->year)) {
  99. // a non-timestamp value was set externally, so we convert it
  100. $ts = strtotime($this->year);
  101. if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
  102. throw new PropelException("Unable to parse value of [year] as date/time value: " . var_export($this->year, true));
  103. }
  104. } else {
  105. $ts = $this->year;
  106. }
  107. if ($format === null) {
  108. return $ts;
  109. } elseif (strpos($format, '%') !== false) {
  110. return strftime($format, $ts);
  111. } else {
  112. return date($format, $ts);
  113. }
  114. }
  115. /**
  116. * Get the [amount] column value.
  117. *
  118. * @return double
  119. */
  120. public function getAmount()
  121. {
  122. return $this->amount;
  123. }
  124. /**
  125. * Get the [type] column value.
  126. *
  127. * @return int
  128. */
  129. public function getType()
  130. {
  131. return $this->type;
  132. }
  133. /**
  134. * Get the [payment_kind] column value.
  135. *
  136. * @return int
  137. */
  138. public function getPaymentKind()
  139. {
  140. return $this->payment_kind;
  141. }
  142. /**
  143. * Get the [check_no] column value.
  144. *
  145. * @return string
  146. */
  147. public function getCheckNo()
  148. {
  149. return $this->check_no;
  150. }
  151. /**
  152. * Set the value of [id] column.
  153. *
  154. * @param int $v new value
  155. * @return void
  156. */
  157. public function setId($v)
  158. {
  159. // Since the native PHP type for this column is integer,
  160. // we will cast the input value to an int (if it is not).
  161. if ($v !== null && !is_int($v) && is_numeric($v)) {
  162. $v = (int) $v;
  163. }
  164. if ($this->id !== $v) {
  165. $this->id = $v;
  166. $this->modifiedColumns[] = KataoMemberAdhesionPeer::ID;
  167. }
  168. } // setId()
  169. /**
  170. * Set the value of [katao_user_id] column.
  171. *
  172. * @param int $v new value
  173. * @return void
  174. */
  175. public function setKataoUserId($v)
  176. {
  177. // Since the native PHP type for this column is integer,
  178. // we will cast the input value to an int (if it is not).
  179. if ($v !== null && !is_int($v) && is_numeric($v)) {
  180. $v = (int) $v;
  181. }
  182. if ($this->katao_user_id !== $v) {
  183. $this->katao_user_id = $v;
  184. $this->modifiedColumns[] = KataoMemberAdhesionPeer::KATAO_USER_ID;
  185. }
  186. if ($this->aKataoUser !== null && $this->aKataoUser->getId() !== $v) {
  187. $this->aKataoUser = null;
  188. }
  189. } // setKataoUserId()
  190. /**
  191. * Set the value of [year] column.
  192. *
  193. * @param int $v new value
  194. * @return void
  195. */
  196. public function setYear($v)
  197. {
  198. if ($v !== null && !is_int($v)) {
  199. $ts = strtotime($v);
  200. if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
  201. throw new PropelException("Unable to parse date/time value for [year] from input: " . var_export($v, true));
  202. }
  203. } else {
  204. $ts = $v;
  205. }
  206. if ($this->year !== $ts) {
  207. $this->year = $ts;
  208. $this->modifiedColumns[] = KataoMemberAdhesionPeer::YEAR;
  209. }
  210. } // setYear()
  211. /**
  212. * Set the value of [amount] column.
  213. *
  214. * @param double $v new value
  215. * @return void
  216. */
  217. public function setAmount($v)
  218. {
  219. if ($this->amount !== $v) {
  220. $this->amount = $v;
  221. $this->modifiedColumns[] = KataoMemberAdhesionPeer::AMOUNT;
  222. }
  223. } // setAmount()
  224. /**
  225. * Set the value of [type] column.
  226. *
  227. * @param int $v new value
  228. * @return void
  229. */
  230. public function setType($v)
  231. {
  232. // Since the native PHP type for this column is integer,
  233. // we will cast the input value to an int (if it is not).
  234. if ($v !== null && !is_int($v) && is_numeric($v)) {
  235. $v = (int) $v;
  236. }
  237. if ($this->type !== $v) {
  238. $this->type = $v;
  239. $this->modifiedColumns[] = KataoMemberAdhesionPeer::TYPE;
  240. }
  241. } // setType()
  242. /**
  243. * Set the value of [payment_kind] column.
  244. *
  245. * @param int $v new value
  246. * @return void
  247. */
  248. public function setPaymentKind($v)
  249. {
  250. // Since the native PHP type for this column is integer,
  251. // we will cast the input value to an int (if it is not).
  252. if ($v !== null && !is_int($v) && is_numeric($v)) {
  253. $v = (int) $v;
  254. }
  255. if ($this->payment_kind !== $v) {
  256. $this->payment_kind = $v;
  257. $this->modifiedColumns[] = KataoMemberAdhesionPeer::PAYMENT_KIND;
  258. }
  259. } // setPaymentKind()
  260. /**
  261. * Set the value of [check_no] column.
  262. *
  263. * @param string $v new value
  264. * @return void
  265. */
  266. public function setCheckNo($v)
  267. {
  268. // Since the native PHP type for this column is string,
  269. // we will cast the input to a string (if it is not).
  270. if ($v !== null && !is_string($v)) {
  271. $v = (string) $v;
  272. }
  273. if ($this->check_no !== $v) {
  274. $this->check_no = $v;
  275. $this->modifiedColumns[] = KataoMemberAdhesionPeer::CHECK_NO;
  276. }
  277. } // setCheckNo()
  278. /**
  279. * Hydrates (populates) the object variables with values from the database resultset.
  280. *
  281. * An offset (1-based "start column") is specified so that objects can be hydrated
  282. * with a subset of the columns in the resultset rows. This is needed, for example,
  283. * for results of JOIN queries where the resultset row includes columns from two or
  284. * more tables.
  285. *
  286. * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
  287. * @param int $startcol 1-based offset column which indicates which restultset column to start with.
  288. * @return int next starting column
  289. * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
  290. */
  291. public function hydrate(ResultSet $rs, $startcol = 1)
  292. {
  293. try {
  294. $this->id = $rs->getInt($startcol + 0);
  295. $this->katao_user_id = $rs->getInt($startcol + 1);
  296. $this->year = $rs->getDate($startcol + 2, null);
  297. $this->amount = $rs->getFloat($startcol + 3);
  298. $this->type = $rs->getInt($startcol + 4);
  299. $this->payment_kind = $rs->getInt($startcol + 5);
  300. $this->check_no = $rs->getString($startcol + 6);
  301. $this->resetModified();
  302. $this->setNew(false);
  303. // FIXME - using NUM_COLUMNS may be clearer.
  304. return $startcol + 7; // 7 = KataoMemberAdhesionPeer::NUM_COLUMNS - KataoMemberAdhesionPeer::NUM_LAZY_LOAD_COLUMNS).
  305. } catch (Exception $e) {
  306. throw new PropelException("Error populating KataoMemberAdhesion object", $e);
  307. }
  308. }
  309. /**
  310. * Removes this object from datastore and sets delete attribute.
  311. *
  312. * @param Connection $con
  313. * @return void
  314. * @throws PropelException
  315. * @see BaseObject::setDeleted()
  316. * @see BaseObject::isDeleted()
  317. */
  318. public function delete($con = null)
  319. {
  320. foreach (sfMixer::getCallables('BaseKataoMemberAdhesion:delete:pre') as $callable)
  321. {
  322. $ret = call_user_func($callable, $this, $con);
  323. if ($ret)
  324. {
  325. return;
  326. }
  327. }
  328. if ($this->isDeleted()) {
  329. throw new PropelException("This object has already been deleted.");
  330. }
  331. if ($con === null) {
  332. $con = Propel::getConnection(KataoMemberAdhesionPeer::DATABASE_NAME);
  333. }
  334. try {
  335. $con->begin();
  336. KataoMemberAdhesionPeer::doDelete($this, $con);
  337. $this->setDeleted(true);
  338. $con->commit();
  339. } catch (PropelException $e) {
  340. $con->rollback();
  341. throw $e;
  342. }
  343. foreach (sfMixer::getCallables('BaseKataoMemberAdhesion:delete:post') as $callable)
  344. {
  345. call_user_func($callable, $this, $con);
  346. }
  347. }
  348. /**
  349. * Stores the object in the database. If the object is new,
  350. * it inserts it; otherwise an update is performed. This method
  351. * wraps the doSave() worker method in a transaction.
  352. *
  353. * @param Connection $con
  354. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  355. * @throws PropelException
  356. * @see doSave()
  357. */
  358. public function save($con = null)
  359. {
  360. foreach (sfMixer::getCallables('BaseKataoMemberAdhesion:save:pre') as $callable)
  361. {
  362. $affectedRows = call_user_func($callable, $this, $con);
  363. if (is_int($affectedRows))
  364. {
  365. return $affectedRows;
  366. }
  367. }
  368. if ($this->isDeleted()) {
  369. throw new PropelException("You cannot save an object that has been deleted.");
  370. }
  371. if ($con === null) {
  372. $con = Propel::getConnection(KataoMemberAdhesionPeer::DATABASE_NAME);
  373. }
  374. try {
  375. $con->begin();
  376. $affectedRows = $this->doSave($con);
  377. $con->commit();
  378. foreach (sfMixer::getCallables('BaseKataoMemberAdhesion:save:post') as $callable)
  379. {
  380. call_user_func($callable, $this, $con, $affectedRows);
  381. }
  382. return $affectedRows;
  383. } catch (PropelException $e) {
  384. $con->rollback();
  385. throw $e;
  386. }
  387. }
  388. /**
  389. * Stores the object in the database.
  390. *
  391. * If the object is new, it inserts it; otherwise an update is performed.
  392. * All related objects are also updated in this method.
  393. *
  394. * @param Connection $con
  395. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  396. * @throws PropelException
  397. * @see save()
  398. */
  399. protected function doSave($con)
  400. {
  401. $affectedRows = 0; // initialize var to track total num of affected rows
  402. if (!$this->alreadyInSave) {
  403. $this->alreadyInSave = true;
  404. // We call the save method on the following object(s) if they
  405. // were passed to this object by their coresponding set
  406. // method. This object relates to these object(s) by a
  407. // foreign key reference.
  408. if ($this->aKataoUser !== null) {
  409. if ($this->aKataoUser->isModified()) {
  410. $affectedRows += $this->aKataoUser->save($con);
  411. }
  412. $this->setKataoUser($this->aKataoUser);
  413. }
  414. // If this object has been modified, then save it to the database.
  415. if ($this->isModified()) {
  416. if ($this->isNew()) {
  417. $pk = KataoMemberAdhesionPeer::doInsert($this, $con);
  418. $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
  419. // should always be true here (even though technically
  420. // BasePeer::doInsert() can insert multiple rows).
  421. $this->setId($pk); //[IMV] update autoincrement primary key
  422. $this->setNew(false);
  423. } else {
  424. $affectedRows += KataoMemberAdhesionPeer::doUpdate($this, $con);
  425. }
  426. $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
  427. }
  428. $this->alreadyInSave = false;
  429. }
  430. return $affectedRows;
  431. } // doSave()
  432. /**
  433. * Array of ValidationFailed objects.
  434. * @var array ValidationFailed[]
  435. */
  436. protected $validationFailures = array();
  437. /**
  438. * Gets any ValidationFailed objects that resulted from last call to validate().
  439. *
  440. *
  441. * @return array ValidationFailed[]
  442. * @see validate()
  443. */
  444. public function getValidationFailures()
  445. {
  446. return $this->validationFailures;
  447. }
  448. /**
  449. * Validates the objects modified field values and all objects related to this table.
  450. *
  451. * If $columns is either a column name or an array of column names
  452. * only those columns are validated.
  453. *
  454. * @param mixed $columns Column name or an array of column names.
  455. * @return boolean Whether all columns pass validation.
  456. * @see doValidate()
  457. * @see getValidationFailures()
  458. */
  459. public function validate($columns = null)
  460. {
  461. $res = $this->doValidate($columns);
  462. if ($res === true) {
  463. $this->validationFailures = array();
  464. return true;
  465. } else {
  466. $this->validationFailures = $res;
  467. return false;
  468. }
  469. }
  470. /**
  471. * This function performs the validation work for complex object models.
  472. *
  473. * In addition to checking the current object, all related objects will
  474. * also be validated. If all pass then <code>true</code> is returned; otherwise
  475. * an aggreagated array of ValidationFailed objects will be returned.
  476. *
  477. * @param array $columns Array of column names to validate.
  478. * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  479. */
  480. protected function doValidate($columns = null)
  481. {
  482. if (!$this->alreadyInValidation) {
  483. $this->alreadyInValidation = true;
  484. $retval = null;
  485. $failureMap = array();
  486. // We call the validate method on the following object(s) if they
  487. // were passed to this object by their coresponding set
  488. // method. This object relates to these object(s) by a
  489. // foreign key reference.
  490. if ($this->aKataoUser !== null) {
  491. if (!$this->aKataoUser->validate($columns)) {
  492. $failureMap = array_merge($failureMap, $this->aKataoUser->getValidationFailures());
  493. }
  494. }
  495. if (($retval = KataoMemberAdhesionPeer::doValidate($this, $columns)) !== true) {
  496. $failureMap = array_merge($failureMap, $retval);
  497. }
  498. $this->alreadyInValidation = false;
  499. }
  500. return (!empty($failureMap) ? $failureMap : true);
  501. }
  502. /**
  503. * Retrieves a field from the object by name passed in as a string.
  504. *
  505. * @param string $name name
  506. * @param string $type The type of fieldname the $name is of:
  507. * one of the class type constants TYPE_PHPNAME,
  508. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  509. * @return mixed Value of field.
  510. */
  511. public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
  512. {
  513. $pos = KataoMemberAdhesionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  514. return $this->getByPosition($pos);
  515. }
  516. /**
  517. * Retrieves a field from the object by Position as specified in the xml schema.
  518. * Zero-based.
  519. *
  520. * @param int $pos position in xml schema
  521. * @return mixed Value of field at $pos
  522. */
  523. public function getByPosition($pos)
  524. {
  525. switch($pos) {
  526. case 0:
  527. return $this->getId();
  528. break;
  529. case 1:
  530. return $this->getKataoUserId();
  531. break;
  532. case 2:
  533. return $this->getYear();
  534. break;
  535. case 3:
  536. return $this->getAmount();
  537. break;
  538. case 4:
  539. return $this->getType();
  540. break;
  541. case 5:
  542. return $this->getPaymentKind();
  543. break;
  544. case 6:
  545. return $this->getCheckNo();
  546. break;
  547. default:
  548. return null;
  549. break;
  550. } // switch()
  551. }
  552. /**
  553. * Exports the object as an array.
  554. *
  555. * You can specify the key type of the array by passing one of the class
  556. * type constants.
  557. *
  558. * @param string $keyType One of the class type constants TYPE_PHPNAME,
  559. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  560. * @return an associative array containing the field names (as keys) and field values
  561. */
  562. public function toArray($keyType = BasePeer::TYPE_PHPNAME)
  563. {
  564. $keys = KataoMemberAdhesionPeer::getFieldNames($keyType);
  565. $result = array(
  566. $keys[0] => $this->getId(),
  567. $keys[1] => $this->getKataoUserId(),
  568. $keys[2] => $this->getYear(),
  569. $keys[3] => $this->getAmount(),
  570. $keys[4] => $this->getType(),
  571. $keys[5] => $this->getPaymentKind(),
  572. $keys[6] => $this->getCheckNo(),
  573. );
  574. return $result;
  575. }
  576. /**
  577. * Sets a field from the object by name passed in as a string.
  578. *
  579. * @param string $name peer name
  580. * @param mixed $value field value
  581. * @param string $type The type of fieldname the $name is of:
  582. * one of the class type constants TYPE_PHPNAME,
  583. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  584. * @return void
  585. */
  586. public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
  587. {
  588. $pos = KataoMemberAdhesionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  589. return $this->setByPosition($pos, $value);
  590. }
  591. /**
  592. * Sets a field from the object by Position as specified in the xml schema.
  593. * Zero-based.
  594. *
  595. * @param int $pos position in xml schema
  596. * @param mixed $value field value
  597. * @return void
  598. */
  599. public function setByPosition($pos, $value)
  600. {
  601. switch($pos) {
  602. case 0:
  603. $this->setId($value);
  604. break;
  605. case 1:
  606. $this->setKataoUserId($value);
  607. break;
  608. case 2:
  609. $this->setYear($value);
  610. break;
  611. case 3:
  612. $this->setAmount($value);
  613. break;
  614. case 4:
  615. $this->setType($value);
  616. break;
  617. case 5:
  618. $this->setPaymentKind($value);
  619. break;
  620. case 6:
  621. $this->setCheckNo($value);
  622. break;
  623. } // switch()
  624. }
  625. /**
  626. * Populates the object using an array.
  627. *
  628. * This is particularly useful when populating an object from one of the
  629. * request arrays (e.g. $_POST). This method goes through the column
  630. * names, checking to see whether a matching key exists in populated
  631. * array. If so the setByName() method is called for that column.
  632. *
  633. * You can specify the key type of the array by additionally passing one
  634. * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
  635. * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
  636. *
  637. * @param array $arr An array to populate the object from.
  638. * @param string $keyType The type of keys the array uses.
  639. * @return void
  640. */
  641. public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
  642. {
  643. $keys = KataoMemberAdhesionPeer::getFieldNames($keyType);
  644. if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
  645. if (array_key_exists($keys[1], $arr)) $this->setKataoUserId($arr[$keys[1]]);
  646. if (array_key_exists($keys[2], $arr)) $this->setYear($arr[$keys[2]]);
  647. if (array_key_exists($keys[3], $arr)) $this->setAmount($arr[$keys[3]]);
  648. if (array_key_exists($keys[4], $arr)) $this->setType($arr[$keys[4]]);
  649. if (array_key_exists($keys[5], $arr)) $this->setPaymentKind($arr[$keys[5]]);
  650. if (array_key_exists($keys[6], $arr)) $this->setCheckNo($arr[$keys[6]]);
  651. }
  652. /**
  653. * Build a Criteria object containing the values of all modified columns in this object.
  654. *
  655. * @return Criteria The Criteria object containing all modified values.
  656. */
  657. public function buildCriteria()
  658. {
  659. $criteria = new Criteria(KataoMemberAdhesionPeer::DATABASE_NAME);
  660. if ($this->isColumnModified(KataoMemberAdhesionPeer::ID)) $criteria->add(KataoMemberAdhesionPeer::ID, $this->id);
  661. if ($this->isColumnModified(KataoMemberAdhesionPeer::KATAO_USER_ID)) $criteria->add(KataoMemberAdhesionPeer::KATAO_USER_ID, $this->katao_user_id);
  662. if ($this->isColumnModified(KataoMemberAdhesionPeer::YEAR)) $criteria->add(KataoMemberAdhesionPeer::YEAR, $this->year);
  663. if ($this->isColumnModified(KataoMemberAdhesionPeer::AMOUNT)) $criteria->add(KataoMemberAdhesionPeer::AMOUNT, $this->amount);
  664. if ($this->isColumnModified(KataoMemberAdhesionPeer::TYPE)) $criteria->add(KataoMemberAdhesionPeer::TYPE, $this->type);
  665. if ($this->isColumnModified(KataoMemberAdhesionPeer::PAYMENT_KIND)) $criteria->add(KataoMemberAdhesionPeer::PAYMENT_KIND, $this->payment_kind);
  666. if ($this->isColumnModified(KataoMemberAdhesionPeer::CHECK_NO)) $criteria->add(KataoMemberAdhesionPeer::CHECK_NO, $this->check_no);
  667. return $criteria;
  668. }
  669. /**
  670. * Builds a Criteria object containing the primary key for this object.
  671. *
  672. * Unlike buildCriteria() this method includes the primary key values regardless
  673. * of whether or not they have been modified.
  674. *
  675. * @return Criteria The Criteria object containing value(s) for primary key(s).
  676. */
  677. public function buildPkeyCriteria()
  678. {
  679. $criteria = new Criteria(KataoMemberAdhesionPeer::DATABASE_NAME);
  680. $criteria->add(KataoMemberAdhesionPeer::ID, $this->id);
  681. return $criteria;
  682. }
  683. /**
  684. * Returns the primary key for this object (row).
  685. * @return int
  686. */
  687. public function getPrimaryKey()
  688. {
  689. return $this->getId();
  690. }
  691. /**
  692. * Generic method to set the primary key (id column).
  693. *
  694. * @param int $key Primary key.
  695. * @return void
  696. */
  697. public function setPrimaryKey($key)
  698. {
  699. $this->setId($key);
  700. }
  701. /**
  702. * Sets contents of passed object to values from current object.
  703. *
  704. * If desired, this method can also make copies of all associated (fkey referrers)
  705. * objects.
  706. *
  707. * @param object $copyObj An object of KataoMemberAdhesion (or compatible) type.
  708. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  709. * @throws PropelException
  710. */
  711. public function copyInto($copyObj, $deepCopy = false)
  712. {
  713. $copyObj->setKataoUserId($this->katao_user_id);
  714. $copyObj->setYear($this->year);
  715. $copyObj->setAmount($this->amount);
  716. $copyObj->setType($this->type);
  717. $copyObj->setPaymentKind($this->payment_kind);
  718. $copyObj->setCheckNo($this->check_no);
  719. $copyObj->setNew(true);
  720. $copyObj->setId(NULL); // this is a pkey column, so set to default value
  721. }
  722. /**
  723. * Makes a copy of this object that will be inserted as a new row in table when saved.
  724. * It creates a new object filling in the simple attributes, but skipping any primary
  725. * keys that are defined for the table.
  726. *
  727. * If desired, this method can also make copies of all associated (fkey referrers)
  728. * objects.
  729. *
  730. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  731. * @return KataoMemberAdhesion Clone of current object.
  732. * @throws PropelException
  733. */
  734. public function copy($deepCopy = false)
  735. {
  736. // we use get_class(), because this might be a subclass
  737. $clazz = get_class($this);
  738. $copyObj = new $clazz();
  739. $this->copyInto($copyObj, $deepCopy);
  740. return $copyObj;
  741. }
  742. /**
  743. * Returns a peer instance associated with this om.
  744. *
  745. * Since Peer classes are not to have any instance attributes, this method returns the
  746. * same instance for all member of this class. The method could therefore
  747. * be static, but this would prevent one from overriding the behavior.
  748. *
  749. * @return KataoMemberAdhesionPeer
  750. */
  751. public function getPeer()
  752. {
  753. if (self::$peer === null) {
  754. self::$peer = new KataoMemberAdhesionPeer();
  755. }
  756. return self::$peer;
  757. }
  758. /**
  759. * Declares an association between this object and a KataoUser object.
  760. *
  761. * @param KataoUser $v
  762. * @return void
  763. * @throws PropelException
  764. */
  765. public function setKataoUser($v)
  766. {
  767. if ($v === null) {
  768. $this->setKataoUserId(NULL);
  769. } else {
  770. $this->setKataoUserId($v->getId());
  771. }
  772. $this->aKataoUser = $v;
  773. }
  774. /**
  775. * Get the associated KataoUser object
  776. *
  777. * @param Connection Optional Connection object.
  778. * @return KataoUser The associated KataoUser object.
  779. * @throws PropelException
  780. */
  781. public function getKataoUser($con = null)
  782. {
  783. if ($this->aKataoUser === null && ($this->katao_user_id !== null)) {
  784. // include the related Peer class
  785. $this->aKataoUser = KataoUserPeer::retrieveByPK($this->katao_user_id, $con);
  786. /* The following can be used instead of the line above to
  787. guarantee the related object contains a reference
  788. to this object, but this level of coupling
  789. may be undesirable in many circumstances.
  790. As it can lead to a db query with many results that may
  791. never be used.
  792. $obj = KataoUserPeer::retrieveByPK($this->katao_user_id, $con);
  793. $obj->addKataoUsers($this);
  794. */
  795. }
  796. return $this->aKataoUser;
  797. }
  798. public function __call($method, $arguments)
  799. {
  800. if (!$callable = sfMixer::getCallable('BaseKataoMemberAdhesion:'.$method))
  801. {
  802. throw new sfException(sprintf('Call to undefined method BaseKataoMemberAdhesion::%s', $method));
  803. }
  804. array_unshift($arguments, $this);
  805. return call_user_func_array($callable, $arguments);
  806. }
  807. } // BaseKataoMemberAdhesion