PageRenderTime 141ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/model/om/BaseFcsoldet2.php

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