PageRenderTime 70ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/model/om/BaseFcfueprePeer.php

https://github.com/cidesa/siga-universitario
PHP | 498 lines | 321 code | 177 blank | 0 comment | 32 complexity | c8ffa71370321966a7b23ec517db2f6e MD5 | raw file
  1. <?php
  2. abstract class BaseFcfueprePeer {
  3. const DATABASE_NAME = 'propel';
  4. const TABLE_NAME = 'fcfuepre';
  5. const CLASS_DEFAULT = 'lib.model.Fcfuepre';
  6. const NUM_COLUMNS = 28;
  7. const NUM_LAZY_LOAD_COLUMNS = 0;
  8. const CODFUE = 'fcfuepre.CODFUE';
  9. const NOMFUE = 'fcfuepre.NOMFUE';
  10. const NOMABR = 'fcfuepre.NOMABR';
  11. const FRECOB = 'fcfuepre.FRECOB';
  12. const MONMOR = 'fcfuepre.MONMOR';
  13. const PERMOR = 'fcfuepre.PERMOR';
  14. const PROPAG = 'fcfuepre.PROPAG';
  15. const PERPPG = 'fcfuepre.PERPPG';
  16. const LIQACT = 'fcfuepre.LIQACT';
  17. const DEUFEC = 'fcfuepre.DEUFEC';
  18. const RECFEC = 'fcfuepre.RECFEC';
  19. const FECUFA = 'fcfuepre.FECUFA';
  20. const INGREC = 'fcfuepre.INGREC';
  21. const FUEING = 'fcfuepre.FUEING';
  22. const INIEJE = 'fcfuepre.INIEJE';
  23. const FINEJE = 'fcfuepre.FINEJE';
  24. const DIAVSO = 'fcfuepre.DIAVSO';
  25. const CODPREI = 'fcfuepre.CODPREI';
  26. const DEUFRA = 'fcfuepre.DEUFRA';
  27. const AUTLIQ = 'fcfuepre.AUTLIQ';
  28. const SIMPRE = 'fcfuepre.SIMPRE';
  29. const FECCIE = 'fcfuepre.FECCIE';
  30. const TIPMUL = 'fcfuepre.TIPMUL';
  31. const FECEST = 'fcfuepre.FECEST';
  32. const DIAVEN = 'fcfuepre.DIAVEN';
  33. const TIPVEN = 'fcfuepre.TIPVEN';
  34. const TIPFUE = 'fcfuepre.TIPFUE';
  35. const ID = 'fcfuepre.ID';
  36. private static $phpNameMap = null;
  37. private static $fieldNames = array (
  38. BasePeer::TYPE_PHPNAME => array ('Codfue', 'Nomfue', 'Nomabr', 'Frecob', 'Monmor', 'Permor', 'Propag', 'Perppg', 'Liqact', 'Deufec', 'Recfec', 'Fecufa', 'Ingrec', 'Fueing', 'Inieje', 'Fineje', 'Diavso', 'Codprei', 'Deufra', 'Autliq', 'Simpre', 'Feccie', 'Tipmul', 'Fecest', 'Diaven', 'Tipven', 'Tipfue', 'Id', ),
  39. BasePeer::TYPE_COLNAME => array (FcfueprePeer::CODFUE, FcfueprePeer::NOMFUE, FcfueprePeer::NOMABR, FcfueprePeer::FRECOB, FcfueprePeer::MONMOR, FcfueprePeer::PERMOR, FcfueprePeer::PROPAG, FcfueprePeer::PERPPG, FcfueprePeer::LIQACT, FcfueprePeer::DEUFEC, FcfueprePeer::RECFEC, FcfueprePeer::FECUFA, FcfueprePeer::INGREC, FcfueprePeer::FUEING, FcfueprePeer::INIEJE, FcfueprePeer::FINEJE, FcfueprePeer::DIAVSO, FcfueprePeer::CODPREI, FcfueprePeer::DEUFRA, FcfueprePeer::AUTLIQ, FcfueprePeer::SIMPRE, FcfueprePeer::FECCIE, FcfueprePeer::TIPMUL, FcfueprePeer::FECEST, FcfueprePeer::DIAVEN, FcfueprePeer::TIPVEN, FcfueprePeer::TIPFUE, FcfueprePeer::ID, ),
  40. BasePeer::TYPE_FIELDNAME => array ('codfue', 'nomfue', 'nomabr', 'frecob', 'monmor', 'permor', 'propag', 'perppg', 'liqact', 'deufec', 'recfec', 'fecufa', 'ingrec', 'fueing', 'inieje', 'fineje', 'diavso', 'codprei', 'deufra', 'autliq', 'simpre', 'feccie', 'tipmul', 'fecest', 'diaven', 'tipven', 'tipfue', 'id', ),
  41. BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, )
  42. );
  43. private static $fieldKeys = array (
  44. BasePeer::TYPE_PHPNAME => array ('Codfue' => 0, 'Nomfue' => 1, 'Nomabr' => 2, 'Frecob' => 3, 'Monmor' => 4, 'Permor' => 5, 'Propag' => 6, 'Perppg' => 7, 'Liqact' => 8, 'Deufec' => 9, 'Recfec' => 10, 'Fecufa' => 11, 'Ingrec' => 12, 'Fueing' => 13, 'Inieje' => 14, 'Fineje' => 15, 'Diavso' => 16, 'Codprei' => 17, 'Deufra' => 18, 'Autliq' => 19, 'Simpre' => 20, 'Feccie' => 21, 'Tipmul' => 22, 'Fecest' => 23, 'Diaven' => 24, 'Tipven' => 25, 'Tipfue' => 26, 'Id' => 27, ),
  45. BasePeer::TYPE_COLNAME => array (FcfueprePeer::CODFUE => 0, FcfueprePeer::NOMFUE => 1, FcfueprePeer::NOMABR => 2, FcfueprePeer::FRECOB => 3, FcfueprePeer::MONMOR => 4, FcfueprePeer::PERMOR => 5, FcfueprePeer::PROPAG => 6, FcfueprePeer::PERPPG => 7, FcfueprePeer::LIQACT => 8, FcfueprePeer::DEUFEC => 9, FcfueprePeer::RECFEC => 10, FcfueprePeer::FECUFA => 11, FcfueprePeer::INGREC => 12, FcfueprePeer::FUEING => 13, FcfueprePeer::INIEJE => 14, FcfueprePeer::FINEJE => 15, FcfueprePeer::DIAVSO => 16, FcfueprePeer::CODPREI => 17, FcfueprePeer::DEUFRA => 18, FcfueprePeer::AUTLIQ => 19, FcfueprePeer::SIMPRE => 20, FcfueprePeer::FECCIE => 21, FcfueprePeer::TIPMUL => 22, FcfueprePeer::FECEST => 23, FcfueprePeer::DIAVEN => 24, FcfueprePeer::TIPVEN => 25, FcfueprePeer::TIPFUE => 26, FcfueprePeer::ID => 27, ),
  46. BasePeer::TYPE_FIELDNAME => array ('codfue' => 0, 'nomfue' => 1, 'nomabr' => 2, 'frecob' => 3, 'monmor' => 4, 'permor' => 5, 'propag' => 6, 'perppg' => 7, 'liqact' => 8, 'deufec' => 9, 'recfec' => 10, 'fecufa' => 11, 'ingrec' => 12, 'fueing' => 13, 'inieje' => 14, 'fineje' => 15, 'diavso' => 16, 'codprei' => 17, 'deufra' => 18, 'autliq' => 19, 'simpre' => 20, 'feccie' => 21, 'tipmul' => 22, 'fecest' => 23, 'diaven' => 24, 'tipven' => 25, 'tipfue' => 26, 'id' => 27, ),
  47. BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, )
  48. );
  49. public static function getMapBuilder()
  50. {
  51. include_once 'lib/model/map/FcfuepreMapBuilder.php';
  52. return BasePeer::getMapBuilder('lib.model.map.FcfuepreMapBuilder');
  53. }
  54. public static function getPhpNameMap()
  55. {
  56. if (self::$phpNameMap === null) {
  57. $map = FcfueprePeer::getTableMap();
  58. $columns = $map->getColumns();
  59. $nameMap = array();
  60. foreach ($columns as $column) {
  61. $nameMap[$column->getPhpName()] = $column->getColumnName();
  62. }
  63. self::$phpNameMap = $nameMap;
  64. }
  65. return self::$phpNameMap;
  66. }
  67. static public function translateFieldName($name, $fromType, $toType)
  68. {
  69. $toNames = self::getFieldNames($toType);
  70. $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
  71. if ($key === null) {
  72. throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
  73. }
  74. return $toNames[$key];
  75. }
  76. static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
  77. {
  78. if (!array_key_exists($type, self::$fieldNames)) {
  79. throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
  80. }
  81. return self::$fieldNames[$type];
  82. }
  83. public static function alias($alias, $column)
  84. {
  85. return str_replace(FcfueprePeer::TABLE_NAME.'.', $alias.'.', $column);
  86. }
  87. public static function addSelectColumns(Criteria $criteria)
  88. {
  89. $criteria->addSelectColumn(FcfueprePeer::CODFUE);
  90. $criteria->addSelectColumn(FcfueprePeer::NOMFUE);
  91. $criteria->addSelectColumn(FcfueprePeer::NOMABR);
  92. $criteria->addSelectColumn(FcfueprePeer::FRECOB);
  93. $criteria->addSelectColumn(FcfueprePeer::MONMOR);
  94. $criteria->addSelectColumn(FcfueprePeer::PERMOR);
  95. $criteria->addSelectColumn(FcfueprePeer::PROPAG);
  96. $criteria->addSelectColumn(FcfueprePeer::PERPPG);
  97. $criteria->addSelectColumn(FcfueprePeer::LIQACT);
  98. $criteria->addSelectColumn(FcfueprePeer::DEUFEC);
  99. $criteria->addSelectColumn(FcfueprePeer::RECFEC);
  100. $criteria->addSelectColumn(FcfueprePeer::FECUFA);
  101. $criteria->addSelectColumn(FcfueprePeer::INGREC);
  102. $criteria->addSelectColumn(FcfueprePeer::FUEING);
  103. $criteria->addSelectColumn(FcfueprePeer::INIEJE);
  104. $criteria->addSelectColumn(FcfueprePeer::FINEJE);
  105. $criteria->addSelectColumn(FcfueprePeer::DIAVSO);
  106. $criteria->addSelectColumn(FcfueprePeer::CODPREI);
  107. $criteria->addSelectColumn(FcfueprePeer::DEUFRA);
  108. $criteria->addSelectColumn(FcfueprePeer::AUTLIQ);
  109. $criteria->addSelectColumn(FcfueprePeer::SIMPRE);
  110. $criteria->addSelectColumn(FcfueprePeer::FECCIE);
  111. $criteria->addSelectColumn(FcfueprePeer::TIPMUL);
  112. $criteria->addSelectColumn(FcfueprePeer::FECEST);
  113. $criteria->addSelectColumn(FcfueprePeer::DIAVEN);
  114. $criteria->addSelectColumn(FcfueprePeer::TIPVEN);
  115. $criteria->addSelectColumn(FcfueprePeer::TIPFUE);
  116. $criteria->addSelectColumn(FcfueprePeer::ID);
  117. }
  118. const COUNT = 'COUNT(fcfuepre.ID)';
  119. const COUNT_DISTINCT = 'COUNT(DISTINCT fcfuepre.ID)';
  120. public static function doCount(Criteria $criteria, $distinct = false, $con = null)
  121. {
  122. $criteria = clone $criteria;
  123. $criteria->clearSelectColumns()->clearOrderByColumns();
  124. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  125. $criteria->addSelectColumn(FcfueprePeer::COUNT_DISTINCT);
  126. } else {
  127. $criteria->addSelectColumn(FcfueprePeer::COUNT);
  128. }
  129. foreach($criteria->getGroupByColumns() as $column)
  130. {
  131. $criteria->addSelectColumn($column);
  132. }
  133. $rs = FcfueprePeer::doSelectRS($criteria, $con);
  134. if ($rs->next()) {
  135. return $rs->getInt(1);
  136. } else {
  137. return 0;
  138. }
  139. }
  140. public static function doSelectOne(Criteria $criteria, $con = null)
  141. {
  142. $critcopy = clone $criteria;
  143. $critcopy->setLimit(1);
  144. $objects = FcfueprePeer::doSelect($critcopy, $con);
  145. if ($objects) {
  146. return $objects[0];
  147. }
  148. return null;
  149. }
  150. public static function doSelect(Criteria $criteria, $con = null)
  151. {
  152. return FcfueprePeer::populateObjects(FcfueprePeer::doSelectRS($criteria, $con));
  153. }
  154. public static function doSelectRS(Criteria $criteria, $con = null)
  155. {
  156. if ($con === null) {
  157. $con = Propel::getConnection(self::DATABASE_NAME);
  158. }
  159. if (!$criteria->getSelectColumns()) {
  160. $criteria = clone $criteria;
  161. FcfueprePeer::addSelectColumns($criteria);
  162. }
  163. $criteria->setDbName(self::DATABASE_NAME);
  164. return BasePeer::doSelect($criteria, $con);
  165. }
  166. public static function populateObjects(ResultSet $rs)
  167. {
  168. $results = array();
  169. $cls = FcfueprePeer::getOMClass();
  170. $cls = Propel::import($cls);
  171. while($rs->next()) {
  172. $obj = new $cls();
  173. $obj->hydrate($rs);
  174. $results[] = $obj;
  175. }
  176. return $results;
  177. }
  178. public static function getTableMap()
  179. {
  180. return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
  181. }
  182. public static function getOMClass()
  183. {
  184. return FcfueprePeer::CLASS_DEFAULT;
  185. }
  186. public static function doInsert($values, $con = null)
  187. {
  188. if ($con === null) {
  189. $con = Propel::getConnection(self::DATABASE_NAME);
  190. }
  191. if ($values instanceof Criteria) {
  192. $criteria = clone $values; } else {
  193. $criteria = $values->buildCriteria(); }
  194. $criteria->remove(FcfueprePeer::ID);
  195. $criteria->setDbName(self::DATABASE_NAME);
  196. try {
  197. $con->begin();
  198. $pk = BasePeer::doInsert($criteria, $con);
  199. $con->commit();
  200. } catch(PropelException $e) {
  201. $con->rollback();
  202. throw $e;
  203. }
  204. return $pk;
  205. }
  206. public static function doUpdate($values, $con = null)
  207. {
  208. if ($con === null) {
  209. $con = Propel::getConnection(self::DATABASE_NAME);
  210. }
  211. $selectCriteria = new Criteria(self::DATABASE_NAME);
  212. if ($values instanceof Criteria) {
  213. $criteria = clone $values;
  214. $comparison = $criteria->getComparison(FcfueprePeer::ID);
  215. $selectCriteria->add(FcfueprePeer::ID, $criteria->remove(FcfueprePeer::ID), $comparison);
  216. } else { $criteria = $values->buildCriteria(); $selectCriteria = $values->buildPkeyCriteria(); }
  217. $criteria->setDbName(self::DATABASE_NAME);
  218. return BasePeer::doUpdate($selectCriteria, $criteria, $con);
  219. }
  220. public static function doDeleteAll($con = null)
  221. {
  222. if ($con === null) {
  223. $con = Propel::getConnection(self::DATABASE_NAME);
  224. }
  225. $affectedRows = 0; try {
  226. $con->begin();
  227. $affectedRows += BasePeer::doDeleteAll(FcfueprePeer::TABLE_NAME, $con);
  228. $con->commit();
  229. return $affectedRows;
  230. } catch (PropelException $e) {
  231. $con->rollback();
  232. throw $e;
  233. }
  234. }
  235. public static function doDelete($values, $con = null)
  236. {
  237. if ($con === null) {
  238. $con = Propel::getConnection(FcfueprePeer::DATABASE_NAME);
  239. }
  240. if ($values instanceof Criteria) {
  241. $criteria = clone $values; } elseif ($values instanceof Fcfuepre) {
  242. $criteria = $values->buildPkeyCriteria();
  243. } else {
  244. $criteria = new Criteria(self::DATABASE_NAME);
  245. $criteria->add(FcfueprePeer::ID, (array) $values, Criteria::IN);
  246. }
  247. $criteria->setDbName(self::DATABASE_NAME);
  248. $affectedRows = 0;
  249. try {
  250. $con->begin();
  251. $affectedRows += BasePeer::doDelete($criteria, $con);
  252. $con->commit();
  253. return $affectedRows;
  254. } catch (PropelException $e) {
  255. $con->rollback();
  256. throw $e;
  257. }
  258. }
  259. public static function doValidate(Fcfuepre $obj, $cols = null)
  260. {
  261. $columns = array();
  262. if ($cols) {
  263. $dbMap = Propel::getDatabaseMap(FcfueprePeer::DATABASE_NAME);
  264. $tableMap = $dbMap->getTable(FcfueprePeer::TABLE_NAME);
  265. if (! is_array($cols)) {
  266. $cols = array($cols);
  267. }
  268. foreach($cols as $colName) {
  269. if ($tableMap->containsColumn($colName)) {
  270. $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
  271. $columns[$colName] = $obj->$get();
  272. }
  273. }
  274. } else {
  275. }
  276. $res = BasePeer::doValidate(FcfueprePeer::DATABASE_NAME, FcfueprePeer::TABLE_NAME, $columns);
  277. if ($res !== true) {
  278. $request = sfContext::getInstance()->getRequest();
  279. foreach ($res as $failed) {
  280. $col = FcfueprePeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
  281. $request->setError($col, $failed->getMessage());
  282. }
  283. }
  284. return $res;
  285. }
  286. public static function retrieveByPK($pk, $con = null)
  287. {
  288. if ($con === null) {
  289. $con = Propel::getConnection(self::DATABASE_NAME);
  290. }
  291. $criteria = new Criteria(FcfueprePeer::DATABASE_NAME);
  292. $criteria->add(FcfueprePeer::ID, $pk);
  293. $v = FcfueprePeer::doSelect($criteria, $con);
  294. return !empty($v) > 0 ? $v[0] : null;
  295. }
  296. public static function retrieveByPKs($pks, $con = null)
  297. {
  298. if ($con === null) {
  299. $con = Propel::getConnection(self::DATABASE_NAME);
  300. }
  301. $objs = null;
  302. if (empty($pks)) {
  303. $objs = array();
  304. } else {
  305. $criteria = new Criteria();
  306. $criteria->add(FcfueprePeer::ID, $pks, Criteria::IN);
  307. $objs = FcfueprePeer::doSelect($criteria, $con);
  308. }
  309. return $objs;
  310. }
  311. }
  312. if (Propel::isInit()) {
  313. try {
  314. BaseFcfueprePeer::getMapBuilder();
  315. } catch (Exception $e) {
  316. Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
  317. }
  318. } else {
  319. require_once 'lib/model/map/FcfuepreMapBuilder.php';
  320. Propel::registerMapBuilder('lib.model.map.FcfuepreMapBuilder');
  321. }