PageRenderTime 55ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/model/om/BaseCidisniv.php

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