BaseCcSchedule.php 58 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017
  1. <?php
  2. /**
  3. * Base class that represents a row from the 'cc_schedule' table.
  4. *
  5. *
  6. *
  7. * @package propel.generator.airtime.om
  8. */
  9. abstract class BaseCcSchedule extends BaseObject implements Persistent
  10. {
  11. /**
  12. * Peer class name
  13. */
  14. const PEER = 'CcSchedulePeer';
  15. /**
  16. * The Peer class.
  17. * Instance provides a convenient way of calling static methods on a class
  18. * that calling code may not be able to identify.
  19. * @var CcSchedulePeer
  20. */
  21. protected static $peer;
  22. /**
  23. * The value for the id field.
  24. * @var int
  25. */
  26. protected $id;
  27. /**
  28. * The value for the starts field.
  29. * @var string
  30. */
  31. protected $starts;
  32. /**
  33. * The value for the ends field.
  34. * @var string
  35. */
  36. protected $ends;
  37. /**
  38. * The value for the file_id field.
  39. * @var int
  40. */
  41. protected $file_id;
  42. /**
  43. * The value for the stream_id field.
  44. * @var int
  45. */
  46. protected $stream_id;
  47. /**
  48. * The value for the clip_length field.
  49. * Note: this column has a database default value of: '00:00:00'
  50. * @var string
  51. */
  52. protected $clip_length;
  53. /**
  54. * The value for the fade_in field.
  55. * Note: this column has a database default value of: '00:00:00'
  56. * @var string
  57. */
  58. protected $fade_in;
  59. /**
  60. * The value for the fade_out field.
  61. * Note: this column has a database default value of: '00:00:00'
  62. * @var string
  63. */
  64. protected $fade_out;
  65. /**
  66. * The value for the cue_in field.
  67. * @var string
  68. */
  69. protected $cue_in;
  70. /**
  71. * The value for the cue_out field.
  72. * @var string
  73. */
  74. protected $cue_out;
  75. /**
  76. * The value for the media_item_played field.
  77. * Note: this column has a database default value of: false
  78. * @var boolean
  79. */
  80. protected $media_item_played;
  81. /**
  82. * The value for the instance_id field.
  83. * @var int
  84. */
  85. protected $instance_id;
  86. /**
  87. * The value for the playout_status field.
  88. * Note: this column has a database default value of: 1
  89. * @var int
  90. */
  91. protected $playout_status;
  92. /**
  93. * The value for the broadcasted field.
  94. * Note: this column has a database default value of: 0
  95. * @var int
  96. */
  97. protected $broadcasted;
  98. /**
  99. * The value for the position field.
  100. * Note: this column has a database default value of: 0
  101. * @var int
  102. */
  103. protected $position;
  104. /**
  105. * @var CcShowInstances
  106. */
  107. protected $aCcShowInstances;
  108. /**
  109. * @var CcFiles
  110. */
  111. protected $aCcFiles;
  112. /**
  113. * @var CcWebstream
  114. */
  115. protected $aCcWebstream;
  116. /**
  117. * @var array CcWebstreamMetadata[] Collection to store aggregation of CcWebstreamMetadata objects.
  118. */
  119. protected $collCcWebstreamMetadatas;
  120. /**
  121. * Flag to prevent endless save loop, if this object is referenced
  122. * by another object which falls in this transaction.
  123. * @var boolean
  124. */
  125. protected $alreadyInSave = false;
  126. /**
  127. * Flag to prevent endless validation loop, if this object is referenced
  128. * by another object which falls in this transaction.
  129. * @var boolean
  130. */
  131. protected $alreadyInValidation = false;
  132. /**
  133. * Applies default values to this object.
  134. * This method should be called from the object's constructor (or
  135. * equivalent initialization method).
  136. * @see __construct()
  137. */
  138. public function applyDefaultValues()
  139. {
  140. $this->clip_length = '00:00:00';
  141. $this->fade_in = '00:00:00';
  142. $this->fade_out = '00:00:00';
  143. $this->media_item_played = false;
  144. $this->playout_status = 1;
  145. $this->broadcasted = 0;
  146. $this->position = 0;
  147. }
  148. /**
  149. * Initializes internal state of BaseCcSchedule object.
  150. * @see applyDefaults()
  151. */
  152. public function __construct()
  153. {
  154. parent::__construct();
  155. $this->applyDefaultValues();
  156. }
  157. /**
  158. * Get the [id] column value.
  159. *
  160. * @return int
  161. */
  162. public function getDbId()
  163. {
  164. return $this->id;
  165. }
  166. /**
  167. * Get the [optionally formatted] temporal [starts] column value.
  168. *
  169. *
  170. * @param string $format The date/time format string (either date()-style or strftime()-style).
  171. * If format is NULL, then the raw DateTime object will be returned.
  172. * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
  173. * @throws PropelException - if unable to parse/validate the date/time value.
  174. */
  175. public function getDbStarts($format = 'Y-m-d H:i:s')
  176. {
  177. if ($this->starts === null) {
  178. return null;
  179. }
  180. try {
  181. $dt = new DateTime($this->starts);
  182. } catch (Exception $x) {
  183. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->starts, true), $x);
  184. }
  185. if ($format === null) {
  186. // Because propel.useDateTimeClass is TRUE, we return a DateTime object.
  187. return $dt;
  188. } elseif (strpos($format, '%') !== false) {
  189. return strftime($format, $dt->format('U'));
  190. } else {
  191. return $dt->format($format);
  192. }
  193. }
  194. /**
  195. * Get the [optionally formatted] temporal [ends] column value.
  196. *
  197. *
  198. * @param string $format The date/time format string (either date()-style or strftime()-style).
  199. * If format is NULL, then the raw DateTime object will be returned.
  200. * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
  201. * @throws PropelException - if unable to parse/validate the date/time value.
  202. */
  203. public function getDbEnds($format = 'Y-m-d H:i:s')
  204. {
  205. if ($this->ends === null) {
  206. return null;
  207. }
  208. try {
  209. $dt = new DateTime($this->ends);
  210. } catch (Exception $x) {
  211. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->ends, true), $x);
  212. }
  213. if ($format === null) {
  214. // Because propel.useDateTimeClass is TRUE, we return a DateTime object.
  215. return $dt;
  216. } elseif (strpos($format, '%') !== false) {
  217. return strftime($format, $dt->format('U'));
  218. } else {
  219. return $dt->format($format);
  220. }
  221. }
  222. /**
  223. * Get the [file_id] column value.
  224. *
  225. * @return int
  226. */
  227. public function getDbFileId()
  228. {
  229. return $this->file_id;
  230. }
  231. /**
  232. * Get the [stream_id] column value.
  233. *
  234. * @return int
  235. */
  236. public function getDbStreamId()
  237. {
  238. return $this->stream_id;
  239. }
  240. /**
  241. * Get the [clip_length] column value.
  242. *
  243. * @return string
  244. */
  245. public function getDbClipLength()
  246. {
  247. return $this->clip_length;
  248. }
  249. /**
  250. * Get the [optionally formatted] temporal [fade_in] column value.
  251. *
  252. *
  253. * @param string $format The date/time format string (either date()-style or strftime()-style).
  254. * If format is NULL, then the raw DateTime object will be returned.
  255. * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
  256. * @throws PropelException - if unable to parse/validate the date/time value.
  257. */
  258. public function getDbFadeIn($format = '%X')
  259. {
  260. if ($this->fade_in === null) {
  261. return null;
  262. }
  263. try {
  264. $dt = new DateTime($this->fade_in);
  265. } catch (Exception $x) {
  266. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->fade_in, true), $x);
  267. }
  268. if ($format === null) {
  269. // Because propel.useDateTimeClass is TRUE, we return a DateTime object.
  270. return $dt;
  271. } elseif (strpos($format, '%') !== false) {
  272. return strftime($format, $dt->format('U'));
  273. } else {
  274. return $dt->format($format);
  275. }
  276. }
  277. /**
  278. * Get the [optionally formatted] temporal [fade_out] column value.
  279. *
  280. *
  281. * @param string $format The date/time format string (either date()-style or strftime()-style).
  282. * If format is NULL, then the raw DateTime object will be returned.
  283. * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
  284. * @throws PropelException - if unable to parse/validate the date/time value.
  285. */
  286. public function getDbFadeOut($format = '%X')
  287. {
  288. if ($this->fade_out === null) {
  289. return null;
  290. }
  291. try {
  292. $dt = new DateTime($this->fade_out);
  293. } catch (Exception $x) {
  294. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->fade_out, true), $x);
  295. }
  296. if ($format === null) {
  297. // Because propel.useDateTimeClass is TRUE, we return a DateTime object.
  298. return $dt;
  299. } elseif (strpos($format, '%') !== false) {
  300. return strftime($format, $dt->format('U'));
  301. } else {
  302. return $dt->format($format);
  303. }
  304. }
  305. /**
  306. * Get the [cue_in] column value.
  307. *
  308. * @return string
  309. */
  310. public function getDbCueIn()
  311. {
  312. return $this->cue_in;
  313. }
  314. /**
  315. * Get the [cue_out] column value.
  316. *
  317. * @return string
  318. */
  319. public function getDbCueOut()
  320. {
  321. return $this->cue_out;
  322. }
  323. /**
  324. * Get the [media_item_played] column value.
  325. *
  326. * @return boolean
  327. */
  328. public function getDbMediaItemPlayed()
  329. {
  330. return $this->media_item_played;
  331. }
  332. /**
  333. * Get the [instance_id] column value.
  334. *
  335. * @return int
  336. */
  337. public function getDbInstanceId()
  338. {
  339. return $this->instance_id;
  340. }
  341. /**
  342. * Get the [playout_status] column value.
  343. *
  344. * @return int
  345. */
  346. public function getDbPlayoutStatus()
  347. {
  348. return $this->playout_status;
  349. }
  350. /**
  351. * Get the [broadcasted] column value.
  352. *
  353. * @return int
  354. */
  355. public function getDbBroadcasted()
  356. {
  357. return $this->broadcasted;
  358. }
  359. /**
  360. * Get the [position] column value.
  361. *
  362. * @return int
  363. */
  364. public function getDbPosition()
  365. {
  366. return $this->position;
  367. }
  368. /**
  369. * Set the value of [id] column.
  370. *
  371. * @param int $v new value
  372. * @return CcSchedule The current object (for fluent API support)
  373. */
  374. public function setDbId($v)
  375. {
  376. if ($v !== null) {
  377. $v = (int) $v;
  378. }
  379. if ($this->id !== $v) {
  380. $this->id = $v;
  381. $this->modifiedColumns[] = CcSchedulePeer::ID;
  382. }
  383. return $this;
  384. } // setDbId()
  385. /**
  386. * Sets the value of [starts] column to a normalized version of the date/time value specified.
  387. *
  388. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  389. * be treated as NULL for temporal objects.
  390. * @return CcSchedule The current object (for fluent API support)
  391. */
  392. public function setDbStarts($v)
  393. {
  394. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  395. // -- which is unexpected, to say the least.
  396. if ($v === null || $v === '') {
  397. $dt = null;
  398. } elseif ($v instanceof DateTime) {
  399. $dt = $v;
  400. } else {
  401. // some string/numeric value passed; we normalize that so that we can
  402. // validate it.
  403. try {
  404. if (is_numeric($v)) { // if it's a unix timestamp
  405. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  406. // We have to explicitly specify and then change the time zone because of a
  407. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  408. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  409. } else {
  410. $dt = new DateTime($v);
  411. }
  412. } catch (Exception $x) {
  413. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  414. }
  415. }
  416. if ( $this->starts !== null || $dt !== null ) {
  417. // (nested ifs are a little easier to read in this case)
  418. $currNorm = ($this->starts !== null && $tmpDt = new DateTime($this->starts)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null;
  419. $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null;
  420. if ( ($currNorm !== $newNorm) // normalized values don't match
  421. )
  422. {
  423. $this->starts = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
  424. $this->modifiedColumns[] = CcSchedulePeer::STARTS;
  425. }
  426. } // if either are not null
  427. return $this;
  428. } // setDbStarts()
  429. /**
  430. * Sets the value of [ends] column to a normalized version of the date/time value specified.
  431. *
  432. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  433. * be treated as NULL for temporal objects.
  434. * @return CcSchedule The current object (for fluent API support)
  435. */
  436. public function setDbEnds($v)
  437. {
  438. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  439. // -- which is unexpected, to say the least.
  440. if ($v === null || $v === '') {
  441. $dt = null;
  442. } elseif ($v instanceof DateTime) {
  443. $dt = $v;
  444. } else {
  445. // some string/numeric value passed; we normalize that so that we can
  446. // validate it.
  447. try {
  448. if (is_numeric($v)) { // if it's a unix timestamp
  449. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  450. // We have to explicitly specify and then change the time zone because of a
  451. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  452. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  453. } else {
  454. $dt = new DateTime($v);
  455. }
  456. } catch (Exception $x) {
  457. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  458. }
  459. }
  460. if ( $this->ends !== null || $dt !== null ) {
  461. // (nested ifs are a little easier to read in this case)
  462. $currNorm = ($this->ends !== null && $tmpDt = new DateTime($this->ends)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null;
  463. $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null;
  464. if ( ($currNorm !== $newNorm) // normalized values don't match
  465. )
  466. {
  467. $this->ends = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
  468. $this->modifiedColumns[] = CcSchedulePeer::ENDS;
  469. }
  470. } // if either are not null
  471. return $this;
  472. } // setDbEnds()
  473. /**
  474. * Set the value of [file_id] column.
  475. *
  476. * @param int $v new value
  477. * @return CcSchedule The current object (for fluent API support)
  478. */
  479. public function setDbFileId($v)
  480. {
  481. if ($v !== null) {
  482. $v = (int) $v;
  483. }
  484. if ($this->file_id !== $v) {
  485. $this->file_id = $v;
  486. $this->modifiedColumns[] = CcSchedulePeer::FILE_ID;
  487. }
  488. if ($this->aCcFiles !== null && $this->aCcFiles->getDbId() !== $v) {
  489. $this->aCcFiles = null;
  490. }
  491. return $this;
  492. } // setDbFileId()
  493. /**
  494. * Set the value of [stream_id] column.
  495. *
  496. * @param int $v new value
  497. * @return CcSchedule The current object (for fluent API support)
  498. */
  499. public function setDbStreamId($v)
  500. {
  501. if ($v !== null) {
  502. $v = (int) $v;
  503. }
  504. if ($this->stream_id !== $v) {
  505. $this->stream_id = $v;
  506. $this->modifiedColumns[] = CcSchedulePeer::STREAM_ID;
  507. }
  508. if ($this->aCcWebstream !== null && $this->aCcWebstream->getDbId() !== $v) {
  509. $this->aCcWebstream = null;
  510. }
  511. return $this;
  512. } // setDbStreamId()
  513. /**
  514. * Set the value of [clip_length] column.
  515. *
  516. * @param string $v new value
  517. * @return CcSchedule The current object (for fluent API support)
  518. */
  519. public function setDbClipLength($v)
  520. {
  521. if ($v !== null) {
  522. $v = (string) $v;
  523. }
  524. if ($this->clip_length !== $v || $this->isNew()) {
  525. $this->clip_length = $v;
  526. $this->modifiedColumns[] = CcSchedulePeer::CLIP_LENGTH;
  527. }
  528. return $this;
  529. } // setDbClipLength()
  530. /**
  531. * Sets the value of [fade_in] column to a normalized version of the date/time value specified.
  532. *
  533. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  534. * be treated as NULL for temporal objects.
  535. * @return CcSchedule The current object (for fluent API support)
  536. */
  537. public function setDbFadeIn($v)
  538. {
  539. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  540. // -- which is unexpected, to say the least.
  541. if ($v === null || $v === '') {
  542. $dt = null;
  543. } elseif ($v instanceof DateTime) {
  544. $dt = $v;
  545. } else {
  546. // some string/numeric value passed; we normalize that so that we can
  547. // validate it.
  548. try {
  549. if (is_numeric($v)) { // if it's a unix timestamp
  550. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  551. // We have to explicitly specify and then change the time zone because of a
  552. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  553. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  554. } else {
  555. $dt = new DateTime($v);
  556. }
  557. } catch (Exception $x) {
  558. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  559. }
  560. }
  561. if ( $this->fade_in !== null || $dt !== null ) {
  562. // (nested ifs are a little easier to read in this case)
  563. $currNorm = ($this->fade_in !== null && $tmpDt = new DateTime($this->fade_in)) ? $tmpDt->format('H:i:s') : null;
  564. $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
  565. if ( ($currNorm !== $newNorm) // normalized values don't match
  566. || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
  567. )
  568. {
  569. $this->fade_in = ($dt ? $dt->format('H:i:s') : null);
  570. $this->modifiedColumns[] = CcSchedulePeer::FADE_IN;
  571. }
  572. } // if either are not null
  573. return $this;
  574. } // setDbFadeIn()
  575. /**
  576. * Sets the value of [fade_out] column to a normalized version of the date/time value specified.
  577. *
  578. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  579. * be treated as NULL for temporal objects.
  580. * @return CcSchedule The current object (for fluent API support)
  581. */
  582. public function setDbFadeOut($v)
  583. {
  584. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  585. // -- which is unexpected, to say the least.
  586. if ($v === null || $v === '') {
  587. $dt = null;
  588. } elseif ($v instanceof DateTime) {
  589. $dt = $v;
  590. } else {
  591. // some string/numeric value passed; we normalize that so that we can
  592. // validate it.
  593. try {
  594. if (is_numeric($v)) { // if it's a unix timestamp
  595. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  596. // We have to explicitly specify and then change the time zone because of a
  597. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  598. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  599. } else {
  600. $dt = new DateTime($v);
  601. }
  602. } catch (Exception $x) {
  603. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  604. }
  605. }
  606. if ( $this->fade_out !== null || $dt !== null ) {
  607. // (nested ifs are a little easier to read in this case)
  608. $currNorm = ($this->fade_out !== null && $tmpDt = new DateTime($this->fade_out)) ? $tmpDt->format('H:i:s') : null;
  609. $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
  610. if ( ($currNorm !== $newNorm) // normalized values don't match
  611. || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
  612. )
  613. {
  614. $this->fade_out = ($dt ? $dt->format('H:i:s') : null);
  615. $this->modifiedColumns[] = CcSchedulePeer::FADE_OUT;
  616. }
  617. } // if either are not null
  618. return $this;
  619. } // setDbFadeOut()
  620. /**
  621. * Set the value of [cue_in] column.
  622. *
  623. * @param string $v new value
  624. * @return CcSchedule The current object (for fluent API support)
  625. */
  626. public function setDbCueIn($v)
  627. {
  628. if ($v !== null) {
  629. $v = (string) $v;
  630. }
  631. if ($this->cue_in !== $v) {
  632. $this->cue_in = $v;
  633. $this->modifiedColumns[] = CcSchedulePeer::CUE_IN;
  634. }
  635. return $this;
  636. } // setDbCueIn()
  637. /**
  638. * Set the value of [cue_out] column.
  639. *
  640. * @param string $v new value
  641. * @return CcSchedule The current object (for fluent API support)
  642. */
  643. public function setDbCueOut($v)
  644. {
  645. if ($v !== null) {
  646. $v = (string) $v;
  647. }
  648. if ($this->cue_out !== $v) {
  649. $this->cue_out = $v;
  650. $this->modifiedColumns[] = CcSchedulePeer::CUE_OUT;
  651. }
  652. return $this;
  653. } // setDbCueOut()
  654. /**
  655. * Set the value of [media_item_played] column.
  656. *
  657. * @param boolean $v new value
  658. * @return CcSchedule The current object (for fluent API support)
  659. */
  660. public function setDbMediaItemPlayed($v)
  661. {
  662. if ($v !== null) {
  663. $v = (boolean) $v;
  664. }
  665. if ($this->media_item_played !== $v || $this->isNew()) {
  666. $this->media_item_played = $v;
  667. $this->modifiedColumns[] = CcSchedulePeer::MEDIA_ITEM_PLAYED;
  668. }
  669. return $this;
  670. } // setDbMediaItemPlayed()
  671. /**
  672. * Set the value of [instance_id] column.
  673. *
  674. * @param int $v new value
  675. * @return CcSchedule The current object (for fluent API support)
  676. */
  677. public function setDbInstanceId($v)
  678. {
  679. if ($v !== null) {
  680. $v = (int) $v;
  681. }
  682. if ($this->instance_id !== $v) {
  683. $this->instance_id = $v;
  684. $this->modifiedColumns[] = CcSchedulePeer::INSTANCE_ID;
  685. }
  686. if ($this->aCcShowInstances !== null && $this->aCcShowInstances->getDbId() !== $v) {
  687. $this->aCcShowInstances = null;
  688. }
  689. return $this;
  690. } // setDbInstanceId()
  691. /**
  692. * Set the value of [playout_status] column.
  693. *
  694. * @param int $v new value
  695. * @return CcSchedule The current object (for fluent API support)
  696. */
  697. public function setDbPlayoutStatus($v)
  698. {
  699. if ($v !== null) {
  700. $v = (int) $v;
  701. }
  702. if ($this->playout_status !== $v || $this->isNew()) {
  703. $this->playout_status = $v;
  704. $this->modifiedColumns[] = CcSchedulePeer::PLAYOUT_STATUS;
  705. }
  706. return $this;
  707. } // setDbPlayoutStatus()
  708. /**
  709. * Set the value of [broadcasted] column.
  710. *
  711. * @param int $v new value
  712. * @return CcSchedule The current object (for fluent API support)
  713. */
  714. public function setDbBroadcasted($v)
  715. {
  716. if ($v !== null) {
  717. $v = (int) $v;
  718. }
  719. if ($this->broadcasted !== $v || $this->isNew()) {
  720. $this->broadcasted = $v;
  721. $this->modifiedColumns[] = CcSchedulePeer::BROADCASTED;
  722. }
  723. return $this;
  724. } // setDbBroadcasted()
  725. /**
  726. * Set the value of [position] column.
  727. *
  728. * @param int $v new value
  729. * @return CcSchedule The current object (for fluent API support)
  730. */
  731. public function setDbPosition($v)
  732. {
  733. if ($v !== null) {
  734. $v = (int) $v;
  735. }
  736. if ($this->position !== $v || $this->isNew()) {
  737. $this->position = $v;
  738. $this->modifiedColumns[] = CcSchedulePeer::POSITION;
  739. }
  740. return $this;
  741. } // setDbPosition()
  742. /**
  743. * Indicates whether the columns in this object are only set to default values.
  744. *
  745. * This method can be used in conjunction with isModified() to indicate whether an object is both
  746. * modified _and_ has some values set which are non-default.
  747. *
  748. * @return boolean Whether the columns in this object are only been set with default values.
  749. */
  750. public function hasOnlyDefaultValues()
  751. {
  752. if ($this->clip_length !== '00:00:00') {
  753. return false;
  754. }
  755. if ($this->fade_in !== '00:00:00') {
  756. return false;
  757. }
  758. if ($this->fade_out !== '00:00:00') {
  759. return false;
  760. }
  761. if ($this->media_item_played !== false) {
  762. return false;
  763. }
  764. if ($this->playout_status !== 1) {
  765. return false;
  766. }
  767. if ($this->broadcasted !== 0) {
  768. return false;
  769. }
  770. if ($this->position !== 0) {
  771. return false;
  772. }
  773. // otherwise, everything was equal, so return TRUE
  774. return true;
  775. } // hasOnlyDefaultValues()
  776. /**
  777. * Hydrates (populates) the object variables with values from the database resultset.
  778. *
  779. * An offset (0-based "start column") is specified so that objects can be hydrated
  780. * with a subset of the columns in the resultset rows. This is needed, for example,
  781. * for results of JOIN queries where the resultset row includes columns from two or
  782. * more tables.
  783. *
  784. * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
  785. * @param int $startcol 0-based offset column which indicates which restultset column to start with.
  786. * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
  787. * @return int next starting column
  788. * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
  789. */
  790. public function hydrate($row, $startcol = 0, $rehydrate = false)
  791. {
  792. try {
  793. $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
  794. $this->starts = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
  795. $this->ends = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
  796. $this->file_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
  797. $this->stream_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
  798. $this->clip_length = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
  799. $this->fade_in = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
  800. $this->fade_out = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
  801. $this->cue_in = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
  802. $this->cue_out = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
  803. $this->media_item_played = ($row[$startcol + 10] !== null) ? (boolean) $row[$startcol + 10] : null;
  804. $this->instance_id = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null;
  805. $this->playout_status = ($row[$startcol + 12] !== null) ? (int) $row[$startcol + 12] : null;
  806. $this->broadcasted = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null;
  807. $this->position = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null;
  808. $this->resetModified();
  809. $this->setNew(false);
  810. if ($rehydrate) {
  811. $this->ensureConsistency();
  812. }
  813. return $startcol + 15; // 15 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS).
  814. } catch (Exception $e) {
  815. throw new PropelException("Error populating CcSchedule object", $e);
  816. }
  817. }
  818. /**
  819. * Checks and repairs the internal consistency of the object.
  820. *
  821. * This method is executed after an already-instantiated object is re-hydrated
  822. * from the database. It exists to check any foreign keys to make sure that
  823. * the objects related to the current object are correct based on foreign key.
  824. *
  825. * You can override this method in the stub class, but you should always invoke
  826. * the base method from the overridden method (i.e. parent::ensureConsistency()),
  827. * in case your model changes.
  828. *
  829. * @throws PropelException
  830. */
  831. public function ensureConsistency()
  832. {
  833. if ($this->aCcFiles !== null && $this->file_id !== $this->aCcFiles->getDbId()) {
  834. $this->aCcFiles = null;
  835. }
  836. if ($this->aCcWebstream !== null && $this->stream_id !== $this->aCcWebstream->getDbId()) {
  837. $this->aCcWebstream = null;
  838. }
  839. if ($this->aCcShowInstances !== null && $this->instance_id !== $this->aCcShowInstances->getDbId()) {
  840. $this->aCcShowInstances = null;
  841. }
  842. } // ensureConsistency
  843. /**
  844. * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
  845. *
  846. * This will only work if the object has been saved and has a valid primary key set.
  847. *
  848. * @param boolean $deep (optional) Whether to also de-associated any related objects.
  849. * @param PropelPDO $con (optional) The PropelPDO connection to use.
  850. * @return void
  851. * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
  852. */
  853. public function reload($deep = false, PropelPDO $con = null)
  854. {
  855. if ($this->isDeleted()) {
  856. throw new PropelException("Cannot reload a deleted object.");
  857. }
  858. if ($this->isNew()) {
  859. throw new PropelException("Cannot reload an unsaved object.");
  860. }
  861. if ($con === null) {
  862. $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
  863. }
  864. // We don't need to alter the object instance pool; we're just modifying this instance
  865. // already in the pool.
  866. $stmt = CcSchedulePeer::doSelectStmt($this->buildPkeyCriteria(), $con);
  867. $row = $stmt->fetch(PDO::FETCH_NUM);
  868. $stmt->closeCursor();
  869. if (!$row) {
  870. throw new PropelException('Cannot find matching row in the database to reload object values.');
  871. }
  872. $this->hydrate($row, 0, true); // rehydrate
  873. if ($deep) { // also de-associate any related objects?
  874. $this->aCcShowInstances = null;
  875. $this->aCcFiles = null;
  876. $this->aCcWebstream = null;
  877. $this->collCcWebstreamMetadatas = null;
  878. } // if (deep)
  879. }
  880. /**
  881. * Removes this object from datastore and sets delete attribute.
  882. *
  883. * @param PropelPDO $con
  884. * @return void
  885. * @throws PropelException
  886. * @see BaseObject::setDeleted()
  887. * @see BaseObject::isDeleted()
  888. */
  889. public function delete(PropelPDO $con = null)
  890. {
  891. if ($this->isDeleted()) {
  892. throw new PropelException("This object has already been deleted.");
  893. }
  894. if ($con === null) {
  895. $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  896. }
  897. $con->beginTransaction();
  898. try {
  899. $ret = $this->preDelete($con);
  900. if ($ret) {
  901. CcScheduleQuery::create()
  902. ->filterByPrimaryKey($this->getPrimaryKey())
  903. ->delete($con);
  904. $this->postDelete($con);
  905. $con->commit();
  906. $this->setDeleted(true);
  907. } else {
  908. $con->commit();
  909. }
  910. } catch (PropelException $e) {
  911. $con->rollBack();
  912. throw $e;
  913. }
  914. }
  915. /**
  916. * Persists this object to the database.
  917. *
  918. * If the object is new, it inserts it; otherwise an update is performed.
  919. * All modified related objects will also be persisted in the doSave()
  920. * method. This method wraps all precipitate database operations in a
  921. * single transaction.
  922. *
  923. * @param PropelPDO $con
  924. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  925. * @throws PropelException
  926. * @see doSave()
  927. */
  928. public function save(PropelPDO $con = null)
  929. {
  930. if ($this->isDeleted()) {
  931. throw new PropelException("You cannot save an object that has been deleted.");
  932. }
  933. if ($con === null) {
  934. $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  935. }
  936. $con->beginTransaction();
  937. $isInsert = $this->isNew();
  938. try {
  939. $ret = $this->preSave($con);
  940. if ($isInsert) {
  941. $ret = $ret && $this->preInsert($con);
  942. } else {
  943. $ret = $ret && $this->preUpdate($con);
  944. }
  945. if ($ret) {
  946. $affectedRows = $this->doSave($con);
  947. if ($isInsert) {
  948. $this->postInsert($con);
  949. } else {
  950. $this->postUpdate($con);
  951. }
  952. $this->postSave($con);
  953. CcSchedulePeer::addInstanceToPool($this);
  954. } else {
  955. $affectedRows = 0;
  956. }
  957. $con->commit();
  958. return $affectedRows;
  959. } catch (PropelException $e) {
  960. $con->rollBack();
  961. throw $e;
  962. }
  963. }
  964. /**
  965. * Performs the work of inserting or updating the row in the database.
  966. *
  967. * If the object is new, it inserts it; otherwise an update is performed.
  968. * All related objects are also updated in this method.
  969. *
  970. * @param PropelPDO $con
  971. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  972. * @throws PropelException
  973. * @see save()
  974. */
  975. protected function doSave(PropelPDO $con)
  976. {
  977. $affectedRows = 0; // initialize var to track total num of affected rows
  978. if (!$this->alreadyInSave) {
  979. $this->alreadyInSave = true;
  980. // We call the save method on the following object(s) if they
  981. // were passed to this object by their coresponding set
  982. // method. This object relates to these object(s) by a
  983. // foreign key reference.
  984. if ($this->aCcShowInstances !== null) {
  985. if ($this->aCcShowInstances->isModified() || $this->aCcShowInstances->isNew()) {
  986. $affectedRows += $this->aCcShowInstances->save($con);
  987. }
  988. $this->setCcShowInstances($this->aCcShowInstances);
  989. }
  990. if ($this->aCcFiles !== null) {
  991. if ($this->aCcFiles->isModified() || $this->aCcFiles->isNew()) {
  992. $affectedRows += $this->aCcFiles->save($con);
  993. }
  994. $this->setCcFiles($this->aCcFiles);
  995. }
  996. if ($this->aCcWebstream !== null) {
  997. if ($this->aCcWebstream->isModified() || $this->aCcWebstream->isNew()) {
  998. $affectedRows += $this->aCcWebstream->save($con);
  999. }
  1000. $this->setCcWebstream($this->aCcWebstream);
  1001. }
  1002. if ($this->isNew() ) {
  1003. $this->modifiedColumns[] = CcSchedulePeer::ID;
  1004. }
  1005. // If this object has been modified, then save it to the database.
  1006. if ($this->isModified()) {
  1007. if ($this->isNew()) {
  1008. $criteria = $this->buildCriteria();
  1009. if ($criteria->keyContainsValue(CcSchedulePeer::ID) ) {
  1010. throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcSchedulePeer::ID.')');
  1011. }
  1012. $pk = BasePeer::doInsert($criteria, $con);
  1013. $affectedRows += 1;
  1014. $this->setDbId($pk); //[IMV] update autoincrement primary key
  1015. $this->setNew(false);
  1016. } else {
  1017. $affectedRows += CcSchedulePeer::doUpdate($this, $con);
  1018. }
  1019. $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
  1020. }
  1021. if ($this->collCcWebstreamMetadatas !== null) {
  1022. foreach ($this->collCcWebstreamMetadatas as $referrerFK) {
  1023. if (!$referrerFK->isDeleted()) {
  1024. $affectedRows += $referrerFK->save($con);
  1025. }
  1026. }
  1027. }
  1028. $this->alreadyInSave = false;
  1029. }
  1030. return $affectedRows;
  1031. } // doSave()
  1032. /**
  1033. * Array of ValidationFailed objects.
  1034. * @var array ValidationFailed[]
  1035. */
  1036. protected $validationFailures = array();
  1037. /**
  1038. * Gets any ValidationFailed objects that resulted from last call to validate().
  1039. *
  1040. *
  1041. * @return array ValidationFailed[]
  1042. * @see validate()
  1043. */
  1044. public function getValidationFailures()
  1045. {
  1046. return $this->validationFailures;
  1047. }
  1048. /**
  1049. * Validates the objects modified field values and all objects related to this table.
  1050. *
  1051. * If $columns is either a column name or an array of column names
  1052. * only those columns are validated.
  1053. *
  1054. * @param mixed $columns Column name or an array of column names.
  1055. * @return boolean Whether all columns pass validation.
  1056. * @see doValidate()
  1057. * @see getValidationFailures()
  1058. */
  1059. public function validate($columns = null)
  1060. {
  1061. $res = $this->doValidate($columns);
  1062. if ($res === true) {
  1063. $this->validationFailures = array();
  1064. return true;
  1065. } else {
  1066. $this->validationFailures = $res;
  1067. return false;
  1068. }
  1069. }
  1070. /**
  1071. * This function performs the validation work for complex object models.
  1072. *
  1073. * In addition to checking the current object, all related objects will
  1074. * also be validated. If all pass then <code>true</code> is returned; otherwise
  1075. * an aggreagated array of ValidationFailed objects will be returned.
  1076. *
  1077. * @param array $columns Array of column names to validate.
  1078. * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  1079. */
  1080. protected function doValidate($columns = null)
  1081. {
  1082. if (!$this->alreadyInValidation) {
  1083. $this->alreadyInValidation = true;
  1084. $retval = null;
  1085. $failureMap = array();
  1086. // We call the validate method on the following object(s) if they
  1087. // were passed to this object by their coresponding set
  1088. // method. This object relates to these object(s) by a
  1089. // foreign key reference.
  1090. if ($this->aCcShowInstances !== null) {
  1091. if (!$this->aCcShowInstances->validate($columns)) {
  1092. $failureMap = array_merge($failureMap, $this->aCcShowInstances->getValidationFailures());
  1093. }
  1094. }
  1095. if ($this->aCcFiles !== null) {
  1096. if (!$this->aCcFiles->validate($columns)) {
  1097. $failureMap = array_merge($failureMap, $this->aCcFiles->getValidationFailures());
  1098. }
  1099. }
  1100. if ($this->aCcWebstream !== null) {
  1101. if (!$this->aCcWebstream->validate($columns)) {
  1102. $failureMap = array_merge($failureMap, $this->aCcWebstream->getValidationFailures());
  1103. }
  1104. }
  1105. if (($retval = CcSchedulePeer::doValidate($this, $columns)) !== true) {
  1106. $failureMap = array_merge($failureMap, $retval);
  1107. }
  1108. if ($this->collCcWebstreamMetadatas !== null) {
  1109. foreach ($this->collCcWebstreamMetadatas as $referrerFK) {
  1110. if (!$referrerFK->validate($columns)) {
  1111. $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
  1112. }
  1113. }
  1114. }
  1115. $this->alreadyInValidation = false;
  1116. }
  1117. return (!empty($failureMap) ? $failureMap : true);
  1118. }
  1119. /**
  1120. * Retrieves a field from the object by name passed in as a string.
  1121. *
  1122. * @param string $name name
  1123. * @param string $type The type of fieldname the $name is of:
  1124. * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  1125. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  1126. * @return mixed Value of field.
  1127. */
  1128. public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
  1129. {
  1130. $pos = CcSchedulePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  1131. $field = $this->getByPosition($pos);
  1132. return $field;
  1133. }
  1134. /**
  1135. * Retrieves a field from the object by Position as specified in the xml schema.
  1136. * Zero-based.
  1137. *
  1138. * @param int $pos position in xml schema
  1139. * @return mixed Value of field at $pos
  1140. */
  1141. public function getByPosition($pos)
  1142. {
  1143. switch($pos) {
  1144. case 0:
  1145. return $this->getDbId();
  1146. break;
  1147. case 1:
  1148. return $this->getDbStarts();
  1149. break;
  1150. case 2:
  1151. return $this->getDbEnds();
  1152. break;
  1153. case 3:
  1154. return $this->getDbFileId();
  1155. break;
  1156. case 4:
  1157. return $this->getDbStreamId();
  1158. break;
  1159. case 5:
  1160. return $this->getDbClipLength();
  1161. break;
  1162. case 6:
  1163. return $this->getDbFadeIn();
  1164. break;
  1165. case 7:
  1166. return $this->getDbFadeOut();
  1167. break;
  1168. case 8:
  1169. return $this->getDbCueIn();
  1170. break;
  1171. case 9:
  1172. return $this->getDbCueOut();
  1173. break;
  1174. case 10:
  1175. return $this->getDbMediaItemPlayed();
  1176. break;
  1177. case 11:
  1178. return $this->getDbInstanceId();
  1179. break;
  1180. case 12:
  1181. return $this->getDbPlayoutStatus();
  1182. break;
  1183. case 13:
  1184. return $this->getDbBroadcasted();
  1185. break;
  1186. case 14:
  1187. return $this->getDbPosition();
  1188. break;
  1189. default:
  1190. return null;
  1191. break;
  1192. } // switch()
  1193. }
  1194. /**
  1195. * Exports the object as an array.
  1196. *
  1197. * You can specify the key type of the array by passing one of the class
  1198. * type constants.
  1199. *
  1200. * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  1201. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  1202. * Defaults to BasePeer::TYPE_PHPNAME.
  1203. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  1204. * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  1205. *
  1206. * @return array an associative array containing the field names (as keys) and field values
  1207. */
  1208. public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false)
  1209. {
  1210. $keys = CcSchedulePeer::getFieldNames($keyType);
  1211. $result = array(
  1212. $keys[0] => $this->getDbId(),
  1213. $keys[1] => $this->getDbStarts(),
  1214. $keys[2] => $this->getDbEnds(),
  1215. $keys[3] => $this->getDbFileId(),
  1216. $keys[4] => $this->getDbStreamId(),
  1217. $keys[5] => $this->getDbClipLength(),
  1218. $keys[6] => $this->getDbFadeIn(),
  1219. $keys[7] => $this->getDbFadeOut(),
  1220. $keys[8] => $this->getDbCueIn(),
  1221. $keys[9] => $this->getDbCueOut(),
  1222. $keys[10] => $this->getDbMediaItemPlayed(),
  1223. $keys[11] => $this->getDbInstanceId(),
  1224. $keys[12] => $this->getDbPlayoutStatus(),
  1225. $keys[13] => $this->getDbBroadcasted(),
  1226. $keys[14] => $this->getDbPosition(),
  1227. );
  1228. if ($includeForeignObjects) {
  1229. if (null !== $this->aCcShowInstances) {
  1230. $result['CcShowInstances'] = $this->aCcShowInstances->toArray($keyType, $includeLazyLoadColumns, true);
  1231. }
  1232. if (null !== $this->aCcFiles) {
  1233. $result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, true);
  1234. }
  1235. if (null !== $this->aCcWebstream) {
  1236. $result['CcWebstream'] = $this->aCcWebstream->toArray($keyType, $includeLazyLoadColumns, true);
  1237. }
  1238. }
  1239. return $result;
  1240. }
  1241. /**
  1242. * Sets a field from the object by name passed in as a string.
  1243. *
  1244. * @param string $name peer name
  1245. * @param mixed $value field value
  1246. * @param string $type The type of fieldname the $name is of:
  1247. * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  1248. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  1249. * @return void
  1250. */
  1251. public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
  1252. {
  1253. $pos = CcSchedulePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  1254. return $this->setByPosition($pos, $value);
  1255. }
  1256. /**
  1257. * Sets a field from the object by Position as specified in the xml schema.
  1258. * Zero-based.
  1259. *
  1260. * @param int $pos position in xml schema
  1261. * @param mixed $value field value
  1262. * @return void
  1263. */
  1264. public function setByPosition($pos, $value)
  1265. {
  1266. switch($pos) {
  1267. case 0:
  1268. $this->setDbId($value);
  1269. break;
  1270. case 1:
  1271. $this->setDbStarts($value);
  1272. break;
  1273. case 2:
  1274. $this->setDbEnds($value);
  1275. break;
  1276. case 3:
  1277. $this->setDbFileId($value);
  1278. break;
  1279. case 4:
  1280. $this->setDbStreamId($value);
  1281. break;
  1282. case 5:
  1283. $this->setDbClipLength($value);
  1284. break;
  1285. case 6:
  1286. $this->setDbFadeIn($value);
  1287. break;
  1288. case 7:
  1289. $this->setDbFadeOut($value);
  1290. break;
  1291. case 8:
  1292. $this->setDbCueIn($value);
  1293. break;
  1294. case 9:
  1295. $this->setDbCueOut($value);
  1296. break;
  1297. case 10:
  1298. $this->setDbMediaItemPlayed($value);
  1299. break;
  1300. case 11:
  1301. $this->setDbInstanceId($value);
  1302. break;
  1303. case 12:
  1304. $this->setDbPlayoutStatus($value);
  1305. break;
  1306. case 13:
  1307. $this->setDbBroadcasted($value);
  1308. break;
  1309. case 14:
  1310. $this->setDbPosition($value);
  1311. break;
  1312. } // switch()
  1313. }
  1314. /**
  1315. * Populates the object using an array.
  1316. *
  1317. * This is particularly useful when populating an object from one of the
  1318. * request arrays (e.g. $_POST). This method goes through the column
  1319. * names, checking to see whether a matching key exists in populated
  1320. * array. If so the setByName() method is called for that column.
  1321. *
  1322. * You can specify the key type of the array by additionally passing one
  1323. * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  1324. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  1325. * The default key type is the column's phpname (e.g. 'AuthorId')
  1326. *
  1327. * @param array $arr An array to populate the object from.
  1328. * @param string $keyType The type of keys the array uses.
  1329. * @return void
  1330. */
  1331. public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
  1332. {
  1333. $keys = CcSchedulePeer::getFieldNames($keyType);
  1334. if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
  1335. if (array_key_exists($keys[1], $arr)) $this->setDbStarts($arr[$keys[1]]);
  1336. if (array_key_exists($keys[2], $arr)) $this->setDbEnds($arr[$keys[2]]);
  1337. if (array_key_exists($keys[3], $arr)) $this->setDbFileId($arr[$keys[3]]);
  1338. if (array_key_exists($keys[4], $arr)) $this->setDbStreamId($arr[$keys[4]]);
  1339. if (array_key_exists($keys[5], $arr)) $this->setDbClipLength($arr[$keys[5]]);
  1340. if (array_key_exists($keys[6], $arr)) $this->setDbFadeIn($arr[$keys[6]]);
  1341. if (array_key_exists($keys[7], $arr)) $this->setDbFadeOut($arr[$keys[7]]);
  1342. if (array_key_exists($keys[8], $arr)) $this->setDbCueIn($arr[$keys[8]]);
  1343. if (array_key_exists($keys[9], $arr)) $this->setDbCueOut($arr[$keys[9]]);
  1344. if (array_key_exists($keys[10], $arr)) $this->setDbMediaItemPlayed($arr[$keys[10]]);
  1345. if (array_key_exists($keys[11], $arr)) $this->setDbInstanceId($arr[$keys[11]]);
  1346. if (array_key_exists($keys[12], $arr)) $this->setDbPlayoutStatus($arr[$keys[12]]);
  1347. if (array_key_exists($keys[13], $arr)) $this->setDbBroadcasted($arr[$keys[13]]);
  1348. if (array_key_exists($keys[14], $arr)) $this->setDbPosition($arr[$keys[14]]);
  1349. }
  1350. /**
  1351. * Build a Criteria object containing the values of all modified columns in this object.
  1352. *
  1353. * @return Criteria The Criteria object containing all modified values.
  1354. */
  1355. public function buildCriteria()
  1356. {
  1357. $criteria = new Criteria(CcSchedulePeer::DATABASE_NAME);
  1358. if ($this->isColumnModified(CcSchedulePeer::ID)) $criteria->add(CcSchedulePeer::ID, $this->id);
  1359. if ($this->isColumnModified(CcSchedulePeer::STARTS)) $criteria->add(CcSchedulePeer::STARTS, $this->starts);
  1360. if ($this->isColumnModified(CcSchedulePeer::ENDS)) $criteria->add(CcSchedulePeer::ENDS, $this->ends);
  1361. if ($this->isColumnModified(CcSchedulePeer::FILE_ID)) $criteria->add(CcSchedulePeer::FILE_ID, $this->file_id);
  1362. if ($this->isColumnModified(CcSchedulePeer::STREAM_ID)) $criteria->add(CcSchedulePeer::STREAM_ID, $this->stream_id);
  1363. if ($this->isColumnModified(CcSchedulePeer::CLIP_LENGTH)) $criteria->add(CcSchedulePeer::CLIP_LENGTH, $this->clip_length);
  1364. if ($this->isColumnModified(CcSchedulePeer::FADE_IN)) $criteria->add(CcSchedulePeer::FADE_IN, $this->fade_in);
  1365. if ($this->isColumnModified(CcSchedulePeer::FADE_OUT)) $criteria->add(CcSchedulePeer::FADE_OUT, $this->fade_out);
  1366. if ($this->isColumnModified(CcSchedulePeer::CUE_IN)) $criteria->add(CcSchedulePeer::CUE_IN, $this->cue_in);
  1367. if ($this->isColumnModified(CcSchedulePeer::CUE_OUT)) $criteria->add(CcSchedulePeer::CUE_OUT, $this->cue_out);
  1368. if ($this->isColumnModified(CcSchedulePeer::MEDIA_ITEM_PLAYED)) $criteria->add(CcSchedulePeer::MEDIA_ITEM_PLAYED, $this->media_item_played);
  1369. if ($this->isColumnModified(CcSchedulePeer::INSTANCE_ID)) $criteria->add(CcSchedulePeer::INSTANCE_ID, $this->instance_id);
  1370. if ($this->isColumnModified(CcSchedulePeer::PLAYOUT_STATUS)) $criteria->add(CcSchedulePeer::PLAYOUT_STATUS, $this->playout_status);
  1371. if ($this->isColumnModified(CcSchedulePeer::BROADCASTED)) $criteria->add(CcSchedulePeer::BROADCASTED, $this->broadcasted);
  1372. if ($this->isColumnModified(CcSchedulePeer::POSITION)) $criteria->add(CcSchedulePeer::POSITION, $this->position);
  1373. return $criteria;
  1374. }
  1375. /**
  1376. * Builds a Criteria object containing the primary key for this object.
  1377. *
  1378. * Unlike buildCriteria() this method includes the primary key values regardless
  1379. * of whether or not they have been modified.
  1380. *
  1381. * @return Criteria The Criteria object containing value(s) for primary key(s).
  1382. */
  1383. public function buildPkeyCriteria()
  1384. {
  1385. $criteria = new Criteria(CcSchedulePeer::DATABASE_NAME);
  1386. $criteria->add(CcSchedulePeer::ID, $this->id);
  1387. return $criteria;
  1388. }
  1389. /**
  1390. * Returns the primary key for this object (row).
  1391. * @return int
  1392. */
  1393. public function getPrimaryKey()
  1394. {
  1395. return $this->getDbId();
  1396. }
  1397. /**
  1398. * Generic method to set the primary key (id column).
  1399. *
  1400. * @param int $key Primary key.
  1401. * @return void
  1402. */
  1403. public function setPrimaryKey($key)
  1404. {
  1405. $this->setDbId($key);
  1406. }
  1407. /**
  1408. * Returns true if the primary key for this object is null.
  1409. * @return boolean
  1410. */
  1411. public function isPrimaryKeyNull()
  1412. {
  1413. return null === $this->getDbId();
  1414. }
  1415. /**
  1416. * Sets contents of passed object to values from current object.
  1417. *
  1418. * If desired, this method can also make copies of all associated (fkey referrers)
  1419. * objects.
  1420. *
  1421. * @param object $copyObj An object of CcSchedule (or compatible) type.
  1422. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  1423. * @throws PropelException
  1424. */
  1425. public function copyInto($copyObj, $deepCopy = false)
  1426. {
  1427. $copyObj->setDbStarts($this->starts);
  1428. $copyObj->setDbEnds($this->ends);
  1429. $copyObj->setDbFileId($this->file_id);
  1430. $copyObj->setDbStreamId($this->stream_id);
  1431. $copyObj->setDbClipLength($this->clip_length);
  1432. $copyObj->setDbFadeIn($this->fade_in);
  1433. $copyObj->setDbFadeOut($this->fade_out);
  1434. $copyObj->setDbCueIn($this->cue_in);
  1435. $copyObj->setDbCueOut($this->cue_out);
  1436. $copyObj->setDbMediaItemPlayed($this->media_item_played);
  1437. $copyObj->setDbInstanceId($this->instance_id);
  1438. $copyObj->setDbPlayoutStatus($this->playout_status);
  1439. $copyObj->setDbBroadcasted($this->broadcasted);
  1440. $copyObj->setDbPosition($this->position);
  1441. if ($deepCopy) {
  1442. // important: temporarily setNew(false) because this affects the behavior of
  1443. // the getter/setter methods for fkey referrer objects.
  1444. $copyObj->setNew(false);
  1445. foreach ($this->getCcWebstreamMetadatas() as $relObj) {
  1446. if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
  1447. $copyObj->addCcWebstreamMetadata($relObj->copy($deepCopy));
  1448. }
  1449. }
  1450. } // if ($deepCopy)
  1451. $copyObj->setNew(true);
  1452. $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
  1453. }
  1454. /**
  1455. * Makes a copy of this object that will be inserted as a new row in table when saved.
  1456. * It creates a new object filling in the simple attributes, but skipping any primary
  1457. * keys that are defined for the table.
  1458. *
  1459. * If desired, this method can also make copies of all associated (fkey referrers)
  1460. * objects.
  1461. *
  1462. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  1463. * @return CcSchedule Clone of current object.
  1464. * @throws PropelException
  1465. */
  1466. public function copy($deepCopy = false)
  1467. {
  1468. // we use get_class(), because this might be a subclass
  1469. $clazz = get_class($this);
  1470. $copyObj = new $clazz();
  1471. $this->copyInto($copyObj, $deepCopy);
  1472. return $copyObj;
  1473. }
  1474. /**
  1475. * Returns a peer instance associated with this om.
  1476. *
  1477. * Since Peer classes are not to have any instance attributes, this method returns the
  1478. * same instance for all member of this class. The method could therefore
  1479. * be static, but this would prevent one from overriding the behavior.
  1480. *
  1481. * @return CcSchedulePeer
  1482. */
  1483. public function getPeer()
  1484. {
  1485. if (self::$peer === null) {
  1486. self::$peer = new CcSchedulePeer();
  1487. }
  1488. return self::$peer;
  1489. }
  1490. /**
  1491. * Declares an association between this object and a CcShowInstances object.
  1492. *
  1493. * @param CcShowInstances $v
  1494. * @return CcSchedule The current object (for fluent API support)
  1495. * @throws PropelException
  1496. */
  1497. public function setCcShowInstances(CcShowInstances $v = null)
  1498. {
  1499. if ($v === null) {
  1500. $this->setDbInstanceId(NULL);
  1501. } else {
  1502. $this->setDbInstanceId($v->getDbId());
  1503. }
  1504. $this->aCcShowInstances = $v;
  1505. // Add binding for other direction of this n:n relationship.
  1506. // If this object has already been added to the CcShowInstances object, it will not be re-added.
  1507. if ($v !== null) {
  1508. $v->addCcSchedule($this);
  1509. }
  1510. return $this;
  1511. }
  1512. /**
  1513. * Get the associated CcShowInstances object
  1514. *
  1515. * @param PropelPDO Optional Connection object.
  1516. * @return CcShowInstances The associated CcShowInstances object.
  1517. * @throws PropelException
  1518. */
  1519. public function getCcShowInstances(PropelPDO $con = null)
  1520. {
  1521. if ($this->aCcShowInstances === null && ($this->instance_id !== null)) {
  1522. $this->aCcShowInstances = CcShowInstancesQuery::create()->findPk($this->instance_id, $con);
  1523. /* The following can be used additionally to
  1524. guarantee the related object contains a reference
  1525. to this object. This level of coupling may, however, be
  1526. undesirable since it could result in an only partially populated collection
  1527. in the referenced object.
  1528. $this->aCcShowInstances->addCcSchedules($this);
  1529. */
  1530. }
  1531. return $this->aCcShowInstances;
  1532. }
  1533. /**
  1534. * Declares an association between this object and a CcFiles object.
  1535. *
  1536. * @param CcFiles $v
  1537. * @return CcSchedule The current object (for fluent API support)
  1538. * @throws PropelException
  1539. */
  1540. public function setCcFiles(CcFiles $v = null)
  1541. {
  1542. if ($v === null) {
  1543. $this->setDbFileId(NULL);
  1544. } else {
  1545. $this->setDbFileId($v->getDbId());
  1546. }
  1547. $this->aCcFiles = $v;
  1548. // Add binding for other direction of this n:n relationship.
  1549. // If this object has already been added to the CcFiles object, it will not be re-added.
  1550. if ($v !== null) {
  1551. $v->addCcSchedule($this);
  1552. }
  1553. return $this;
  1554. }
  1555. /**
  1556. * Get the associated CcFiles object
  1557. *
  1558. * @param PropelPDO Optional Connection object.
  1559. * @return CcFiles The associated CcFiles object.
  1560. * @throws PropelException
  1561. */
  1562. public function getCcFiles(PropelPDO $con = null)
  1563. {
  1564. if ($this->aCcFiles === null && ($this->file_id !== null)) {
  1565. $this->aCcFiles = CcFilesQuery::create()->findPk($this->file_id, $con);
  1566. /* The following can be used additionally to
  1567. guarantee the related object contains a reference
  1568. to this object. This level of coupling may, however, be
  1569. undesirable since it could result in an only partially populated collection
  1570. in the referenced object.
  1571. $this->aCcFiles->addCcSchedules($this);
  1572. */
  1573. }
  1574. return $this->aCcFiles;
  1575. }
  1576. /**
  1577. * Declares an association between this object and a CcWebstream object.
  1578. *
  1579. * @param CcWebstream $v
  1580. * @return CcSchedule The current object (for fluent API support)
  1581. * @throws PropelException
  1582. */
  1583. public function setCcWebstream(CcWebstream $v = null)
  1584. {
  1585. if ($v === null) {
  1586. $this->setDbStreamId(NULL);
  1587. } else {
  1588. $this->setDbStreamId($v->getDbId());
  1589. }
  1590. $this->aCcWebstream = $v;
  1591. // Add binding for other direction of this n:n relationship.
  1592. // If this object has already been added to the CcWebstream object, it will not be re-added.
  1593. if ($v !== null) {
  1594. $v->addCcSchedule($this);
  1595. }
  1596. return $this;
  1597. }
  1598. /**
  1599. * Get the associated CcWebstream object
  1600. *
  1601. * @param PropelPDO Optional Connection object.
  1602. * @return CcWebstream The associated CcWebstream object.
  1603. * @throws PropelException
  1604. */
  1605. public function getCcWebstream(PropelPDO $con = null)
  1606. {
  1607. if ($this->aCcWebstream === null && ($this->stream_id !== null)) {
  1608. $this->aCcWebstream = CcWebstreamQuery::create()->findPk($this->stream_id, $con);
  1609. /* The following can be used additionally to
  1610. guarantee the related object contains a reference
  1611. to this object. This level of coupling may, however, be
  1612. undesirable since it could result in an only partially populated collection
  1613. in the referenced object.
  1614. $this->aCcWebstream->addCcSchedules($this);
  1615. */
  1616. }
  1617. return $this->aCcWebstream;
  1618. }
  1619. /**
  1620. * Clears out the collCcWebstreamMetadatas collection
  1621. *
  1622. * This does not modify the database; however, it will remove any associated objects, causing
  1623. * them to be refetched by subsequent calls to accessor method.
  1624. *
  1625. * @return void
  1626. * @see addCcWebstreamMetadatas()
  1627. */
  1628. public function clearCcWebstreamMetadatas()
  1629. {
  1630. $this->collCcWebstreamMetadatas = null; // important to set this to NULL since that means it is uninitialized
  1631. }
  1632. /**
  1633. * Initializes the collCcWebstreamMetadatas collection.
  1634. *
  1635. * By default this just sets the collCcWebstreamMetadatas collection to an empty array (like clearcollCcWebstreamMetadatas());
  1636. * however, you may wish to override this method in your stub class to provide setting appropriate
  1637. * to your application -- for example, setting the initial array to the values stored in database.
  1638. *
  1639. * @return void
  1640. */
  1641. public function initCcWebstreamMetadatas()
  1642. {
  1643. $this->collCcWebstreamMetadatas = new PropelObjectCollection();
  1644. $this->collCcWebstreamMetadatas->setModel('CcWebstreamMetadata');
  1645. }
  1646. /**
  1647. * Gets an array of CcWebstreamMetadata objects which contain a foreign key that references this object.
  1648. *
  1649. * If the $criteria is not null, it is used to always fetch the results from the database.
  1650. * Otherwise the results are fetched from the database the first time, then cached.
  1651. * Next time the same method is called without $criteria, the cached collection is returned.
  1652. * If this CcSchedule is new, it will return
  1653. * an empty collection or the current collection; the criteria is ignored on a new object.
  1654. *
  1655. * @param Criteria $criteria optional Criteria object to narrow the query
  1656. * @param PropelPDO $con optional connection object
  1657. * @return PropelCollection|array CcWebstreamMetadata[] List of CcWebstreamMetadata objects
  1658. * @throws PropelException
  1659. */
  1660. public function getCcWebstreamMetadatas($criteria = null, PropelPDO $con = null)
  1661. {
  1662. if(null === $this->collCcWebstreamMetadatas || null !== $criteria) {
  1663. if ($this->isNew() && null === $this->collCcWebstreamMetadatas) {
  1664. // return empty collection
  1665. $this->initCcWebstreamMetadatas();
  1666. } else {
  1667. $collCcWebstreamMetadatas = CcWebstreamMetadataQuery::create(null, $criteria)
  1668. ->filterByCcSchedule($this)
  1669. ->find($con);
  1670. if (null !== $criteria) {
  1671. return $collCcWebstreamMetadatas;
  1672. }
  1673. $this->collCcWebstreamMetadatas = $collCcWebstreamMetadatas;
  1674. }
  1675. }
  1676. return $this->collCcWebstreamMetadatas;
  1677. }
  1678. /**
  1679. * Returns the number of related CcWebstreamMetadata objects.
  1680. *
  1681. * @param Criteria $criteria
  1682. * @param boolean $distinct
  1683. * @param PropelPDO $con
  1684. * @return int Count of related CcWebstreamMetadata objects.
  1685. * @throws PropelException
  1686. */
  1687. public function countCcWebstreamMetadatas(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
  1688. {
  1689. if(null === $this->collCcWebstreamMetadatas || null !== $criteria) {
  1690. if ($this->isNew() && null === $this->collCcWebstreamMetadatas) {
  1691. return 0;
  1692. } else {
  1693. $query = CcWebstreamMetadataQuery::create(null, $criteria);
  1694. if($distinct) {
  1695. $query->distinct();
  1696. }
  1697. return $query
  1698. ->filterByCcSchedule($this)
  1699. ->count($con);
  1700. }
  1701. } else {
  1702. return count($this->collCcWebstreamMetadatas);
  1703. }
  1704. }
  1705. /**
  1706. * Method called to associate a CcWebstreamMetadata object to this object
  1707. * through the CcWebstreamMetadata foreign key attribute.
  1708. *
  1709. * @param CcWebstreamMetadata $l CcWebstreamMetadata
  1710. * @return void
  1711. * @throws PropelException
  1712. */
  1713. public function addCcWebstreamMetadata(CcWebstreamMetadata $l)
  1714. {
  1715. if ($this->collCcWebstreamMetadatas === null) {
  1716. $this->initCcWebstreamMetadatas();
  1717. }
  1718. if (!$this->collCcWebstreamMetadatas->contains($l)) { // only add it if the **same** object is not already associated
  1719. $this->collCcWebstreamMetadatas[]= $l;
  1720. $l->setCcSchedule($this);
  1721. }
  1722. }
  1723. /**
  1724. * Clears the current object and sets all attributes to their default values
  1725. */
  1726. public function clear()
  1727. {
  1728. $this->id = null;
  1729. $this->starts = null;
  1730. $this->ends = null;
  1731. $this->file_id = null;
  1732. $this->stream_id = null;
  1733. $this->clip_length = null;
  1734. $this->fade_in = null;
  1735. $this->fade_out = null;
  1736. $this->cue_in = null;
  1737. $this->cue_out = null;
  1738. $this->media_item_played = null;
  1739. $this->instance_id = null;
  1740. $this->playout_status = null;
  1741. $this->broadcasted = null;
  1742. $this->position = null;
  1743. $this->alreadyInSave = false;
  1744. $this->alreadyInValidation = false;
  1745. $this->clearAllReferences();
  1746. $this->applyDefaultValues();
  1747. $this->resetModified();
  1748. $this->setNew(true);
  1749. $this->setDeleted(false);
  1750. }
  1751. /**
  1752. * Resets all collections of referencing foreign keys.
  1753. *
  1754. * This method is a user-space workaround for PHP's inability to garbage collect objects
  1755. * with circular references. This is currently necessary when using Propel in certain
  1756. * daemon or large-volumne/high-memory operations.
  1757. *
  1758. * @param boolean $deep Whether to also clear the references on all associated objects.
  1759. */
  1760. public function clearAllReferences($deep = false)
  1761. {
  1762. if ($deep) {
  1763. if ($this->collCcWebstreamMetadatas) {
  1764. foreach ((array) $this->collCcWebstreamMetadatas as $o) {
  1765. $o->clearAllReferences($deep);
  1766. }
  1767. }
  1768. } // if ($deep)
  1769. $this->collCcWebstreamMetadatas = null;
  1770. $this->aCcShowInstances = null;
  1771. $this->aCcFiles = null;
  1772. $this->aCcWebstream = null;
  1773. }
  1774. /**
  1775. * Catches calls to virtual methods
  1776. */
  1777. public function __call($name, $params)
  1778. {
  1779. if (preg_match('/get(\w+)/', $name, $matches)) {
  1780. $virtualColumn = $matches[1];
  1781. if ($this->hasVirtualColumn($virtualColumn)) {
  1782. return $this->getVirtualColumn($virtualColumn);
  1783. }
  1784. // no lcfirst in php<5.3...
  1785. $virtualColumn[0] = strtolower($virtualColumn[0]);
  1786. if ($this->hasVirtualColumn($virtualColumn)) {
  1787. return $this->getVirtualColumn($virtualColumn);
  1788. }
  1789. }
  1790. throw new PropelException('Call to undefined method: ' . $name);
  1791. }
  1792. } // BaseCcSchedule