BaseKataoMemberDepositPeer.php 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899
  1. <?php
  2. /**
  3. * Base static class for performing query and update operations on the 'katao_member_deposit' table.
  4. *
  5. *
  6. *
  7. * @package lib.model.om
  8. */
  9. abstract class BaseKataoMemberDepositPeer {
  10. /** the default database name for this class */
  11. const DATABASE_NAME = 'propel';
  12. /** the table name for this class */
  13. const TABLE_NAME = 'katao_member_deposit';
  14. /** A class that can be returned by this peer. */
  15. const CLASS_DEFAULT = 'lib.model.KataoMemberDeposit';
  16. /** The total number of columns. */
  17. const NUM_COLUMNS = 14;
  18. /** The number of lazy-loaded columns. */
  19. const NUM_LAZY_LOAD_COLUMNS = 0;
  20. /** the column name for the ID field */
  21. const ID = 'katao_member_deposit.ID';
  22. /** the column name for the KATAO_MEMBER_ID field */
  23. const KATAO_MEMBER_ID = 'katao_member_deposit.KATAO_MEMBER_ID';
  24. /** the column name for the AMOUNT field */
  25. const AMOUNT = 'katao_member_deposit.AMOUNT';
  26. /** the column name for the COMMENT field */
  27. const COMMENT = 'katao_member_deposit.COMMENT';
  28. /** the column name for the CURRENCY field */
  29. const CURRENCY = 'katao_member_deposit.CURRENCY';
  30. /** the column name for the PAYMENT_MODE field */
  31. const PAYMENT_MODE = 'katao_member_deposit.PAYMENT_MODE';
  32. /** the column name for the CHECK_NUMBER field */
  33. const CHECK_NUMBER = 'katao_member_deposit.CHECK_NUMBER';
  34. /** the column name for the CHECK_BANK field */
  35. const CHECK_BANK = 'katao_member_deposit.CHECK_BANK';
  36. /** the column name for the CHECK_DEPOSIT field */
  37. const CHECK_DEPOSIT = 'katao_member_deposit.CHECK_DEPOSIT';
  38. /** the column name for the STATUS field */
  39. const STATUS = 'katao_member_deposit.STATUS';
  40. /** the column name for the VALUED_AT field */
  41. const VALUED_AT = 'katao_member_deposit.VALUED_AT';
  42. /** the column name for the VALID_UNTIL field */
  43. const VALID_UNTIL = 'katao_member_deposit.VALID_UNTIL';
  44. /** the column name for the CREATED_AT field */
  45. const CREATED_AT = 'katao_member_deposit.CREATED_AT';
  46. /** the column name for the UPDATED_AT field */
  47. const UPDATED_AT = 'katao_member_deposit.UPDATED_AT';
  48. /** The PHP to DB Name Mapping */
  49. private static $phpNameMap = null;
  50. /**
  51. * holds an array of fieldnames
  52. *
  53. * first dimension keys are the type constants
  54. * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
  55. */
  56. private static $fieldNames = array (
  57. BasePeer::TYPE_PHPNAME => array ('Id', 'KataoMemberId', 'Amount', 'Comment', 'Currency', 'PaymentMode', 'CheckNumber', 'CheckBank', 'CheckDeposit', 'Status', 'ValuedAt', 'ValidUntil', 'CreatedAt', 'UpdatedAt', ),
  58. BasePeer::TYPE_COLNAME => array (KataoMemberDepositPeer::ID, KataoMemberDepositPeer::KATAO_MEMBER_ID, KataoMemberDepositPeer::AMOUNT, KataoMemberDepositPeer::COMMENT, KataoMemberDepositPeer::CURRENCY, KataoMemberDepositPeer::PAYMENT_MODE, KataoMemberDepositPeer::CHECK_NUMBER, KataoMemberDepositPeer::CHECK_BANK, KataoMemberDepositPeer::CHECK_DEPOSIT, KataoMemberDepositPeer::STATUS, KataoMemberDepositPeer::VALUED_AT, KataoMemberDepositPeer::VALID_UNTIL, KataoMemberDepositPeer::CREATED_AT, KataoMemberDepositPeer::UPDATED_AT, ),
  59. BasePeer::TYPE_FIELDNAME => array ('id', 'katao_member_id', 'amount', 'comment', 'currency', 'payment_mode', 'check_number', 'check_bank', 'check_deposit', 'status', 'valued_at', 'valid_until', 'created_at', 'updated_at', ),
  60. BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
  61. );
  62. /**
  63. * holds an array of keys for quick access to the fieldnames array
  64. *
  65. * first dimension keys are the type constants
  66. * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
  67. */
  68. private static $fieldKeys = array (
  69. BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'KataoMemberId' => 1, 'Amount' => 2, 'Comment' => 3, 'Currency' => 4, 'PaymentMode' => 5, 'CheckNumber' => 6, 'CheckBank' => 7, 'CheckDeposit' => 8, 'Status' => 9, 'ValuedAt' => 10, 'ValidUntil' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, ),
  70. BasePeer::TYPE_COLNAME => array (KataoMemberDepositPeer::ID => 0, KataoMemberDepositPeer::KATAO_MEMBER_ID => 1, KataoMemberDepositPeer::AMOUNT => 2, KataoMemberDepositPeer::COMMENT => 3, KataoMemberDepositPeer::CURRENCY => 4, KataoMemberDepositPeer::PAYMENT_MODE => 5, KataoMemberDepositPeer::CHECK_NUMBER => 6, KataoMemberDepositPeer::CHECK_BANK => 7, KataoMemberDepositPeer::CHECK_DEPOSIT => 8, KataoMemberDepositPeer::STATUS => 9, KataoMemberDepositPeer::VALUED_AT => 10, KataoMemberDepositPeer::VALID_UNTIL => 11, KataoMemberDepositPeer::CREATED_AT => 12, KataoMemberDepositPeer::UPDATED_AT => 13, ),
  71. BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'katao_member_id' => 1, 'amount' => 2, 'comment' => 3, 'currency' => 4, 'payment_mode' => 5, 'check_number' => 6, 'check_bank' => 7, 'check_deposit' => 8, 'status' => 9, 'valued_at' => 10, 'valid_until' => 11, 'created_at' => 12, 'updated_at' => 13, ),
  72. BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
  73. );
  74. /**
  75. * @return MapBuilder the map builder for this peer
  76. * @throws PropelException Any exceptions caught during processing will be
  77. * rethrown wrapped into a PropelException.
  78. */
  79. public static function getMapBuilder()
  80. {
  81. return BasePeer::getMapBuilder('lib.model.map.KataoMemberDepositMapBuilder');
  82. }
  83. /**
  84. * Gets a map (hash) of PHP names to DB column names.
  85. *
  86. * @return array The PHP to DB name map for this peer
  87. * @throws PropelException Any exceptions caught during processing will be
  88. * rethrown wrapped into a PropelException.
  89. * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
  90. */
  91. public static function getPhpNameMap()
  92. {
  93. if (self::$phpNameMap === null) {
  94. $map = KataoMemberDepositPeer::getTableMap();
  95. $columns = $map->getColumns();
  96. $nameMap = array();
  97. foreach ($columns as $column) {
  98. $nameMap[$column->getPhpName()] = $column->getColumnName();
  99. }
  100. self::$phpNameMap = $nameMap;
  101. }
  102. return self::$phpNameMap;
  103. }
  104. /**
  105. * Translates a fieldname to another type
  106. *
  107. * @param string $name field name
  108. * @param string $fromType One of the class type constants TYPE_PHPNAME,
  109. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  110. * @param string $toType One of the class type constants
  111. * @return string translated name of the field.
  112. */
  113. static public function translateFieldName($name, $fromType, $toType)
  114. {
  115. $toNames = self::getFieldNames($toType);
  116. $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
  117. if ($key === null) {
  118. throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
  119. }
  120. return $toNames[$key];
  121. }
  122. /**
  123. * Returns an array of of field names.
  124. *
  125. * @param string $type The type of fieldnames to return:
  126. * One of the class type constants TYPE_PHPNAME,
  127. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  128. * @return array A list of field names
  129. */
  130. static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
  131. {
  132. if (!array_key_exists($type, self::$fieldNames)) {
  133. 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.');
  134. }
  135. return self::$fieldNames[$type];
  136. }
  137. /**
  138. * Convenience method which changes table.column to alias.column.
  139. *
  140. * Using this method you can maintain SQL abstraction while using column aliases.
  141. * <code>
  142. * $c->addAlias("alias1", TablePeer::TABLE_NAME);
  143. * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
  144. * </code>
  145. * @param string $alias The alias for the current table.
  146. * @param string $column The column name for current table. (i.e. KataoMemberDepositPeer::COLUMN_NAME).
  147. * @return string
  148. */
  149. public static function alias($alias, $column)
  150. {
  151. return str_replace(KataoMemberDepositPeer::TABLE_NAME.'.', $alias.'.', $column);
  152. }
  153. /**
  154. * Add all the columns needed to create a new object.
  155. *
  156. * Note: any columns that were marked with lazyLoad="true" in the
  157. * XML schema will not be added to the select list and only loaded
  158. * on demand.
  159. *
  160. * @param criteria object containing the columns to add.
  161. * @throws PropelException Any exceptions caught during processing will be
  162. * rethrown wrapped into a PropelException.
  163. */
  164. public static function addSelectColumns(Criteria $criteria)
  165. {
  166. $criteria->addSelectColumn(KataoMemberDepositPeer::ID);
  167. $criteria->addSelectColumn(KataoMemberDepositPeer::KATAO_MEMBER_ID);
  168. $criteria->addSelectColumn(KataoMemberDepositPeer::AMOUNT);
  169. $criteria->addSelectColumn(KataoMemberDepositPeer::COMMENT);
  170. $criteria->addSelectColumn(KataoMemberDepositPeer::CURRENCY);
  171. $criteria->addSelectColumn(KataoMemberDepositPeer::PAYMENT_MODE);
  172. $criteria->addSelectColumn(KataoMemberDepositPeer::CHECK_NUMBER);
  173. $criteria->addSelectColumn(KataoMemberDepositPeer::CHECK_BANK);
  174. $criteria->addSelectColumn(KataoMemberDepositPeer::CHECK_DEPOSIT);
  175. $criteria->addSelectColumn(KataoMemberDepositPeer::STATUS);
  176. $criteria->addSelectColumn(KataoMemberDepositPeer::VALUED_AT);
  177. $criteria->addSelectColumn(KataoMemberDepositPeer::VALID_UNTIL);
  178. $criteria->addSelectColumn(KataoMemberDepositPeer::CREATED_AT);
  179. $criteria->addSelectColumn(KataoMemberDepositPeer::UPDATED_AT);
  180. }
  181. const COUNT = 'COUNT(katao_member_deposit.ID)';
  182. const COUNT_DISTINCT = 'COUNT(DISTINCT katao_member_deposit.ID)';
  183. /**
  184. * Returns the number of rows matching criteria.
  185. *
  186. * @param Criteria $criteria
  187. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  188. * @param Connection $con
  189. * @return int Number of matching rows.
  190. */
  191. public static function doCount(Criteria $criteria, $distinct = false, $con = null)
  192. {
  193. // we're going to modify criteria, so copy it first
  194. $criteria = clone $criteria;
  195. // clear out anything that might confuse the ORDER BY clause
  196. $criteria->clearSelectColumns()->clearOrderByColumns();
  197. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  198. $criteria->addSelectColumn(KataoMemberDepositPeer::COUNT_DISTINCT);
  199. } else {
  200. $criteria->addSelectColumn(KataoMemberDepositPeer::COUNT);
  201. }
  202. // just in case we're grouping: add those columns to the select statement
  203. foreach($criteria->getGroupByColumns() as $column)
  204. {
  205. $criteria->addSelectColumn($column);
  206. }
  207. $rs = KataoMemberDepositPeer::doSelectRS($criteria, $con);
  208. if ($rs->next()) {
  209. return $rs->getInt(1);
  210. } else {
  211. // no rows returned; we infer that means 0 matches.
  212. return 0;
  213. }
  214. }
  215. /**
  216. * Method to select one object from the DB.
  217. *
  218. * @param Criteria $criteria object used to create the SELECT statement.
  219. * @param Connection $con
  220. * @return KataoMemberDeposit
  221. * @throws PropelException Any exceptions caught during processing will be
  222. * rethrown wrapped into a PropelException.
  223. */
  224. public static function doSelectOne(Criteria $criteria, $con = null)
  225. {
  226. $critcopy = clone $criteria;
  227. $critcopy->setLimit(1);
  228. $objects = KataoMemberDepositPeer::doSelect($critcopy, $con);
  229. if ($objects) {
  230. return $objects[0];
  231. }
  232. return null;
  233. }
  234. /**
  235. * Method to do selects.
  236. *
  237. * @param Criteria $criteria The Criteria object used to build the SELECT statement.
  238. * @param Connection $con
  239. * @return array Array of selected Objects
  240. * @throws PropelException Any exceptions caught during processing will be
  241. * rethrown wrapped into a PropelException.
  242. */
  243. public static function doSelect(Criteria $criteria, $con = null)
  244. {
  245. return KataoMemberDepositPeer::populateObjects(KataoMemberDepositPeer::doSelectRS($criteria, $con));
  246. }
  247. /**
  248. * Prepares the Criteria object and uses the parent doSelect()
  249. * method to get a ResultSet.
  250. *
  251. * Use this method directly if you want to just get the resultset
  252. * (instead of an array of objects).
  253. *
  254. * @param Criteria $criteria The Criteria object used to build the SELECT statement.
  255. * @param Connection $con the connection to use
  256. * @throws PropelException Any exceptions caught during processing will be
  257. * rethrown wrapped into a PropelException.
  258. * @return ResultSet The resultset object with numerically-indexed fields.
  259. * @see BasePeer::doSelect()
  260. */
  261. public static function doSelectRS(Criteria $criteria, $con = null)
  262. {
  263. foreach (sfMixer::getCallables('BaseKataoMemberDepositPeer:doSelectRS:doSelectRS') as $callable)
  264. {
  265. call_user_func($callable, 'BaseKataoMemberDepositPeer', $criteria, $con);
  266. }
  267. if ($con === null) {
  268. $con = Propel::getConnection(self::DATABASE_NAME);
  269. }
  270. if (!$criteria->getSelectColumns()) {
  271. $criteria = clone $criteria;
  272. KataoMemberDepositPeer::addSelectColumns($criteria);
  273. }
  274. // Set the correct dbName
  275. $criteria->setDbName(self::DATABASE_NAME);
  276. // BasePeer returns a Creole ResultSet, set to return
  277. // rows indexed numerically.
  278. return BasePeer::doSelect($criteria, $con);
  279. }
  280. /**
  281. * The returned array will contain objects of the default type or
  282. * objects that inherit from the default.
  283. *
  284. * @throws PropelException Any exceptions caught during processing will be
  285. * rethrown wrapped into a PropelException.
  286. */
  287. public static function populateObjects(ResultSet $rs)
  288. {
  289. $results = array();
  290. // set the class once to avoid overhead in the loop
  291. $cls = KataoMemberDepositPeer::getOMClass();
  292. $cls = sfPropel::import($cls);
  293. // populate the object(s)
  294. while($rs->next()) {
  295. $obj = new $cls();
  296. $obj->hydrate($rs);
  297. $results[] = $obj;
  298. }
  299. return $results;
  300. }
  301. /**
  302. * Returns the number of rows matching criteria, joining the related KataoMember table
  303. *
  304. * @param Criteria $c
  305. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  306. * @param Connection $con
  307. * @return int Number of matching rows.
  308. */
  309. public static function doCountJoinKataoMember(Criteria $criteria, $distinct = false, $con = null)
  310. {
  311. // we're going to modify criteria, so copy it first
  312. $criteria = clone $criteria;
  313. // clear out anything that might confuse the ORDER BY clause
  314. $criteria->clearSelectColumns()->clearOrderByColumns();
  315. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  316. $criteria->addSelectColumn(KataoMemberDepositPeer::COUNT_DISTINCT);
  317. } else {
  318. $criteria->addSelectColumn(KataoMemberDepositPeer::COUNT);
  319. }
  320. // just in case we're grouping: add those columns to the select statement
  321. foreach($criteria->getGroupByColumns() as $column)
  322. {
  323. $criteria->addSelectColumn($column);
  324. }
  325. $criteria->addJoin(KataoMemberDepositPeer::KATAO_MEMBER_ID, KataoMemberPeer::ID);
  326. $rs = KataoMemberDepositPeer::doSelectRS($criteria, $con);
  327. if ($rs->next()) {
  328. return $rs->getInt(1);
  329. } else {
  330. // no rows returned; we infer that means 0 matches.
  331. return 0;
  332. }
  333. }
  334. /**
  335. * Selects a collection of KataoMemberDeposit objects pre-filled with their KataoMember objects.
  336. *
  337. * @return array Array of KataoMemberDeposit objects.
  338. * @throws PropelException Any exceptions caught during processing will be
  339. * rethrown wrapped into a PropelException.
  340. */
  341. public static function doSelectJoinKataoMember(Criteria $c, $con = null)
  342. {
  343. foreach (sfMixer::getCallables('BaseKataoMemberDepositPeer:doSelectJoin:doSelectJoin') as $callable)
  344. {
  345. call_user_func($callable, 'BaseKataoMemberDepositPeer', $c, $con);
  346. }
  347. $c = clone $c;
  348. // Set the correct dbName if it has not been overridden
  349. if ($c->getDbName() == Propel::getDefaultDB()) {
  350. $c->setDbName(self::DATABASE_NAME);
  351. }
  352. KataoMemberDepositPeer::addSelectColumns($c);
  353. $startcol = (KataoMemberDepositPeer::NUM_COLUMNS - KataoMemberDepositPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  354. KataoMemberPeer::addSelectColumns($c);
  355. $c->addJoin(KataoMemberDepositPeer::KATAO_MEMBER_ID, KataoMemberPeer::ID);
  356. $rs = BasePeer::doSelect($c, $con);
  357. $results = array();
  358. while($rs->next()) {
  359. $omClass = KataoMemberDepositPeer::getOMClass();
  360. $cls = sfPropel::import($omClass);
  361. $obj1 = new $cls();
  362. $obj1->hydrate($rs);
  363. $omClass = KataoMemberPeer::getOMClass();
  364. $cls = sfPropel::import($omClass);
  365. $obj2 = new $cls();
  366. $obj2->hydrate($rs, $startcol);
  367. $newObject = true;
  368. foreach($results as $temp_obj1) {
  369. $temp_obj2 = $temp_obj1->getKataoMember(); //CHECKME
  370. if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
  371. $newObject = false;
  372. // e.g. $author->addBookRelatedByBookId()
  373. $temp_obj2->addKataoMemberDeposit($obj1); //CHECKME
  374. break;
  375. }
  376. }
  377. if ($newObject) {
  378. $obj2->initKataoMemberDeposits();
  379. $obj2->addKataoMemberDeposit($obj1); //CHECKME
  380. }
  381. $results[] = $obj1;
  382. }
  383. return $results;
  384. }
  385. /**
  386. * Returns the number of rows matching criteria, joining all related tables
  387. *
  388. * @param Criteria $c
  389. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  390. * @param Connection $con
  391. * @return int Number of matching rows.
  392. */
  393. public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
  394. {
  395. $criteria = clone $criteria;
  396. // clear out anything that might confuse the ORDER BY clause
  397. $criteria->clearSelectColumns()->clearOrderByColumns();
  398. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  399. $criteria->addSelectColumn(KataoMemberDepositPeer::COUNT_DISTINCT);
  400. } else {
  401. $criteria->addSelectColumn(KataoMemberDepositPeer::COUNT);
  402. }
  403. // just in case we're grouping: add those columns to the select statement
  404. foreach($criteria->getGroupByColumns() as $column)
  405. {
  406. $criteria->addSelectColumn($column);
  407. }
  408. $criteria->addJoin(KataoMemberDepositPeer::KATAO_MEMBER_ID, KataoMemberPeer::ID);
  409. $rs = KataoMemberDepositPeer::doSelectRS($criteria, $con);
  410. if ($rs->next()) {
  411. return $rs->getInt(1);
  412. } else {
  413. // no rows returned; we infer that means 0 matches.
  414. return 0;
  415. }
  416. }
  417. /**
  418. * Selects a collection of KataoMemberDeposit objects pre-filled with all related objects.
  419. *
  420. * @return array Array of KataoMemberDeposit objects.
  421. * @throws PropelException Any exceptions caught during processing will be
  422. * rethrown wrapped into a PropelException.
  423. */
  424. public static function doSelectJoinAll(Criteria $c, $con = null)
  425. {
  426. foreach (sfMixer::getCallables('BaseKataoMemberDepositPeer:doSelectJoinAll:doSelectJoinAll') as $callable)
  427. {
  428. call_user_func($callable, 'BaseKataoMemberDepositPeer', $c, $con);
  429. }
  430. $c = clone $c;
  431. // Set the correct dbName if it has not been overridden
  432. if ($c->getDbName() == Propel::getDefaultDB()) {
  433. $c->setDbName(self::DATABASE_NAME);
  434. }
  435. KataoMemberDepositPeer::addSelectColumns($c);
  436. $startcol2 = (KataoMemberDepositPeer::NUM_COLUMNS - KataoMemberDepositPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  437. KataoMemberPeer::addSelectColumns($c);
  438. $startcol3 = $startcol2 + KataoMemberPeer::NUM_COLUMNS;
  439. $c->addJoin(KataoMemberDepositPeer::KATAO_MEMBER_ID, KataoMemberPeer::ID);
  440. $rs = BasePeer::doSelect($c, $con);
  441. $results = array();
  442. while($rs->next()) {
  443. $omClass = KataoMemberDepositPeer::getOMClass();
  444. $cls = sfPropel::import($omClass);
  445. $obj1 = new $cls();
  446. $obj1->hydrate($rs);
  447. // Add objects for joined KataoMember rows
  448. $omClass = KataoMemberPeer::getOMClass();
  449. $cls = sfPropel::import($omClass);
  450. $obj2 = new $cls();
  451. $obj2->hydrate($rs, $startcol2);
  452. $newObject = true;
  453. for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
  454. $temp_obj1 = $results[$j];
  455. $temp_obj2 = $temp_obj1->getKataoMember(); // CHECKME
  456. if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
  457. $newObject = false;
  458. $temp_obj2->addKataoMemberDeposit($obj1); // CHECKME
  459. break;
  460. }
  461. }
  462. if ($newObject) {
  463. $obj2->initKataoMemberDeposits();
  464. $obj2->addKataoMemberDeposit($obj1);
  465. }
  466. $results[] = $obj1;
  467. }
  468. return $results;
  469. }
  470. static public function getUniqueColumnNames()
  471. {
  472. return array();
  473. }
  474. /**
  475. * Returns the TableMap related to this peer.
  476. * This method is not needed for general use but a specific application could have a need.
  477. * @return TableMap
  478. * @throws PropelException Any exceptions caught during processing will be
  479. * rethrown wrapped into a PropelException.
  480. */
  481. public static function getTableMap()
  482. {
  483. return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
  484. }
  485. /**
  486. * The class that the Peer will make instances of.
  487. *
  488. * This uses a dot-path notation which is tranalted into a path
  489. * relative to a location on the PHP include_path.
  490. * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
  491. *
  492. * @return string path.to.ClassName
  493. */
  494. public static function getOMClass()
  495. {
  496. return KataoMemberDepositPeer::CLASS_DEFAULT;
  497. }
  498. /**
  499. * Method perform an INSERT on the database, given a KataoMemberDeposit or Criteria object.
  500. *
  501. * @param mixed $values Criteria or KataoMemberDeposit object containing data that is used to create the INSERT statement.
  502. * @param Connection $con the connection to use
  503. * @return mixed The new primary key.
  504. * @throws PropelException Any exceptions caught during processing will be
  505. * rethrown wrapped into a PropelException.
  506. */
  507. public static function doInsert($values, $con = null)
  508. {
  509. foreach (sfMixer::getCallables('BaseKataoMemberDepositPeer:doInsert:pre') as $callable)
  510. {
  511. $ret = call_user_func($callable, 'BaseKataoMemberDepositPeer', $values, $con);
  512. if (false !== $ret)
  513. {
  514. return $ret;
  515. }
  516. }
  517. if ($con === null) {
  518. $con = Propel::getConnection(self::DATABASE_NAME);
  519. }
  520. if ($values instanceof Criteria) {
  521. $criteria = clone $values; // rename for clarity
  522. } else {
  523. $criteria = $values->buildCriteria(); // build Criteria from KataoMemberDeposit object
  524. }
  525. $criteria->remove(KataoMemberDepositPeer::ID); // remove pkey col since this table uses auto-increment
  526. // Set the correct dbName
  527. $criteria->setDbName(self::DATABASE_NAME);
  528. try {
  529. // use transaction because $criteria could contain info
  530. // for more than one table (I guess, conceivably)
  531. $con->begin();
  532. $pk = BasePeer::doInsert($criteria, $con);
  533. $con->commit();
  534. } catch(PropelException $e) {
  535. $con->rollback();
  536. throw $e;
  537. }
  538. foreach (sfMixer::getCallables('BaseKataoMemberDepositPeer:doInsert:post') as $callable)
  539. {
  540. call_user_func($callable, 'BaseKataoMemberDepositPeer', $values, $con, $pk);
  541. }
  542. return $pk;
  543. }
  544. /**
  545. * Method perform an UPDATE on the database, given a KataoMemberDeposit or Criteria object.
  546. *
  547. * @param mixed $values Criteria or KataoMemberDeposit object containing data that is used to create the UPDATE statement.
  548. * @param Connection $con The connection to use (specify Connection object to exert more control over transactions).
  549. * @return int The number of affected rows (if supported by underlying database driver).
  550. * @throws PropelException Any exceptions caught during processing will be
  551. * rethrown wrapped into a PropelException.
  552. */
  553. public static function doUpdate($values, $con = null)
  554. {
  555. foreach (sfMixer::getCallables('BaseKataoMemberDepositPeer:doUpdate:pre') as $callable)
  556. {
  557. $ret = call_user_func($callable, 'BaseKataoMemberDepositPeer', $values, $con);
  558. if (false !== $ret)
  559. {
  560. return $ret;
  561. }
  562. }
  563. if ($con === null) {
  564. $con = Propel::getConnection(self::DATABASE_NAME);
  565. }
  566. $selectCriteria = new Criteria(self::DATABASE_NAME);
  567. if ($values instanceof Criteria) {
  568. $criteria = clone $values; // rename for clarity
  569. $comparison = $criteria->getComparison(KataoMemberDepositPeer::ID);
  570. $selectCriteria->add(KataoMemberDepositPeer::ID, $criteria->remove(KataoMemberDepositPeer::ID), $comparison);
  571. } else { // $values is KataoMemberDeposit object
  572. $criteria = $values->buildCriteria(); // gets full criteria
  573. $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
  574. }
  575. // set the correct dbName
  576. $criteria->setDbName(self::DATABASE_NAME);
  577. $ret = BasePeer::doUpdate($selectCriteria, $criteria, $con);
  578. foreach (sfMixer::getCallables('BaseKataoMemberDepositPeer:doUpdate:post') as $callable)
  579. {
  580. call_user_func($callable, 'BaseKataoMemberDepositPeer', $values, $con, $ret);
  581. }
  582. return $ret;
  583. }
  584. /**
  585. * Method to DELETE all rows from the katao_member_deposit table.
  586. *
  587. * @return int The number of affected rows (if supported by underlying database driver).
  588. */
  589. public static function doDeleteAll($con = null)
  590. {
  591. if ($con === null) {
  592. $con = Propel::getConnection(self::DATABASE_NAME);
  593. }
  594. $affectedRows = 0; // initialize var to track total num of affected rows
  595. try {
  596. // use transaction because $criteria could contain info
  597. // for more than one table or we could emulating ON DELETE CASCADE, etc.
  598. $con->begin();
  599. $affectedRows += BasePeer::doDeleteAll(KataoMemberDepositPeer::TABLE_NAME, $con);
  600. $con->commit();
  601. return $affectedRows;
  602. } catch (PropelException $e) {
  603. $con->rollback();
  604. throw $e;
  605. }
  606. }
  607. /**
  608. * Method perform a DELETE on the database, given a KataoMemberDeposit or Criteria object OR a primary key value.
  609. *
  610. * @param mixed $values Criteria or KataoMemberDeposit object or primary key or array of primary keys
  611. * which is used to create the DELETE statement
  612. * @param Connection $con the connection to use
  613. * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
  614. * if supported by native driver or if emulated using Propel.
  615. * @throws PropelException Any exceptions caught during processing will be
  616. * rethrown wrapped into a PropelException.
  617. */
  618. public static function doDelete($values, $con = null)
  619. {
  620. if ($con === null) {
  621. $con = Propel::getConnection(KataoMemberDepositPeer::DATABASE_NAME);
  622. }
  623. if ($values instanceof Criteria) {
  624. $criteria = clone $values; // rename for clarity
  625. } elseif ($values instanceof KataoMemberDeposit) {
  626. $criteria = $values->buildPkeyCriteria();
  627. } else {
  628. // it must be the primary key
  629. $criteria = new Criteria(self::DATABASE_NAME);
  630. $criteria->add(KataoMemberDepositPeer::ID, (array) $values, Criteria::IN);
  631. }
  632. // Set the correct dbName
  633. $criteria->setDbName(self::DATABASE_NAME);
  634. $affectedRows = 0; // initialize var to track total num of affected rows
  635. try {
  636. // use transaction because $criteria could contain info
  637. // for more than one table or we could emulating ON DELETE CASCADE, etc.
  638. $con->begin();
  639. $affectedRows += BasePeer::doDelete($criteria, $con);
  640. $con->commit();
  641. return $affectedRows;
  642. } catch (PropelException $e) {
  643. $con->rollback();
  644. throw $e;
  645. }
  646. }
  647. /**
  648. * Validates all modified columns of given KataoMemberDeposit object.
  649. * If parameter $columns is either a single column name or an array of column names
  650. * than only those columns are validated.
  651. *
  652. * NOTICE: This does not apply to primary or foreign keys for now.
  653. *
  654. * @param KataoMemberDeposit $obj The object to validate.
  655. * @param mixed $cols Column name or array of column names.
  656. *
  657. * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
  658. */
  659. public static function doValidate(KataoMemberDeposit $obj, $cols = null)
  660. {
  661. $columns = array();
  662. if ($cols) {
  663. $dbMap = Propel::getDatabaseMap(KataoMemberDepositPeer::DATABASE_NAME);
  664. $tableMap = $dbMap->getTable(KataoMemberDepositPeer::TABLE_NAME);
  665. if (! is_array($cols)) {
  666. $cols = array($cols);
  667. }
  668. foreach($cols as $colName) {
  669. if ($tableMap->containsColumn($colName)) {
  670. $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
  671. $columns[$colName] = $obj->$get();
  672. }
  673. }
  674. } else {
  675. }
  676. $res = BasePeer::doValidate(KataoMemberDepositPeer::DATABASE_NAME, KataoMemberDepositPeer::TABLE_NAME, $columns);
  677. if ($res !== true) {
  678. $request = sfContext::getInstance()->getRequest();
  679. foreach ($res as $failed) {
  680. $col = KataoMemberDepositPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
  681. $request->setError($col, $failed->getMessage());
  682. }
  683. }
  684. return $res;
  685. }
  686. /**
  687. * Retrieve a single object by pkey.
  688. *
  689. * @param mixed $pk the primary key.
  690. * @param Connection $con the connection to use
  691. * @return KataoMemberDeposit
  692. */
  693. public static function retrieveByPK($pk, $con = null)
  694. {
  695. if ($con === null) {
  696. $con = Propel::getConnection(self::DATABASE_NAME);
  697. }
  698. $criteria = new Criteria(KataoMemberDepositPeer::DATABASE_NAME);
  699. $criteria->add(KataoMemberDepositPeer::ID, $pk);
  700. $v = KataoMemberDepositPeer::doSelect($criteria, $con);
  701. return !empty($v) > 0 ? $v[0] : null;
  702. }
  703. /**
  704. * Retrieve multiple objects by pkey.
  705. *
  706. * @param array $pks List of primary keys
  707. * @param Connection $con the connection to use
  708. * @throws PropelException Any exceptions caught during processing will be
  709. * rethrown wrapped into a PropelException.
  710. */
  711. public static function retrieveByPKs($pks, $con = null)
  712. {
  713. if ($con === null) {
  714. $con = Propel::getConnection(self::DATABASE_NAME);
  715. }
  716. $objs = null;
  717. if (empty($pks)) {
  718. $objs = array();
  719. } else {
  720. $criteria = new Criteria();
  721. $criteria->add(KataoMemberDepositPeer::ID, $pks, Criteria::IN);
  722. $objs = KataoMemberDepositPeer::doSelect($criteria, $con);
  723. }
  724. return $objs;
  725. }
  726. } // BaseKataoMemberDepositPeer
  727. // static code to register the map builder for this Peer with the main Propel class
  728. if (Propel::isInit()) {
  729. // the MapBuilder classes register themselves with Propel during initialization
  730. // so we need to load them here.
  731. try {
  732. BaseKataoMemberDepositPeer::getMapBuilder();
  733. } catch (Exception $e) {
  734. Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
  735. }
  736. } else {
  737. // even if Propel is not yet initialized, the map builder class can be registered
  738. // now and then it will be loaded when Propel initializes.
  739. Propel::registerMapBuilder('lib.model.map.KataoMemberDepositMapBuilder');
  740. }