BaseKataoPeriodSupplier.php 23 KB

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