BaseKataoOrderPeer.php 51 KB

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