BaseKataoUserPeer.php 40 KB

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