BaseCcWebstream.php 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486
  1. <?php
  2. /**
  3. * Base class that represents a row from the 'cc_webstream' table.
  4. *
  5. *
  6. *
  7. * @package propel.generator.airtime.om
  8. */
  9. abstract class BaseCcWebstream extends BaseObject implements Persistent
  10. {
  11. /**
  12. * Peer class name
  13. */
  14. const PEER = 'CcWebstreamPeer';
  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 CcWebstreamPeer
  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 name field.
  29. * @var string
  30. */
  31. protected $name;
  32. /**
  33. * The value for the description field.
  34. * @var string
  35. */
  36. protected $description;
  37. /**
  38. * The value for the url field.
  39. * @var string
  40. */
  41. protected $url;
  42. /**
  43. * The value for the length field.
  44. * Note: this column has a database default value of: '00:00:00'
  45. * @var string
  46. */
  47. protected $length;
  48. /**
  49. * The value for the creator_id field.
  50. * @var int
  51. */
  52. protected $creator_id;
  53. /**
  54. * The value for the mtime field.
  55. * @var string
  56. */
  57. protected $mtime;
  58. /**
  59. * The value for the utime field.
  60. * @var string
  61. */
  62. protected $utime;
  63. /**
  64. * The value for the lptime field.
  65. * @var string
  66. */
  67. protected $lptime;
  68. /**
  69. * The value for the mime field.
  70. * @var string
  71. */
  72. protected $mime;
  73. /**
  74. * @var array CcSchedule[] Collection to store aggregation of CcSchedule objects.
  75. */
  76. protected $collCcSchedules;
  77. /**
  78. * Flag to prevent endless save loop, if this object is referenced
  79. * by another object which falls in this transaction.
  80. * @var boolean
  81. */
  82. protected $alreadyInSave = false;
  83. /**
  84. * Flag to prevent endless validation loop, if this object is referenced
  85. * by another object which falls in this transaction.
  86. * @var boolean
  87. */
  88. protected $alreadyInValidation = false;
  89. /**
  90. * Applies default values to this object.
  91. * This method should be called from the object's constructor (or
  92. * equivalent initialization method).
  93. * @see __construct()
  94. */
  95. public function applyDefaultValues()
  96. {
  97. $this->length = '00:00:00';
  98. }
  99. /**
  100. * Initializes internal state of BaseCcWebstream object.
  101. * @see applyDefaults()
  102. */
  103. public function __construct()
  104. {
  105. parent::__construct();
  106. $this->applyDefaultValues();
  107. }
  108. /**
  109. * Get the [id] column value.
  110. *
  111. * @return int
  112. */
  113. public function getDbId()
  114. {
  115. return $this->id;
  116. }
  117. /**
  118. * Get the [name] column value.
  119. *
  120. * @return string
  121. */
  122. public function getDbName()
  123. {
  124. return $this->name;
  125. }
  126. /**
  127. * Get the [description] column value.
  128. *
  129. * @return string
  130. */
  131. public function getDbDescription()
  132. {
  133. return $this->description;
  134. }
  135. /**
  136. * Get the [url] column value.
  137. *
  138. * @return string
  139. */
  140. public function getDbUrl()
  141. {
  142. return $this->url;
  143. }
  144. /**
  145. * Get the [length] column value.
  146. *
  147. * @return string
  148. */
  149. public function getDbLength()
  150. {
  151. return $this->length;
  152. }
  153. /**
  154. * Get the [creator_id] column value.
  155. *
  156. * @return int
  157. */
  158. public function getDbCreatorId()
  159. {
  160. return $this->creator_id;
  161. }
  162. /**
  163. * Get the [optionally formatted] temporal [mtime] column value.
  164. *
  165. *
  166. * @param string $format The date/time format string (either date()-style or strftime()-style).
  167. * If format is NULL, then the raw DateTime object will be returned.
  168. * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
  169. * @throws PropelException - if unable to parse/validate the date/time value.
  170. */
  171. public function getDbMtime($format = 'Y-m-d H:i:s')
  172. {
  173. if ($this->mtime === null) {
  174. return null;
  175. }
  176. try {
  177. $dt = new DateTime($this->mtime);
  178. } catch (Exception $x) {
  179. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->mtime, true), $x);
  180. }
  181. if ($format === null) {
  182. // Because propel.useDateTimeClass is TRUE, we return a DateTime object.
  183. return $dt;
  184. } elseif (strpos($format, '%') !== false) {
  185. return strftime($format, $dt->format('U'));
  186. } else {
  187. return $dt->format($format);
  188. }
  189. }
  190. /**
  191. * Get the [optionally formatted] temporal [utime] column value.
  192. *
  193. *
  194. * @param string $format The date/time format string (either date()-style or strftime()-style).
  195. * If format is NULL, then the raw DateTime object will be returned.
  196. * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
  197. * @throws PropelException - if unable to parse/validate the date/time value.
  198. */
  199. public function getDbUtime($format = 'Y-m-d H:i:s')
  200. {
  201. if ($this->utime === null) {
  202. return null;
  203. }
  204. try {
  205. $dt = new DateTime($this->utime);
  206. } catch (Exception $x) {
  207. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->utime, true), $x);
  208. }
  209. if ($format === null) {
  210. // Because propel.useDateTimeClass is TRUE, we return a DateTime object.
  211. return $dt;
  212. } elseif (strpos($format, '%') !== false) {
  213. return strftime($format, $dt->format('U'));
  214. } else {
  215. return $dt->format($format);
  216. }
  217. }
  218. /**
  219. * Get the [optionally formatted] temporal [lptime] column value.
  220. *
  221. *
  222. * @param string $format The date/time format string (either date()-style or strftime()-style).
  223. * If format is NULL, then the raw DateTime object will be returned.
  224. * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
  225. * @throws PropelException - if unable to parse/validate the date/time value.
  226. */
  227. public function getDbLPtime($format = 'Y-m-d H:i:s')
  228. {
  229. if ($this->lptime === null) {
  230. return null;
  231. }
  232. try {
  233. $dt = new DateTime($this->lptime);
  234. } catch (Exception $x) {
  235. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->lptime, true), $x);
  236. }
  237. if ($format === null) {
  238. // Because propel.useDateTimeClass is TRUE, we return a DateTime object.
  239. return $dt;
  240. } elseif (strpos($format, '%') !== false) {
  241. return strftime($format, $dt->format('U'));
  242. } else {
  243. return $dt->format($format);
  244. }
  245. }
  246. /**
  247. * Get the [mime] column value.
  248. *
  249. * @return string
  250. */
  251. public function getDbMime()
  252. {
  253. return $this->mime;
  254. }
  255. /**
  256. * Set the value of [id] column.
  257. *
  258. * @param int $v new value
  259. * @return CcWebstream The current object (for fluent API support)
  260. */
  261. public function setDbId($v)
  262. {
  263. if ($v !== null) {
  264. $v = (int) $v;
  265. }
  266. if ($this->id !== $v) {
  267. $this->id = $v;
  268. $this->modifiedColumns[] = CcWebstreamPeer::ID;
  269. }
  270. return $this;
  271. } // setDbId()
  272. /**
  273. * Set the value of [name] column.
  274. *
  275. * @param string $v new value
  276. * @return CcWebstream The current object (for fluent API support)
  277. */
  278. public function setDbName($v)
  279. {
  280. if ($v !== null) {
  281. $v = (string) $v;
  282. }
  283. if ($this->name !== $v) {
  284. $this->name = $v;
  285. $this->modifiedColumns[] = CcWebstreamPeer::NAME;
  286. }
  287. return $this;
  288. } // setDbName()
  289. /**
  290. * Set the value of [description] column.
  291. *
  292. * @param string $v new value
  293. * @return CcWebstream The current object (for fluent API support)
  294. */
  295. public function setDbDescription($v)
  296. {
  297. if ($v !== null) {
  298. $v = (string) $v;
  299. }
  300. if ($this->description !== $v) {
  301. $this->description = $v;
  302. $this->modifiedColumns[] = CcWebstreamPeer::DESCRIPTION;
  303. }
  304. return $this;
  305. } // setDbDescription()
  306. /**
  307. * Set the value of [url] column.
  308. *
  309. * @param string $v new value
  310. * @return CcWebstream The current object (for fluent API support)
  311. */
  312. public function setDbUrl($v)
  313. {
  314. if ($v !== null) {
  315. $v = (string) $v;
  316. }
  317. if ($this->url !== $v) {
  318. $this->url = $v;
  319. $this->modifiedColumns[] = CcWebstreamPeer::URL;
  320. }
  321. return $this;
  322. } // setDbUrl()
  323. /**
  324. * Set the value of [length] column.
  325. *
  326. * @param string $v new value
  327. * @return CcWebstream The current object (for fluent API support)
  328. */
  329. public function setDbLength($v)
  330. {
  331. if ($v !== null) {
  332. $v = (string) $v;
  333. }
  334. if ($this->length !== $v || $this->isNew()) {
  335. $this->length = $v;
  336. $this->modifiedColumns[] = CcWebstreamPeer::LENGTH;
  337. }
  338. return $this;
  339. } // setDbLength()
  340. /**
  341. * Set the value of [creator_id] column.
  342. *
  343. * @param int $v new value
  344. * @return CcWebstream The current object (for fluent API support)
  345. */
  346. public function setDbCreatorId($v)
  347. {
  348. if ($v !== null) {
  349. $v = (int) $v;
  350. }
  351. if ($this->creator_id !== $v) {
  352. $this->creator_id = $v;
  353. $this->modifiedColumns[] = CcWebstreamPeer::CREATOR_ID;
  354. }
  355. return $this;
  356. } // setDbCreatorId()
  357. /**
  358. * Sets the value of [mtime] column to a normalized version of the date/time value specified.
  359. *
  360. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  361. * be treated as NULL for temporal objects.
  362. * @return CcWebstream The current object (for fluent API support)
  363. */
  364. public function setDbMtime($v)
  365. {
  366. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  367. // -- which is unexpected, to say the least.
  368. if ($v === null || $v === '') {
  369. $dt = null;
  370. } elseif ($v instanceof DateTime) {
  371. $dt = $v;
  372. } else {
  373. // some string/numeric value passed; we normalize that so that we can
  374. // validate it.
  375. try {
  376. if (is_numeric($v)) { // if it's a unix timestamp
  377. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  378. // We have to explicitly specify and then change the time zone because of a
  379. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  380. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  381. } else {
  382. $dt = new DateTime($v);
  383. }
  384. } catch (Exception $x) {
  385. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  386. }
  387. }
  388. if ( $this->mtime !== null || $dt !== null ) {
  389. // (nested ifs are a little easier to read in this case)
  390. $currNorm = ($this->mtime !== null && $tmpDt = new DateTime($this->mtime)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null;
  391. $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null;
  392. if ( ($currNorm !== $newNorm) // normalized values don't match
  393. )
  394. {
  395. $this->mtime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
  396. $this->modifiedColumns[] = CcWebstreamPeer::MTIME;
  397. }
  398. } // if either are not null
  399. return $this;
  400. } // setDbMtime()
  401. /**
  402. * Sets the value of [utime] column to a normalized version of the date/time value specified.
  403. *
  404. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  405. * be treated as NULL for temporal objects.
  406. * @return CcWebstream The current object (for fluent API support)
  407. */
  408. public function setDbUtime($v)
  409. {
  410. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  411. // -- which is unexpected, to say the least.
  412. if ($v === null || $v === '') {
  413. $dt = null;
  414. } elseif ($v instanceof DateTime) {
  415. $dt = $v;
  416. } else {
  417. // some string/numeric value passed; we normalize that so that we can
  418. // validate it.
  419. try {
  420. if (is_numeric($v)) { // if it's a unix timestamp
  421. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  422. // We have to explicitly specify and then change the time zone because of a
  423. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  424. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  425. } else {
  426. $dt = new DateTime($v);
  427. }
  428. } catch (Exception $x) {
  429. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  430. }
  431. }
  432. if ( $this->utime !== null || $dt !== null ) {
  433. // (nested ifs are a little easier to read in this case)
  434. $currNorm = ($this->utime !== null && $tmpDt = new DateTime($this->utime)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null;
  435. $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null;
  436. if ( ($currNorm !== $newNorm) // normalized values don't match
  437. )
  438. {
  439. $this->utime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
  440. $this->modifiedColumns[] = CcWebstreamPeer::UTIME;
  441. }
  442. } // if either are not null
  443. return $this;
  444. } // setDbUtime()
  445. /**
  446. * Sets the value of [lptime] column to a normalized version of the date/time value specified.
  447. *
  448. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  449. * be treated as NULL for temporal objects.
  450. * @return CcWebstream The current object (for fluent API support)
  451. */
  452. public function setDbLPtime($v)
  453. {
  454. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  455. // -- which is unexpected, to say the least.
  456. if ($v === null || $v === '') {
  457. $dt = null;
  458. } elseif ($v instanceof DateTime) {
  459. $dt = $v;
  460. } else {
  461. // some string/numeric value passed; we normalize that so that we can
  462. // validate it.
  463. try {
  464. if (is_numeric($v)) { // if it's a unix timestamp
  465. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  466. // We have to explicitly specify and then change the time zone because of a
  467. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  468. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  469. } else {
  470. $dt = new DateTime($v);
  471. }
  472. } catch (Exception $x) {
  473. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  474. }
  475. }
  476. if ( $this->lptime !== null || $dt !== null ) {
  477. // (nested ifs are a little easier to read in this case)
  478. $currNorm = ($this->lptime !== null && $tmpDt = new DateTime($this->lptime)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null;
  479. $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null;
  480. if ( ($currNorm !== $newNorm) // normalized values don't match
  481. )
  482. {
  483. $this->lptime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
  484. $this->modifiedColumns[] = CcWebstreamPeer::LPTIME;
  485. }
  486. } // if either are not null
  487. return $this;
  488. } // setDbLPtime()
  489. /**
  490. * Set the value of [mime] column.
  491. *
  492. * @param string $v new value
  493. * @return CcWebstream The current object (for fluent API support)
  494. */
  495. public function setDbMime($v)
  496. {
  497. if ($v !== null) {
  498. $v = (string) $v;
  499. }
  500. if ($this->mime !== $v) {
  501. $this->mime = $v;
  502. $this->modifiedColumns[] = CcWebstreamPeer::MIME;
  503. }
  504. return $this;
  505. } // setDbMime()
  506. /**
  507. * Indicates whether the columns in this object are only set to default values.
  508. *
  509. * This method can be used in conjunction with isModified() to indicate whether an object is both
  510. * modified _and_ has some values set which are non-default.
  511. *
  512. * @return boolean Whether the columns in this object are only been set with default values.
  513. */
  514. public function hasOnlyDefaultValues()
  515. {
  516. if ($this->length !== '00:00:00') {
  517. return false;
  518. }
  519. // otherwise, everything was equal, so return TRUE
  520. return true;
  521. } // hasOnlyDefaultValues()
  522. /**
  523. * Hydrates (populates) the object variables with values from the database resultset.
  524. *
  525. * An offset (0-based "start column") is specified so that objects can be hydrated
  526. * with a subset of the columns in the resultset rows. This is needed, for example,
  527. * for results of JOIN queries where the resultset row includes columns from two or
  528. * more tables.
  529. *
  530. * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
  531. * @param int $startcol 0-based offset column which indicates which restultset column to start with.
  532. * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
  533. * @return int next starting column
  534. * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
  535. */
  536. public function hydrate($row, $startcol = 0, $rehydrate = false)
  537. {
  538. try {
  539. $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
  540. $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
  541. $this->description = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
  542. $this->url = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
  543. $this->length = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
  544. $this->creator_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
  545. $this->mtime = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
  546. $this->utime = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
  547. $this->lptime = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
  548. $this->mime = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
  549. $this->resetModified();
  550. $this->setNew(false);
  551. if ($rehydrate) {
  552. $this->ensureConsistency();
  553. }
  554. return $startcol + 10; // 10 = CcWebstreamPeer::NUM_COLUMNS - CcWebstreamPeer::NUM_LAZY_LOAD_COLUMNS).
  555. } catch (Exception $e) {
  556. throw new PropelException("Error populating CcWebstream object", $e);
  557. }
  558. }
  559. /**
  560. * Checks and repairs the internal consistency of the object.
  561. *
  562. * This method is executed after an already-instantiated object is re-hydrated
  563. * from the database. It exists to check any foreign keys to make sure that
  564. * the objects related to the current object are correct based on foreign key.
  565. *
  566. * You can override this method in the stub class, but you should always invoke
  567. * the base method from the overridden method (i.e. parent::ensureConsistency()),
  568. * in case your model changes.
  569. *
  570. * @throws PropelException
  571. */
  572. public function ensureConsistency()
  573. {
  574. } // ensureConsistency
  575. /**
  576. * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
  577. *
  578. * This will only work if the object has been saved and has a valid primary key set.
  579. *
  580. * @param boolean $deep (optional) Whether to also de-associated any related objects.
  581. * @param PropelPDO $con (optional) The PropelPDO connection to use.
  582. * @return void
  583. * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
  584. */
  585. public function reload($deep = false, PropelPDO $con = null)
  586. {
  587. if ($this->isDeleted()) {
  588. throw new PropelException("Cannot reload a deleted object.");
  589. }
  590. if ($this->isNew()) {
  591. throw new PropelException("Cannot reload an unsaved object.");
  592. }
  593. if ($con === null) {
  594. $con = Propel::getConnection(CcWebstreamPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  595. }
  596. // We don't need to alter the object instance pool; we're just modifying this instance
  597. // already in the pool.
  598. $stmt = CcWebstreamPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
  599. $row = $stmt->fetch(PDO::FETCH_NUM);
  600. $stmt->closeCursor();
  601. if (!$row) {
  602. throw new PropelException('Cannot find matching row in the database to reload object values.');
  603. }
  604. $this->hydrate($row, 0, true); // rehydrate
  605. if ($deep) { // also de-associate any related objects?
  606. $this->collCcSchedules = null;
  607. } // if (deep)
  608. }
  609. /**
  610. * Removes this object from datastore and sets delete attribute.
  611. *
  612. * @param PropelPDO $con
  613. * @return void
  614. * @throws PropelException
  615. * @see BaseObject::setDeleted()
  616. * @see BaseObject::isDeleted()
  617. */
  618. public function delete(PropelPDO $con = null)
  619. {
  620. if ($this->isDeleted()) {
  621. throw new PropelException("This object has already been deleted.");
  622. }
  623. if ($con === null) {
  624. $con = Propel::getConnection(CcWebstreamPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  625. }
  626. $con->beginTransaction();
  627. try {
  628. $ret = $this->preDelete($con);
  629. if ($ret) {
  630. CcWebstreamQuery::create()
  631. ->filterByPrimaryKey($this->getPrimaryKey())
  632. ->delete($con);
  633. $this->postDelete($con);
  634. $con->commit();
  635. $this->setDeleted(true);
  636. } else {
  637. $con->commit();
  638. }
  639. } catch (PropelException $e) {
  640. $con->rollBack();
  641. throw $e;
  642. }
  643. }
  644. /**
  645. * Persists this object to the database.
  646. *
  647. * If the object is new, it inserts it; otherwise an update is performed.
  648. * All modified related objects will also be persisted in the doSave()
  649. * method. This method wraps all precipitate database operations in a
  650. * single transaction.
  651. *
  652. * @param PropelPDO $con
  653. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  654. * @throws PropelException
  655. * @see doSave()
  656. */
  657. public function save(PropelPDO $con = null)
  658. {
  659. if ($this->isDeleted()) {
  660. throw new PropelException("You cannot save an object that has been deleted.");
  661. }
  662. if ($con === null) {
  663. $con = Propel::getConnection(CcWebstreamPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  664. }
  665. $con->beginTransaction();
  666. $isInsert = $this->isNew();
  667. try {
  668. $ret = $this->preSave($con);
  669. if ($isInsert) {
  670. $ret = $ret && $this->preInsert($con);
  671. } else {
  672. $ret = $ret && $this->preUpdate($con);
  673. }
  674. if ($ret) {
  675. $affectedRows = $this->doSave($con);
  676. if ($isInsert) {
  677. $this->postInsert($con);
  678. } else {
  679. $this->postUpdate($con);
  680. }
  681. $this->postSave($con);
  682. CcWebstreamPeer::addInstanceToPool($this);
  683. } else {
  684. $affectedRows = 0;
  685. }
  686. $con->commit();
  687. return $affectedRows;
  688. } catch (PropelException $e) {
  689. $con->rollBack();
  690. throw $e;
  691. }
  692. }
  693. /**
  694. * Performs the work of inserting or updating the row in the database.
  695. *
  696. * If the object is new, it inserts it; otherwise an update is performed.
  697. * All related objects are also updated in this method.
  698. *
  699. * @param PropelPDO $con
  700. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  701. * @throws PropelException
  702. * @see save()
  703. */
  704. protected function doSave(PropelPDO $con)
  705. {
  706. $affectedRows = 0; // initialize var to track total num of affected rows
  707. if (!$this->alreadyInSave) {
  708. $this->alreadyInSave = true;
  709. if ($this->isNew() ) {
  710. $this->modifiedColumns[] = CcWebstreamPeer::ID;
  711. }
  712. // If this object has been modified, then save it to the database.
  713. if ($this->isModified()) {
  714. if ($this->isNew()) {
  715. $criteria = $this->buildCriteria();
  716. if ($criteria->keyContainsValue(CcWebstreamPeer::ID) ) {
  717. throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcWebstreamPeer::ID.')');
  718. }
  719. $pk = BasePeer::doInsert($criteria, $con);
  720. $affectedRows = 1;
  721. $this->setDbId($pk); //[IMV] update autoincrement primary key
  722. $this->setNew(false);
  723. } else {
  724. $affectedRows = CcWebstreamPeer::doUpdate($this, $con);
  725. }
  726. $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
  727. }
  728. if ($this->collCcSchedules !== null) {
  729. foreach ($this->collCcSchedules as $referrerFK) {
  730. if (!$referrerFK->isDeleted()) {
  731. $affectedRows += $referrerFK->save($con);
  732. }
  733. }
  734. }
  735. $this->alreadyInSave = false;
  736. }
  737. return $affectedRows;
  738. } // doSave()
  739. /**
  740. * Array of ValidationFailed objects.
  741. * @var array ValidationFailed[]
  742. */
  743. protected $validationFailures = array();
  744. /**
  745. * Gets any ValidationFailed objects that resulted from last call to validate().
  746. *
  747. *
  748. * @return array ValidationFailed[]
  749. * @see validate()
  750. */
  751. public function getValidationFailures()
  752. {
  753. return $this->validationFailures;
  754. }
  755. /**
  756. * Validates the objects modified field values and all objects related to this table.
  757. *
  758. * If $columns is either a column name or an array of column names
  759. * only those columns are validated.
  760. *
  761. * @param mixed $columns Column name or an array of column names.
  762. * @return boolean Whether all columns pass validation.
  763. * @see doValidate()
  764. * @see getValidationFailures()
  765. */
  766. public function validate($columns = null)
  767. {
  768. $res = $this->doValidate($columns);
  769. if ($res === true) {
  770. $this->validationFailures = array();
  771. return true;
  772. } else {
  773. $this->validationFailures = $res;
  774. return false;
  775. }
  776. }
  777. /**
  778. * This function performs the validation work for complex object models.
  779. *
  780. * In addition to checking the current object, all related objects will
  781. * also be validated. If all pass then <code>true</code> is returned; otherwise
  782. * an aggreagated array of ValidationFailed objects will be returned.
  783. *
  784. * @param array $columns Array of column names to validate.
  785. * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  786. */
  787. protected function doValidate($columns = null)
  788. {
  789. if (!$this->alreadyInValidation) {
  790. $this->alreadyInValidation = true;
  791. $retval = null;
  792. $failureMap = array();
  793. if (($retval = CcWebstreamPeer::doValidate($this, $columns)) !== true) {
  794. $failureMap = array_merge($failureMap, $retval);
  795. }
  796. if ($this->collCcSchedules !== null) {
  797. foreach ($this->collCcSchedules as $referrerFK) {
  798. if (!$referrerFK->validate($columns)) {
  799. $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
  800. }
  801. }
  802. }
  803. $this->alreadyInValidation = false;
  804. }
  805. return (!empty($failureMap) ? $failureMap : true);
  806. }
  807. /**
  808. * Retrieves a field from the object by name passed in as a string.
  809. *
  810. * @param string $name name
  811. * @param string $type The type of fieldname the $name is of:
  812. * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  813. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  814. * @return mixed Value of field.
  815. */
  816. public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
  817. {
  818. $pos = CcWebstreamPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  819. $field = $this->getByPosition($pos);
  820. return $field;
  821. }
  822. /**
  823. * Retrieves a field from the object by Position as specified in the xml schema.
  824. * Zero-based.
  825. *
  826. * @param int $pos position in xml schema
  827. * @return mixed Value of field at $pos
  828. */
  829. public function getByPosition($pos)
  830. {
  831. switch($pos) {
  832. case 0:
  833. return $this->getDbId();
  834. break;
  835. case 1:
  836. return $this->getDbName();
  837. break;
  838. case 2:
  839. return $this->getDbDescription();
  840. break;
  841. case 3:
  842. return $this->getDbUrl();
  843. break;
  844. case 4:
  845. return $this->getDbLength();
  846. break;
  847. case 5:
  848. return $this->getDbCreatorId();
  849. break;
  850. case 6:
  851. return $this->getDbMtime();
  852. break;
  853. case 7:
  854. return $this->getDbUtime();
  855. break;
  856. case 8:
  857. return $this->getDbLPtime();
  858. break;
  859. case 9:
  860. return $this->getDbMime();
  861. break;
  862. default:
  863. return null;
  864. break;
  865. } // switch()
  866. }
  867. /**
  868. * Exports the object as an array.
  869. *
  870. * You can specify the key type of the array by passing one of the class
  871. * type constants.
  872. *
  873. * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  874. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  875. * Defaults to BasePeer::TYPE_PHPNAME.
  876. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  877. *
  878. * @return array an associative array containing the field names (as keys) and field values
  879. */
  880. public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
  881. {
  882. $keys = CcWebstreamPeer::getFieldNames($keyType);
  883. $result = array(
  884. $keys[0] => $this->getDbId(),
  885. $keys[1] => $this->getDbName(),
  886. $keys[2] => $this->getDbDescription(),
  887. $keys[3] => $this->getDbUrl(),
  888. $keys[4] => $this->getDbLength(),
  889. $keys[5] => $this->getDbCreatorId(),
  890. $keys[6] => $this->getDbMtime(),
  891. $keys[7] => $this->getDbUtime(),
  892. $keys[8] => $this->getDbLPtime(),
  893. $keys[9] => $this->getDbMime(),
  894. );
  895. return $result;
  896. }
  897. /**
  898. * Sets a field from the object by name passed in as a string.
  899. *
  900. * @param string $name peer name
  901. * @param mixed $value field value
  902. * @param string $type The type of fieldname the $name is of:
  903. * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  904. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  905. * @return void
  906. */
  907. public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
  908. {
  909. $pos = CcWebstreamPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  910. return $this->setByPosition($pos, $value);
  911. }
  912. /**
  913. * Sets a field from the object by Position as specified in the xml schema.
  914. * Zero-based.
  915. *
  916. * @param int $pos position in xml schema
  917. * @param mixed $value field value
  918. * @return void
  919. */
  920. public function setByPosition($pos, $value)
  921. {
  922. switch($pos) {
  923. case 0:
  924. $this->setDbId($value);
  925. break;
  926. case 1:
  927. $this->setDbName($value);
  928. break;
  929. case 2:
  930. $this->setDbDescription($value);
  931. break;
  932. case 3:
  933. $this->setDbUrl($value);
  934. break;
  935. case 4:
  936. $this->setDbLength($value);
  937. break;
  938. case 5:
  939. $this->setDbCreatorId($value);
  940. break;
  941. case 6:
  942. $this->setDbMtime($value);
  943. break;
  944. case 7:
  945. $this->setDbUtime($value);
  946. break;
  947. case 8:
  948. $this->setDbLPtime($value);
  949. break;
  950. case 9:
  951. $this->setDbMime($value);
  952. break;
  953. } // switch()
  954. }
  955. /**
  956. * Populates the object using an array.
  957. *
  958. * This is particularly useful when populating an object from one of the
  959. * request arrays (e.g. $_POST). This method goes through the column
  960. * names, checking to see whether a matching key exists in populated
  961. * array. If so the setByName() method is called for that column.
  962. *
  963. * You can specify the key type of the array by additionally passing one
  964. * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  965. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  966. * The default key type is the column's phpname (e.g. 'AuthorId')
  967. *
  968. * @param array $arr An array to populate the object from.
  969. * @param string $keyType The type of keys the array uses.
  970. * @return void
  971. */
  972. public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
  973. {
  974. $keys = CcWebstreamPeer::getFieldNames($keyType);
  975. if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
  976. if (array_key_exists($keys[1], $arr)) $this->setDbName($arr[$keys[1]]);
  977. if (array_key_exists($keys[2], $arr)) $this->setDbDescription($arr[$keys[2]]);
  978. if (array_key_exists($keys[3], $arr)) $this->setDbUrl($arr[$keys[3]]);
  979. if (array_key_exists($keys[4], $arr)) $this->setDbLength($arr[$keys[4]]);
  980. if (array_key_exists($keys[5], $arr)) $this->setDbCreatorId($arr[$keys[5]]);
  981. if (array_key_exists($keys[6], $arr)) $this->setDbMtime($arr[$keys[6]]);
  982. if (array_key_exists($keys[7], $arr)) $this->setDbUtime($arr[$keys[7]]);
  983. if (array_key_exists($keys[8], $arr)) $this->setDbLPtime($arr[$keys[8]]);
  984. if (array_key_exists($keys[9], $arr)) $this->setDbMime($arr[$keys[9]]);
  985. }
  986. /**
  987. * Build a Criteria object containing the values of all modified columns in this object.
  988. *
  989. * @return Criteria The Criteria object containing all modified values.
  990. */
  991. public function buildCriteria()
  992. {
  993. $criteria = new Criteria(CcWebstreamPeer::DATABASE_NAME);
  994. if ($this->isColumnModified(CcWebstreamPeer::ID)) $criteria->add(CcWebstreamPeer::ID, $this->id);
  995. if ($this->isColumnModified(CcWebstreamPeer::NAME)) $criteria->add(CcWebstreamPeer::NAME, $this->name);
  996. if ($this->isColumnModified(CcWebstreamPeer::DESCRIPTION)) $criteria->add(CcWebstreamPeer::DESCRIPTION, $this->description);
  997. if ($this->isColumnModified(CcWebstreamPeer::URL)) $criteria->add(CcWebstreamPeer::URL, $this->url);
  998. if ($this->isColumnModified(CcWebstreamPeer::LENGTH)) $criteria->add(CcWebstreamPeer::LENGTH, $this->length);
  999. if ($this->isColumnModified(CcWebstreamPeer::CREATOR_ID)) $criteria->add(CcWebstreamPeer::CREATOR_ID, $this->creator_id);
  1000. if ($this->isColumnModified(CcWebstreamPeer::MTIME)) $criteria->add(CcWebstreamPeer::MTIME, $this->mtime);
  1001. if ($this->isColumnModified(CcWebstreamPeer::UTIME)) $criteria->add(CcWebstreamPeer::UTIME, $this->utime);
  1002. if ($this->isColumnModified(CcWebstreamPeer::LPTIME)) $criteria->add(CcWebstreamPeer::LPTIME, $this->lptime);
  1003. if ($this->isColumnModified(CcWebstreamPeer::MIME)) $criteria->add(CcWebstreamPeer::MIME, $this->mime);
  1004. return $criteria;
  1005. }
  1006. /**
  1007. * Builds a Criteria object containing the primary key for this object.
  1008. *
  1009. * Unlike buildCriteria() this method includes the primary key values regardless
  1010. * of whether or not they have been modified.
  1011. *
  1012. * @return Criteria The Criteria object containing value(s) for primary key(s).
  1013. */
  1014. public function buildPkeyCriteria()
  1015. {
  1016. $criteria = new Criteria(CcWebstreamPeer::DATABASE_NAME);
  1017. $criteria->add(CcWebstreamPeer::ID, $this->id);
  1018. return $criteria;
  1019. }
  1020. /**
  1021. * Returns the primary key for this object (row).
  1022. * @return int
  1023. */
  1024. public function getPrimaryKey()
  1025. {
  1026. return $this->getDbId();
  1027. }
  1028. /**
  1029. * Generic method to set the primary key (id column).
  1030. *
  1031. * @param int $key Primary key.
  1032. * @return void
  1033. */
  1034. public function setPrimaryKey($key)
  1035. {
  1036. $this->setDbId($key);
  1037. }
  1038. /**
  1039. * Returns true if the primary key for this object is null.
  1040. * @return boolean
  1041. */
  1042. public function isPrimaryKeyNull()
  1043. {
  1044. return null === $this->getDbId();
  1045. }
  1046. /**
  1047. * Sets contents of passed object to values from current object.
  1048. *
  1049. * If desired, this method can also make copies of all associated (fkey referrers)
  1050. * objects.
  1051. *
  1052. * @param object $copyObj An object of CcWebstream (or compatible) type.
  1053. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  1054. * @throws PropelException
  1055. */
  1056. public function copyInto($copyObj, $deepCopy = false)
  1057. {
  1058. $copyObj->setDbName($this->name);
  1059. $copyObj->setDbDescription($this->description);
  1060. $copyObj->setDbUrl($this->url);
  1061. $copyObj->setDbLength($this->length);
  1062. $copyObj->setDbCreatorId($this->creator_id);
  1063. $copyObj->setDbMtime($this->mtime);
  1064. $copyObj->setDbUtime($this->utime);
  1065. $copyObj->setDbLPtime($this->lptime);
  1066. $copyObj->setDbMime($this->mime);
  1067. if ($deepCopy) {
  1068. // important: temporarily setNew(false) because this affects the behavior of
  1069. // the getter/setter methods for fkey referrer objects.
  1070. $copyObj->setNew(false);
  1071. foreach ($this->getCcSchedules() as $relObj) {
  1072. if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
  1073. $copyObj->addCcSchedule($relObj->copy($deepCopy));
  1074. }
  1075. }
  1076. } // if ($deepCopy)
  1077. $copyObj->setNew(true);
  1078. $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
  1079. }
  1080. /**
  1081. * Makes a copy of this object that will be inserted as a new row in table when saved.
  1082. * It creates a new object filling in the simple attributes, but skipping any primary
  1083. * keys that are defined for the table.
  1084. *
  1085. * If desired, this method can also make copies of all associated (fkey referrers)
  1086. * objects.
  1087. *
  1088. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  1089. * @return CcWebstream Clone of current object.
  1090. * @throws PropelException
  1091. */
  1092. public function copy($deepCopy = false)
  1093. {
  1094. // we use get_class(), because this might be a subclass
  1095. $clazz = get_class($this);
  1096. $copyObj = new $clazz();
  1097. $this->copyInto($copyObj, $deepCopy);
  1098. return $copyObj;
  1099. }
  1100. /**
  1101. * Returns a peer instance associated with this om.
  1102. *
  1103. * Since Peer classes are not to have any instance attributes, this method returns the
  1104. * same instance for all member of this class. The method could therefore
  1105. * be static, but this would prevent one from overriding the behavior.
  1106. *
  1107. * @return CcWebstreamPeer
  1108. */
  1109. public function getPeer()
  1110. {
  1111. if (self::$peer === null) {
  1112. self::$peer = new CcWebstreamPeer();
  1113. }
  1114. return self::$peer;
  1115. }
  1116. /**
  1117. * Clears out the collCcSchedules collection
  1118. *
  1119. * This does not modify the database; however, it will remove any associated objects, causing
  1120. * them to be refetched by subsequent calls to accessor method.
  1121. *
  1122. * @return void
  1123. * @see addCcSchedules()
  1124. */
  1125. public function clearCcSchedules()
  1126. {
  1127. $this->collCcSchedules = null; // important to set this to NULL since that means it is uninitialized
  1128. }
  1129. /**
  1130. * Initializes the collCcSchedules collection.
  1131. *
  1132. * By default this just sets the collCcSchedules collection to an empty array (like clearcollCcSchedules());
  1133. * however, you may wish to override this method in your stub class to provide setting appropriate
  1134. * to your application -- for example, setting the initial array to the values stored in database.
  1135. *
  1136. * @return void
  1137. */
  1138. public function initCcSchedules()
  1139. {
  1140. $this->collCcSchedules = new PropelObjectCollection();
  1141. $this->collCcSchedules->setModel('CcSchedule');
  1142. }
  1143. /**
  1144. * Gets an array of CcSchedule objects which contain a foreign key that references this object.
  1145. *
  1146. * If the $criteria is not null, it is used to always fetch the results from the database.
  1147. * Otherwise the results are fetched from the database the first time, then cached.
  1148. * Next time the same method is called without $criteria, the cached collection is returned.
  1149. * If this CcWebstream is new, it will return
  1150. * an empty collection or the current collection; the criteria is ignored on a new object.
  1151. *
  1152. * @param Criteria $criteria optional Criteria object to narrow the query
  1153. * @param PropelPDO $con optional connection object
  1154. * @return PropelCollection|array CcSchedule[] List of CcSchedule objects
  1155. * @throws PropelException
  1156. */
  1157. public function getCcSchedules($criteria = null, PropelPDO $con = null)
  1158. {
  1159. if(null === $this->collCcSchedules || null !== $criteria) {
  1160. if ($this->isNew() && null === $this->collCcSchedules) {
  1161. // return empty collection
  1162. $this->initCcSchedules();
  1163. } else {
  1164. $collCcSchedules = CcScheduleQuery::create(null, $criteria)
  1165. ->filterByCcWebstream($this)
  1166. ->find($con);
  1167. if (null !== $criteria) {
  1168. return $collCcSchedules;
  1169. }
  1170. $this->collCcSchedules = $collCcSchedules;
  1171. }
  1172. }
  1173. return $this->collCcSchedules;
  1174. }
  1175. /**
  1176. * Returns the number of related CcSchedule objects.
  1177. *
  1178. * @param Criteria $criteria
  1179. * @param boolean $distinct
  1180. * @param PropelPDO $con
  1181. * @return int Count of related CcSchedule objects.
  1182. * @throws PropelException
  1183. */
  1184. public function countCcSchedules(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
  1185. {
  1186. if(null === $this->collCcSchedules || null !== $criteria) {
  1187. if ($this->isNew() && null === $this->collCcSchedules) {
  1188. return 0;
  1189. } else {
  1190. $query = CcScheduleQuery::create(null, $criteria);
  1191. if($distinct) {
  1192. $query->distinct();
  1193. }
  1194. return $query
  1195. ->filterByCcWebstream($this)
  1196. ->count($con);
  1197. }
  1198. } else {
  1199. return count($this->collCcSchedules);
  1200. }
  1201. }
  1202. /**
  1203. * Method called to associate a CcSchedule object to this object
  1204. * through the CcSchedule foreign key attribute.
  1205. *
  1206. * @param CcSchedule $l CcSchedule
  1207. * @return void
  1208. * @throws PropelException
  1209. */
  1210. public function addCcSchedule(CcSchedule $l)
  1211. {
  1212. if ($this->collCcSchedules === null) {
  1213. $this->initCcSchedules();
  1214. }
  1215. if (!$this->collCcSchedules->contains($l)) { // only add it if the **same** object is not already associated
  1216. $this->collCcSchedules[]= $l;
  1217. $l->setCcWebstream($this);
  1218. }
  1219. }
  1220. /**
  1221. * If this collection has already been initialized with
  1222. * an identical criteria, it returns the collection.
  1223. * Otherwise if this CcWebstream is new, it will return
  1224. * an empty collection; or if this CcWebstream has previously
  1225. * been saved, it will retrieve related CcSchedules from storage.
  1226. *
  1227. * This method is protected by default in order to keep the public
  1228. * api reasonable. You can provide public methods for those you
  1229. * actually need in CcWebstream.
  1230. *
  1231. * @param Criteria $criteria optional Criteria object to narrow the query
  1232. * @param PropelPDO $con optional connection object
  1233. * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
  1234. * @return PropelCollection|array CcSchedule[] List of CcSchedule objects
  1235. */
  1236. public function getCcSchedulesJoinCcShowInstances($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  1237. {
  1238. $query = CcScheduleQuery::create(null, $criteria);
  1239. $query->joinWith('CcShowInstances', $join_behavior);
  1240. return $this->getCcSchedules($query, $con);
  1241. }
  1242. /**
  1243. * If this collection has already been initialized with
  1244. * an identical criteria, it returns the collection.
  1245. * Otherwise if this CcWebstream is new, it will return
  1246. * an empty collection; or if this CcWebstream has previously
  1247. * been saved, it will retrieve related CcSchedules from storage.
  1248. *
  1249. * This method is protected by default in order to keep the public
  1250. * api reasonable. You can provide public methods for those you
  1251. * actually need in CcWebstream.
  1252. *
  1253. * @param Criteria $criteria optional Criteria object to narrow the query
  1254. * @param PropelPDO $con optional connection object
  1255. * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
  1256. * @return PropelCollection|array CcSchedule[] List of CcSchedule objects
  1257. */
  1258. public function getCcSchedulesJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  1259. {
  1260. $query = CcScheduleQuery::create(null, $criteria);
  1261. $query->joinWith('CcFiles', $join_behavior);
  1262. return $this->getCcSchedules($query, $con);
  1263. }
  1264. /**
  1265. * Clears the current object and sets all attributes to their default values
  1266. */
  1267. public function clear()
  1268. {
  1269. $this->id = null;
  1270. $this->name = null;
  1271. $this->description = null;
  1272. $this->url = null;
  1273. $this->length = null;
  1274. $this->creator_id = null;
  1275. $this->mtime = null;
  1276. $this->utime = null;
  1277. $this->lptime = null;
  1278. $this->mime = null;
  1279. $this->alreadyInSave = false;
  1280. $this->alreadyInValidation = false;
  1281. $this->clearAllReferences();
  1282. $this->applyDefaultValues();
  1283. $this->resetModified();
  1284. $this->setNew(true);
  1285. $this->setDeleted(false);
  1286. }
  1287. /**
  1288. * Resets all collections of referencing foreign keys.
  1289. *
  1290. * This method is a user-space workaround for PHP's inability to garbage collect objects
  1291. * with circular references. This is currently necessary when using Propel in certain
  1292. * daemon or large-volumne/high-memory operations.
  1293. *
  1294. * @param boolean $deep Whether to also clear the references on all associated objects.
  1295. */
  1296. public function clearAllReferences($deep = false)
  1297. {
  1298. if ($deep) {
  1299. if ($this->collCcSchedules) {
  1300. foreach ((array) $this->collCcSchedules as $o) {
  1301. $o->clearAllReferences($deep);
  1302. }
  1303. }
  1304. } // if ($deep)
  1305. $this->collCcSchedules = null;
  1306. }
  1307. /**
  1308. * Catches calls to virtual methods
  1309. */
  1310. public function __call($name, $params)
  1311. {
  1312. if (preg_match('/get(\w+)/', $name, $matches)) {
  1313. $virtualColumn = $matches[1];
  1314. if ($this->hasVirtualColumn($virtualColumn)) {
  1315. return $this->getVirtualColumn($virtualColumn);
  1316. }
  1317. // no lcfirst in php<5.3...
  1318. $virtualColumn[0] = strtolower($virtualColumn[0]);
  1319. if ($this->hasVirtualColumn($virtualColumn)) {
  1320. return $this->getVirtualColumn($virtualColumn);
  1321. }
  1322. }
  1323. throw new PropelException('Call to undefined method: ' . $name);
  1324. }
  1325. } // BaseCcWebstream