BaseKataoPeriodProduct.php 21 KB

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