PageRenderTime 45ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/model/om/BaseFctraveh.php

https://github.com/cidesa/siga-universitario
PHP | 593 lines | 412 code | 181 blank | 0 comment | 57 complexity | 1262472eaa5b6a57ea929da252f48472 MD5 | raw file
  1. <?php
  2. abstract class BaseFctraveh extends BaseObject implements Persistent {
  3. protected static $peer;
  4. protected $numtra;
  5. protected $plaveh;
  6. protected $fectra;
  7. protected $rifcon;
  8. protected $rifrep;
  9. protected $rifconant;
  10. protected $rifrepant;
  11. protected $funrec;
  12. protected $id;
  13. protected $alreadyInSave = false;
  14. protected $alreadyInValidation = false;
  15. public function getNumtra()
  16. {
  17. return trim($this->numtra);
  18. }
  19. public function getPlaveh()
  20. {
  21. return trim($this->plaveh);
  22. }
  23. public function getFectra($format = 'Y-m-d')
  24. {
  25. if ($this->fectra === null || $this->fectra === '') {
  26. return null;
  27. } elseif (!is_int($this->fectra)) {
  28. $ts = adodb_strtotime($this->fectra);
  29. if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fectra] as date/time value: " . var_export($this->fectra, true));
  30. }
  31. } else {
  32. $ts = $this->fectra;
  33. }
  34. if ($format === null) {
  35. return $ts;
  36. } elseif (strpos($format, '%') !== false) {
  37. return adodb_strftime($format, $ts);
  38. } else {
  39. return @adodb_date($format, $ts);
  40. }
  41. }
  42. public function getRifcon()
  43. {
  44. return trim($this->rifcon);
  45. }
  46. public function getRifrep()
  47. {
  48. return trim($this->rifrep);
  49. }
  50. public function getRifconant()
  51. {
  52. return trim($this->rifconant);
  53. }
  54. public function getRifrepant()
  55. {
  56. return trim($this->rifrepant);
  57. }
  58. public function getFunrec()
  59. {
  60. return trim($this->funrec);
  61. }
  62. public function getId()
  63. {
  64. return $this->id;
  65. }
  66. public function setNumtra($v)
  67. {
  68. if ($this->numtra !== $v) {
  69. $this->numtra = $v;
  70. $this->modifiedColumns[] = FctravehPeer::NUMTRA;
  71. }
  72. }
  73. public function setPlaveh($v)
  74. {
  75. if ($this->plaveh !== $v) {
  76. $this->plaveh = $v;
  77. $this->modifiedColumns[] = FctravehPeer::PLAVEH;
  78. }
  79. }
  80. public function setFectra($v)
  81. {
  82. if ($v !== null && !is_int($v)) {
  83. $ts = adodb_strtotime($v);
  84. if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fectra] from input: " . var_export($v, true));
  85. }
  86. } else {
  87. $ts = $v;
  88. }
  89. if ($this->fectra !== $ts) {
  90. $this->fectra = $ts;
  91. $this->modifiedColumns[] = FctravehPeer::FECTRA;
  92. }
  93. }
  94. public function setRifcon($v)
  95. {
  96. if ($this->rifcon !== $v) {
  97. $this->rifcon = $v;
  98. $this->modifiedColumns[] = FctravehPeer::RIFCON;
  99. }
  100. }
  101. public function setRifrep($v)
  102. {
  103. if ($this->rifrep !== $v) {
  104. $this->rifrep = $v;
  105. $this->modifiedColumns[] = FctravehPeer::RIFREP;
  106. }
  107. }
  108. public function setRifconant($v)
  109. {
  110. if ($this->rifconant !== $v) {
  111. $this->rifconant = $v;
  112. $this->modifiedColumns[] = FctravehPeer::RIFCONANT;
  113. }
  114. }
  115. public function setRifrepant($v)
  116. {
  117. if ($this->rifrepant !== $v) {
  118. $this->rifrepant = $v;
  119. $this->modifiedColumns[] = FctravehPeer::RIFREPANT;
  120. }
  121. }
  122. public function setFunrec($v)
  123. {
  124. if ($this->funrec !== $v) {
  125. $this->funrec = $v;
  126. $this->modifiedColumns[] = FctravehPeer::FUNREC;
  127. }
  128. }
  129. public function setId($v)
  130. {
  131. if ($this->id !== $v) {
  132. $this->id = $v;
  133. $this->modifiedColumns[] = FctravehPeer::ID;
  134. }
  135. }
  136. public function hydrate(ResultSet $rs, $startcol = 1)
  137. {
  138. try {
  139. $this->numtra = $rs->getString($startcol + 0);
  140. $this->plaveh = $rs->getString($startcol + 1);
  141. $this->fectra = $rs->getDate($startcol + 2, null);
  142. $this->rifcon = $rs->getString($startcol + 3);
  143. $this->rifrep = $rs->getString($startcol + 4);
  144. $this->rifconant = $rs->getString($startcol + 5);
  145. $this->rifrepant = $rs->getString($startcol + 6);
  146. $this->funrec = $rs->getString($startcol + 7);
  147. $this->id = $rs->getInt($startcol + 8);
  148. $this->resetModified();
  149. $this->setNew(false);
  150. $this->afterHydrate();
  151. return $startcol + 9;
  152. } catch (Exception $e) {
  153. throw new PropelException("Error populating Fctraveh object", $e);
  154. }
  155. }
  156. protected function afterHydrate()
  157. {
  158. }
  159. public function __call($m, $a)
  160. {
  161. $prefijo = substr($m,0,3);
  162. $metodo = strtolower(substr($m,3));
  163. if($prefijo=='get'){
  164. if(isset($this->$metodo)) return $this->$metodo;
  165. else return '';
  166. }elseif($prefijo=='set'){
  167. if(isset($this->$metodo)) $this->$metodo = $a[0];
  168. }else call_user_func_array($m, $a);
  169. }
  170. public function delete($con = null)
  171. {
  172. if ($this->isDeleted()) {
  173. throw new PropelException("This object has already been deleted.");
  174. }
  175. if ($con === null) {
  176. $con = Propel::getConnection(FctravehPeer::DATABASE_NAME);
  177. }
  178. try {
  179. $con->begin();
  180. FctravehPeer::doDelete($this, $con);
  181. $this->setDeleted(true);
  182. $con->commit();
  183. } catch (PropelException $e) {
  184. $con->rollback();
  185. throw $e;
  186. }
  187. }
  188. public function save($con = null)
  189. {
  190. if ($this->isDeleted()) {
  191. throw new PropelException("You cannot save an object that has been deleted.");
  192. }
  193. if ($con === null) {
  194. $con = Propel::getConnection(FctravehPeer::DATABASE_NAME);
  195. }
  196. try {
  197. $con->begin();
  198. $affectedRows = $this->doSave($con);
  199. $con->commit();
  200. return $affectedRows;
  201. } catch (PropelException $e) {
  202. $con->rollback();
  203. throw $e;
  204. }
  205. }
  206. protected function doSave($con)
  207. {
  208. $affectedRows = 0; if (!$this->alreadyInSave) {
  209. $this->alreadyInSave = true;
  210. if ($this->isModified()) {
  211. if ($this->isNew()) {
  212. $pk = FctravehPeer::doInsert($this, $con);
  213. $affectedRows += 1;
  214. $this->setId($pk);
  215. $this->setNew(false);
  216. } else {
  217. $affectedRows += FctravehPeer::doUpdate($this, $con);
  218. }
  219. $this->resetModified(); }
  220. $this->alreadyInSave = false;
  221. }
  222. return $affectedRows;
  223. }
  224. protected $validationFailures = array();
  225. public function getValidationFailures()
  226. {
  227. return $this->validationFailures;
  228. }
  229. public function validate($columns = null)
  230. {
  231. $res = $this->doValidate($columns);
  232. if ($res === true) {
  233. $this->validationFailures = array();
  234. return true;
  235. } else {
  236. $this->validationFailures = $res;
  237. return false;
  238. }
  239. }
  240. protected function doValidate($columns = null)
  241. {
  242. if (!$this->alreadyInValidation) {
  243. $this->alreadyInValidation = true;
  244. $retval = null;
  245. $failureMap = array();
  246. if (($retval = FctravehPeer::doValidate($this, $columns)) !== true) {
  247. $failureMap = array_merge($failureMap, $retval);
  248. }
  249. $this->alreadyInValidation = false;
  250. }
  251. return (!empty($failureMap) ? $failureMap : true);
  252. }
  253. public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
  254. {
  255. $pos = FctravehPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  256. return $this->getByPosition($pos);
  257. }
  258. public function getByPosition($pos)
  259. {
  260. switch($pos) {
  261. case 0:
  262. return $this->getNumtra();
  263. break;
  264. case 1:
  265. return $this->getPlaveh();
  266. break;
  267. case 2:
  268. return $this->getFectra();
  269. break;
  270. case 3:
  271. return $this->getRifcon();
  272. break;
  273. case 4:
  274. return $this->getRifrep();
  275. break;
  276. case 5:
  277. return $this->getRifconant();
  278. break;
  279. case 6:
  280. return $this->getRifrepant();
  281. break;
  282. case 7:
  283. return $this->getFunrec();
  284. break;
  285. case 8:
  286. return $this->getId();
  287. break;
  288. default:
  289. return null;
  290. break;
  291. } }
  292. public function toArray($keyType = BasePeer::TYPE_PHPNAME)
  293. {
  294. $keys = FctravehPeer::getFieldNames($keyType);
  295. $result = array(
  296. $keys[0] => $this->getNumtra(),
  297. $keys[1] => $this->getPlaveh(),
  298. $keys[2] => $this->getFectra(),
  299. $keys[3] => $this->getRifcon(),
  300. $keys[4] => $this->getRifrep(),
  301. $keys[5] => $this->getRifconant(),
  302. $keys[6] => $this->getRifrepant(),
  303. $keys[7] => $this->getFunrec(),
  304. $keys[8] => $this->getId(),
  305. );
  306. return $result;
  307. }
  308. public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
  309. {
  310. $pos = FctravehPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  311. return $this->setByPosition($pos, $value);
  312. }
  313. public function setByPosition($pos, $value)
  314. {
  315. switch($pos) {
  316. case 0:
  317. $this->setNumtra($value);
  318. break;
  319. case 1:
  320. $this->setPlaveh($value);
  321. break;
  322. case 2:
  323. $this->setFectra($value);
  324. break;
  325. case 3:
  326. $this->setRifcon($value);
  327. break;
  328. case 4:
  329. $this->setRifrep($value);
  330. break;
  331. case 5:
  332. $this->setRifconant($value);
  333. break;
  334. case 6:
  335. $this->setRifrepant($value);
  336. break;
  337. case 7:
  338. $this->setFunrec($value);
  339. break;
  340. case 8:
  341. $this->setId($value);
  342. break;
  343. } }
  344. public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
  345. {
  346. $keys = FctravehPeer::getFieldNames($keyType);
  347. if (array_key_exists($keys[0], $arr)) $this->setNumtra($arr[$keys[0]]);
  348. if (array_key_exists($keys[1], $arr)) $this->setPlaveh($arr[$keys[1]]);
  349. if (array_key_exists($keys[2], $arr)) $this->setFectra($arr[$keys[2]]);
  350. if (array_key_exists($keys[3], $arr)) $this->setRifcon($arr[$keys[3]]);
  351. if (array_key_exists($keys[4], $arr)) $this->setRifrep($arr[$keys[4]]);
  352. if (array_key_exists($keys[5], $arr)) $this->setRifconant($arr[$keys[5]]);
  353. if (array_key_exists($keys[6], $arr)) $this->setRifrepant($arr[$keys[6]]);
  354. if (array_key_exists($keys[7], $arr)) $this->setFunrec($arr[$keys[7]]);
  355. if (array_key_exists($keys[8], $arr)) $this->setId($arr[$keys[8]]);
  356. }
  357. public function buildCriteria()
  358. {
  359. $criteria = new Criteria(FctravehPeer::DATABASE_NAME);
  360. if ($this->isColumnModified(FctravehPeer::NUMTRA)) $criteria->add(FctravehPeer::NUMTRA, $this->numtra);
  361. if ($this->isColumnModified(FctravehPeer::PLAVEH)) $criteria->add(FctravehPeer::PLAVEH, $this->plaveh);
  362. if ($this->isColumnModified(FctravehPeer::FECTRA)) $criteria->add(FctravehPeer::FECTRA, $this->fectra);
  363. if ($this->isColumnModified(FctravehPeer::RIFCON)) $criteria->add(FctravehPeer::RIFCON, $this->rifcon);
  364. if ($this->isColumnModified(FctravehPeer::RIFREP)) $criteria->add(FctravehPeer::RIFREP, $this->rifrep);
  365. if ($this->isColumnModified(FctravehPeer::RIFCONANT)) $criteria->add(FctravehPeer::RIFCONANT, $this->rifconant);
  366. if ($this->isColumnModified(FctravehPeer::RIFREPANT)) $criteria->add(FctravehPeer::RIFREPANT, $this->rifrepant);
  367. if ($this->isColumnModified(FctravehPeer::FUNREC)) $criteria->add(FctravehPeer::FUNREC, $this->funrec);
  368. if ($this->isColumnModified(FctravehPeer::ID)) $criteria->add(FctravehPeer::ID, $this->id);
  369. return $criteria;
  370. }
  371. public function buildPkeyCriteria()
  372. {
  373. $criteria = new Criteria(FctravehPeer::DATABASE_NAME);
  374. $criteria->add(FctravehPeer::ID, $this->id);
  375. return $criteria;
  376. }
  377. public function getPrimaryKey()
  378. {
  379. return $this->getId();
  380. }
  381. public function setPrimaryKey($key)
  382. {
  383. $this->setId($key);
  384. }
  385. public function copyInto($copyObj, $deepCopy = false)
  386. {
  387. $copyObj->setNumtra($this->numtra);
  388. $copyObj->setPlaveh($this->plaveh);
  389. $copyObj->setFectra($this->fectra);
  390. $copyObj->setRifcon($this->rifcon);
  391. $copyObj->setRifrep($this->rifrep);
  392. $copyObj->setRifconant($this->rifconant);
  393. $copyObj->setRifrepant($this->rifrepant);
  394. $copyObj->setFunrec($this->funrec);
  395. $copyObj->setNew(true);
  396. $copyObj->setId(NULL);
  397. }
  398. public function copy($deepCopy = false)
  399. {
  400. $clazz = get_class($this);
  401. $copyObj = new $clazz();
  402. $this->copyInto($copyObj, $deepCopy);
  403. return $copyObj;
  404. }
  405. public function getPeer()
  406. {
  407. if (self::$peer === null) {
  408. self::$peer = new FctravehPeer();
  409. }
  410. return self::$peer;
  411. }
  412. }