/lib/model/om/BaseFcaliinm.php

https://github.com/cidesa/siga-universitario · PHP · 541 lines · 371 code · 170 blank · 0 comment · 49 complexity · 37480ef2782a392849388ea5a2583974 MD5 · raw file

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