BaseCcSchedulePeer.php 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771
  1. <?php
  2. /**
  3. * Base static class for performing query and update operations on the 'cc_schedule' table.
  4. *
  5. *
  6. *
  7. * @package propel.generator.airtime.om
  8. */
  9. abstract class BaseCcSchedulePeer {
  10. /** the default database name for this class */
  11. const DATABASE_NAME = 'airtime';
  12. /** the table name for this class */
  13. const TABLE_NAME = 'cc_schedule';
  14. /** the related Propel class for this table */
  15. const OM_CLASS = 'CcSchedule';
  16. /** A class that can be returned by this peer. */
  17. const CLASS_DEFAULT = 'airtime.CcSchedule';
  18. /** the related TableMap class for this table */
  19. const TM_CLASS = 'CcScheduleTableMap';
  20. /** The total number of columns. */
  21. const NUM_COLUMNS = 15;
  22. /** The number of lazy-loaded columns. */
  23. const NUM_LAZY_LOAD_COLUMNS = 0;
  24. /** the column name for the ID field */
  25. const ID = 'cc_schedule.ID';
  26. /** the column name for the STARTS field */
  27. const STARTS = 'cc_schedule.STARTS';
  28. /** the column name for the ENDS field */
  29. const ENDS = 'cc_schedule.ENDS';
  30. /** the column name for the FILE_ID field */
  31. const FILE_ID = 'cc_schedule.FILE_ID';
  32. /** the column name for the STREAM_ID field */
  33. const STREAM_ID = 'cc_schedule.STREAM_ID';
  34. /** the column name for the CLIP_LENGTH field */
  35. const CLIP_LENGTH = 'cc_schedule.CLIP_LENGTH';
  36. /** the column name for the FADE_IN field */
  37. const FADE_IN = 'cc_schedule.FADE_IN';
  38. /** the column name for the FADE_OUT field */
  39. const FADE_OUT = 'cc_schedule.FADE_OUT';
  40. /** the column name for the CUE_IN field */
  41. const CUE_IN = 'cc_schedule.CUE_IN';
  42. /** the column name for the CUE_OUT field */
  43. const CUE_OUT = 'cc_schedule.CUE_OUT';
  44. /** the column name for the MEDIA_ITEM_PLAYED field */
  45. const MEDIA_ITEM_PLAYED = 'cc_schedule.MEDIA_ITEM_PLAYED';
  46. /** the column name for the INSTANCE_ID field */
  47. const INSTANCE_ID = 'cc_schedule.INSTANCE_ID';
  48. /** the column name for the PLAYOUT_STATUS field */
  49. const PLAYOUT_STATUS = 'cc_schedule.PLAYOUT_STATUS';
  50. /** the column name for the BROADCASTED field */
  51. const BROADCASTED = 'cc_schedule.BROADCASTED';
  52. /** the column name for the POSITION field */
  53. const POSITION = 'cc_schedule.POSITION';
  54. /**
  55. * An identiy map to hold any loaded instances of CcSchedule objects.
  56. * This must be public so that other peer classes can access this when hydrating from JOIN
  57. * queries.
  58. * @var array CcSchedule[]
  59. */
  60. public static $instances = array();
  61. /**
  62. * holds an array of fieldnames
  63. *
  64. * first dimension keys are the type constants
  65. * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
  66. */
  67. private static $fieldNames = array (
  68. BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbFileId', 'DbStreamId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbMediaItemPlayed', 'DbInstanceId', 'DbPlayoutStatus', 'DbBroadcasted', 'DbPosition', ),
  69. BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbFileId', 'dbStreamId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbMediaItemPlayed', 'dbInstanceId', 'dbPlayoutStatus', 'dbBroadcasted', 'dbPosition', ),
  70. BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::FILE_ID, self::STREAM_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, self::PLAYOUT_STATUS, self::BROADCASTED, self::POSITION, ),
  71. BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'FILE_ID', 'STREAM_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', 'PLAYOUT_STATUS', 'BROADCASTED', 'POSITION', ),
  72. BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'file_id', 'stream_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'media_item_played', 'instance_id', 'playout_status', 'broadcasted', 'position', ),
  73. BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
  74. );
  75. /**
  76. * holds an array of keys for quick access to the fieldnames array
  77. *
  78. * first dimension keys are the type constants
  79. * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
  80. */
  81. private static $fieldKeys = array (
  82. BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbFileId' => 3, 'DbStreamId' => 4, 'DbClipLength' => 5, 'DbFadeIn' => 6, 'DbFadeOut' => 7, 'DbCueIn' => 8, 'DbCueOut' => 9, 'DbMediaItemPlayed' => 10, 'DbInstanceId' => 11, 'DbPlayoutStatus' => 12, 'DbBroadcasted' => 13, 'DbPosition' => 14, ),
  83. BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbFileId' => 3, 'dbStreamId' => 4, 'dbClipLength' => 5, 'dbFadeIn' => 6, 'dbFadeOut' => 7, 'dbCueIn' => 8, 'dbCueOut' => 9, 'dbMediaItemPlayed' => 10, 'dbInstanceId' => 11, 'dbPlayoutStatus' => 12, 'dbBroadcasted' => 13, 'dbPosition' => 14, ),
  84. BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::FILE_ID => 3, self::STREAM_ID => 4, self::CLIP_LENGTH => 5, self::FADE_IN => 6, self::FADE_OUT => 7, self::CUE_IN => 8, self::CUE_OUT => 9, self::MEDIA_ITEM_PLAYED => 10, self::INSTANCE_ID => 11, self::PLAYOUT_STATUS => 12, self::BROADCASTED => 13, self::POSITION => 14, ),
  85. BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'FILE_ID' => 3, 'STREAM_ID' => 4, 'CLIP_LENGTH' => 5, 'FADE_IN' => 6, 'FADE_OUT' => 7, 'CUE_IN' => 8, 'CUE_OUT' => 9, 'MEDIA_ITEM_PLAYED' => 10, 'INSTANCE_ID' => 11, 'PLAYOUT_STATUS' => 12, 'BROADCASTED' => 13, 'POSITION' => 14, ),
  86. BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'file_id' => 3, 'stream_id' => 4, 'clip_length' => 5, 'fade_in' => 6, 'fade_out' => 7, 'cue_in' => 8, 'cue_out' => 9, 'media_item_played' => 10, 'instance_id' => 11, 'playout_status' => 12, 'broadcasted' => 13, 'position' => 14, ),
  87. BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
  88. );
  89. /**
  90. * Translates a fieldname to another type
  91. *
  92. * @param string $name field name
  93. * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  94. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  95. * @param string $toType One of the class type constants
  96. * @return string translated name of the field.
  97. * @throws PropelException - if the specified name could not be found in the fieldname mappings.
  98. */
  99. static public function translateFieldName($name, $fromType, $toType)
  100. {
  101. $toNames = self::getFieldNames($toType);
  102. $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
  103. if ($key === null) {
  104. throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
  105. }
  106. return $toNames[$key];
  107. }
  108. /**
  109. * Returns an array of field names.
  110. *
  111. * @param string $type The type of fieldnames to return:
  112. * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  113. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  114. * @return array A list of field names
  115. */
  116. static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
  117. {
  118. if (!array_key_exists($type, self::$fieldNames)) {
  119. throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
  120. }
  121. return self::$fieldNames[$type];
  122. }
  123. /**
  124. * Convenience method which changes table.column to alias.column.
  125. *
  126. * Using this method you can maintain SQL abstraction while using column aliases.
  127. * <code>
  128. * $c->addAlias("alias1", TablePeer::TABLE_NAME);
  129. * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
  130. * </code>
  131. * @param string $alias The alias for the current table.
  132. * @param string $column The column name for current table. (i.e. CcSchedulePeer::COLUMN_NAME).
  133. * @return string
  134. */
  135. public static function alias($alias, $column)
  136. {
  137. return str_replace(CcSchedulePeer::TABLE_NAME.'.', $alias.'.', $column);
  138. }
  139. /**
  140. * Add all the columns needed to create a new object.
  141. *
  142. * Note: any columns that were marked with lazyLoad="true" in the
  143. * XML schema will not be added to the select list and only loaded
  144. * on demand.
  145. *
  146. * @param Criteria $criteria object containing the columns to add.
  147. * @param string $alias optional table alias
  148. * @throws PropelException Any exceptions caught during processing will be
  149. * rethrown wrapped into a PropelException.
  150. */
  151. public static function addSelectColumns(Criteria $criteria, $alias = null)
  152. {
  153. if (null === $alias) {
  154. $criteria->addSelectColumn(CcSchedulePeer::ID);
  155. $criteria->addSelectColumn(CcSchedulePeer::STARTS);
  156. $criteria->addSelectColumn(CcSchedulePeer::ENDS);
  157. $criteria->addSelectColumn(CcSchedulePeer::FILE_ID);
  158. $criteria->addSelectColumn(CcSchedulePeer::STREAM_ID);
  159. $criteria->addSelectColumn(CcSchedulePeer::CLIP_LENGTH);
  160. $criteria->addSelectColumn(CcSchedulePeer::FADE_IN);
  161. $criteria->addSelectColumn(CcSchedulePeer::FADE_OUT);
  162. $criteria->addSelectColumn(CcSchedulePeer::CUE_IN);
  163. $criteria->addSelectColumn(CcSchedulePeer::CUE_OUT);
  164. $criteria->addSelectColumn(CcSchedulePeer::MEDIA_ITEM_PLAYED);
  165. $criteria->addSelectColumn(CcSchedulePeer::INSTANCE_ID);
  166. $criteria->addSelectColumn(CcSchedulePeer::PLAYOUT_STATUS);
  167. $criteria->addSelectColumn(CcSchedulePeer::BROADCASTED);
  168. $criteria->addSelectColumn(CcSchedulePeer::POSITION);
  169. } else {
  170. $criteria->addSelectColumn($alias . '.ID');
  171. $criteria->addSelectColumn($alias . '.STARTS');
  172. $criteria->addSelectColumn($alias . '.ENDS');
  173. $criteria->addSelectColumn($alias . '.FILE_ID');
  174. $criteria->addSelectColumn($alias . '.STREAM_ID');
  175. $criteria->addSelectColumn($alias . '.CLIP_LENGTH');
  176. $criteria->addSelectColumn($alias . '.FADE_IN');
  177. $criteria->addSelectColumn($alias . '.FADE_OUT');
  178. $criteria->addSelectColumn($alias . '.CUE_IN');
  179. $criteria->addSelectColumn($alias . '.CUE_OUT');
  180. $criteria->addSelectColumn($alias . '.MEDIA_ITEM_PLAYED');
  181. $criteria->addSelectColumn($alias . '.INSTANCE_ID');
  182. $criteria->addSelectColumn($alias . '.PLAYOUT_STATUS');
  183. $criteria->addSelectColumn($alias . '.BROADCASTED');
  184. $criteria->addSelectColumn($alias . '.POSITION');
  185. }
  186. }
  187. /**
  188. * Returns the number of rows matching criteria.
  189. *
  190. * @param Criteria $criteria
  191. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  192. * @param PropelPDO $con
  193. * @return int Number of matching rows.
  194. */
  195. public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
  196. {
  197. // we may modify criteria, so copy it first
  198. $criteria = clone $criteria;
  199. // We need to set the primary table name, since in the case that there are no WHERE columns
  200. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  201. // tables go into the FROM clause.
  202. $criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME);
  203. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  204. $criteria->setDistinct();
  205. }
  206. if (!$criteria->hasSelectClause()) {
  207. CcSchedulePeer::addSelectColumns($criteria);
  208. }
  209. $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
  210. $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
  211. if ($con === null) {
  212. $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
  213. }
  214. // BasePeer returns a PDOStatement
  215. $stmt = BasePeer::doCount($criteria, $con);
  216. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  217. $count = (int) $row[0];
  218. } else {
  219. $count = 0; // no rows returned; we infer that means 0 matches.
  220. }
  221. $stmt->closeCursor();
  222. return $count;
  223. }
  224. /**
  225. * Method to select one object from the DB.
  226. *
  227. * @param Criteria $criteria object used to create the SELECT statement.
  228. * @param PropelPDO $con
  229. * @return CcSchedule
  230. * @throws PropelException Any exceptions caught during processing will be
  231. * rethrown wrapped into a PropelException.
  232. */
  233. public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
  234. {
  235. $critcopy = clone $criteria;
  236. $critcopy->setLimit(1);
  237. $objects = CcSchedulePeer::doSelect($critcopy, $con);
  238. if ($objects) {
  239. return $objects[0];
  240. }
  241. return null;
  242. }
  243. /**
  244. * Method to do selects.
  245. *
  246. * @param Criteria $criteria The Criteria object used to build the SELECT statement.
  247. * @param PropelPDO $con
  248. * @return array Array of selected Objects
  249. * @throws PropelException Any exceptions caught during processing will be
  250. * rethrown wrapped into a PropelException.
  251. */
  252. public static function doSelect(Criteria $criteria, PropelPDO $con = null)
  253. {
  254. return CcSchedulePeer::populateObjects(CcSchedulePeer::doSelectStmt($criteria, $con));
  255. }
  256. /**
  257. * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
  258. *
  259. * Use this method directly if you want to work with an executed statement durirectly (for example
  260. * to perform your own object hydration).
  261. *
  262. * @param Criteria $criteria The Criteria object used to build the SELECT statement.
  263. * @param PropelPDO $con The connection to use
  264. * @throws PropelException Any exceptions caught during processing will be
  265. * rethrown wrapped into a PropelException.
  266. * @return PDOStatement The executed PDOStatement object.
  267. * @see BasePeer::doSelect()
  268. */
  269. public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
  270. {
  271. if ($con === null) {
  272. $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
  273. }
  274. if (!$criteria->hasSelectClause()) {
  275. $criteria = clone $criteria;
  276. CcSchedulePeer::addSelectColumns($criteria);
  277. }
  278. // Set the correct dbName
  279. $criteria->setDbName(self::DATABASE_NAME);
  280. // BasePeer returns a PDOStatement
  281. return BasePeer::doSelect($criteria, $con);
  282. }
  283. /**
  284. * Adds an object to the instance pool.
  285. *
  286. * Propel keeps cached copies of objects in an instance pool when they are retrieved
  287. * from the database. In some cases -- especially when you override doSelect*()
  288. * methods in your stub classes -- you may need to explicitly add objects
  289. * to the cache in order to ensure that the same objects are always returned by doSelect*()
  290. * and retrieveByPK*() calls.
  291. *
  292. * @param CcSchedule $value A CcSchedule object.
  293. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  294. */
  295. public static function addInstanceToPool(CcSchedule $obj, $key = null)
  296. {
  297. if (Propel::isInstancePoolingEnabled()) {
  298. if ($key === null) {
  299. $key = (string) $obj->getDbId();
  300. } // if key === null
  301. self::$instances[$key] = $obj;
  302. }
  303. }
  304. /**
  305. * Removes an object from the instance pool.
  306. *
  307. * Propel keeps cached copies of objects in an instance pool when they are retrieved
  308. * from the database. In some cases -- especially when you override doDelete
  309. * methods in your stub classes -- you may need to explicitly remove objects
  310. * from the cache in order to prevent returning objects that no longer exist.
  311. *
  312. * @param mixed $value A CcSchedule object or a primary key value.
  313. */
  314. public static function removeInstanceFromPool($value)
  315. {
  316. if (Propel::isInstancePoolingEnabled() && $value !== null) {
  317. if (is_object($value) && $value instanceof CcSchedule) {
  318. $key = (string) $value->getDbId();
  319. } elseif (is_scalar($value)) {
  320. // assume we've been passed a primary key
  321. $key = (string) $value;
  322. } else {
  323. $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcSchedule object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
  324. throw $e;
  325. }
  326. unset(self::$instances[$key]);
  327. }
  328. } // removeInstanceFromPool()
  329. /**
  330. * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
  331. *
  332. * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
  333. * a multi-column primary key, a serialize()d version of the primary key will be returned.
  334. *
  335. * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
  336. * @return CcSchedule Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
  337. * @see getPrimaryKeyHash()
  338. */
  339. public static function getInstanceFromPool($key)
  340. {
  341. if (Propel::isInstancePoolingEnabled()) {
  342. if (isset(self::$instances[$key])) {
  343. return self::$instances[$key];
  344. }
  345. }
  346. return null; // just to be explicit
  347. }
  348. /**
  349. * Clear the instance pool.
  350. *
  351. * @return void
  352. */
  353. public static function clearInstancePool()
  354. {
  355. self::$instances = array();
  356. }
  357. /**
  358. * Method to invalidate the instance pool of all tables related to cc_schedule
  359. * by a foreign key with ON DELETE CASCADE
  360. */
  361. public static function clearRelatedInstancePool()
  362. {
  363. // Invalidate objects in CcWebstreamMetadataPeer instance pool,
  364. // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
  365. CcWebstreamMetadataPeer::clearInstancePool();
  366. }
  367. /**
  368. * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
  369. *
  370. * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
  371. * a multi-column primary key, a serialize()d version of the primary key will be returned.
  372. *
  373. * @param array $row PropelPDO resultset row.
  374. * @param int $startcol The 0-based offset for reading from the resultset row.
  375. * @return string A string version of PK or NULL if the components of primary key in result array are all null.
  376. */
  377. public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
  378. {
  379. // If the PK cannot be derived from the row, return NULL.
  380. if ($row[$startcol] === null) {
  381. return null;
  382. }
  383. return (string) $row[$startcol];
  384. }
  385. /**
  386. * Retrieves the primary key from the DB resultset row
  387. * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
  388. * a multi-column primary key, an array of the primary key columns will be returned.
  389. *
  390. * @param array $row PropelPDO resultset row.
  391. * @param int $startcol The 0-based offset for reading from the resultset row.
  392. * @return mixed The primary key of the row
  393. */
  394. public static function getPrimaryKeyFromRow($row, $startcol = 0)
  395. {
  396. return (int) $row[$startcol];
  397. }
  398. /**
  399. * The returned array will contain objects of the default type or
  400. * objects that inherit from the default.
  401. *
  402. * @throws PropelException Any exceptions caught during processing will be
  403. * rethrown wrapped into a PropelException.
  404. */
  405. public static function populateObjects(PDOStatement $stmt)
  406. {
  407. $results = array();
  408. // set the class once to avoid overhead in the loop
  409. $cls = CcSchedulePeer::getOMClass(false);
  410. // populate the object(s)
  411. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  412. $key = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0);
  413. if (null !== ($obj = CcSchedulePeer::getInstanceFromPool($key))) {
  414. // We no longer rehydrate the object, since this can cause data loss.
  415. // See http://www.propelorm.org/ticket/509
  416. // $obj->hydrate($row, 0, true); // rehydrate
  417. $results[] = $obj;
  418. } else {
  419. $obj = new $cls();
  420. $obj->hydrate($row);
  421. $results[] = $obj;
  422. CcSchedulePeer::addInstanceToPool($obj, $key);
  423. } // if key exists
  424. }
  425. $stmt->closeCursor();
  426. return $results;
  427. }
  428. /**
  429. * Populates an object of the default type or an object that inherit from the default.
  430. *
  431. * @param array $row PropelPDO resultset row.
  432. * @param int $startcol The 0-based offset for reading from the resultset row.
  433. * @throws PropelException Any exceptions caught during processing will be
  434. * rethrown wrapped into a PropelException.
  435. * @return array (CcSchedule object, last column rank)
  436. */
  437. public static function populateObject($row, $startcol = 0)
  438. {
  439. $key = CcSchedulePeer::getPrimaryKeyHashFromRow($row, $startcol);
  440. if (null !== ($obj = CcSchedulePeer::getInstanceFromPool($key))) {
  441. // We no longer rehydrate the object, since this can cause data loss.
  442. // See http://www.propelorm.org/ticket/509
  443. // $obj->hydrate($row, $startcol, true); // rehydrate
  444. $col = $startcol + CcSchedulePeer::NUM_COLUMNS;
  445. } else {
  446. $cls = CcSchedulePeer::OM_CLASS;
  447. $obj = new $cls();
  448. $col = $obj->hydrate($row, $startcol);
  449. CcSchedulePeer::addInstanceToPool($obj, $key);
  450. }
  451. return array($obj, $col);
  452. }
  453. /**
  454. * Returns the number of rows matching criteria, joining the related CcShowInstances table
  455. *
  456. * @param Criteria $criteria
  457. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  458. * @param PropelPDO $con
  459. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  460. * @return int Number of matching rows.
  461. */
  462. public static function doCountJoinCcShowInstances(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
  463. {
  464. // we're going to modify criteria, so copy it first
  465. $criteria = clone $criteria;
  466. // We need to set the primary table name, since in the case that there are no WHERE columns
  467. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  468. // tables go into the FROM clause.
  469. $criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME);
  470. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  471. $criteria->setDistinct();
  472. }
  473. if (!$criteria->hasSelectClause()) {
  474. CcSchedulePeer::addSelectColumns($criteria);
  475. }
  476. $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
  477. // Set the correct dbName
  478. $criteria->setDbName(self::DATABASE_NAME);
  479. if ($con === null) {
  480. $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
  481. }
  482. $criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
  483. $stmt = BasePeer::doCount($criteria, $con);
  484. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  485. $count = (int) $row[0];
  486. } else {
  487. $count = 0; // no rows returned; we infer that means 0 matches.
  488. }
  489. $stmt->closeCursor();
  490. return $count;
  491. }
  492. /**
  493. * Returns the number of rows matching criteria, joining the related CcFiles table
  494. *
  495. * @param Criteria $criteria
  496. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  497. * @param PropelPDO $con
  498. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  499. * @return int Number of matching rows.
  500. */
  501. public static function doCountJoinCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
  502. {
  503. // we're going to modify criteria, so copy it first
  504. $criteria = clone $criteria;
  505. // We need to set the primary table name, since in the case that there are no WHERE columns
  506. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  507. // tables go into the FROM clause.
  508. $criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME);
  509. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  510. $criteria->setDistinct();
  511. }
  512. if (!$criteria->hasSelectClause()) {
  513. CcSchedulePeer::addSelectColumns($criteria);
  514. }
  515. $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
  516. // Set the correct dbName
  517. $criteria->setDbName(self::DATABASE_NAME);
  518. if ($con === null) {
  519. $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
  520. }
  521. $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
  522. $stmt = BasePeer::doCount($criteria, $con);
  523. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  524. $count = (int) $row[0];
  525. } else {
  526. $count = 0; // no rows returned; we infer that means 0 matches.
  527. }
  528. $stmt->closeCursor();
  529. return $count;
  530. }
  531. /**
  532. * Returns the number of rows matching criteria, joining the related CcWebstream table
  533. *
  534. * @param Criteria $criteria
  535. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  536. * @param PropelPDO $con
  537. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  538. * @return int Number of matching rows.
  539. */
  540. public static function doCountJoinCcWebstream(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
  541. {
  542. // we're going to modify criteria, so copy it first
  543. $criteria = clone $criteria;
  544. // We need to set the primary table name, since in the case that there are no WHERE columns
  545. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  546. // tables go into the FROM clause.
  547. $criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME);
  548. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  549. $criteria->setDistinct();
  550. }
  551. if (!$criteria->hasSelectClause()) {
  552. CcSchedulePeer::addSelectColumns($criteria);
  553. }
  554. $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
  555. // Set the correct dbName
  556. $criteria->setDbName(self::DATABASE_NAME);
  557. if ($con === null) {
  558. $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
  559. }
  560. $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::ID, $join_behavior);
  561. $stmt = BasePeer::doCount($criteria, $con);
  562. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  563. $count = (int) $row[0];
  564. } else {
  565. $count = 0; // no rows returned; we infer that means 0 matches.
  566. }
  567. $stmt->closeCursor();
  568. return $count;
  569. }
  570. /**
  571. * Selects a collection of CcSchedule objects pre-filled with their CcShowInstances objects.
  572. * @param Criteria $criteria
  573. * @param PropelPDO $con
  574. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  575. * @return array Array of CcSchedule objects.
  576. * @throws PropelException Any exceptions caught during processing will be
  577. * rethrown wrapped into a PropelException.
  578. */
  579. public static function doSelectJoinCcShowInstances(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  580. {
  581. $criteria = clone $criteria;
  582. // Set the correct dbName if it has not been overridden
  583. if ($criteria->getDbName() == Propel::getDefaultDB()) {
  584. $criteria->setDbName(self::DATABASE_NAME);
  585. }
  586. CcSchedulePeer::addSelectColumns($criteria);
  587. $startcol = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS);
  588. CcShowInstancesPeer::addSelectColumns($criteria);
  589. $criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
  590. $stmt = BasePeer::doSelect($criteria, $con);
  591. $results = array();
  592. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  593. $key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0);
  594. if (null !== ($obj1 = CcSchedulePeer::getInstanceFromPool($key1))) {
  595. // We no longer rehydrate the object, since this can cause data loss.
  596. // See http://www.propelorm.org/ticket/509
  597. // $obj1->hydrate($row, 0, true); // rehydrate
  598. } else {
  599. $cls = CcSchedulePeer::getOMClass(false);
  600. $obj1 = new $cls();
  601. $obj1->hydrate($row);
  602. CcSchedulePeer::addInstanceToPool($obj1, $key1);
  603. } // if $obj1 already loaded
  604. $key2 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol);
  605. if ($key2 !== null) {
  606. $obj2 = CcShowInstancesPeer::getInstanceFromPool($key2);
  607. if (!$obj2) {
  608. $cls = CcShowInstancesPeer::getOMClass(false);
  609. $obj2 = new $cls();
  610. $obj2->hydrate($row, $startcol);
  611. CcShowInstancesPeer::addInstanceToPool($obj2, $key2);
  612. } // if obj2 already loaded
  613. // Add the $obj1 (CcSchedule) to $obj2 (CcShowInstances)
  614. $obj2->addCcSchedule($obj1);
  615. } // if joined row was not null
  616. $results[] = $obj1;
  617. }
  618. $stmt->closeCursor();
  619. return $results;
  620. }
  621. /**
  622. * Selects a collection of CcSchedule objects pre-filled with their CcFiles objects.
  623. * @param Criteria $criteria
  624. * @param PropelPDO $con
  625. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  626. * @return array Array of CcSchedule objects.
  627. * @throws PropelException Any exceptions caught during processing will be
  628. * rethrown wrapped into a PropelException.
  629. */
  630. public static function doSelectJoinCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  631. {
  632. $criteria = clone $criteria;
  633. // Set the correct dbName if it has not been overridden
  634. if ($criteria->getDbName() == Propel::getDefaultDB()) {
  635. $criteria->setDbName(self::DATABASE_NAME);
  636. }
  637. CcSchedulePeer::addSelectColumns($criteria);
  638. $startcol = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS);
  639. CcFilesPeer::addSelectColumns($criteria);
  640. $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
  641. $stmt = BasePeer::doSelect($criteria, $con);
  642. $results = array();
  643. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  644. $key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0);
  645. if (null !== ($obj1 = CcSchedulePeer::getInstanceFromPool($key1))) {
  646. // We no longer rehydrate the object, since this can cause data loss.
  647. // See http://www.propelorm.org/ticket/509
  648. // $obj1->hydrate($row, 0, true); // rehydrate
  649. } else {
  650. $cls = CcSchedulePeer::getOMClass(false);
  651. $obj1 = new $cls();
  652. $obj1->hydrate($row);
  653. CcSchedulePeer::addInstanceToPool($obj1, $key1);
  654. } // if $obj1 already loaded
  655. $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol);
  656. if ($key2 !== null) {
  657. $obj2 = CcFilesPeer::getInstanceFromPool($key2);
  658. if (!$obj2) {
  659. $cls = CcFilesPeer::getOMClass(false);
  660. $obj2 = new $cls();
  661. $obj2->hydrate($row, $startcol);
  662. CcFilesPeer::addInstanceToPool($obj2, $key2);
  663. } // if obj2 already loaded
  664. // Add the $obj1 (CcSchedule) to $obj2 (CcFiles)
  665. $obj2->addCcSchedule($obj1);
  666. } // if joined row was not null
  667. $results[] = $obj1;
  668. }
  669. $stmt->closeCursor();
  670. return $results;
  671. }
  672. /**
  673. * Selects a collection of CcSchedule objects pre-filled with their CcWebstream objects.
  674. * @param Criteria $criteria
  675. * @param PropelPDO $con
  676. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  677. * @return array Array of CcSchedule objects.
  678. * @throws PropelException Any exceptions caught during processing will be
  679. * rethrown wrapped into a PropelException.
  680. */
  681. public static function doSelectJoinCcWebstream(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  682. {
  683. $criteria = clone $criteria;
  684. // Set the correct dbName if it has not been overridden
  685. if ($criteria->getDbName() == Propel::getDefaultDB()) {
  686. $criteria->setDbName(self::DATABASE_NAME);
  687. }
  688. CcSchedulePeer::addSelectColumns($criteria);
  689. $startcol = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS);
  690. CcWebstreamPeer::addSelectColumns($criteria);
  691. $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::ID, $join_behavior);
  692. $stmt = BasePeer::doSelect($criteria, $con);
  693. $results = array();
  694. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  695. $key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0);
  696. if (null !== ($obj1 = CcSchedulePeer::getInstanceFromPool($key1))) {
  697. // We no longer rehydrate the object, since this can cause data loss.
  698. // See http://www.propelorm.org/ticket/509
  699. // $obj1->hydrate($row, 0, true); // rehydrate
  700. } else {
  701. $cls = CcSchedulePeer::getOMClass(false);
  702. $obj1 = new $cls();
  703. $obj1->hydrate($row);
  704. CcSchedulePeer::addInstanceToPool($obj1, $key1);
  705. } // if $obj1 already loaded
  706. $key2 = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, $startcol);
  707. if ($key2 !== null) {
  708. $obj2 = CcWebstreamPeer::getInstanceFromPool($key2);
  709. if (!$obj2) {
  710. $cls = CcWebstreamPeer::getOMClass(false);
  711. $obj2 = new $cls();
  712. $obj2->hydrate($row, $startcol);
  713. CcWebstreamPeer::addInstanceToPool($obj2, $key2);
  714. } // if obj2 already loaded
  715. // Add the $obj1 (CcSchedule) to $obj2 (CcWebstream)
  716. $obj2->addCcSchedule($obj1);
  717. } // if joined row was not null
  718. $results[] = $obj1;
  719. }
  720. $stmt->closeCursor();
  721. return $results;
  722. }
  723. /**
  724. * Returns the number of rows matching criteria, joining all related tables
  725. *
  726. * @param Criteria $criteria
  727. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  728. * @param PropelPDO $con
  729. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  730. * @return int Number of matching rows.
  731. */
  732. public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
  733. {
  734. // we're going to modify criteria, so copy it first
  735. $criteria = clone $criteria;
  736. // We need to set the primary table name, since in the case that there are no WHERE columns
  737. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  738. // tables go into the FROM clause.
  739. $criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME);
  740. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  741. $criteria->setDistinct();
  742. }
  743. if (!$criteria->hasSelectClause()) {
  744. CcSchedulePeer::addSelectColumns($criteria);
  745. }
  746. $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
  747. // Set the correct dbName
  748. $criteria->setDbName(self::DATABASE_NAME);
  749. if ($con === null) {
  750. $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
  751. }
  752. $criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
  753. $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
  754. $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::ID, $join_behavior);
  755. $stmt = BasePeer::doCount($criteria, $con);
  756. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  757. $count = (int) $row[0];
  758. } else {
  759. $count = 0; // no rows returned; we infer that means 0 matches.
  760. }
  761. $stmt->closeCursor();
  762. return $count;
  763. }
  764. /**
  765. * Selects a collection of CcSchedule objects pre-filled with all related objects.
  766. *
  767. * @param Criteria $criteria
  768. * @param PropelPDO $con
  769. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  770. * @return array Array of CcSchedule objects.
  771. * @throws PropelException Any exceptions caught during processing will be
  772. * rethrown wrapped into a PropelException.
  773. */
  774. public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  775. {
  776. $criteria = clone $criteria;
  777. // Set the correct dbName if it has not been overridden
  778. if ($criteria->getDbName() == Propel::getDefaultDB()) {
  779. $criteria->setDbName(self::DATABASE_NAME);
  780. }
  781. CcSchedulePeer::addSelectColumns($criteria);
  782. $startcol2 = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS);
  783. CcShowInstancesPeer::addSelectColumns($criteria);
  784. $startcol3 = $startcol2 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS);
  785. CcFilesPeer::addSelectColumns($criteria);
  786. $startcol4 = $startcol3 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
  787. CcWebstreamPeer::addSelectColumns($criteria);
  788. $startcol5 = $startcol4 + (CcWebstreamPeer::NUM_COLUMNS - CcWebstreamPeer::NUM_LAZY_LOAD_COLUMNS);
  789. $criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
  790. $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
  791. $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::ID, $join_behavior);
  792. $stmt = BasePeer::doSelect($criteria, $con);
  793. $results = array();
  794. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  795. $key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0);
  796. if (null !== ($obj1 = CcSchedulePeer::getInstanceFromPool($key1))) {
  797. // We no longer rehydrate the object, since this can cause data loss.
  798. // See http://www.propelorm.org/ticket/509
  799. // $obj1->hydrate($row, 0, true); // rehydrate
  800. } else {
  801. $cls = CcSchedulePeer::getOMClass(false);
  802. $obj1 = new $cls();
  803. $obj1->hydrate($row);
  804. CcSchedulePeer::addInstanceToPool($obj1, $key1);
  805. } // if obj1 already loaded
  806. // Add objects for joined CcShowInstances rows
  807. $key2 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
  808. if ($key2 !== null) {
  809. $obj2 = CcShowInstancesPeer::getInstanceFromPool($key2);
  810. if (!$obj2) {
  811. $cls = CcShowInstancesPeer::getOMClass(false);
  812. $obj2 = new $cls();
  813. $obj2->hydrate($row, $startcol2);
  814. CcShowInstancesPeer::addInstanceToPool($obj2, $key2);
  815. } // if obj2 loaded
  816. // Add the $obj1 (CcSchedule) to the collection in $obj2 (CcShowInstances)
  817. $obj2->addCcSchedule($obj1);
  818. } // if joined row not null
  819. // Add objects for joined CcFiles rows
  820. $key3 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol3);
  821. if ($key3 !== null) {
  822. $obj3 = CcFilesPeer::getInstanceFromPool($key3);
  823. if (!$obj3) {
  824. $cls = CcFilesPeer::getOMClass(false);
  825. $obj3 = new $cls();
  826. $obj3->hydrate($row, $startcol3);
  827. CcFilesPeer::addInstanceToPool($obj3, $key3);
  828. } // if obj3 loaded
  829. // Add the $obj1 (CcSchedule) to the collection in $obj3 (CcFiles)
  830. $obj3->addCcSchedule($obj1);
  831. } // if joined row not null
  832. // Add objects for joined CcWebstream rows
  833. $key4 = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, $startcol4);
  834. if ($key4 !== null) {
  835. $obj4 = CcWebstreamPeer::getInstanceFromPool($key4);
  836. if (!$obj4) {
  837. $cls = CcWebstreamPeer::getOMClass(false);
  838. $obj4 = new $cls();
  839. $obj4->hydrate($row, $startcol4);
  840. CcWebstreamPeer::addInstanceToPool($obj4, $key4);
  841. } // if obj4 loaded
  842. // Add the $obj1 (CcSchedule) to the collection in $obj4 (CcWebstream)
  843. $obj4->addCcSchedule($obj1);
  844. } // if joined row not null
  845. $results[] = $obj1;
  846. }
  847. $stmt->closeCursor();
  848. return $results;
  849. }
  850. /**
  851. * Returns the number of rows matching criteria, joining the related CcShowInstances table
  852. *
  853. * @param Criteria $criteria
  854. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  855. * @param PropelPDO $con
  856. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  857. * @return int Number of matching rows.
  858. */
  859. public static function doCountJoinAllExceptCcShowInstances(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
  860. {
  861. // we're going to modify criteria, so copy it first
  862. $criteria = clone $criteria;
  863. // We need to set the primary table name, since in the case that there are no WHERE columns
  864. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  865. // tables go into the FROM clause.
  866. $criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME);
  867. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  868. $criteria->setDistinct();
  869. }
  870. if (!$criteria->hasSelectClause()) {
  871. CcSchedulePeer::addSelectColumns($criteria);
  872. }
  873. $criteria->clearOrderByColumns(); // ORDER BY should not affect count
  874. // Set the correct dbName
  875. $criteria->setDbName(self::DATABASE_NAME);
  876. if ($con === null) {
  877. $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
  878. }
  879. $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
  880. $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::ID, $join_behavior);
  881. $stmt = BasePeer::doCount($criteria, $con);
  882. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  883. $count = (int) $row[0];
  884. } else {
  885. $count = 0; // no rows returned; we infer that means 0 matches.
  886. }
  887. $stmt->closeCursor();
  888. return $count;
  889. }
  890. /**
  891. * Returns the number of rows matching criteria, joining the related CcFiles table
  892. *
  893. * @param Criteria $criteria
  894. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  895. * @param PropelPDO $con
  896. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  897. * @return int Number of matching rows.
  898. */
  899. public static function doCountJoinAllExceptCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
  900. {
  901. // we're going to modify criteria, so copy it first
  902. $criteria = clone $criteria;
  903. // We need to set the primary table name, since in the case that there are no WHERE columns
  904. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  905. // tables go into the FROM clause.
  906. $criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME);
  907. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  908. $criteria->setDistinct();
  909. }
  910. if (!$criteria->hasSelectClause()) {
  911. CcSchedulePeer::addSelectColumns($criteria);
  912. }
  913. $criteria->clearOrderByColumns(); // ORDER BY should not affect count
  914. // Set the correct dbName
  915. $criteria->setDbName(self::DATABASE_NAME);
  916. if ($con === null) {
  917. $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
  918. }
  919. $criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
  920. $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::ID, $join_behavior);
  921. $stmt = BasePeer::doCount($criteria, $con);
  922. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  923. $count = (int) $row[0];
  924. } else {
  925. $count = 0; // no rows returned; we infer that means 0 matches.
  926. }
  927. $stmt->closeCursor();
  928. return $count;
  929. }
  930. /**
  931. * Returns the number of rows matching criteria, joining the related CcWebstream table
  932. *
  933. * @param Criteria $criteria
  934. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  935. * @param PropelPDO $con
  936. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  937. * @return int Number of matching rows.
  938. */
  939. public static function doCountJoinAllExceptCcWebstream(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
  940. {
  941. // we're going to modify criteria, so copy it first
  942. $criteria = clone $criteria;
  943. // We need to set the primary table name, since in the case that there are no WHERE columns
  944. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  945. // tables go into the FROM clause.
  946. $criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME);
  947. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  948. $criteria->setDistinct();
  949. }
  950. if (!$criteria->hasSelectClause()) {
  951. CcSchedulePeer::addSelectColumns($criteria);
  952. }
  953. $criteria->clearOrderByColumns(); // ORDER BY should not affect count
  954. // Set the correct dbName
  955. $criteria->setDbName(self::DATABASE_NAME);
  956. if ($con === null) {
  957. $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
  958. }
  959. $criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
  960. $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
  961. $stmt = BasePeer::doCount($criteria, $con);
  962. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  963. $count = (int) $row[0];
  964. } else {
  965. $count = 0; // no rows returned; we infer that means 0 matches.
  966. }
  967. $stmt->closeCursor();
  968. return $count;
  969. }
  970. /**
  971. * Selects a collection of CcSchedule objects pre-filled with all related objects except CcShowInstances.
  972. *
  973. * @param Criteria $criteria
  974. * @param PropelPDO $con
  975. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  976. * @return array Array of CcSchedule objects.
  977. * @throws PropelException Any exceptions caught during processing will be
  978. * rethrown wrapped into a PropelException.
  979. */
  980. public static function doSelectJoinAllExceptCcShowInstances(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  981. {
  982. $criteria = clone $criteria;
  983. // Set the correct dbName if it has not been overridden
  984. // $criteria->getDbName() will return the same object if not set to another value
  985. // so == check is okay and faster
  986. if ($criteria->getDbName() == Propel::getDefaultDB()) {
  987. $criteria->setDbName(self::DATABASE_NAME);
  988. }
  989. CcSchedulePeer::addSelectColumns($criteria);
  990. $startcol2 = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS);
  991. CcFilesPeer::addSelectColumns($criteria);
  992. $startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
  993. CcWebstreamPeer::addSelectColumns($criteria);
  994. $startcol4 = $startcol3 + (CcWebstreamPeer::NUM_COLUMNS - CcWebstreamPeer::NUM_LAZY_LOAD_COLUMNS);
  995. $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
  996. $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::ID, $join_behavior);
  997. $stmt = BasePeer::doSelect($criteria, $con);
  998. $results = array();
  999. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  1000. $key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0);
  1001. if (null !== ($obj1 = CcSchedulePeer::getInstanceFromPool($key1))) {
  1002. // We no longer rehydrate the object, since this can cause data loss.
  1003. // See http://www.propelorm.org/ticket/509
  1004. // $obj1->hydrate($row, 0, true); // rehydrate
  1005. } else {
  1006. $cls = CcSchedulePeer::getOMClass(false);
  1007. $obj1 = new $cls();
  1008. $obj1->hydrate($row);
  1009. CcSchedulePeer::addInstanceToPool($obj1, $key1);
  1010. } // if obj1 already loaded
  1011. // Add objects for joined CcFiles rows
  1012. $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
  1013. if ($key2 !== null) {
  1014. $obj2 = CcFilesPeer::getInstanceFromPool($key2);
  1015. if (!$obj2) {
  1016. $cls = CcFilesPeer::getOMClass(false);
  1017. $obj2 = new $cls();
  1018. $obj2->hydrate($row, $startcol2);
  1019. CcFilesPeer::addInstanceToPool($obj2, $key2);
  1020. } // if $obj2 already loaded
  1021. // Add the $obj1 (CcSchedule) to the collection in $obj2 (CcFiles)
  1022. $obj2->addCcSchedule($obj1);
  1023. } // if joined row is not null
  1024. // Add objects for joined CcWebstream rows
  1025. $key3 = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, $startcol3);
  1026. if ($key3 !== null) {
  1027. $obj3 = CcWebstreamPeer::getInstanceFromPool($key3);
  1028. if (!$obj3) {
  1029. $cls = CcWebstreamPeer::getOMClass(false);
  1030. $obj3 = new $cls();
  1031. $obj3->hydrate($row, $startcol3);
  1032. CcWebstreamPeer::addInstanceToPool($obj3, $key3);
  1033. } // if $obj3 already loaded
  1034. // Add the $obj1 (CcSchedule) to the collection in $obj3 (CcWebstream)
  1035. $obj3->addCcSchedule($obj1);
  1036. } // if joined row is not null
  1037. $results[] = $obj1;
  1038. }
  1039. $stmt->closeCursor();
  1040. return $results;
  1041. }
  1042. /**
  1043. * Selects a collection of CcSchedule objects pre-filled with all related objects except CcFiles.
  1044. *
  1045. * @param Criteria $criteria
  1046. * @param PropelPDO $con
  1047. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  1048. * @return array Array of CcSchedule objects.
  1049. * @throws PropelException Any exceptions caught during processing will be
  1050. * rethrown wrapped into a PropelException.
  1051. */
  1052. public static function doSelectJoinAllExceptCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  1053. {
  1054. $criteria = clone $criteria;
  1055. // Set the correct dbName if it has not been overridden
  1056. // $criteria->getDbName() will return the same object if not set to another value
  1057. // so == check is okay and faster
  1058. if ($criteria->getDbName() == Propel::getDefaultDB()) {
  1059. $criteria->setDbName(self::DATABASE_NAME);
  1060. }
  1061. CcSchedulePeer::addSelectColumns($criteria);
  1062. $startcol2 = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS);
  1063. CcShowInstancesPeer::addSelectColumns($criteria);
  1064. $startcol3 = $startcol2 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS);
  1065. CcWebstreamPeer::addSelectColumns($criteria);
  1066. $startcol4 = $startcol3 + (CcWebstreamPeer::NUM_COLUMNS - CcWebstreamPeer::NUM_LAZY_LOAD_COLUMNS);
  1067. $criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
  1068. $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::ID, $join_behavior);
  1069. $stmt = BasePeer::doSelect($criteria, $con);
  1070. $results = array();
  1071. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  1072. $key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0);
  1073. if (null !== ($obj1 = CcSchedulePeer::getInstanceFromPool($key1))) {
  1074. // We no longer rehydrate the object, since this can cause data loss.
  1075. // See http://www.propelorm.org/ticket/509
  1076. // $obj1->hydrate($row, 0, true); // rehydrate
  1077. } else {
  1078. $cls = CcSchedulePeer::getOMClass(false);
  1079. $obj1 = new $cls();
  1080. $obj1->hydrate($row);
  1081. CcSchedulePeer::addInstanceToPool($obj1, $key1);
  1082. } // if obj1 already loaded
  1083. // Add objects for joined CcShowInstances rows
  1084. $key2 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
  1085. if ($key2 !== null) {
  1086. $obj2 = CcShowInstancesPeer::getInstanceFromPool($key2);
  1087. if (!$obj2) {
  1088. $cls = CcShowInstancesPeer::getOMClass(false);
  1089. $obj2 = new $cls();
  1090. $obj2->hydrate($row, $startcol2);
  1091. CcShowInstancesPeer::addInstanceToPool($obj2, $key2);
  1092. } // if $obj2 already loaded
  1093. // Add the $obj1 (CcSchedule) to the collection in $obj2 (CcShowInstances)
  1094. $obj2->addCcSchedule($obj1);
  1095. } // if joined row is not null
  1096. // Add objects for joined CcWebstream rows
  1097. $key3 = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, $startcol3);
  1098. if ($key3 !== null) {
  1099. $obj3 = CcWebstreamPeer::getInstanceFromPool($key3);
  1100. if (!$obj3) {
  1101. $cls = CcWebstreamPeer::getOMClass(false);
  1102. $obj3 = new $cls();
  1103. $obj3->hydrate($row, $startcol3);
  1104. CcWebstreamPeer::addInstanceToPool($obj3, $key3);
  1105. } // if $obj3 already loaded
  1106. // Add the $obj1 (CcSchedule) to the collection in $obj3 (CcWebstream)
  1107. $obj3->addCcSchedule($obj1);
  1108. } // if joined row is not null
  1109. $results[] = $obj1;
  1110. }
  1111. $stmt->closeCursor();
  1112. return $results;
  1113. }
  1114. /**
  1115. * Selects a collection of CcSchedule objects pre-filled with all related objects except CcWebstream.
  1116. *
  1117. * @param Criteria $criteria
  1118. * @param PropelPDO $con
  1119. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  1120. * @return array Array of CcSchedule objects.
  1121. * @throws PropelException Any exceptions caught during processing will be
  1122. * rethrown wrapped into a PropelException.
  1123. */
  1124. public static function doSelectJoinAllExceptCcWebstream(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  1125. {
  1126. $criteria = clone $criteria;
  1127. // Set the correct dbName if it has not been overridden
  1128. // $criteria->getDbName() will return the same object if not set to another value
  1129. // so == check is okay and faster
  1130. if ($criteria->getDbName() == Propel::getDefaultDB()) {
  1131. $criteria->setDbName(self::DATABASE_NAME);
  1132. }
  1133. CcSchedulePeer::addSelectColumns($criteria);
  1134. $startcol2 = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS);
  1135. CcShowInstancesPeer::addSelectColumns($criteria);
  1136. $startcol3 = $startcol2 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS);
  1137. CcFilesPeer::addSelectColumns($criteria);
  1138. $startcol4 = $startcol3 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
  1139. $criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
  1140. $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
  1141. $stmt = BasePeer::doSelect($criteria, $con);
  1142. $results = array();
  1143. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  1144. $key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0);
  1145. if (null !== ($obj1 = CcSchedulePeer::getInstanceFromPool($key1))) {
  1146. // We no longer rehydrate the object, since this can cause data loss.
  1147. // See http://www.propelorm.org/ticket/509
  1148. // $obj1->hydrate($row, 0, true); // rehydrate
  1149. } else {
  1150. $cls = CcSchedulePeer::getOMClass(false);
  1151. $obj1 = new $cls();
  1152. $obj1->hydrate($row);
  1153. CcSchedulePeer::addInstanceToPool($obj1, $key1);
  1154. } // if obj1 already loaded
  1155. // Add objects for joined CcShowInstances rows
  1156. $key2 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
  1157. if ($key2 !== null) {
  1158. $obj2 = CcShowInstancesPeer::getInstanceFromPool($key2);
  1159. if (!$obj2) {
  1160. $cls = CcShowInstancesPeer::getOMClass(false);
  1161. $obj2 = new $cls();
  1162. $obj2->hydrate($row, $startcol2);
  1163. CcShowInstancesPeer::addInstanceToPool($obj2, $key2);
  1164. } // if $obj2 already loaded
  1165. // Add the $obj1 (CcSchedule) to the collection in $obj2 (CcShowInstances)
  1166. $obj2->addCcSchedule($obj1);
  1167. } // if joined row is not null
  1168. // Add objects for joined CcFiles rows
  1169. $key3 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol3);
  1170. if ($key3 !== null) {
  1171. $obj3 = CcFilesPeer::getInstanceFromPool($key3);
  1172. if (!$obj3) {
  1173. $cls = CcFilesPeer::getOMClass(false);
  1174. $obj3 = new $cls();
  1175. $obj3->hydrate($row, $startcol3);
  1176. CcFilesPeer::addInstanceToPool($obj3, $key3);
  1177. } // if $obj3 already loaded
  1178. // Add the $obj1 (CcSchedule) to the collection in $obj3 (CcFiles)
  1179. $obj3->addCcSchedule($obj1);
  1180. } // if joined row is not null
  1181. $results[] = $obj1;
  1182. }
  1183. $stmt->closeCursor();
  1184. return $results;
  1185. }
  1186. /**
  1187. * Returns the TableMap related to this peer.
  1188. * This method is not needed for general use but a specific application could have a need.
  1189. * @return TableMap
  1190. * @throws PropelException Any exceptions caught during processing will be
  1191. * rethrown wrapped into a PropelException.
  1192. */
  1193. public static function getTableMap()
  1194. {
  1195. return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
  1196. }
  1197. /**
  1198. * Add a TableMap instance to the database for this peer class.
  1199. */
  1200. public static function buildTableMap()
  1201. {
  1202. $dbMap = Propel::getDatabaseMap(BaseCcSchedulePeer::DATABASE_NAME);
  1203. if (!$dbMap->hasTable(BaseCcSchedulePeer::TABLE_NAME))
  1204. {
  1205. $dbMap->addTableObject(new CcScheduleTableMap());
  1206. }
  1207. }
  1208. /**
  1209. * The class that the Peer will make instances of.
  1210. *
  1211. * If $withPrefix is true, the returned path
  1212. * uses a dot-path notation which is tranalted into a path
  1213. * relative to a location on the PHP include_path.
  1214. * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
  1215. *
  1216. * @param boolean $withPrefix Whether or not to return the path with the class name
  1217. * @return string path.to.ClassName
  1218. */
  1219. public static function getOMClass($withPrefix = true)
  1220. {
  1221. return $withPrefix ? CcSchedulePeer::CLASS_DEFAULT : CcSchedulePeer::OM_CLASS;
  1222. }
  1223. /**
  1224. * Method perform an INSERT on the database, given a CcSchedule or Criteria object.
  1225. *
  1226. * @param mixed $values Criteria or CcSchedule object containing data that is used to create the INSERT statement.
  1227. * @param PropelPDO $con the PropelPDO connection to use
  1228. * @return mixed The new primary key.
  1229. * @throws PropelException Any exceptions caught during processing will be
  1230. * rethrown wrapped into a PropelException.
  1231. */
  1232. public static function doInsert($values, PropelPDO $con = null)
  1233. {
  1234. if ($con === null) {
  1235. $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  1236. }
  1237. if ($values instanceof Criteria) {
  1238. $criteria = clone $values; // rename for clarity
  1239. } else {
  1240. $criteria = $values->buildCriteria(); // build Criteria from CcSchedule object
  1241. }
  1242. if ($criteria->containsKey(CcSchedulePeer::ID) && $criteria->keyContainsValue(CcSchedulePeer::ID) ) {
  1243. throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcSchedulePeer::ID.')');
  1244. }
  1245. // Set the correct dbName
  1246. $criteria->setDbName(self::DATABASE_NAME);
  1247. try {
  1248. // use transaction because $criteria could contain info
  1249. // for more than one table (I guess, conceivably)
  1250. $con->beginTransaction();
  1251. $pk = BasePeer::doInsert($criteria, $con);
  1252. $con->commit();
  1253. } catch(PropelException $e) {
  1254. $con->rollBack();
  1255. throw $e;
  1256. }
  1257. return $pk;
  1258. }
  1259. /**
  1260. * Method perform an UPDATE on the database, given a CcSchedule or Criteria object.
  1261. *
  1262. * @param mixed $values Criteria or CcSchedule object containing data that is used to create the UPDATE statement.
  1263. * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
  1264. * @return int The number of affected rows (if supported by underlying database driver).
  1265. * @throws PropelException Any exceptions caught during processing will be
  1266. * rethrown wrapped into a PropelException.
  1267. */
  1268. public static function doUpdate($values, PropelPDO $con = null)
  1269. {
  1270. if ($con === null) {
  1271. $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  1272. }
  1273. $selectCriteria = new Criteria(self::DATABASE_NAME);
  1274. if ($values instanceof Criteria) {
  1275. $criteria = clone $values; // rename for clarity
  1276. $comparison = $criteria->getComparison(CcSchedulePeer::ID);
  1277. $value = $criteria->remove(CcSchedulePeer::ID);
  1278. if ($value) {
  1279. $selectCriteria->add(CcSchedulePeer::ID, $value, $comparison);
  1280. } else {
  1281. $selectCriteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME);
  1282. }
  1283. } else { // $values is CcSchedule object
  1284. $criteria = $values->buildCriteria(); // gets full criteria
  1285. $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
  1286. }
  1287. // set the correct dbName
  1288. $criteria->setDbName(self::DATABASE_NAME);
  1289. return BasePeer::doUpdate($selectCriteria, $criteria, $con);
  1290. }
  1291. /**
  1292. * Method to DELETE all rows from the cc_schedule table.
  1293. *
  1294. * @return int The number of affected rows (if supported by underlying database driver).
  1295. */
  1296. public static function doDeleteAll($con = null)
  1297. {
  1298. if ($con === null) {
  1299. $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  1300. }
  1301. $affectedRows = 0; // initialize var to track total num of affected rows
  1302. try {
  1303. // use transaction because $criteria could contain info
  1304. // for more than one table or we could emulating ON DELETE CASCADE, etc.
  1305. $con->beginTransaction();
  1306. $affectedRows += BasePeer::doDeleteAll(CcSchedulePeer::TABLE_NAME, $con, CcSchedulePeer::DATABASE_NAME);
  1307. // Because this db requires some delete cascade/set null emulation, we have to
  1308. // clear the cached instance *after* the emulation has happened (since
  1309. // instances get re-added by the select statement contained therein).
  1310. CcSchedulePeer::clearInstancePool();
  1311. CcSchedulePeer::clearRelatedInstancePool();
  1312. $con->commit();
  1313. return $affectedRows;
  1314. } catch (PropelException $e) {
  1315. $con->rollBack();
  1316. throw $e;
  1317. }
  1318. }
  1319. /**
  1320. * Method perform a DELETE on the database, given a CcSchedule or Criteria object OR a primary key value.
  1321. *
  1322. * @param mixed $values Criteria or CcSchedule object or primary key or array of primary keys
  1323. * which is used to create the DELETE statement
  1324. * @param PropelPDO $con the connection to use
  1325. * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
  1326. * if supported by native driver or if emulated using Propel.
  1327. * @throws PropelException Any exceptions caught during processing will be
  1328. * rethrown wrapped into a PropelException.
  1329. */
  1330. public static function doDelete($values, PropelPDO $con = null)
  1331. {
  1332. if ($con === null) {
  1333. $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  1334. }
  1335. if ($values instanceof Criteria) {
  1336. // invalidate the cache for all objects of this type, since we have no
  1337. // way of knowing (without running a query) what objects should be invalidated
  1338. // from the cache based on this Criteria.
  1339. CcSchedulePeer::clearInstancePool();
  1340. // rename for clarity
  1341. $criteria = clone $values;
  1342. } elseif ($values instanceof CcSchedule) { // it's a model object
  1343. // invalidate the cache for this single object
  1344. CcSchedulePeer::removeInstanceFromPool($values);
  1345. // create criteria based on pk values
  1346. $criteria = $values->buildPkeyCriteria();
  1347. } else { // it's a primary key, or an array of pks
  1348. $criteria = new Criteria(self::DATABASE_NAME);
  1349. $criteria->add(CcSchedulePeer::ID, (array) $values, Criteria::IN);
  1350. // invalidate the cache for this object(s)
  1351. foreach ((array) $values as $singleval) {
  1352. CcSchedulePeer::removeInstanceFromPool($singleval);
  1353. }
  1354. }
  1355. // Set the correct dbName
  1356. $criteria->setDbName(self::DATABASE_NAME);
  1357. $affectedRows = 0; // initialize var to track total num of affected rows
  1358. try {
  1359. // use transaction because $criteria could contain info
  1360. // for more than one table or we could emulating ON DELETE CASCADE, etc.
  1361. $con->beginTransaction();
  1362. $affectedRows += BasePeer::doDelete($criteria, $con);
  1363. CcSchedulePeer::clearRelatedInstancePool();
  1364. $con->commit();
  1365. return $affectedRows;
  1366. } catch (PropelException $e) {
  1367. $con->rollBack();
  1368. throw $e;
  1369. }
  1370. }
  1371. /**
  1372. * Validates all modified columns of given CcSchedule object.
  1373. * If parameter $columns is either a single column name or an array of column names
  1374. * than only those columns are validated.
  1375. *
  1376. * NOTICE: This does not apply to primary or foreign keys for now.
  1377. *
  1378. * @param CcSchedule $obj The object to validate.
  1379. * @param mixed $cols Column name or array of column names.
  1380. *
  1381. * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
  1382. */
  1383. public static function doValidate(CcSchedule $obj, $cols = null)
  1384. {
  1385. $columns = array();
  1386. if ($cols) {
  1387. $dbMap = Propel::getDatabaseMap(CcSchedulePeer::DATABASE_NAME);
  1388. $tableMap = $dbMap->getTable(CcSchedulePeer::TABLE_NAME);
  1389. if (! is_array($cols)) {
  1390. $cols = array($cols);
  1391. }
  1392. foreach ($cols as $colName) {
  1393. if ($tableMap->containsColumn($colName)) {
  1394. $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
  1395. $columns[$colName] = $obj->$get();
  1396. }
  1397. }
  1398. } else {
  1399. }
  1400. return BasePeer::doValidate(CcSchedulePeer::DATABASE_NAME, CcSchedulePeer::TABLE_NAME, $columns);
  1401. }
  1402. /**
  1403. * Retrieve a single object by pkey.
  1404. *
  1405. * @param int $pk the primary key.
  1406. * @param PropelPDO $con the connection to use
  1407. * @return CcSchedule
  1408. */
  1409. public static function retrieveByPK($pk, PropelPDO $con = null)
  1410. {
  1411. if (null !== ($obj = CcSchedulePeer::getInstanceFromPool((string) $pk))) {
  1412. return $obj;
  1413. }
  1414. if ($con === null) {
  1415. $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
  1416. }
  1417. $criteria = new Criteria(CcSchedulePeer::DATABASE_NAME);
  1418. $criteria->add(CcSchedulePeer::ID, $pk);
  1419. $v = CcSchedulePeer::doSelect($criteria, $con);
  1420. return !empty($v) > 0 ? $v[0] : null;
  1421. }
  1422. /**
  1423. * Retrieve multiple objects by pkey.
  1424. *
  1425. * @param array $pks List of primary keys
  1426. * @param PropelPDO $con the connection to use
  1427. * @throws PropelException Any exceptions caught during processing will be
  1428. * rethrown wrapped into a PropelException.
  1429. */
  1430. public static function retrieveByPKs($pks, PropelPDO $con = null)
  1431. {
  1432. if ($con === null) {
  1433. $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
  1434. }
  1435. $objs = null;
  1436. if (empty($pks)) {
  1437. $objs = array();
  1438. } else {
  1439. $criteria = new Criteria(CcSchedulePeer::DATABASE_NAME);
  1440. $criteria->add(CcSchedulePeer::ID, $pks, Criteria::IN);
  1441. $objs = CcSchedulePeer::doSelect($criteria, $con);
  1442. }
  1443. return $objs;
  1444. }
  1445. } // BaseCcSchedulePeer
  1446. // This is the static code needed to register the TableMap for this table with the main Propel class.
  1447. //
  1448. BaseCcSchedulePeer::buildTableMap();