/lib/model/om/BaseFcrepliq.php

https://github.com/cidesa/siga-universitario · PHP · 576 lines · 395 code · 181 blank · 0 comment · 54 complexity · caab63e58a089d6053bc1ac81aa07954 MD5 · raw file

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