BaseKataoMemberPeer.php 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380
  1. <?php
  2. /**
  3. * Base static class for performing query and update operations on the 'katao_member' table.
  4. *
  5. *
  6. *
  7. * @package lib.model.om
  8. */
  9. abstract class BaseKataoMemberPeer {
  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';
  14. /** A class that can be returned by this peer. */
  15. const CLASS_DEFAULT = 'lib.model.KataoMember';
  16. /** The total number of columns. */
  17. const NUM_COLUMNS = 21;
  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.ID';
  22. /** the column name for the KATAO_INDEX field */
  23. const KATAO_INDEX = 'katao_member.KATAO_INDEX';
  24. /** the column name for the KATAO_NODE_ID field */
  25. const KATAO_NODE_ID = 'katao_member.KATAO_NODE_ID';
  26. /** the column name for the NEXT_KATAO_NODE_ID field */
  27. const NEXT_KATAO_NODE_ID = 'katao_member.NEXT_KATAO_NODE_ID';
  28. /** the column name for the KATAO_MEMBER_ID field */
  29. const KATAO_MEMBER_ID = 'katao_member.KATAO_MEMBER_ID';
  30. /** the column name for the FIRST_NAME field */
  31. const FIRST_NAME = 'katao_member.FIRST_NAME';
  32. /** the column name for the LAST_NAME field */
  33. const LAST_NAME = 'katao_member.LAST_NAME';
  34. /** the column name for the ACCOUNTING_CODE field */
  35. const ACCOUNTING_CODE = 'katao_member.ACCOUNTING_CODE';
  36. /** the column name for the ACCOUNTING_CODE_SOL field */
  37. const ACCOUNTING_CODE_SOL = 'katao_member.ACCOUNTING_CODE_SOL';
  38. /** the column name for the INITIAL_AMOUNT_EURO field */
  39. const INITIAL_AMOUNT_EURO = 'katao_member.INITIAL_AMOUNT_EURO';
  40. /** the column name for the INITIAL_AMOUNT_SOL field */
  41. const INITIAL_AMOUNT_SOL = 'katao_member.INITIAL_AMOUNT_SOL';
  42. /** the column name for the IS_REFERER field */
  43. const IS_REFERER = 'katao_member.IS_REFERER';
  44. /** the column name for the IS_DELEGATE field */
  45. const IS_DELEGATE = 'katao_member.IS_DELEGATE';
  46. /** the column name for the IS_ANONYMOUS field */
  47. const IS_ANONYMOUS = 'katao_member.IS_ANONYMOUS';
  48. /** the column name for the IS_MEMBER field */
  49. const IS_MEMBER = 'katao_member.IS_MEMBER';
  50. /** the column name for the CARD_NUMBER_SOL field */
  51. const CARD_NUMBER_SOL = 'katao_member.CARD_NUMBER_SOL';
  52. /** the column name for the USER_SITUATION field */
  53. const USER_SITUATION = 'katao_member.USER_SITUATION';
  54. /** the column name for the USER_BIRTHDAY field */
  55. const USER_BIRTHDAY = 'katao_member.USER_BIRTHDAY';
  56. /** the column name for the PARRAIN_NAME field */
  57. const PARRAIN_NAME = 'katao_member.PARRAIN_NAME';
  58. /** the column name for the CREATED_AT field */
  59. const CREATED_AT = 'katao_member.CREATED_AT';
  60. /** the column name for the UPDATED_AT field */
  61. const UPDATED_AT = 'katao_member.UPDATED_AT';
  62. /** The PHP to DB Name Mapping */
  63. private static $phpNameMap = null;
  64. /**
  65. * holds an array of fieldnames
  66. *
  67. * first dimension keys are the type constants
  68. * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
  69. */
  70. private static $fieldNames = array (
  71. BasePeer::TYPE_PHPNAME => array ('Id', 'KataoIndex', 'KataoNodeId', 'NextKataoNodeId', 'KataoMemberId', 'FirstName', 'LastName', 'AccountingCode', 'AccountingCodeSol', 'InitialAmountEuro', 'InitialAmountSol', 'IsReferer', 'IsDelegate', 'IsAnonymous', 'IsMember', 'CardNumberSol', 'UserSituation', 'UserBirthday', 'ParrainName', 'CreatedAt', 'UpdatedAt', ),
  72. BasePeer::TYPE_COLNAME => array (KataoMemberPeer::ID, KataoMemberPeer::KATAO_INDEX, KataoMemberPeer::KATAO_NODE_ID, KataoMemberPeer::NEXT_KATAO_NODE_ID, KataoMemberPeer::KATAO_MEMBER_ID, KataoMemberPeer::FIRST_NAME, KataoMemberPeer::LAST_NAME, KataoMemberPeer::ACCOUNTING_CODE, KataoMemberPeer::ACCOUNTING_CODE_SOL, KataoMemberPeer::INITIAL_AMOUNT_EURO, KataoMemberPeer::INITIAL_AMOUNT_SOL, KataoMemberPeer::IS_REFERER, KataoMemberPeer::IS_DELEGATE, KataoMemberPeer::IS_ANONYMOUS, KataoMemberPeer::IS_MEMBER, KataoMemberPeer::CARD_NUMBER_SOL, KataoMemberPeer::USER_SITUATION, KataoMemberPeer::USER_BIRTHDAY, KataoMemberPeer::PARRAIN_NAME, KataoMemberPeer::CREATED_AT, KataoMemberPeer::UPDATED_AT, ),
  73. BasePeer::TYPE_FIELDNAME => array ('id', 'katao_index', 'katao_node_id', 'next_katao_node_id', 'katao_member_id', 'first_name', 'last_name', 'accounting_code', 'accounting_code_sol', 'initial_amount_euro', 'initial_amount_sol', 'is_referer', 'is_delegate', 'is_anonymous', 'is_member', 'card_number_sol', 'user_situation', 'user_birthday', 'parrain_name', 'created_at', 'updated_at', ),
  74. 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, )
  75. );
  76. /**
  77. * holds an array of keys for quick access to the fieldnames array
  78. *
  79. * first dimension keys are the type constants
  80. * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
  81. */
  82. private static $fieldKeys = array (
  83. BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'KataoIndex' => 1, 'KataoNodeId' => 2, 'NextKataoNodeId' => 3, 'KataoMemberId' => 4, 'FirstName' => 5, 'LastName' => 6, 'AccountingCode' => 7, 'AccountingCodeSol' => 8, 'InitialAmountEuro' => 9, 'InitialAmountSol' => 10, 'IsReferer' => 11, 'IsDelegate' => 12, 'IsAnonymous' => 13, 'IsMember' => 14, 'CardNumberSol' => 15, 'UserSituation' => 16, 'UserBirthday' => 17, 'ParrainName' => 18, 'CreatedAt' => 19, 'UpdatedAt' => 20, ),
  84. BasePeer::TYPE_COLNAME => array (KataoMemberPeer::ID => 0, KataoMemberPeer::KATAO_INDEX => 1, KataoMemberPeer::KATAO_NODE_ID => 2, KataoMemberPeer::NEXT_KATAO_NODE_ID => 3, KataoMemberPeer::KATAO_MEMBER_ID => 4, KataoMemberPeer::FIRST_NAME => 5, KataoMemberPeer::LAST_NAME => 6, KataoMemberPeer::ACCOUNTING_CODE => 7, KataoMemberPeer::ACCOUNTING_CODE_SOL => 8, KataoMemberPeer::INITIAL_AMOUNT_EURO => 9, KataoMemberPeer::INITIAL_AMOUNT_SOL => 10, KataoMemberPeer::IS_REFERER => 11, KataoMemberPeer::IS_DELEGATE => 12, KataoMemberPeer::IS_ANONYMOUS => 13, KataoMemberPeer::IS_MEMBER => 14, KataoMemberPeer::CARD_NUMBER_SOL => 15, KataoMemberPeer::USER_SITUATION => 16, KataoMemberPeer::USER_BIRTHDAY => 17, KataoMemberPeer::PARRAIN_NAME => 18, KataoMemberPeer::CREATED_AT => 19, KataoMemberPeer::UPDATED_AT => 20, ),
  85. BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'katao_index' => 1, 'katao_node_id' => 2, 'next_katao_node_id' => 3, 'katao_member_id' => 4, 'first_name' => 5, 'last_name' => 6, 'accounting_code' => 7, 'accounting_code_sol' => 8, 'initial_amount_euro' => 9, 'initial_amount_sol' => 10, 'is_referer' => 11, 'is_delegate' => 12, 'is_anonymous' => 13, 'is_member' => 14, 'card_number_sol' => 15, 'user_situation' => 16, 'user_birthday' => 17, 'parrain_name' => 18, 'created_at' => 19, 'updated_at' => 20, ),
  86. 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, )
  87. );
  88. /**
  89. * @return MapBuilder the map builder for this peer
  90. * @throws PropelException Any exceptions caught during processing will be
  91. * rethrown wrapped into a PropelException.
  92. */
  93. public static function getMapBuilder()
  94. {
  95. return BasePeer::getMapBuilder('lib.model.map.KataoMemberMapBuilder');
  96. }
  97. /**
  98. * Gets a map (hash) of PHP names to DB column names.
  99. *
  100. * @return array The PHP to DB name map for this peer
  101. * @throws PropelException Any exceptions caught during processing will be
  102. * rethrown wrapped into a PropelException.
  103. * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
  104. */
  105. public static function getPhpNameMap()
  106. {
  107. if (self::$phpNameMap === null) {
  108. $map = KataoMemberPeer::getTableMap();
  109. $columns = $map->getColumns();
  110. $nameMap = array();
  111. foreach ($columns as $column) {
  112. $nameMap[$column->getPhpName()] = $column->getColumnName();
  113. }
  114. self::$phpNameMap = $nameMap;
  115. }
  116. return self::$phpNameMap;
  117. }
  118. /**
  119. * Translates a fieldname to another type
  120. *
  121. * @param string $name field name
  122. * @param string $fromType One of the class type constants TYPE_PHPNAME,
  123. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  124. * @param string $toType One of the class type constants
  125. * @return string translated name of the field.
  126. */
  127. static public function translateFieldName($name, $fromType, $toType)
  128. {
  129. $toNames = self::getFieldNames($toType);
  130. $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
  131. if ($key === null) {
  132. throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
  133. }
  134. return $toNames[$key];
  135. }
  136. /**
  137. * Returns an array of of field names.
  138. *
  139. * @param string $type The type of fieldnames to return:
  140. * One of the class type constants TYPE_PHPNAME,
  141. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  142. * @return array A list of field names
  143. */
  144. static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
  145. {
  146. if (!array_key_exists($type, self::$fieldNames)) {
  147. 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.');
  148. }
  149. return self::$fieldNames[$type];
  150. }
  151. /**
  152. * Convenience method which changes table.column to alias.column.
  153. *
  154. * Using this method you can maintain SQL abstraction while using column aliases.
  155. * <code>
  156. * $c->addAlias("alias1", TablePeer::TABLE_NAME);
  157. * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
  158. * </code>
  159. * @param string $alias The alias for the current table.
  160. * @param string $column The column name for current table. (i.e. KataoMemberPeer::COLUMN_NAME).
  161. * @return string
  162. */
  163. public static function alias($alias, $column)
  164. {
  165. return str_replace(KataoMemberPeer::TABLE_NAME.'.', $alias.'.', $column);
  166. }
  167. /**
  168. * Add all the columns needed to create a new object.
  169. *
  170. * Note: any columns that were marked with lazyLoad="true" in the
  171. * XML schema will not be added to the select list and only loaded
  172. * on demand.
  173. *
  174. * @param criteria object containing the columns to add.
  175. * @throws PropelException Any exceptions caught during processing will be
  176. * rethrown wrapped into a PropelException.
  177. */
  178. public static function addSelectColumns(Criteria $criteria)
  179. {
  180. $criteria->addSelectColumn(KataoMemberPeer::ID);
  181. $criteria->addSelectColumn(KataoMemberPeer::KATAO_INDEX);
  182. $criteria->addSelectColumn(KataoMemberPeer::KATAO_NODE_ID);
  183. $criteria->addSelectColumn(KataoMemberPeer::NEXT_KATAO_NODE_ID);
  184. $criteria->addSelectColumn(KataoMemberPeer::KATAO_MEMBER_ID);
  185. $criteria->addSelectColumn(KataoMemberPeer::FIRST_NAME);
  186. $criteria->addSelectColumn(KataoMemberPeer::LAST_NAME);
  187. $criteria->addSelectColumn(KataoMemberPeer::ACCOUNTING_CODE);
  188. $criteria->addSelectColumn(KataoMemberPeer::ACCOUNTING_CODE_SOL);
  189. $criteria->addSelectColumn(KataoMemberPeer::INITIAL_AMOUNT_EURO);
  190. $criteria->addSelectColumn(KataoMemberPeer::INITIAL_AMOUNT_SOL);
  191. $criteria->addSelectColumn(KataoMemberPeer::IS_REFERER);
  192. $criteria->addSelectColumn(KataoMemberPeer::IS_DELEGATE);
  193. $criteria->addSelectColumn(KataoMemberPeer::IS_ANONYMOUS);
  194. $criteria->addSelectColumn(KataoMemberPeer::IS_MEMBER);
  195. $criteria->addSelectColumn(KataoMemberPeer::CARD_NUMBER_SOL);
  196. $criteria->addSelectColumn(KataoMemberPeer::USER_SITUATION);
  197. $criteria->addSelectColumn(KataoMemberPeer::USER_BIRTHDAY);
  198. $criteria->addSelectColumn(KataoMemberPeer::PARRAIN_NAME);
  199. $criteria->addSelectColumn(KataoMemberPeer::CREATED_AT);
  200. $criteria->addSelectColumn(KataoMemberPeer::UPDATED_AT);
  201. }
  202. const COUNT = 'COUNT(katao_member.ID)';
  203. const COUNT_DISTINCT = 'COUNT(DISTINCT katao_member.ID)';
  204. /**
  205. * Returns the number of rows matching criteria.
  206. *
  207. * @param Criteria $criteria
  208. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  209. * @param Connection $con
  210. * @return int Number of matching rows.
  211. */
  212. public static function doCount(Criteria $criteria, $distinct = false, $con = null)
  213. {
  214. // we're going to modify criteria, so copy it first
  215. $criteria = clone $criteria;
  216. // clear out anything that might confuse the ORDER BY clause
  217. $criteria->clearSelectColumns()->clearOrderByColumns();
  218. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  219. $criteria->addSelectColumn(KataoMemberPeer::COUNT_DISTINCT);
  220. } else {
  221. $criteria->addSelectColumn(KataoMemberPeer::COUNT);
  222. }
  223. // just in case we're grouping: add those columns to the select statement
  224. foreach($criteria->getGroupByColumns() as $column)
  225. {
  226. $criteria->addSelectColumn($column);
  227. }
  228. $rs = KataoMemberPeer::doSelectRS($criteria, $con);
  229. if ($rs->next()) {
  230. return $rs->getInt(1);
  231. } else {
  232. // no rows returned; we infer that means 0 matches.
  233. return 0;
  234. }
  235. }
  236. /**
  237. * Method to select one object from the DB.
  238. *
  239. * @param Criteria $criteria object used to create the SELECT statement.
  240. * @param Connection $con
  241. * @return KataoMember
  242. * @throws PropelException Any exceptions caught during processing will be
  243. * rethrown wrapped into a PropelException.
  244. */
  245. public static function doSelectOne(Criteria $criteria, $con = null)
  246. {
  247. $critcopy = clone $criteria;
  248. $critcopy->setLimit(1);
  249. $objects = KataoMemberPeer::doSelect($critcopy, $con);
  250. if ($objects) {
  251. return $objects[0];
  252. }
  253. return null;
  254. }
  255. /**
  256. * Method to do selects.
  257. *
  258. * @param Criteria $criteria The Criteria object used to build the SELECT statement.
  259. * @param Connection $con
  260. * @return array Array of selected Objects
  261. * @throws PropelException Any exceptions caught during processing will be
  262. * rethrown wrapped into a PropelException.
  263. */
  264. public static function doSelect(Criteria $criteria, $con = null)
  265. {
  266. return KataoMemberPeer::populateObjects(KataoMemberPeer::doSelectRS($criteria, $con));
  267. }
  268. /**
  269. * Prepares the Criteria object and uses the parent doSelect()
  270. * method to get a ResultSet.
  271. *
  272. * Use this method directly if you want to just get the resultset
  273. * (instead of an array of objects).
  274. *
  275. * @param Criteria $criteria The Criteria object used to build the SELECT statement.
  276. * @param Connection $con the connection to use
  277. * @throws PropelException Any exceptions caught during processing will be
  278. * rethrown wrapped into a PropelException.
  279. * @return ResultSet The resultset object with numerically-indexed fields.
  280. * @see BasePeer::doSelect()
  281. */
  282. public static function doSelectRS(Criteria $criteria, $con = null)
  283. {
  284. foreach (sfMixer::getCallables('BaseKataoMemberPeer:doSelectRS:doSelectRS') as $callable)
  285. {
  286. call_user_func($callable, 'BaseKataoMemberPeer', $criteria, $con);
  287. }
  288. if ($con === null) {
  289. $con = Propel::getConnection(self::DATABASE_NAME);
  290. }
  291. if (!$criteria->getSelectColumns()) {
  292. $criteria = clone $criteria;
  293. KataoMemberPeer::addSelectColumns($criteria);
  294. }
  295. // Set the correct dbName
  296. $criteria->setDbName(self::DATABASE_NAME);
  297. // BasePeer returns a Creole ResultSet, set to return
  298. // rows indexed numerically.
  299. return BasePeer::doSelect($criteria, $con);
  300. }
  301. /**
  302. * The returned array will contain objects of the default type or
  303. * objects that inherit from the default.
  304. *
  305. * @throws PropelException Any exceptions caught during processing will be
  306. * rethrown wrapped into a PropelException.
  307. */
  308. public static function populateObjects(ResultSet $rs)
  309. {
  310. $results = array();
  311. // set the class once to avoid overhead in the loop
  312. $cls = KataoMemberPeer::getOMClass();
  313. $cls = sfPropel::import($cls);
  314. // populate the object(s)
  315. while($rs->next()) {
  316. $obj = new $cls();
  317. $obj->hydrate($rs);
  318. $results[] = $obj;
  319. }
  320. return $results;
  321. }
  322. /**
  323. * Returns the number of rows matching criteria, joining the related KataoNodeRelatedByKataoNodeId table
  324. *
  325. * @param Criteria $c
  326. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  327. * @param Connection $con
  328. * @return int Number of matching rows.
  329. */
  330. public static function doCountJoinKataoNodeRelatedByKataoNodeId(Criteria $criteria, $distinct = false, $con = null)
  331. {
  332. // we're going to modify criteria, so copy it first
  333. $criteria = clone $criteria;
  334. // clear out anything that might confuse the ORDER BY clause
  335. $criteria->clearSelectColumns()->clearOrderByColumns();
  336. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  337. $criteria->addSelectColumn(KataoMemberPeer::COUNT_DISTINCT);
  338. } else {
  339. $criteria->addSelectColumn(KataoMemberPeer::COUNT);
  340. }
  341. // just in case we're grouping: add those columns to the select statement
  342. foreach($criteria->getGroupByColumns() as $column)
  343. {
  344. $criteria->addSelectColumn($column);
  345. }
  346. $criteria->addJoin(KataoMemberPeer::KATAO_NODE_ID, KataoNodePeer::ID);
  347. $rs = KataoMemberPeer::doSelectRS($criteria, $con);
  348. if ($rs->next()) {
  349. return $rs->getInt(1);
  350. } else {
  351. // no rows returned; we infer that means 0 matches.
  352. return 0;
  353. }
  354. }
  355. /**
  356. * Returns the number of rows matching criteria, joining the related KataoNodeRelatedByNextKataoNodeId table
  357. *
  358. * @param Criteria $c
  359. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  360. * @param Connection $con
  361. * @return int Number of matching rows.
  362. */
  363. public static function doCountJoinKataoNodeRelatedByNextKataoNodeId(Criteria $criteria, $distinct = false, $con = null)
  364. {
  365. // we're going to modify criteria, so copy it first
  366. $criteria = clone $criteria;
  367. // clear out anything that might confuse the ORDER BY clause
  368. $criteria->clearSelectColumns()->clearOrderByColumns();
  369. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  370. $criteria->addSelectColumn(KataoMemberPeer::COUNT_DISTINCT);
  371. } else {
  372. $criteria->addSelectColumn(KataoMemberPeer::COUNT);
  373. }
  374. // just in case we're grouping: add those columns to the select statement
  375. foreach($criteria->getGroupByColumns() as $column)
  376. {
  377. $criteria->addSelectColumn($column);
  378. }
  379. $criteria->addJoin(KataoMemberPeer::NEXT_KATAO_NODE_ID, KataoNodePeer::ID);
  380. $rs = KataoMemberPeer::doSelectRS($criteria, $con);
  381. if ($rs->next()) {
  382. return $rs->getInt(1);
  383. } else {
  384. // no rows returned; we infer that means 0 matches.
  385. return 0;
  386. }
  387. }
  388. /**
  389. * Selects a collection of KataoMember objects pre-filled with their KataoNode objects.
  390. *
  391. * @return array Array of KataoMember objects.
  392. * @throws PropelException Any exceptions caught during processing will be
  393. * rethrown wrapped into a PropelException.
  394. */
  395. public static function doSelectJoinKataoNodeRelatedByKataoNodeId(Criteria $c, $con = null)
  396. {
  397. foreach (sfMixer::getCallables('BaseKataoMemberPeer:doSelectJoin:doSelectJoin') as $callable)
  398. {
  399. call_user_func($callable, 'BaseKataoMemberPeer', $c, $con);
  400. }
  401. $c = clone $c;
  402. // Set the correct dbName if it has not been overridden
  403. if ($c->getDbName() == Propel::getDefaultDB()) {
  404. $c->setDbName(self::DATABASE_NAME);
  405. }
  406. KataoMemberPeer::addSelectColumns($c);
  407. $startcol = (KataoMemberPeer::NUM_COLUMNS - KataoMemberPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  408. KataoNodePeer::addSelectColumns($c);
  409. $c->addJoin(KataoMemberPeer::KATAO_NODE_ID, KataoNodePeer::ID);
  410. $rs = BasePeer::doSelect($c, $con);
  411. $results = array();
  412. while($rs->next()) {
  413. $omClass = KataoMemberPeer::getOMClass();
  414. $cls = sfPropel::import($omClass);
  415. $obj1 = new $cls();
  416. $obj1->hydrate($rs);
  417. $omClass = KataoNodePeer::getOMClass();
  418. $cls = sfPropel::import($omClass);
  419. $obj2 = new $cls();
  420. $obj2->hydrate($rs, $startcol);
  421. $newObject = true;
  422. foreach($results as $temp_obj1) {
  423. $temp_obj2 = $temp_obj1->getKataoNodeRelatedByKataoNodeId(); //CHECKME
  424. if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
  425. $newObject = false;
  426. // e.g. $author->addBookRelatedByBookId()
  427. $temp_obj2->addKataoMemberRelatedByKataoNodeId($obj1); //CHECKME
  428. break;
  429. }
  430. }
  431. if ($newObject) {
  432. $obj2->initKataoMembersRelatedByKataoNodeId();
  433. $obj2->addKataoMemberRelatedByKataoNodeId($obj1); //CHECKME
  434. }
  435. $results[] = $obj1;
  436. }
  437. return $results;
  438. }
  439. /**
  440. * Selects a collection of KataoMember objects pre-filled with their KataoNode objects.
  441. *
  442. * @return array Array of KataoMember objects.
  443. * @throws PropelException Any exceptions caught during processing will be
  444. * rethrown wrapped into a PropelException.
  445. */
  446. public static function doSelectJoinKataoNodeRelatedByNextKataoNodeId(Criteria $c, $con = null)
  447. {
  448. foreach (sfMixer::getCallables('BaseKataoMemberPeer:doSelectJoin:doSelectJoin') as $callable)
  449. {
  450. call_user_func($callable, 'BaseKataoMemberPeer', $c, $con);
  451. }
  452. $c = clone $c;
  453. // Set the correct dbName if it has not been overridden
  454. if ($c->getDbName() == Propel::getDefaultDB()) {
  455. $c->setDbName(self::DATABASE_NAME);
  456. }
  457. KataoMemberPeer::addSelectColumns($c);
  458. $startcol = (KataoMemberPeer::NUM_COLUMNS - KataoMemberPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  459. KataoNodePeer::addSelectColumns($c);
  460. $c->addJoin(KataoMemberPeer::NEXT_KATAO_NODE_ID, KataoNodePeer::ID);
  461. $rs = BasePeer::doSelect($c, $con);
  462. $results = array();
  463. while($rs->next()) {
  464. $omClass = KataoMemberPeer::getOMClass();
  465. $cls = sfPropel::import($omClass);
  466. $obj1 = new $cls();
  467. $obj1->hydrate($rs);
  468. $omClass = KataoNodePeer::getOMClass();
  469. $cls = sfPropel::import($omClass);
  470. $obj2 = new $cls();
  471. $obj2->hydrate($rs, $startcol);
  472. $newObject = true;
  473. foreach($results as $temp_obj1) {
  474. $temp_obj2 = $temp_obj1->getKataoNodeRelatedByNextKataoNodeId(); //CHECKME
  475. if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
  476. $newObject = false;
  477. // e.g. $author->addBookRelatedByBookId()
  478. $temp_obj2->addKataoMemberRelatedByNextKataoNodeId($obj1); //CHECKME
  479. break;
  480. }
  481. }
  482. if ($newObject) {
  483. $obj2->initKataoMembersRelatedByNextKataoNodeId();
  484. $obj2->addKataoMemberRelatedByNextKataoNodeId($obj1); //CHECKME
  485. }
  486. $results[] = $obj1;
  487. }
  488. return $results;
  489. }
  490. /**
  491. * Returns the number of rows matching criteria, joining all related tables
  492. *
  493. * @param Criteria $c
  494. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  495. * @param Connection $con
  496. * @return int Number of matching rows.
  497. */
  498. public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
  499. {
  500. $criteria = clone $criteria;
  501. // clear out anything that might confuse the ORDER BY clause
  502. $criteria->clearSelectColumns()->clearOrderByColumns();
  503. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  504. $criteria->addSelectColumn(KataoMemberPeer::COUNT_DISTINCT);
  505. } else {
  506. $criteria->addSelectColumn(KataoMemberPeer::COUNT);
  507. }
  508. // just in case we're grouping: add those columns to the select statement
  509. foreach($criteria->getGroupByColumns() as $column)
  510. {
  511. $criteria->addSelectColumn($column);
  512. }
  513. $criteria->addJoin(KataoMemberPeer::KATAO_NODE_ID, KataoNodePeer::ID);
  514. $criteria->addJoin(KataoMemberPeer::NEXT_KATAO_NODE_ID, KataoNodePeer::ID);
  515. $rs = KataoMemberPeer::doSelectRS($criteria, $con);
  516. if ($rs->next()) {
  517. return $rs->getInt(1);
  518. } else {
  519. // no rows returned; we infer that means 0 matches.
  520. return 0;
  521. }
  522. }
  523. /**
  524. * Selects a collection of KataoMember objects pre-filled with all related objects.
  525. *
  526. * @return array Array of KataoMember objects.
  527. * @throws PropelException Any exceptions caught during processing will be
  528. * rethrown wrapped into a PropelException.
  529. */
  530. public static function doSelectJoinAll(Criteria $c, $con = null)
  531. {
  532. foreach (sfMixer::getCallables('BaseKataoMemberPeer:doSelectJoinAll:doSelectJoinAll') as $callable)
  533. {
  534. call_user_func($callable, 'BaseKataoMemberPeer', $c, $con);
  535. }
  536. $c = clone $c;
  537. // Set the correct dbName if it has not been overridden
  538. if ($c->getDbName() == Propel::getDefaultDB()) {
  539. $c->setDbName(self::DATABASE_NAME);
  540. }
  541. KataoMemberPeer::addSelectColumns($c);
  542. $startcol2 = (KataoMemberPeer::NUM_COLUMNS - KataoMemberPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  543. KataoNodePeer::addSelectColumns($c);
  544. $startcol3 = $startcol2 + KataoNodePeer::NUM_COLUMNS;
  545. KataoNodePeer::addSelectColumns($c);
  546. $startcol4 = $startcol3 + KataoNodePeer::NUM_COLUMNS;
  547. $c->addJoin(KataoMemberPeer::KATAO_NODE_ID, KataoNodePeer::ID);
  548. $c->addJoin(KataoMemberPeer::NEXT_KATAO_NODE_ID, KataoNodePeer::ID);
  549. $rs = BasePeer::doSelect($c, $con);
  550. $results = array();
  551. while($rs->next()) {
  552. $omClass = KataoMemberPeer::getOMClass();
  553. $cls = sfPropel::import($omClass);
  554. $obj1 = new $cls();
  555. $obj1->hydrate($rs);
  556. // Add objects for joined KataoNode rows
  557. $omClass = KataoNodePeer::getOMClass();
  558. $cls = sfPropel::import($omClass);
  559. $obj2 = new $cls();
  560. $obj2->hydrate($rs, $startcol2);
  561. $newObject = true;
  562. for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
  563. $temp_obj1 = $results[$j];
  564. $temp_obj2 = $temp_obj1->getKataoNodeRelatedByKataoNodeId(); // CHECKME
  565. if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
  566. $newObject = false;
  567. $temp_obj2->addKataoMemberRelatedByKataoNodeId($obj1); // CHECKME
  568. break;
  569. }
  570. }
  571. if ($newObject) {
  572. $obj2->initKataoMembersRelatedByKataoNodeId();
  573. $obj2->addKataoMemberRelatedByKataoNodeId($obj1);
  574. }
  575. // Add objects for joined KataoNode rows
  576. $omClass = KataoNodePeer::getOMClass();
  577. $cls = sfPropel::import($omClass);
  578. $obj3 = new $cls();
  579. $obj3->hydrate($rs, $startcol3);
  580. $newObject = true;
  581. for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
  582. $temp_obj1 = $results[$j];
  583. $temp_obj3 = $temp_obj1->getKataoNodeRelatedByNextKataoNodeId(); // CHECKME
  584. if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
  585. $newObject = false;
  586. $temp_obj3->addKataoMemberRelatedByNextKataoNodeId($obj1); // CHECKME
  587. break;
  588. }
  589. }
  590. if ($newObject) {
  591. $obj3->initKataoMembersRelatedByNextKataoNodeId();
  592. $obj3->addKataoMemberRelatedByNextKataoNodeId($obj1);
  593. }
  594. $results[] = $obj1;
  595. }
  596. return $results;
  597. }
  598. /**
  599. * Returns the number of rows matching criteria, joining the related KataoNodeRelatedByKataoNodeId table
  600. *
  601. * @param Criteria $c
  602. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  603. * @param Connection $con
  604. * @return int Number of matching rows.
  605. */
  606. public static function doCountJoinAllExceptKataoNodeRelatedByKataoNodeId(Criteria $criteria, $distinct = false, $con = null)
  607. {
  608. // we're going to modify criteria, so copy it first
  609. $criteria = clone $criteria;
  610. // clear out anything that might confuse the ORDER BY clause
  611. $criteria->clearSelectColumns()->clearOrderByColumns();
  612. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  613. $criteria->addSelectColumn(KataoMemberPeer::COUNT_DISTINCT);
  614. } else {
  615. $criteria->addSelectColumn(KataoMemberPeer::COUNT);
  616. }
  617. // just in case we're grouping: add those columns to the select statement
  618. foreach($criteria->getGroupByColumns() as $column)
  619. {
  620. $criteria->addSelectColumn($column);
  621. }
  622. $rs = KataoMemberPeer::doSelectRS($criteria, $con);
  623. if ($rs->next()) {
  624. return $rs->getInt(1);
  625. } else {
  626. // no rows returned; we infer that means 0 matches.
  627. return 0;
  628. }
  629. }
  630. /**
  631. * Returns the number of rows matching criteria, joining the related KataoNodeRelatedByNextKataoNodeId table
  632. *
  633. * @param Criteria $c
  634. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  635. * @param Connection $con
  636. * @return int Number of matching rows.
  637. */
  638. public static function doCountJoinAllExceptKataoNodeRelatedByNextKataoNodeId(Criteria $criteria, $distinct = false, $con = null)
  639. {
  640. // we're going to modify criteria, so copy it first
  641. $criteria = clone $criteria;
  642. // clear out anything that might confuse the ORDER BY clause
  643. $criteria->clearSelectColumns()->clearOrderByColumns();
  644. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  645. $criteria->addSelectColumn(KataoMemberPeer::COUNT_DISTINCT);
  646. } else {
  647. $criteria->addSelectColumn(KataoMemberPeer::COUNT);
  648. }
  649. // just in case we're grouping: add those columns to the select statement
  650. foreach($criteria->getGroupByColumns() as $column)
  651. {
  652. $criteria->addSelectColumn($column);
  653. }
  654. $rs = KataoMemberPeer::doSelectRS($criteria, $con);
  655. if ($rs->next()) {
  656. return $rs->getInt(1);
  657. } else {
  658. // no rows returned; we infer that means 0 matches.
  659. return 0;
  660. }
  661. }
  662. /**
  663. * Returns the number of rows matching criteria, joining the related KataoMemberRelatedByKataoMemberId table
  664. *
  665. * @param Criteria $c
  666. * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
  667. * @param Connection $con
  668. * @return int Number of matching rows.
  669. */
  670. public static function doCountJoinAllExceptKataoMemberRelatedByKataoMemberId(Criteria $criteria, $distinct = false, $con = null)
  671. {
  672. // we're going to modify criteria, so copy it first
  673. $criteria = clone $criteria;
  674. // clear out anything that might confuse the ORDER BY clause
  675. $criteria->clearSelectColumns()->clearOrderByColumns();
  676. if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  677. $criteria->addSelectColumn(KataoMemberPeer::COUNT_DISTINCT);
  678. } else {
  679. $criteria->addSelectColumn(KataoMemberPeer::COUNT);
  680. }
  681. // just in case we're grouping: add those columns to the select statement
  682. foreach($criteria->getGroupByColumns() as $column)
  683. {
  684. $criteria->addSelectColumn($column);
  685. }
  686. $criteria->addJoin(KataoMemberPeer::KATAO_NODE_ID, KataoNodePeer::ID);
  687. $criteria->addJoin(KataoMemberPeer::NEXT_KATAO_NODE_ID, KataoNodePeer::ID);
  688. $rs = KataoMemberPeer::doSelectRS($criteria, $con);
  689. if ($rs->next()) {
  690. return $rs->getInt(1);
  691. } else {
  692. // no rows returned; we infer that means 0 matches.
  693. return 0;
  694. }
  695. }
  696. /**
  697. * Selects a collection of KataoMember objects pre-filled with all related objects except KataoNodeRelatedByKataoNodeId.
  698. *
  699. * @return array Array of KataoMember objects.
  700. * @throws PropelException Any exceptions caught during processing will be
  701. * rethrown wrapped into a PropelException.
  702. */
  703. public static function doSelectJoinAllExceptKataoNodeRelatedByKataoNodeId(Criteria $c, $con = null)
  704. {
  705. foreach (sfMixer::getCallables('BaseKataoMemberPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable)
  706. {
  707. call_user_func($callable, 'BaseKataoMemberPeer', $c, $con);
  708. }
  709. $c = clone $c;
  710. // Set the correct dbName if it has not been overridden
  711. // $c->getDbName() will return the same object if not set to another value
  712. // so == check is okay and faster
  713. if ($c->getDbName() == Propel::getDefaultDB()) {
  714. $c->setDbName(self::DATABASE_NAME);
  715. }
  716. KataoMemberPeer::addSelectColumns($c);
  717. $startcol2 = (KataoMemberPeer::NUM_COLUMNS - KataoMemberPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  718. $rs = BasePeer::doSelect($c, $con);
  719. $results = array();
  720. while($rs->next()) {
  721. $omClass = KataoMemberPeer::getOMClass();
  722. $cls = sfPropel::import($omClass);
  723. $obj1 = new $cls();
  724. $obj1->hydrate($rs);
  725. $results[] = $obj1;
  726. }
  727. return $results;
  728. }
  729. /**
  730. * Selects a collection of KataoMember objects pre-filled with all related objects except KataoNodeRelatedByNextKataoNodeId.
  731. *
  732. * @return array Array of KataoMember objects.
  733. * @throws PropelException Any exceptions caught during processing will be
  734. * rethrown wrapped into a PropelException.
  735. */
  736. public static function doSelectJoinAllExceptKataoNodeRelatedByNextKataoNodeId(Criteria $c, $con = null)
  737. {
  738. foreach (sfMixer::getCallables('BaseKataoMemberPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable)
  739. {
  740. call_user_func($callable, 'BaseKataoMemberPeer', $c, $con);
  741. }
  742. $c = clone $c;
  743. // Set the correct dbName if it has not been overridden
  744. // $c->getDbName() will return the same object if not set to another value
  745. // so == check is okay and faster
  746. if ($c->getDbName() == Propel::getDefaultDB()) {
  747. $c->setDbName(self::DATABASE_NAME);
  748. }
  749. KataoMemberPeer::addSelectColumns($c);
  750. $startcol2 = (KataoMemberPeer::NUM_COLUMNS - KataoMemberPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  751. $rs = BasePeer::doSelect($c, $con);
  752. $results = array();
  753. while($rs->next()) {
  754. $omClass = KataoMemberPeer::getOMClass();
  755. $cls = sfPropel::import($omClass);
  756. $obj1 = new $cls();
  757. $obj1->hydrate($rs);
  758. $results[] = $obj1;
  759. }
  760. return $results;
  761. }
  762. /**
  763. * Selects a collection of KataoMember objects pre-filled with all related objects except KataoMemberRelatedByKataoMemberId.
  764. *
  765. * @return array Array of KataoMember objects.
  766. * @throws PropelException Any exceptions caught during processing will be
  767. * rethrown wrapped into a PropelException.
  768. */
  769. public static function doSelectJoinAllExceptKataoMemberRelatedByKataoMemberId(Criteria $c, $con = null)
  770. {
  771. foreach (sfMixer::getCallables('BaseKataoMemberPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable)
  772. {
  773. call_user_func($callable, 'BaseKataoMemberPeer', $c, $con);
  774. }
  775. $c = clone $c;
  776. // Set the correct dbName if it has not been overridden
  777. // $c->getDbName() will return the same object if not set to another value
  778. // so == check is okay and faster
  779. if ($c->getDbName() == Propel::getDefaultDB()) {
  780. $c->setDbName(self::DATABASE_NAME);
  781. }
  782. KataoMemberPeer::addSelectColumns($c);
  783. $startcol2 = (KataoMemberPeer::NUM_COLUMNS - KataoMemberPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
  784. KataoNodePeer::addSelectColumns($c);
  785. $startcol3 = $startcol2 + KataoNodePeer::NUM_COLUMNS;
  786. KataoNodePeer::addSelectColumns($c);
  787. $startcol4 = $startcol3 + KataoNodePeer::NUM_COLUMNS;
  788. $c->addJoin(KataoMemberPeer::KATAO_NODE_ID, KataoNodePeer::ID);
  789. $c->addJoin(KataoMemberPeer::NEXT_KATAO_NODE_ID, KataoNodePeer::ID);
  790. $rs = BasePeer::doSelect($c, $con);
  791. $results = array();
  792. while($rs->next()) {
  793. $omClass = KataoMemberPeer::getOMClass();
  794. $cls = sfPropel::import($omClass);
  795. $obj1 = new $cls();
  796. $obj1->hydrate($rs);
  797. $omClass = KataoNodePeer::getOMClass();
  798. $cls = sfPropel::import($omClass);
  799. $obj2 = new $cls();
  800. $obj2->hydrate($rs, $startcol2);
  801. $newObject = true;
  802. for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
  803. $temp_obj1 = $results[$j];
  804. $temp_obj2 = $temp_obj1->getKataoNodeRelatedByKataoNodeId(); //CHECKME
  805. if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
  806. $newObject = false;
  807. $temp_obj2->addKataoMemberRelatedByKataoNodeId($obj1);
  808. break;
  809. }
  810. }
  811. if ($newObject) {
  812. $obj2->initKataoMembersRelatedByKataoNodeId();
  813. $obj2->addKataoMemberRelatedByKataoNodeId($obj1);
  814. }
  815. $omClass = KataoNodePeer::getOMClass();
  816. $cls = sfPropel::import($omClass);
  817. $obj3 = new $cls();
  818. $obj3->hydrate($rs, $startcol3);
  819. $newObject = true;
  820. for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
  821. $temp_obj1 = $results[$j];
  822. $temp_obj3 = $temp_obj1->getKataoNodeRelatedByNextKataoNodeId(); //CHECKME
  823. if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
  824. $newObject = false;
  825. $temp_obj3->addKataoMemberRelatedByNextKataoNodeId($obj1);
  826. break;
  827. }
  828. }
  829. if ($newObject) {
  830. $obj3->initKataoMembersRelatedByNextKataoNodeId();
  831. $obj3->addKataoMemberRelatedByNextKataoNodeId($obj1);
  832. }
  833. $results[] = $obj1;
  834. }
  835. return $results;
  836. }
  837. static public function getUniqueColumnNames()
  838. {
  839. return array();
  840. }
  841. /**
  842. * Returns the TableMap related to this peer.
  843. * This method is not needed for general use but a specific application could have a need.
  844. * @return TableMap
  845. * @throws PropelException Any exceptions caught during processing will be
  846. * rethrown wrapped into a PropelException.
  847. */
  848. public static function getTableMap()
  849. {
  850. return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
  851. }
  852. /**
  853. * The class that the Peer will make instances of.
  854. *
  855. * This uses a dot-path notation which is tranalted into a path
  856. * relative to a location on the PHP include_path.
  857. * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
  858. *
  859. * @return string path.to.ClassName
  860. */
  861. public static function getOMClass()
  862. {
  863. return KataoMemberPeer::CLASS_DEFAULT;
  864. }
  865. /**
  866. * Method perform an INSERT on the database, given a KataoMember or Criteria object.
  867. *
  868. * @param mixed $values Criteria or KataoMember object containing data that is used to create the INSERT statement.
  869. * @param Connection $con the connection to use
  870. * @return mixed The new primary key.
  871. * @throws PropelException Any exceptions caught during processing will be
  872. * rethrown wrapped into a PropelException.
  873. */
  874. public static function doInsert($values, $con = null)
  875. {
  876. foreach (sfMixer::getCallables('BaseKataoMemberPeer:doInsert:pre') as $callable)
  877. {
  878. $ret = call_user_func($callable, 'BaseKataoMemberPeer', $values, $con);
  879. if (false !== $ret)
  880. {
  881. return $ret;
  882. }
  883. }
  884. if ($con === null) {
  885. $con = Propel::getConnection(self::DATABASE_NAME);
  886. }
  887. if ($values instanceof Criteria) {
  888. $criteria = clone $values; // rename for clarity
  889. } else {
  890. $criteria = $values->buildCriteria(); // build Criteria from KataoMember object
  891. }
  892. $criteria->remove(KataoMemberPeer::ID); // remove pkey col since this table uses auto-increment
  893. // Set the correct dbName
  894. $criteria->setDbName(self::DATABASE_NAME);
  895. try {
  896. // use transaction because $criteria could contain info
  897. // for more than one table (I guess, conceivably)
  898. $con->begin();
  899. $pk = BasePeer::doInsert($criteria, $con);
  900. $con->commit();
  901. } catch(PropelException $e) {
  902. $con->rollback();
  903. throw $e;
  904. }
  905. foreach (sfMixer::getCallables('BaseKataoMemberPeer:doInsert:post') as $callable)
  906. {
  907. call_user_func($callable, 'BaseKataoMemberPeer', $values, $con, $pk);
  908. }
  909. return $pk;
  910. }
  911. /**
  912. * Method perform an UPDATE on the database, given a KataoMember or Criteria object.
  913. *
  914. * @param mixed $values Criteria or KataoMember object containing data that is used to create the UPDATE statement.
  915. * @param Connection $con The connection to use (specify Connection object to exert more control over transactions).
  916. * @return int The number of affected rows (if supported by underlying database driver).
  917. * @throws PropelException Any exceptions caught during processing will be
  918. * rethrown wrapped into a PropelException.
  919. */
  920. public static function doUpdate($values, $con = null)
  921. {
  922. foreach (sfMixer::getCallables('BaseKataoMemberPeer:doUpdate:pre') as $callable)
  923. {
  924. $ret = call_user_func($callable, 'BaseKataoMemberPeer', $values, $con);
  925. if (false !== $ret)
  926. {
  927. return $ret;
  928. }
  929. }
  930. if ($con === null) {
  931. $con = Propel::getConnection(self::DATABASE_NAME);
  932. }
  933. $selectCriteria = new Criteria(self::DATABASE_NAME);
  934. if ($values instanceof Criteria) {
  935. $criteria = clone $values; // rename for clarity
  936. $comparison = $criteria->getComparison(KataoMemberPeer::ID);
  937. $selectCriteria->add(KataoMemberPeer::ID, $criteria->remove(KataoMemberPeer::ID), $comparison);
  938. } else { // $values is KataoMember object
  939. $criteria = $values->buildCriteria(); // gets full criteria
  940. $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
  941. }
  942. // set the correct dbName
  943. $criteria->setDbName(self::DATABASE_NAME);
  944. $ret = BasePeer::doUpdate($selectCriteria, $criteria, $con);
  945. foreach (sfMixer::getCallables('BaseKataoMemberPeer:doUpdate:post') as $callable)
  946. {
  947. call_user_func($callable, 'BaseKataoMemberPeer', $values, $con, $ret);
  948. }
  949. return $ret;
  950. }
  951. /**
  952. * Method to DELETE all rows from the katao_member table.
  953. *
  954. * @return int The number of affected rows (if supported by underlying database driver).
  955. */
  956. public static function doDeleteAll($con = null)
  957. {
  958. if ($con === null) {
  959. $con = Propel::getConnection(self::DATABASE_NAME);
  960. }
  961. $affectedRows = 0; // initialize var to track total num of affected rows
  962. try {
  963. // use transaction because $criteria could contain info
  964. // for more than one table or we could emulating ON DELETE CASCADE, etc.
  965. $con->begin();
  966. $affectedRows += BasePeer::doDeleteAll(KataoMemberPeer::TABLE_NAME, $con);
  967. $con->commit();
  968. return $affectedRows;
  969. } catch (PropelException $e) {
  970. $con->rollback();
  971. throw $e;
  972. }
  973. }
  974. /**
  975. * Method perform a DELETE on the database, given a KataoMember or Criteria object OR a primary key value.
  976. *
  977. * @param mixed $values Criteria or KataoMember object or primary key or array of primary keys
  978. * which is used to create the DELETE statement
  979. * @param Connection $con the connection to use
  980. * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
  981. * if supported by native driver or if emulated using Propel.
  982. * @throws PropelException Any exceptions caught during processing will be
  983. * rethrown wrapped into a PropelException.
  984. */
  985. public static function doDelete($values, $con = null)
  986. {
  987. if ($con === null) {
  988. $con = Propel::getConnection(KataoMemberPeer::DATABASE_NAME);
  989. }
  990. if ($values instanceof Criteria) {
  991. $criteria = clone $values; // rename for clarity
  992. } elseif ($values instanceof KataoMember) {
  993. $criteria = $values->buildPkeyCriteria();
  994. } else {
  995. // it must be the primary key
  996. $criteria = new Criteria(self::DATABASE_NAME);
  997. $criteria->add(KataoMemberPeer::ID, (array) $values, Criteria::IN);
  998. }
  999. // Set the correct dbName
  1000. $criteria->setDbName(self::DATABASE_NAME);
  1001. $affectedRows = 0; // initialize var to track total num of affected rows
  1002. try {
  1003. // use transaction because $criteria could contain info
  1004. // for more than one table or we could emulating ON DELETE CASCADE, etc.
  1005. $con->begin();
  1006. $affectedRows += BasePeer::doDelete($criteria, $con);
  1007. $con->commit();
  1008. return $affectedRows;
  1009. } catch (PropelException $e) {
  1010. $con->rollback();
  1011. throw $e;
  1012. }
  1013. }
  1014. /**
  1015. * Validates all modified columns of given KataoMember object.
  1016. * If parameter $columns is either a single column name or an array of column names
  1017. * than only those columns are validated.
  1018. *
  1019. * NOTICE: This does not apply to primary or foreign keys for now.
  1020. *
  1021. * @param KataoMember $obj The object to validate.
  1022. * @param mixed $cols Column name or array of column names.
  1023. *
  1024. * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
  1025. */
  1026. public static function doValidate(KataoMember $obj, $cols = null)
  1027. {
  1028. $columns = array();
  1029. if ($cols) {
  1030. $dbMap = Propel::getDatabaseMap(KataoMemberPeer::DATABASE_NAME);
  1031. $tableMap = $dbMap->getTable(KataoMemberPeer::TABLE_NAME);
  1032. if (! is_array($cols)) {
  1033. $cols = array($cols);
  1034. }
  1035. foreach($cols as $colName) {
  1036. if ($tableMap->containsColumn($colName)) {
  1037. $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
  1038. $columns[$colName] = $obj->$get();
  1039. }
  1040. }
  1041. } else {
  1042. }
  1043. $res = BasePeer::doValidate(KataoMemberPeer::DATABASE_NAME, KataoMemberPeer::TABLE_NAME, $columns);
  1044. if ($res !== true) {
  1045. $request = sfContext::getInstance()->getRequest();
  1046. foreach ($res as $failed) {
  1047. $col = KataoMemberPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
  1048. $request->setError($col, $failed->getMessage());
  1049. }
  1050. }
  1051. return $res;
  1052. }
  1053. /**
  1054. * Retrieve a single object by pkey.
  1055. *
  1056. * @param mixed $pk the primary key.
  1057. * @param Connection $con the connection to use
  1058. * @return KataoMember
  1059. */
  1060. public static function retrieveByPK($pk, $con = null)
  1061. {
  1062. if ($con === null) {
  1063. $con = Propel::getConnection(self::DATABASE_NAME);
  1064. }
  1065. $criteria = new Criteria(KataoMemberPeer::DATABASE_NAME);
  1066. $criteria->add(KataoMemberPeer::ID, $pk);
  1067. $v = KataoMemberPeer::doSelect($criteria, $con);
  1068. return !empty($v) > 0 ? $v[0] : null;
  1069. }
  1070. /**
  1071. * Retrieve multiple objects by pkey.
  1072. *
  1073. * @param array $pks List of primary keys
  1074. * @param Connection $con the connection to use
  1075. * @throws PropelException Any exceptions caught during processing will be
  1076. * rethrown wrapped into a PropelException.
  1077. */
  1078. public static function retrieveByPKs($pks, $con = null)
  1079. {
  1080. if ($con === null) {
  1081. $con = Propel::getConnection(self::DATABASE_NAME);
  1082. }
  1083. $objs = null;
  1084. if (empty($pks)) {
  1085. $objs = array();
  1086. } else {
  1087. $criteria = new Criteria();
  1088. $criteria->add(KataoMemberPeer::ID, $pks, Criteria::IN);
  1089. $objs = KataoMemberPeer::doSelect($criteria, $con);
  1090. }
  1091. return $objs;
  1092. }
  1093. } // BaseKataoMemberPeer
  1094. // static code to register the map builder for this Peer with the main Propel class
  1095. if (Propel::isInit()) {
  1096. // the MapBuilder classes register themselves with Propel during initialization
  1097. // so we need to load them here.
  1098. try {
  1099. BaseKataoMemberPeer::getMapBuilder();
  1100. } catch (Exception $e) {
  1101. Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
  1102. }
  1103. } else {
  1104. // even if Propel is not yet initialized, the map builder class can be registered
  1105. // now and then it will be loaded when Propel initializes.
  1106. Propel::registerMapBuilder('lib.model.map.KataoMemberMapBuilder');
  1107. }