PageRenderTime 58ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/model/om/BaseFcrepfis.php

https://github.com/cidesa/siga-universitario
PHP | 719 lines | 505 code | 214 blank | 0 comment | 83 complexity | dbe2372f2741556df36adcad315bc97a MD5 | raw file
  1. <?php
  2. abstract class BaseFcrepfis extends BaseObject implements Persistent {
  3. protected static $peer;
  4. protected $numlic;
  5. protected $funrec;
  6. protected $fecrep;
  7. protected $numrep;
  8. protected $monrep;
  9. protected $conrep;
  10. protected $modo;
  11. protected $monadi;
  12. protected $fuerep;
  13. protected $fuesan;
  14. protected $fecrec;
  15. protected $id;
  16. protected $alreadyInSave = false;
  17. protected $alreadyInValidation = false;
  18. public function getNumlic()
  19. {
  20. return trim($this->numlic);
  21. }
  22. public function getFunrec()
  23. {
  24. return trim($this->funrec);
  25. }
  26. public function getFecrep($format = 'Y-m-d')
  27. {
  28. if ($this->fecrep === null || $this->fecrep === '') {
  29. return null;
  30. } elseif (!is_int($this->fecrep)) {
  31. $ts = adodb_strtotime($this->fecrep);
  32. if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecrep] as date/time value: " . var_export($this->fecrep, true));
  33. }
  34. } else {
  35. $ts = $this->fecrep;
  36. }
  37. if ($format === null) {
  38. return $ts;
  39. } elseif (strpos($format, '%') !== false) {
  40. return adodb_strftime($format, $ts);
  41. } else {
  42. return @adodb_date($format, $ts);
  43. }
  44. }
  45. public function getNumrep()
  46. {
  47. return trim($this->numrep);
  48. }
  49. public function getMonrep($val=false)
  50. {
  51. if($val) return number_format($this->monrep,2,',','.');
  52. else return $this->monrep;
  53. }
  54. public function getConrep()
  55. {
  56. return trim($this->conrep);
  57. }
  58. public function getModo()
  59. {
  60. return trim($this->modo);
  61. }
  62. public function getMonadi($val=false)
  63. {
  64. if($val) return number_format($this->monadi,2,',','.');
  65. else return $this->monadi;
  66. }
  67. public function getFuerep()
  68. {
  69. return trim($this->fuerep);
  70. }
  71. public function getFuesan()
  72. {
  73. return trim($this->fuesan);
  74. }
  75. public function getFecrec($format = 'Y-m-d')
  76. {
  77. if ($this->fecrec === null || $this->fecrec === '') {
  78. return null;
  79. } elseif (!is_int($this->fecrec)) {
  80. $ts = adodb_strtotime($this->fecrec);
  81. if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecrec] as date/time value: " . var_export($this->fecrec, true));
  82. }
  83. } else {
  84. $ts = $this->fecrec;
  85. }
  86. if ($format === null) {
  87. return $ts;
  88. } elseif (strpos($format, '%') !== false) {
  89. return adodb_strftime($format, $ts);
  90. } else {
  91. return @adodb_date($format, $ts);
  92. }
  93. }
  94. public function getId()
  95. {
  96. return $this->id;
  97. }
  98. public function setNumlic($v)
  99. {
  100. if ($this->numlic !== $v) {
  101. $this->numlic = $v;
  102. $this->modifiedColumns[] = FcrepfisPeer::NUMLIC;
  103. }
  104. }
  105. public function setFunrec($v)
  106. {
  107. if ($this->funrec !== $v) {
  108. $this->funrec = $v;
  109. $this->modifiedColumns[] = FcrepfisPeer::FUNREC;
  110. }
  111. }
  112. public function setFecrep($v)
  113. {
  114. if ($v !== null && !is_int($v)) {
  115. $ts = adodb_strtotime($v);
  116. if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecrep] from input: " . var_export($v, true));
  117. }
  118. } else {
  119. $ts = $v;
  120. }
  121. if ($this->fecrep !== $ts) {
  122. $this->fecrep = $ts;
  123. $this->modifiedColumns[] = FcrepfisPeer::FECREP;
  124. }
  125. }
  126. public function setNumrep($v)
  127. {
  128. if ($this->numrep !== $v) {
  129. $this->numrep = $v;
  130. $this->modifiedColumns[] = FcrepfisPeer::NUMREP;
  131. }
  132. }
  133. public function setMonrep($v)
  134. {
  135. if ($this->monrep !== $v) {
  136. $this->monrep = Herramientas::toFloat($v);
  137. $this->modifiedColumns[] = FcrepfisPeer::MONREP;
  138. }
  139. }
  140. public function setConrep($v)
  141. {
  142. if ($this->conrep !== $v) {
  143. $this->conrep = $v;
  144. $this->modifiedColumns[] = FcrepfisPeer::CONREP;
  145. }
  146. }
  147. public function setModo($v)
  148. {
  149. if ($this->modo !== $v) {
  150. $this->modo = $v;
  151. $this->modifiedColumns[] = FcrepfisPeer::MODO;
  152. }
  153. }
  154. public function setMonadi($v)
  155. {
  156. if ($this->monadi !== $v) {
  157. $this->monadi = Herramientas::toFloat($v);
  158. $this->modifiedColumns[] = FcrepfisPeer::MONADI;
  159. }
  160. }
  161. public function setFuerep($v)
  162. {
  163. if ($this->fuerep !== $v) {
  164. $this->fuerep = $v;
  165. $this->modifiedColumns[] = FcrepfisPeer::FUEREP;
  166. }
  167. }
  168. public function setFuesan($v)
  169. {
  170. if ($this->fuesan !== $v) {
  171. $this->fuesan = $v;
  172. $this->modifiedColumns[] = FcrepfisPeer::FUESAN;
  173. }
  174. }
  175. public function setFecrec($v)
  176. {
  177. if ($v !== null && !is_int($v)) {
  178. $ts = adodb_strtotime($v);
  179. if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecrec] from input: " . var_export($v, true));
  180. }
  181. } else {
  182. $ts = $v;
  183. }
  184. if ($this->fecrec !== $ts) {
  185. $this->fecrec = $ts;
  186. $this->modifiedColumns[] = FcrepfisPeer::FECREC;
  187. }
  188. }
  189. public function setId($v)
  190. {
  191. if ($this->id !== $v) {
  192. $this->id = $v;
  193. $this->modifiedColumns[] = FcrepfisPeer::ID;
  194. }
  195. }
  196. public function hydrate(ResultSet $rs, $startcol = 1)
  197. {
  198. try {
  199. $this->numlic = $rs->getString($startcol + 0);
  200. $this->funrec = $rs->getString($startcol + 1);
  201. $this->fecrep = $rs->getDate($startcol + 2, null);
  202. $this->numrep = $rs->getString($startcol + 3);
  203. $this->monrep = $rs->getFloat($startcol + 4);
  204. $this->conrep = $rs->getString($startcol + 5);
  205. $this->modo = $rs->getString($startcol + 6);
  206. $this->monadi = $rs->getFloat($startcol + 7);
  207. $this->fuerep = $rs->getString($startcol + 8);
  208. $this->fuesan = $rs->getString($startcol + 9);
  209. $this->fecrec = $rs->getDate($startcol + 10, null);
  210. $this->id = $rs->getInt($startcol + 11);
  211. $this->resetModified();
  212. $this->setNew(false);
  213. $this->afterHydrate();
  214. return $startcol + 12;
  215. } catch (Exception $e) {
  216. throw new PropelException("Error populating Fcrepfis object", $e);
  217. }
  218. }
  219. protected function afterHydrate()
  220. {
  221. }
  222. public function __call($m, $a)
  223. {
  224. $prefijo = substr($m,0,3);
  225. $metodo = strtolower(substr($m,3));
  226. if($prefijo=='get'){
  227. if(isset($this->$metodo)) return $this->$metodo;
  228. else return '';
  229. }elseif($prefijo=='set'){
  230. if(isset($this->$metodo)) $this->$metodo = $a[0];
  231. }else call_user_func_array($m, $a);
  232. }
  233. public function delete($con = null)
  234. {
  235. if ($this->isDeleted()) {
  236. throw new PropelException("This object has already been deleted.");
  237. }
  238. if ($con === null) {
  239. $con = Propel::getConnection(FcrepfisPeer::DATABASE_NAME);
  240. }
  241. try {
  242. $con->begin();
  243. FcrepfisPeer::doDelete($this, $con);
  244. $this->setDeleted(true);
  245. $con->commit();
  246. } catch (PropelException $e) {
  247. $con->rollback();
  248. throw $e;
  249. }
  250. }
  251. public function save($con = null)
  252. {
  253. if ($this->isDeleted()) {
  254. throw new PropelException("You cannot save an object that has been deleted.");
  255. }
  256. if ($con === null) {
  257. $con = Propel::getConnection(FcrepfisPeer::DATABASE_NAME);
  258. }
  259. try {
  260. $con->begin();
  261. $affectedRows = $this->doSave($con);
  262. $con->commit();
  263. return $affectedRows;
  264. } catch (PropelException $e) {
  265. $con->rollback();
  266. throw $e;
  267. }
  268. }
  269. protected function doSave($con)
  270. {
  271. $affectedRows = 0; if (!$this->alreadyInSave) {
  272. $this->alreadyInSave = true;
  273. if ($this->isModified()) {
  274. if ($this->isNew()) {
  275. $pk = FcrepfisPeer::doInsert($this, $con);
  276. $affectedRows += 1;
  277. $this->setId($pk);
  278. $this->setNew(false);
  279. } else {
  280. $affectedRows += FcrepfisPeer::doUpdate($this, $con);
  281. }
  282. $this->resetModified(); }
  283. $this->alreadyInSave = false;
  284. }
  285. return $affectedRows;
  286. }
  287. protected $validationFailures = array();
  288. public function getValidationFailures()
  289. {
  290. return $this->validationFailures;
  291. }
  292. public function validate($columns = null)
  293. {
  294. $res = $this->doValidate($columns);
  295. if ($res === true) {
  296. $this->validationFailures = array();
  297. return true;
  298. } else {
  299. $this->validationFailures = $res;
  300. return false;
  301. }
  302. }
  303. protected function doValidate($columns = null)
  304. {
  305. if (!$this->alreadyInValidation) {
  306. $this->alreadyInValidation = true;
  307. $retval = null;
  308. $failureMap = array();
  309. if (($retval = FcrepfisPeer::doValidate($this, $columns)) !== true) {
  310. $failureMap = array_merge($failureMap, $retval);
  311. }
  312. $this->alreadyInValidation = false;
  313. }
  314. return (!empty($failureMap) ? $failureMap : true);
  315. }
  316. public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
  317. {
  318. $pos = FcrepfisPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  319. return $this->getByPosition($pos);
  320. }
  321. public function getByPosition($pos)
  322. {
  323. switch($pos) {
  324. case 0:
  325. return $this->getNumlic();
  326. break;
  327. case 1:
  328. return $this->getFunrec();
  329. break;
  330. case 2:
  331. return $this->getFecrep();
  332. break;
  333. case 3:
  334. return $this->getNumrep();
  335. break;
  336. case 4:
  337. return $this->getMonrep();
  338. break;
  339. case 5:
  340. return $this->getConrep();
  341. break;
  342. case 6:
  343. return $this->getModo();
  344. break;
  345. case 7:
  346. return $this->getMonadi();
  347. break;
  348. case 8:
  349. return $this->getFuerep();
  350. break;
  351. case 9:
  352. return $this->getFuesan();
  353. break;
  354. case 10:
  355. return $this->getFecrec();
  356. break;
  357. case 11:
  358. return $this->getId();
  359. break;
  360. default:
  361. return null;
  362. break;
  363. } }
  364. public function toArray($keyType = BasePeer::TYPE_PHPNAME)
  365. {
  366. $keys = FcrepfisPeer::getFieldNames($keyType);
  367. $result = array(
  368. $keys[0] => $this->getNumlic(),
  369. $keys[1] => $this->getFunrec(),
  370. $keys[2] => $this->getFecrep(),
  371. $keys[3] => $this->getNumrep(),
  372. $keys[4] => $this->getMonrep(),
  373. $keys[5] => $this->getConrep(),
  374. $keys[6] => $this->getModo(),
  375. $keys[7] => $this->getMonadi(),
  376. $keys[8] => $this->getFuerep(),
  377. $keys[9] => $this->getFuesan(),
  378. $keys[10] => $this->getFecrec(),
  379. $keys[11] => $this->getId(),
  380. );
  381. return $result;
  382. }
  383. public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
  384. {
  385. $pos = FcrepfisPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  386. return $this->setByPosition($pos, $value);
  387. }
  388. public function setByPosition($pos, $value)
  389. {
  390. switch($pos) {
  391. case 0:
  392. $this->setNumlic($value);
  393. break;
  394. case 1:
  395. $this->setFunrec($value);
  396. break;
  397. case 2:
  398. $this->setFecrep($value);
  399. break;
  400. case 3:
  401. $this->setNumrep($value);
  402. break;
  403. case 4:
  404. $this->setMonrep($value);
  405. break;
  406. case 5:
  407. $this->setConrep($value);
  408. break;
  409. case 6:
  410. $this->setModo($value);
  411. break;
  412. case 7:
  413. $this->setMonadi($value);
  414. break;
  415. case 8:
  416. $this->setFuerep($value);
  417. break;
  418. case 9:
  419. $this->setFuesan($value);
  420. break;
  421. case 10:
  422. $this->setFecrec($value);
  423. break;
  424. case 11:
  425. $this->setId($value);
  426. break;
  427. } }
  428. public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
  429. {
  430. $keys = FcrepfisPeer::getFieldNames($keyType);
  431. if (array_key_exists($keys[0], $arr)) $this->setNumlic($arr[$keys[0]]);
  432. if (array_key_exists($keys[1], $arr)) $this->setFunrec($arr[$keys[1]]);
  433. if (array_key_exists($keys[2], $arr)) $this->setFecrep($arr[$keys[2]]);
  434. if (array_key_exists($keys[3], $arr)) $this->setNumrep($arr[$keys[3]]);
  435. if (array_key_exists($keys[4], $arr)) $this->setMonrep($arr[$keys[4]]);
  436. if (array_key_exists($keys[5], $arr)) $this->setConrep($arr[$keys[5]]);
  437. if (array_key_exists($keys[6], $arr)) $this->setModo($arr[$keys[6]]);
  438. if (array_key_exists($keys[7], $arr)) $this->setMonadi($arr[$keys[7]]);
  439. if (array_key_exists($keys[8], $arr)) $this->setFuerep($arr[$keys[8]]);
  440. if (array_key_exists($keys[9], $arr)) $this->setFuesan($arr[$keys[9]]);
  441. if (array_key_exists($keys[10], $arr)) $this->setFecrec($arr[$keys[10]]);
  442. if (array_key_exists($keys[11], $arr)) $this->setId($arr[$keys[11]]);
  443. }
  444. public function buildCriteria()
  445. {
  446. $criteria = new Criteria(FcrepfisPeer::DATABASE_NAME);
  447. if ($this->isColumnModified(FcrepfisPeer::NUMLIC)) $criteria->add(FcrepfisPeer::NUMLIC, $this->numlic);
  448. if ($this->isColumnModified(FcrepfisPeer::FUNREC)) $criteria->add(FcrepfisPeer::FUNREC, $this->funrec);
  449. if ($this->isColumnModified(FcrepfisPeer::FECREP)) $criteria->add(FcrepfisPeer::FECREP, $this->fecrep);
  450. if ($this->isColumnModified(FcrepfisPeer::NUMREP)) $criteria->add(FcrepfisPeer::NUMREP, $this->numrep);
  451. if ($this->isColumnModified(FcrepfisPeer::MONREP)) $criteria->add(FcrepfisPeer::MONREP, $this->monrep);
  452. if ($this->isColumnModified(FcrepfisPeer::CONREP)) $criteria->add(FcrepfisPeer::CONREP, $this->conrep);
  453. if ($this->isColumnModified(FcrepfisPeer::MODO)) $criteria->add(FcrepfisPeer::MODO, $this->modo);
  454. if ($this->isColumnModified(FcrepfisPeer::MONADI)) $criteria->add(FcrepfisPeer::MONADI, $this->monadi);
  455. if ($this->isColumnModified(FcrepfisPeer::FUEREP)) $criteria->add(FcrepfisPeer::FUEREP, $this->fuerep);
  456. if ($this->isColumnModified(FcrepfisPeer::FUESAN)) $criteria->add(FcrepfisPeer::FUESAN, $this->fuesan);
  457. if ($this->isColumnModified(FcrepfisPeer::FECREC)) $criteria->add(FcrepfisPeer::FECREC, $this->fecrec);
  458. if ($this->isColumnModified(FcrepfisPeer::ID)) $criteria->add(FcrepfisPeer::ID, $this->id);
  459. return $criteria;
  460. }
  461. public function buildPkeyCriteria()
  462. {
  463. $criteria = new Criteria(FcrepfisPeer::DATABASE_NAME);
  464. $criteria->add(FcrepfisPeer::ID, $this->id);
  465. return $criteria;
  466. }
  467. public function getPrimaryKey()
  468. {
  469. return $this->getId();
  470. }
  471. public function setPrimaryKey($key)
  472. {
  473. $this->setId($key);
  474. }
  475. public function copyInto($copyObj, $deepCopy = false)
  476. {
  477. $copyObj->setNumlic($this->numlic);
  478. $copyObj->setFunrec($this->funrec);
  479. $copyObj->setFecrep($this->fecrep);
  480. $copyObj->setNumrep($this->numrep);
  481. $copyObj->setMonrep($this->monrep);
  482. $copyObj->setConrep($this->conrep);
  483. $copyObj->setModo($this->modo);
  484. $copyObj->setMonadi($this->monadi);
  485. $copyObj->setFuerep($this->fuerep);
  486. $copyObj->setFuesan($this->fuesan);
  487. $copyObj->setFecrec($this->fecrec);
  488. $copyObj->setNew(true);
  489. $copyObj->setId(NULL);
  490. }
  491. public function copy($deepCopy = false)
  492. {
  493. $clazz = get_class($this);
  494. $copyObj = new $clazz();
  495. $this->copyInto($copyObj, $deepCopy);
  496. return $copyObj;
  497. }
  498. public function getPeer()
  499. {
  500. if (self::$peer === null) {
  501. self::$peer = new FcrepfisPeer();
  502. }
  503. return self::$peer;
  504. }
  505. }