BaseCcShow.php 57 KB

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