BaseCcShowDays.php 42 KB

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