BaseKataoNodeSupplier.php 26 KB

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