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

/lib/model/om/BaseFcdprinm.php

https://github.com/cidesa/siga-universitario
PHP | 437 lines | 300 code | 137 blank | 0 comment | 36 complexity | 3f5772b3e56ea0286c0044033d6e5ba2 MD5 | raw file
  1. <?php
  2. abstract class BaseFcdprinm extends BaseObject implements Persistent {
  3. protected static $peer;
  4. protected $anovig;
  5. protected $antinm;
  6. protected $codestinm;
  7. protected $mondpr;
  8. protected $id;
  9. protected $alreadyInSave = false;
  10. protected $alreadyInValidation = false;
  11. public function getAnovig()
  12. {
  13. return trim($this->anovig);
  14. }
  15. public function getAntinm($val=false)
  16. {
  17. if($val) return number_format($this->antinm,2,',','.');
  18. else return $this->antinm;
  19. }
  20. public function getCodestinm()
  21. {
  22. return trim($this->codestinm);
  23. }
  24. public function getMondpr($val=false)
  25. {
  26. if($val) return number_format($this->mondpr,2,',','.');
  27. else return $this->mondpr;
  28. }
  29. public function getId()
  30. {
  31. return $this->id;
  32. }
  33. public function setAnovig($v)
  34. {
  35. if ($this->anovig !== $v) {
  36. $this->anovig = $v;
  37. $this->modifiedColumns[] = FcdprinmPeer::ANOVIG;
  38. }
  39. }
  40. public function setAntinm($v)
  41. {
  42. if ($this->antinm !== $v) {
  43. $this->antinm = Herramientas::toFloat($v);
  44. $this->modifiedColumns[] = FcdprinmPeer::ANTINM;
  45. }
  46. }
  47. public function setCodestinm($v)
  48. {
  49. if ($this->codestinm !== $v) {
  50. $this->codestinm = $v;
  51. $this->modifiedColumns[] = FcdprinmPeer::CODESTINM;
  52. }
  53. }
  54. public function setMondpr($v)
  55. {
  56. if ($this->mondpr !== $v) {
  57. $this->mondpr = Herramientas::toFloat($v);
  58. $this->modifiedColumns[] = FcdprinmPeer::MONDPR;
  59. }
  60. }
  61. public function setId($v)
  62. {
  63. if ($this->id !== $v) {
  64. $this->id = $v;
  65. $this->modifiedColumns[] = FcdprinmPeer::ID;
  66. }
  67. }
  68. public function hydrate(ResultSet $rs, $startcol = 1)
  69. {
  70. try {
  71. $this->anovig = $rs->getString($startcol + 0);
  72. $this->antinm = $rs->getFloat($startcol + 1);
  73. $this->codestinm = $rs->getString($startcol + 2);
  74. $this->mondpr = $rs->getFloat($startcol + 3);
  75. $this->id = $rs->getInt($startcol + 4);
  76. $this->resetModified();
  77. $this->setNew(false);
  78. $this->afterHydrate();
  79. return $startcol + 5;
  80. } catch (Exception $e) {
  81. throw new PropelException("Error populating Fcdprinm object", $e);
  82. }
  83. }
  84. protected function afterHydrate()
  85. {
  86. }
  87. public function __call($m, $a)
  88. {
  89. $prefijo = substr($m,0,3);
  90. $metodo = strtolower(substr($m,3));
  91. if($prefijo=='get'){
  92. if(isset($this->$metodo)) return $this->$metodo;
  93. else return '';
  94. }elseif($prefijo=='set'){
  95. if(isset($this->$metodo)) $this->$metodo = $a[0];
  96. }else call_user_func_array($m, $a);
  97. }
  98. public function delete($con = null)
  99. {
  100. if ($this->isDeleted()) {
  101. throw new PropelException("This object has already been deleted.");
  102. }
  103. if ($con === null) {
  104. $con = Propel::getConnection(FcdprinmPeer::DATABASE_NAME);
  105. }
  106. try {
  107. $con->begin();
  108. FcdprinmPeer::doDelete($this, $con);
  109. $this->setDeleted(true);
  110. $con->commit();
  111. } catch (PropelException $e) {
  112. $con->rollback();
  113. throw $e;
  114. }
  115. }
  116. public function save($con = null)
  117. {
  118. if ($this->isDeleted()) {
  119. throw new PropelException("You cannot save an object that has been deleted.");
  120. }
  121. if ($con === null) {
  122. $con = Propel::getConnection(FcdprinmPeer::DATABASE_NAME);
  123. }
  124. try {
  125. $con->begin();
  126. $affectedRows = $this->doSave($con);
  127. $con->commit();
  128. return $affectedRows;
  129. } catch (PropelException $e) {
  130. $con->rollback();
  131. throw $e;
  132. }
  133. }
  134. protected function doSave($con)
  135. {
  136. $affectedRows = 0; if (!$this->alreadyInSave) {
  137. $this->alreadyInSave = true;
  138. if ($this->isModified()) {
  139. if ($this->isNew()) {
  140. $pk = FcdprinmPeer::doInsert($this, $con);
  141. $affectedRows += 1;
  142. $this->setId($pk);
  143. $this->setNew(false);
  144. } else {
  145. $affectedRows += FcdprinmPeer::doUpdate($this, $con);
  146. }
  147. $this->resetModified(); }
  148. $this->alreadyInSave = false;
  149. }
  150. return $affectedRows;
  151. }
  152. protected $validationFailures = array();
  153. public function getValidationFailures()
  154. {
  155. return $this->validationFailures;
  156. }
  157. public function validate($columns = null)
  158. {
  159. $res = $this->doValidate($columns);
  160. if ($res === true) {
  161. $this->validationFailures = array();
  162. return true;
  163. } else {
  164. $this->validationFailures = $res;
  165. return false;
  166. }
  167. }
  168. protected function doValidate($columns = null)
  169. {
  170. if (!$this->alreadyInValidation) {
  171. $this->alreadyInValidation = true;
  172. $retval = null;
  173. $failureMap = array();
  174. if (($retval = FcdprinmPeer::doValidate($this, $columns)) !== true) {
  175. $failureMap = array_merge($failureMap, $retval);
  176. }
  177. $this->alreadyInValidation = false;
  178. }
  179. return (!empty($failureMap) ? $failureMap : true);
  180. }
  181. public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
  182. {
  183. $pos = FcdprinmPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  184. return $this->getByPosition($pos);
  185. }
  186. public function getByPosition($pos)
  187. {
  188. switch($pos) {
  189. case 0:
  190. return $this->getAnovig();
  191. break;
  192. case 1:
  193. return $this->getAntinm();
  194. break;
  195. case 2:
  196. return $this->getCodestinm();
  197. break;
  198. case 3:
  199. return $this->getMondpr();
  200. break;
  201. case 4:
  202. return $this->getId();
  203. break;
  204. default:
  205. return null;
  206. break;
  207. } }
  208. public function toArray($keyType = BasePeer::TYPE_PHPNAME)
  209. {
  210. $keys = FcdprinmPeer::getFieldNames($keyType);
  211. $result = array(
  212. $keys[0] => $this->getAnovig(),
  213. $keys[1] => $this->getAntinm(),
  214. $keys[2] => $this->getCodestinm(),
  215. $keys[3] => $this->getMondpr(),
  216. $keys[4] => $this->getId(),
  217. );
  218. return $result;
  219. }
  220. public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
  221. {
  222. $pos = FcdprinmPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  223. return $this->setByPosition($pos, $value);
  224. }
  225. public function setByPosition($pos, $value)
  226. {
  227. switch($pos) {
  228. case 0:
  229. $this->setAnovig($value);
  230. break;
  231. case 1:
  232. $this->setAntinm($value);
  233. break;
  234. case 2:
  235. $this->setCodestinm($value);
  236. break;
  237. case 3:
  238. $this->setMondpr($value);
  239. break;
  240. case 4:
  241. $this->setId($value);
  242. break;
  243. } }
  244. public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
  245. {
  246. $keys = FcdprinmPeer::getFieldNames($keyType);
  247. if (array_key_exists($keys[0], $arr)) $this->setAnovig($arr[$keys[0]]);
  248. if (array_key_exists($keys[1], $arr)) $this->setAntinm($arr[$keys[1]]);
  249. if (array_key_exists($keys[2], $arr)) $this->setCodestinm($arr[$keys[2]]);
  250. if (array_key_exists($keys[3], $arr)) $this->setMondpr($arr[$keys[3]]);
  251. if (array_key_exists($keys[4], $arr)) $this->setId($arr[$keys[4]]);
  252. }
  253. public function buildCriteria()
  254. {
  255. $criteria = new Criteria(FcdprinmPeer::DATABASE_NAME);
  256. if ($this->isColumnModified(FcdprinmPeer::ANOVIG)) $criteria->add(FcdprinmPeer::ANOVIG, $this->anovig);
  257. if ($this->isColumnModified(FcdprinmPeer::ANTINM)) $criteria->add(FcdprinmPeer::ANTINM, $this->antinm);
  258. if ($this->isColumnModified(FcdprinmPeer::CODESTINM)) $criteria->add(FcdprinmPeer::CODESTINM, $this->codestinm);
  259. if ($this->isColumnModified(FcdprinmPeer::MONDPR)) $criteria->add(FcdprinmPeer::MONDPR, $this->mondpr);
  260. if ($this->isColumnModified(FcdprinmPeer::ID)) $criteria->add(FcdprinmPeer::ID, $this->id);
  261. return $criteria;
  262. }
  263. public function buildPkeyCriteria()
  264. {
  265. $criteria = new Criteria(FcdprinmPeer::DATABASE_NAME);
  266. $criteria->add(FcdprinmPeer::ID, $this->id);
  267. return $criteria;
  268. }
  269. public function getPrimaryKey()
  270. {
  271. return $this->getId();
  272. }
  273. public function setPrimaryKey($key)
  274. {
  275. $this->setId($key);
  276. }
  277. public function copyInto($copyObj, $deepCopy = false)
  278. {
  279. $copyObj->setAnovig($this->anovig);
  280. $copyObj->setAntinm($this->antinm);
  281. $copyObj->setCodestinm($this->codestinm);
  282. $copyObj->setMondpr($this->mondpr);
  283. $copyObj->setNew(true);
  284. $copyObj->setId(NULL);
  285. }
  286. public function copy($deepCopy = false)
  287. {
  288. $clazz = get_class($this);
  289. $copyObj = new $clazz();
  290. $this->copyInto($copyObj, $deepCopy);
  291. return $copyObj;
  292. }
  293. public function getPeer()
  294. {
  295. if (self::$peer === null) {
  296. self::$peer = new FcdprinmPeer();
  297. }
  298. return self::$peer;
  299. }
  300. }