BaseKataoMemberNode.php 23 KB

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