diff --git a/application/configs/classmap-propel-config.php b/application/configs/classmap-propel-config.php index c3d70cb9d..f621cdf8b 100644 --- a/application/configs/classmap-propel-config.php +++ b/application/configs/classmap-propel-config.php @@ -50,6 +50,13 @@ return array ( 'BaseCcShowHostsPeer' => 'campcaster/om/BaseCcShowHostsPeer.php', 'BaseCcShowHosts' => 'campcaster/om/BaseCcShowHosts.php', 'BaseCcShowHostsQuery' => 'campcaster/om/BaseCcShowHostsQuery.php', + 'CcShowScheduleTableMap' => 'campcaster/map/CcShowScheduleTableMap.php', + 'CcShowSchedulePeer' => 'campcaster/CcShowSchedulePeer.php', + 'CcShowSchedule' => 'campcaster/CcShowSchedule.php', + 'CcShowScheduleQuery' => 'campcaster/CcShowScheduleQuery.php', + 'BaseCcShowSchedulePeer' => 'campcaster/om/BaseCcShowSchedulePeer.php', + 'BaseCcShowSchedule' => 'campcaster/om/BaseCcShowSchedule.php', + 'BaseCcShowScheduleQuery' => 'campcaster/om/BaseCcShowScheduleQuery.php', 'CcPlaylistTableMap' => 'campcaster/map/CcPlaylistTableMap.php', 'CcPlaylistPeer' => 'campcaster/CcPlaylistPeer.php', 'CcPlaylist' => 'campcaster/CcPlaylist.php', diff --git a/application/configs/navigation.php b/application/configs/navigation.php index 279287eff..c2990f357 100644 --- a/application/configs/navigation.php +++ b/application/configs/navigation.php @@ -23,6 +23,13 @@ $pages = array( 'action' => 'index', 'pages' => array( array( + 'label' => 'New', + 'module' => 'default', + 'controller' => 'Playlist', + 'action' => 'new', + 'visible' => false + ), + array( 'label' => 'Edit', 'module' => 'default', 'controller' => 'Playlist', diff --git a/application/configs/propel-config.php b/application/configs/propel-config.php index 768c5b151..22571384c 100644 --- a/application/configs/propel-config.php +++ b/application/configs/propel-config.php @@ -1,6 +1,6 @@ array ( diff --git a/application/controllers/ScheduleController.php b/application/controllers/ScheduleController.php index bb0c3dda7..97b4fd727 100644 --- a/application/controllers/ScheduleController.php +++ b/application/controllers/ScheduleController.php @@ -145,13 +145,11 @@ class ScheduleController extends Zend_Controller_Action $showId = $this->_getParam('showId'); $userInfo = Zend_Auth::getInstance()->getStorage()->read(); + $user = new User($userInfo->id, $userInfo->type); + $show = new Show($user, $showId); + $show->scheduleShow($start, $plId); - if($user->isHost($showId)) { - - $sched = new ScheduleGroup(); - $this->view->res = $sched->add($start, null, $plId); - } } else { $length = $this->_getParam('length'); diff --git a/application/models/Shows.php b/application/models/Shows.php index 7477ead70..0caf05ce6 100644 --- a/application/models/Shows.php +++ b/application/models/Shows.php @@ -3,10 +3,12 @@ class Show { private $_user; + private $_showId; - public function __construct($user=NULL) + public function __construct($user=NULL, $showId=NULL) { - $this->_user = $user; + $this->_user = $user; + $this->_showId = $showId; } //end dates are non inclusive. @@ -187,7 +189,27 @@ class Show { } + public function scheduleShow($start, $plId) { + if($this->_user->isHost($this->_showId)) { + + $sched = new ScheduleGroup(); + $groupId = $sched->add($start, null, $plId); + + $groupsched = new CcShowSchedule(); + $groupsched->setDbShowId($this->_showId); + $groupsched->setDbGroupId($groupId); + $groupsched->save(); + } + } + public function deleteShow($showId, $dayId=NULL) { + $groups = CcShowScheduleQuery::create()->filterByDbShowId($showId)->find(); + + foreach($groups as $group) { + $groupId = $group->getDbGroupId(); + CcScheduleQuery::create()->filterByDbGroupId($groupId)->delete(); + } + CcShowQuery::create()->filterByDbId($showId)->delete(); } @@ -258,55 +280,52 @@ class Show { foreach($res as $row) { - if(!is_null($start)) { + $timeDiff = "SELECT date '{$start}' - date '{$row["first_show"]}' as diff"; + $diff = $CC_DBC->GetOne($timeDiff); - $timeDiff = "SELECT date '{$start}' - date '{$row["first_show"]}' as diff"; - $diff = $CC_DBC->GetOne($timeDiff); + if($diff > 0) { - if($diff > 0) { + $add = ($diff % 7 === 0) ? $diff : $diff + (7 - $diff % 7); - $add = ($diff % 7 === 0) ? $diff : $diff + (7 - $diff % 7); + $new = "SELECT date '{$row["first_show"]}' + integer '{$add}'"; + $newDate = $CC_DBC->GetOne($new); + } + else { + $newDate = $row["first_show"]; + } - $new = "SELECT date '{$row["first_show"]}' + integer '{$add}'"; - $newDate = $CC_DBC->GetOne($new); - } - else { - $newDate = $row["first_show"]; + $shows[] = $this->makeFullCalendarEvent($row, $newDate); + + $end_epoch = strtotime($end); + + //add repeating events until the show end is reached or fullcalendar's end date is reached. + if($row["repeats"]) { + + if(!is_null($row["last_show"])) { + $show_end_epoch = strtotime($row["last_show"]); } - $shows[] = $this->makeFullCalendarEvent($row, $newDate); - - $end_epoch = strtotime($end); + while(true) { - //add repeating events until the show end is reached or fullcalendar's end date is reached. - if($row["repeats"]) { + $diff = "SELECT date '{$newDate}' + integer '7'"; + $repeatDate = $CC_DBC->GetOne($diff); + $repeat_epoch = strtotime($repeatDate); - if(!is_null($row["last_show"])) { - $show_end_epoch = strtotime($row["last_show"]); + //show has finite duration. + if (isset($show_end_epoch) && $repeat_epoch < $show_end_epoch && $repeat_epoch < $end_epoch) { + $shows[] = $this->makeFullCalendarEvent($row, $repeatDate); + } + //case for non-ending shows. + else if(!isset($show_end_epoch) && $repeat_epoch < $end_epoch) { + $shows[] = $this->makeFullCalendarEvent($row, $repeatDate); + } + else { + break; } - while(true) { - - $diff = "SELECT date '{$newDate}' + integer '7'"; - $repeatDate = $CC_DBC->GetOne($diff); - $repeat_epoch = strtotime($repeatDate); - - //show has finite duration. - if (isset($show_end_epoch) && $repeat_epoch < $show_end_epoch && $repeat_epoch < $end_epoch) { - $shows[] = $this->makeFullCalendarEvent($row, $repeatDate); - } - //case for non-ending shows. - else if(!isset($show_end_epoch) && $repeat_epoch < $end_epoch) { - $shows[] = $this->makeFullCalendarEvent($row, $repeatDate); - } - else { - break; - } - - $newDate = $repeatDate; - } - } - } + $newDate = $repeatDate; + } + } } return $shows; diff --git a/application/models/campcaster/CcShowSchedule.php b/application/models/campcaster/CcShowSchedule.php new file mode 100644 index 000000000..198afd766 --- /dev/null +++ b/application/models/campcaster/CcShowSchedule.php @@ -0,0 +1,18 @@ +setPackage('campcaster'); $this->setUseIdGenerator(false); // columns - $this->addPrimaryKey('ID', 'Id', 'BIGINT', true, null, null); - $this->addColumn('PLAYLIST_ID', 'PlaylistId', 'INTEGER', true, null, null); - $this->addColumn('STARTS', 'Starts', 'TIMESTAMP', true, null, null); - $this->addColumn('ENDS', 'Ends', 'TIMESTAMP', true, null, null); - $this->addColumn('GROUP_ID', 'GroupId', 'INTEGER', false, null, null); - $this->addColumn('FILE_ID', 'FileId', 'INTEGER', false, null, null); - $this->addColumn('CLIP_LENGTH', 'ClipLength', 'TIME', false, null, '00:00:00'); - $this->addColumn('FADE_IN', 'FadeIn', 'TIME', false, null, '00:00:00'); - $this->addColumn('FADE_OUT', 'FadeOut', 'TIME', false, null, '00:00:00'); - $this->addColumn('CUE_IN', 'CueIn', 'TIME', false, null, '00:00:00'); - $this->addColumn('CUE_OUT', 'CueOut', 'TIME', false, null, '00:00:00'); + $this->addPrimaryKey('ID', 'DbId', 'BIGINT', true, null, null); + $this->addColumn('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', true, null, null); + $this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null); + $this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null); + $this->addColumn('GROUP_ID', 'DbGroupId', 'INTEGER', false, null, null); + $this->addColumn('FILE_ID', 'DbFileId', 'INTEGER', false, null, null); + $this->addColumn('CLIP_LENGTH', 'DbClipLength', 'TIME', false, null, '00:00:00'); + $this->addColumn('FADE_IN', 'DbFadeIn', 'TIME', false, null, '00:00:00'); + $this->addColumn('FADE_OUT', 'DbFadeOut', 'TIME', false, null, '00:00:00'); + $this->addColumn('CUE_IN', 'DbCueIn', 'TIME', false, null, '00:00:00'); + $this->addColumn('CUE_OUT', 'DbCueOut', 'TIME', false, null, '00:00:00'); // validators } // initialize() diff --git a/application/models/campcaster/map/CcShowScheduleTableMap.php b/application/models/campcaster/map/CcShowScheduleTableMap.php new file mode 100644 index 000000000..3edc93611 --- /dev/null +++ b/application/models/campcaster/map/CcShowScheduleTableMap.php @@ -0,0 +1,55 @@ +setName('cc_show_schedule'); + $this->setPhpName('CcShowSchedule'); + $this->setClassname('CcShowSchedule'); + $this->setPackage('campcaster'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('cc_show_schedule_id_seq'); + // columns + $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); + $this->addForeignKey('SHOW_ID', 'DbShowId', 'INTEGER', 'cc_show', 'ID', true, null, null); + $this->addColumn('GROUP_ID', 'DbGroupId', 'INTEGER', true, null, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('CcShow', 'CcShow', RelationMap::MANY_TO_ONE, array('show_id' => 'id', ), 'CASCADE', null); + } // buildRelations() + +} // CcShowScheduleTableMap diff --git a/application/models/campcaster/map/CcShowTableMap.php b/application/models/campcaster/map/CcShowTableMap.php index a71706a9b..ebfb0d82e 100644 --- a/application/models/campcaster/map/CcShowTableMap.php +++ b/application/models/campcaster/map/CcShowTableMap.php @@ -52,6 +52,7 @@ class CcShowTableMap extends TableMap { { $this->addRelation('CcShowDays', 'CcShowDays', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null); $this->addRelation('CcShowHosts', 'CcShowHosts', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null); + $this->addRelation('CcShowSchedule', 'CcShowSchedule', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null); } // buildRelations() } // CcShowTableMap diff --git a/application/models/campcaster/om/BaseCcSchedule.php b/application/models/campcaster/om/BaseCcSchedule.php index 39bad3761..3358377b2 100644 --- a/application/models/campcaster/om/BaseCcSchedule.php +++ b/application/models/campcaster/om/BaseCcSchedule.php @@ -139,7 +139,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * * @return string */ - public function getId() + public function getDbId() { return $this->id; } @@ -149,7 +149,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * * @return int */ - public function getPlaylistId() + public function getDbPlaylistId() { return $this->playlist_id; } @@ -163,7 +163,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL * @throws PropelException - if unable to parse/validate the date/time value. */ - public function getStarts($format = 'Y-m-d H:i:s') + public function getDbStarts($format = 'Y-m-d H:i:s') { if ($this->starts === null) { return null; @@ -196,7 +196,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL * @throws PropelException - if unable to parse/validate the date/time value. */ - public function getEnds($format = 'Y-m-d H:i:s') + public function getDbEnds($format = 'Y-m-d H:i:s') { if ($this->ends === null) { return null; @@ -225,7 +225,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * * @return int */ - public function getGroupId() + public function getDbGroupId() { return $this->group_id; } @@ -235,7 +235,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * * @return int */ - public function getFileId() + public function getDbFileId() { return $this->file_id; } @@ -249,7 +249,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL * @throws PropelException - if unable to parse/validate the date/time value. */ - public function getClipLength($format = '%X') + public function getDbClipLength($format = '%X') { if ($this->clip_length === null) { return null; @@ -282,7 +282,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL * @throws PropelException - if unable to parse/validate the date/time value. */ - public function getFadeIn($format = '%X') + public function getDbFadeIn($format = '%X') { if ($this->fade_in === null) { return null; @@ -315,7 +315,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL * @throws PropelException - if unable to parse/validate the date/time value. */ - public function getFadeOut($format = '%X') + public function getDbFadeOut($format = '%X') { if ($this->fade_out === null) { return null; @@ -348,7 +348,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL * @throws PropelException - if unable to parse/validate the date/time value. */ - public function getCueIn($format = '%X') + public function getDbCueIn($format = '%X') { if ($this->cue_in === null) { return null; @@ -381,7 +381,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL * @throws PropelException - if unable to parse/validate the date/time value. */ - public function getCueOut($format = '%X') + public function getDbCueOut($format = '%X') { if ($this->cue_out === null) { return null; @@ -411,7 +411,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * @param string $v new value * @return CcSchedule The current object (for fluent API support) */ - public function setId($v) + public function setDbId($v) { if ($v !== null) { $v = (string) $v; @@ -423,7 +423,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent } return $this; - } // setId() + } // setDbId() /** * Set the value of [playlist_id] column. @@ -431,7 +431,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * @param int $v new value * @return CcSchedule The current object (for fluent API support) */ - public function setPlaylistId($v) + public function setDbPlaylistId($v) { if ($v !== null) { $v = (int) $v; @@ -443,7 +443,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent } return $this; - } // setPlaylistId() + } // setDbPlaylistId() /** * Sets the value of [starts] column to a normalized version of the date/time value specified. @@ -452,7 +452,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * be treated as NULL for temporal objects. * @return CcSchedule The current object (for fluent API support) */ - public function setStarts($v) + public function setDbStarts($v) { // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') // -- which is unexpected, to say the least. @@ -492,7 +492,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent } // if either are not null return $this; - } // setStarts() + } // setDbStarts() /** * Sets the value of [ends] column to a normalized version of the date/time value specified. @@ -501,7 +501,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * be treated as NULL for temporal objects. * @return CcSchedule The current object (for fluent API support) */ - public function setEnds($v) + public function setDbEnds($v) { // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') // -- which is unexpected, to say the least. @@ -541,7 +541,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent } // if either are not null return $this; - } // setEnds() + } // setDbEnds() /** * Set the value of [group_id] column. @@ -549,7 +549,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * @param int $v new value * @return CcSchedule The current object (for fluent API support) */ - public function setGroupId($v) + public function setDbGroupId($v) { if ($v !== null) { $v = (int) $v; @@ -561,7 +561,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent } return $this; - } // setGroupId() + } // setDbGroupId() /** * Set the value of [file_id] column. @@ -569,7 +569,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * @param int $v new value * @return CcSchedule The current object (for fluent API support) */ - public function setFileId($v) + public function setDbFileId($v) { if ($v !== null) { $v = (int) $v; @@ -581,7 +581,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent } return $this; - } // setFileId() + } // setDbFileId() /** * Sets the value of [clip_length] column to a normalized version of the date/time value specified. @@ -590,7 +590,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * be treated as NULL for temporal objects. * @return CcSchedule The current object (for fluent API support) */ - public function setClipLength($v) + public function setDbClipLength($v) { // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') // -- which is unexpected, to say the least. @@ -631,7 +631,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent } // if either are not null return $this; - } // setClipLength() + } // setDbClipLength() /** * Sets the value of [fade_in] column to a normalized version of the date/time value specified. @@ -640,7 +640,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * be treated as NULL for temporal objects. * @return CcSchedule The current object (for fluent API support) */ - public function setFadeIn($v) + public function setDbFadeIn($v) { // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') // -- which is unexpected, to say the least. @@ -681,7 +681,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent } // if either are not null return $this; - } // setFadeIn() + } // setDbFadeIn() /** * Sets the value of [fade_out] column to a normalized version of the date/time value specified. @@ -690,7 +690,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * be treated as NULL for temporal objects. * @return CcSchedule The current object (for fluent API support) */ - public function setFadeOut($v) + public function setDbFadeOut($v) { // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') // -- which is unexpected, to say the least. @@ -731,7 +731,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent } // if either are not null return $this; - } // setFadeOut() + } // setDbFadeOut() /** * Sets the value of [cue_in] column to a normalized version of the date/time value specified. @@ -740,7 +740,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * be treated as NULL for temporal objects. * @return CcSchedule The current object (for fluent API support) */ - public function setCueIn($v) + public function setDbCueIn($v) { // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') // -- which is unexpected, to say the least. @@ -781,7 +781,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent } // if either are not null return $this; - } // setCueIn() + } // setDbCueIn() /** * Sets the value of [cue_out] column to a normalized version of the date/time value specified. @@ -790,7 +790,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent * be treated as NULL for temporal objects. * @return CcSchedule The current object (for fluent API support) */ - public function setCueOut($v) + public function setDbCueOut($v) { // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') // -- which is unexpected, to say the least. @@ -831,7 +831,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent } // if either are not null return $this; - } // setCueOut() + } // setDbCueOut() /** * Indicates whether the columns in this object are only set to default values. @@ -1196,37 +1196,37 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent { switch($pos) { case 0: - return $this->getId(); + return $this->getDbId(); break; case 1: - return $this->getPlaylistId(); + return $this->getDbPlaylistId(); break; case 2: - return $this->getStarts(); + return $this->getDbStarts(); break; case 3: - return $this->getEnds(); + return $this->getDbEnds(); break; case 4: - return $this->getGroupId(); + return $this->getDbGroupId(); break; case 5: - return $this->getFileId(); + return $this->getDbFileId(); break; case 6: - return $this->getClipLength(); + return $this->getDbClipLength(); break; case 7: - return $this->getFadeIn(); + return $this->getDbFadeIn(); break; case 8: - return $this->getFadeOut(); + return $this->getDbFadeOut(); break; case 9: - return $this->getCueIn(); + return $this->getDbCueIn(); break; case 10: - return $this->getCueOut(); + return $this->getDbCueOut(); break; default: return null; @@ -1251,17 +1251,17 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent { $keys = CcSchedulePeer::getFieldNames($keyType); $result = array( - $keys[0] => $this->getId(), - $keys[1] => $this->getPlaylistId(), - $keys[2] => $this->getStarts(), - $keys[3] => $this->getEnds(), - $keys[4] => $this->getGroupId(), - $keys[5] => $this->getFileId(), - $keys[6] => $this->getClipLength(), - $keys[7] => $this->getFadeIn(), - $keys[8] => $this->getFadeOut(), - $keys[9] => $this->getCueIn(), - $keys[10] => $this->getCueOut(), + $keys[0] => $this->getDbId(), + $keys[1] => $this->getDbPlaylistId(), + $keys[2] => $this->getDbStarts(), + $keys[3] => $this->getDbEnds(), + $keys[4] => $this->getDbGroupId(), + $keys[5] => $this->getDbFileId(), + $keys[6] => $this->getDbClipLength(), + $keys[7] => $this->getDbFadeIn(), + $keys[8] => $this->getDbFadeOut(), + $keys[9] => $this->getDbCueIn(), + $keys[10] => $this->getDbCueOut(), ); return $result; } @@ -1294,37 +1294,37 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent { switch($pos) { case 0: - $this->setId($value); + $this->setDbId($value); break; case 1: - $this->setPlaylistId($value); + $this->setDbPlaylistId($value); break; case 2: - $this->setStarts($value); + $this->setDbStarts($value); break; case 3: - $this->setEnds($value); + $this->setDbEnds($value); break; case 4: - $this->setGroupId($value); + $this->setDbGroupId($value); break; case 5: - $this->setFileId($value); + $this->setDbFileId($value); break; case 6: - $this->setClipLength($value); + $this->setDbClipLength($value); break; case 7: - $this->setFadeIn($value); + $this->setDbFadeIn($value); break; case 8: - $this->setFadeOut($value); + $this->setDbFadeOut($value); break; case 9: - $this->setCueIn($value); + $this->setDbCueIn($value); break; case 10: - $this->setCueOut($value); + $this->setDbCueOut($value); break; } // switch() } @@ -1350,17 +1350,17 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent { $keys = CcSchedulePeer::getFieldNames($keyType); - if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); - if (array_key_exists($keys[1], $arr)) $this->setPlaylistId($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setStarts($arr[$keys[2]]); - if (array_key_exists($keys[3], $arr)) $this->setEnds($arr[$keys[3]]); - if (array_key_exists($keys[4], $arr)) $this->setGroupId($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setFileId($arr[$keys[5]]); - if (array_key_exists($keys[6], $arr)) $this->setClipLength($arr[$keys[6]]); - if (array_key_exists($keys[7], $arr)) $this->setFadeIn($arr[$keys[7]]); - if (array_key_exists($keys[8], $arr)) $this->setFadeOut($arr[$keys[8]]); - if (array_key_exists($keys[9], $arr)) $this->setCueIn($arr[$keys[9]]); - if (array_key_exists($keys[10], $arr)) $this->setCueOut($arr[$keys[10]]); + if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbPlaylistId($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDbStarts($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDbEnds($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setDbGroupId($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setDbFileId($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setDbClipLength($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setDbFadeIn($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setDbFadeOut($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setDbCueIn($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setDbCueOut($arr[$keys[10]]); } /** @@ -1409,7 +1409,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent */ public function getPrimaryKey() { - return $this->getId(); + return $this->getDbId(); } /** @@ -1420,7 +1420,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent */ public function setPrimaryKey($key) { - $this->setId($key); + $this->setDbId($key); } /** @@ -1429,7 +1429,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent */ public function isPrimaryKeyNull() { - return null === $this->getId(); + return null === $this->getDbId(); } /** @@ -1444,17 +1444,17 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent */ public function copyInto($copyObj, $deepCopy = false) { - $copyObj->setId($this->id); - $copyObj->setPlaylistId($this->playlist_id); - $copyObj->setStarts($this->starts); - $copyObj->setEnds($this->ends); - $copyObj->setGroupId($this->group_id); - $copyObj->setFileId($this->file_id); - $copyObj->setClipLength($this->clip_length); - $copyObj->setFadeIn($this->fade_in); - $copyObj->setFadeOut($this->fade_out); - $copyObj->setCueIn($this->cue_in); - $copyObj->setCueOut($this->cue_out); + $copyObj->setDbId($this->id); + $copyObj->setDbPlaylistId($this->playlist_id); + $copyObj->setDbStarts($this->starts); + $copyObj->setDbEnds($this->ends); + $copyObj->setDbGroupId($this->group_id); + $copyObj->setDbFileId($this->file_id); + $copyObj->setDbClipLength($this->clip_length); + $copyObj->setDbFadeIn($this->fade_in); + $copyObj->setDbFadeOut($this->fade_out); + $copyObj->setDbCueIn($this->cue_in); + $copyObj->setDbCueOut($this->cue_out); $copyObj->setNew(true); } diff --git a/application/models/campcaster/om/BaseCcSchedulePeer.php b/application/models/campcaster/om/BaseCcSchedulePeer.php index c62a304c7..9ade88000 100644 --- a/application/models/campcaster/om/BaseCcSchedulePeer.php +++ b/application/models/campcaster/om/BaseCcSchedulePeer.php @@ -80,8 +80,8 @@ abstract class BaseCcSchedulePeer { * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('Id', 'PlaylistId', 'Starts', 'Ends', 'GroupId', 'FileId', 'ClipLength', 'FadeIn', 'FadeOut', 'CueIn', 'CueOut', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'playlistId', 'starts', 'ends', 'groupId', 'fileId', 'clipLength', 'fadeIn', 'fadeOut', 'cueIn', 'cueOut', ), + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbPlaylistId', 'DbStarts', 'DbEnds', 'DbGroupId', 'DbFileId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbStarts', 'dbEnds', 'dbGroupId', 'dbFileId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', ), BasePeer::TYPE_COLNAME => array (self::ID, self::PLAYLIST_ID, self::STARTS, self::ENDS, self::GROUP_ID, self::FILE_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, ), BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'STARTS', 'ENDS', 'GROUP_ID', 'FILE_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', ), BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'starts', 'ends', 'group_id', 'file_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', ), @@ -95,8 +95,8 @@ abstract class BaseCcSchedulePeer { * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'PlaylistId' => 1, 'Starts' => 2, 'Ends' => 3, 'GroupId' => 4, 'FileId' => 5, 'ClipLength' => 6, 'FadeIn' => 7, 'FadeOut' => 8, 'CueIn' => 9, 'CueOut' => 10, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'playlistId' => 1, 'starts' => 2, 'ends' => 3, 'groupId' => 4, 'fileId' => 5, 'clipLength' => 6, 'fadeIn' => 7, 'fadeOut' => 8, 'cueIn' => 9, 'cueOut' => 10, ), + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbPlaylistId' => 1, 'DbStarts' => 2, 'DbEnds' => 3, 'DbGroupId' => 4, 'DbFileId' => 5, 'DbClipLength' => 6, 'DbFadeIn' => 7, 'DbFadeOut' => 8, 'DbCueIn' => 9, 'DbCueOut' => 10, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbStarts' => 2, 'dbEnds' => 3, 'dbGroupId' => 4, 'dbFileId' => 5, 'dbClipLength' => 6, 'dbFadeIn' => 7, 'dbFadeOut' => 8, 'dbCueIn' => 9, 'dbCueOut' => 10, ), BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PLAYLIST_ID => 1, self::STARTS => 2, self::ENDS => 3, self::GROUP_ID => 4, self::FILE_ID => 5, self::CLIP_LENGTH => 6, self::FADE_IN => 7, self::FADE_OUT => 8, self::CUE_IN => 9, self::CUE_OUT => 10, ), BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'STARTS' => 2, 'ENDS' => 3, 'GROUP_ID' => 4, 'FILE_ID' => 5, 'CLIP_LENGTH' => 6, 'FADE_IN' => 7, 'FADE_OUT' => 8, 'CUE_IN' => 9, 'CUE_OUT' => 10, ), BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'starts' => 2, 'ends' => 3, 'group_id' => 4, 'file_id' => 5, 'clip_length' => 6, 'fade_in' => 7, 'fade_out' => 8, 'cue_in' => 9, 'cue_out' => 10, ), @@ -319,7 +319,7 @@ abstract class BaseCcSchedulePeer { { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { - $key = (string) $obj->getId(); + $key = (string) $obj->getDbId(); } // if key === null self::$instances[$key] = $obj; } @@ -339,7 +339,7 @@ abstract class BaseCcSchedulePeer { { if (Propel::isInstancePoolingEnabled() && $value !== null) { if (is_object($value) && $value instanceof CcSchedule) { - $key = (string) $value->getId(); + $key = (string) $value->getDbId(); } elseif (is_scalar($value)) { // assume we've been passed a primary key $key = (string) $value; diff --git a/application/models/campcaster/om/BaseCcScheduleQuery.php b/application/models/campcaster/om/BaseCcScheduleQuery.php index 22435bf77..710015081 100644 --- a/application/models/campcaster/om/BaseCcScheduleQuery.php +++ b/application/models/campcaster/om/BaseCcScheduleQuery.php @@ -6,29 +6,29 @@ * * * - * @method CcScheduleQuery orderById($order = Criteria::ASC) Order by the id column - * @method CcScheduleQuery orderByPlaylistId($order = Criteria::ASC) Order by the playlist_id column - * @method CcScheduleQuery orderByStarts($order = Criteria::ASC) Order by the starts column - * @method CcScheduleQuery orderByEnds($order = Criteria::ASC) Order by the ends column - * @method CcScheduleQuery orderByGroupId($order = Criteria::ASC) Order by the group_id column - * @method CcScheduleQuery orderByFileId($order = Criteria::ASC) Order by the file_id column - * @method CcScheduleQuery orderByClipLength($order = Criteria::ASC) Order by the clip_length column - * @method CcScheduleQuery orderByFadeIn($order = Criteria::ASC) Order by the fade_in column - * @method CcScheduleQuery orderByFadeOut($order = Criteria::ASC) Order by the fade_out column - * @method CcScheduleQuery orderByCueIn($order = Criteria::ASC) Order by the cue_in column - * @method CcScheduleQuery orderByCueOut($order = Criteria::ASC) Order by the cue_out column + * @method CcScheduleQuery orderByDbId($order = Criteria::ASC) Order by the id column + * @method CcScheduleQuery orderByDbPlaylistId($order = Criteria::ASC) Order by the playlist_id column + * @method CcScheduleQuery orderByDbStarts($order = Criteria::ASC) Order by the starts column + * @method CcScheduleQuery orderByDbEnds($order = Criteria::ASC) Order by the ends column + * @method CcScheduleQuery orderByDbGroupId($order = Criteria::ASC) Order by the group_id column + * @method CcScheduleQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column + * @method CcScheduleQuery orderByDbClipLength($order = Criteria::ASC) Order by the clip_length column + * @method CcScheduleQuery orderByDbFadeIn($order = Criteria::ASC) Order by the fade_in column + * @method CcScheduleQuery orderByDbFadeOut($order = Criteria::ASC) Order by the fade_out column + * @method CcScheduleQuery orderByDbCueIn($order = Criteria::ASC) Order by the cue_in column + * @method CcScheduleQuery orderByDbCueOut($order = Criteria::ASC) Order by the cue_out column * - * @method CcScheduleQuery groupById() Group by the id column - * @method CcScheduleQuery groupByPlaylistId() Group by the playlist_id column - * @method CcScheduleQuery groupByStarts() Group by the starts column - * @method CcScheduleQuery groupByEnds() Group by the ends column - * @method CcScheduleQuery groupByGroupId() Group by the group_id column - * @method CcScheduleQuery groupByFileId() Group by the file_id column - * @method CcScheduleQuery groupByClipLength() Group by the clip_length column - * @method CcScheduleQuery groupByFadeIn() Group by the fade_in column - * @method CcScheduleQuery groupByFadeOut() Group by the fade_out column - * @method CcScheduleQuery groupByCueIn() Group by the cue_in column - * @method CcScheduleQuery groupByCueOut() Group by the cue_out column + * @method CcScheduleQuery groupByDbId() Group by the id column + * @method CcScheduleQuery groupByDbPlaylistId() Group by the playlist_id column + * @method CcScheduleQuery groupByDbStarts() Group by the starts column + * @method CcScheduleQuery groupByDbEnds() Group by the ends column + * @method CcScheduleQuery groupByDbGroupId() Group by the group_id column + * @method CcScheduleQuery groupByDbFileId() Group by the file_id column + * @method CcScheduleQuery groupByDbClipLength() Group by the clip_length column + * @method CcScheduleQuery groupByDbFadeIn() Group by the fade_in column + * @method CcScheduleQuery groupByDbFadeOut() Group by the fade_out column + * @method CcScheduleQuery groupByDbCueIn() Group by the cue_in column + * @method CcScheduleQuery groupByDbCueOut() Group by the cue_out column * * @method CcScheduleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method CcScheduleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query @@ -37,29 +37,29 @@ * @method CcSchedule findOne(PropelPDO $con = null) Return the first CcSchedule matching the query * @method CcSchedule findOneOrCreate(PropelPDO $con = null) Return the first CcSchedule matching the query, or a new CcSchedule object populated from the query conditions when no match is found * - * @method CcSchedule findOneById(string $id) Return the first CcSchedule filtered by the id column - * @method CcSchedule findOneByPlaylistId(int $playlist_id) Return the first CcSchedule filtered by the playlist_id column - * @method CcSchedule findOneByStarts(string $starts) Return the first CcSchedule filtered by the starts column - * @method CcSchedule findOneByEnds(string $ends) Return the first CcSchedule filtered by the ends column - * @method CcSchedule findOneByGroupId(int $group_id) Return the first CcSchedule filtered by the group_id column - * @method CcSchedule findOneByFileId(int $file_id) Return the first CcSchedule filtered by the file_id column - * @method CcSchedule findOneByClipLength(string $clip_length) Return the first CcSchedule filtered by the clip_length column - * @method CcSchedule findOneByFadeIn(string $fade_in) Return the first CcSchedule filtered by the fade_in column - * @method CcSchedule findOneByFadeOut(string $fade_out) Return the first CcSchedule filtered by the fade_out column - * @method CcSchedule findOneByCueIn(string $cue_in) Return the first CcSchedule filtered by the cue_in column - * @method CcSchedule findOneByCueOut(string $cue_out) Return the first CcSchedule filtered by the cue_out column + * @method CcSchedule findOneByDbId(string $id) Return the first CcSchedule filtered by the id column + * @method CcSchedule findOneByDbPlaylistId(int $playlist_id) Return the first CcSchedule filtered by the playlist_id column + * @method CcSchedule findOneByDbStarts(string $starts) Return the first CcSchedule filtered by the starts column + * @method CcSchedule findOneByDbEnds(string $ends) Return the first CcSchedule filtered by the ends column + * @method CcSchedule findOneByDbGroupId(int $group_id) Return the first CcSchedule filtered by the group_id column + * @method CcSchedule findOneByDbFileId(int $file_id) Return the first CcSchedule filtered by the file_id column + * @method CcSchedule findOneByDbClipLength(string $clip_length) Return the first CcSchedule filtered by the clip_length column + * @method CcSchedule findOneByDbFadeIn(string $fade_in) Return the first CcSchedule filtered by the fade_in column + * @method CcSchedule findOneByDbFadeOut(string $fade_out) Return the first CcSchedule filtered by the fade_out column + * @method CcSchedule findOneByDbCueIn(string $cue_in) Return the first CcSchedule filtered by the cue_in column + * @method CcSchedule findOneByDbCueOut(string $cue_out) Return the first CcSchedule filtered by the cue_out column * - * @method array findById(string $id) Return CcSchedule objects filtered by the id column - * @method array findByPlaylistId(int $playlist_id) Return CcSchedule objects filtered by the playlist_id column - * @method array findByStarts(string $starts) Return CcSchedule objects filtered by the starts column - * @method array findByEnds(string $ends) Return CcSchedule objects filtered by the ends column - * @method array findByGroupId(int $group_id) Return CcSchedule objects filtered by the group_id column - * @method array findByFileId(int $file_id) Return CcSchedule objects filtered by the file_id column - * @method array findByClipLength(string $clip_length) Return CcSchedule objects filtered by the clip_length column - * @method array findByFadeIn(string $fade_in) Return CcSchedule objects filtered by the fade_in column - * @method array findByFadeOut(string $fade_out) Return CcSchedule objects filtered by the fade_out column - * @method array findByCueIn(string $cue_in) Return CcSchedule objects filtered by the cue_in column - * @method array findByCueOut(string $cue_out) Return CcSchedule objects filtered by the cue_out column + * @method array findByDbId(string $id) Return CcSchedule objects filtered by the id column + * @method array findByDbPlaylistId(int $playlist_id) Return CcSchedule objects filtered by the playlist_id column + * @method array findByDbStarts(string $starts) Return CcSchedule objects filtered by the starts column + * @method array findByDbEnds(string $ends) Return CcSchedule objects filtered by the ends column + * @method array findByDbGroupId(int $group_id) Return CcSchedule objects filtered by the group_id column + * @method array findByDbFileId(int $file_id) Return CcSchedule objects filtered by the file_id column + * @method array findByDbClipLength(string $clip_length) Return CcSchedule objects filtered by the clip_length column + * @method array findByDbFadeIn(string $fade_in) Return CcSchedule objects filtered by the fade_in column + * @method array findByDbFadeOut(string $fade_out) Return CcSchedule objects filtered by the fade_out column + * @method array findByDbCueIn(string $cue_in) Return CcSchedule objects filtered by the cue_in column + * @method array findByDbCueOut(string $cue_out) Return CcSchedule objects filtered by the cue_out column * * @package propel.generator.campcaster.om */ @@ -172,39 +172,39 @@ abstract class BaseCcScheduleQuery extends ModelCriteria /** * Filter the query on the id column * - * @param string|array $id The value to use as filter. + * @param string|array $dbId The value to use as filter. * Accepts an associative array('min' => $minValue, 'max' => $maxValue) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return CcScheduleQuery The current query, for fluid interface */ - public function filterById($id = null, $comparison = null) + public function filterByDbId($dbId = null, $comparison = null) { - if (is_array($id) && null === $comparison) { + if (is_array($dbId) && null === $comparison) { $comparison = Criteria::IN; } - return $this->addUsingAlias(CcSchedulePeer::ID, $id, $comparison); + return $this->addUsingAlias(CcSchedulePeer::ID, $dbId, $comparison); } /** * Filter the query on the playlist_id column * - * @param int|array $playlistId The value to use as filter. + * @param int|array $dbPlaylistId The value to use as filter. * Accepts an associative array('min' => $minValue, 'max' => $maxValue) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return CcScheduleQuery The current query, for fluid interface */ - public function filterByPlaylistId($playlistId = null, $comparison = null) + public function filterByDbPlaylistId($dbPlaylistId = null, $comparison = null) { - if (is_array($playlistId)) { + if (is_array($dbPlaylistId)) { $useMinMax = false; - if (isset($playlistId['min'])) { - $this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $playlistId['min'], Criteria::GREATER_EQUAL); + if (isset($dbPlaylistId['min'])) { + $this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $dbPlaylistId['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($playlistId['max'])) { - $this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $playlistId['max'], Criteria::LESS_EQUAL); + if (isset($dbPlaylistId['max'])) { + $this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $dbPlaylistId['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -214,28 +214,28 @@ abstract class BaseCcScheduleQuery extends ModelCriteria $comparison = Criteria::IN; } } - return $this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $playlistId, $comparison); + return $this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $dbPlaylistId, $comparison); } /** * Filter the query on the starts column * - * @param string|array $starts The value to use as filter. + * @param string|array $dbStarts The value to use as filter. * Accepts an associative array('min' => $minValue, 'max' => $maxValue) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return CcScheduleQuery The current query, for fluid interface */ - public function filterByStarts($starts = null, $comparison = null) + public function filterByDbStarts($dbStarts = null, $comparison = null) { - if (is_array($starts)) { + if (is_array($dbStarts)) { $useMinMax = false; - if (isset($starts['min'])) { - $this->addUsingAlias(CcSchedulePeer::STARTS, $starts['min'], Criteria::GREATER_EQUAL); + if (isset($dbStarts['min'])) { + $this->addUsingAlias(CcSchedulePeer::STARTS, $dbStarts['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($starts['max'])) { - $this->addUsingAlias(CcSchedulePeer::STARTS, $starts['max'], Criteria::LESS_EQUAL); + if (isset($dbStarts['max'])) { + $this->addUsingAlias(CcSchedulePeer::STARTS, $dbStarts['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -245,28 +245,28 @@ abstract class BaseCcScheduleQuery extends ModelCriteria $comparison = Criteria::IN; } } - return $this->addUsingAlias(CcSchedulePeer::STARTS, $starts, $comparison); + return $this->addUsingAlias(CcSchedulePeer::STARTS, $dbStarts, $comparison); } /** * Filter the query on the ends column * - * @param string|array $ends The value to use as filter. + * @param string|array $dbEnds The value to use as filter. * Accepts an associative array('min' => $minValue, 'max' => $maxValue) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return CcScheduleQuery The current query, for fluid interface */ - public function filterByEnds($ends = null, $comparison = null) + public function filterByDbEnds($dbEnds = null, $comparison = null) { - if (is_array($ends)) { + if (is_array($dbEnds)) { $useMinMax = false; - if (isset($ends['min'])) { - $this->addUsingAlias(CcSchedulePeer::ENDS, $ends['min'], Criteria::GREATER_EQUAL); + if (isset($dbEnds['min'])) { + $this->addUsingAlias(CcSchedulePeer::ENDS, $dbEnds['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($ends['max'])) { - $this->addUsingAlias(CcSchedulePeer::ENDS, $ends['max'], Criteria::LESS_EQUAL); + if (isset($dbEnds['max'])) { + $this->addUsingAlias(CcSchedulePeer::ENDS, $dbEnds['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -276,28 +276,28 @@ abstract class BaseCcScheduleQuery extends ModelCriteria $comparison = Criteria::IN; } } - return $this->addUsingAlias(CcSchedulePeer::ENDS, $ends, $comparison); + return $this->addUsingAlias(CcSchedulePeer::ENDS, $dbEnds, $comparison); } /** * Filter the query on the group_id column * - * @param int|array $groupId The value to use as filter. + * @param int|array $dbGroupId The value to use as filter. * Accepts an associative array('min' => $minValue, 'max' => $maxValue) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return CcScheduleQuery The current query, for fluid interface */ - public function filterByGroupId($groupId = null, $comparison = null) + public function filterByDbGroupId($dbGroupId = null, $comparison = null) { - if (is_array($groupId)) { + if (is_array($dbGroupId)) { $useMinMax = false; - if (isset($groupId['min'])) { - $this->addUsingAlias(CcSchedulePeer::GROUP_ID, $groupId['min'], Criteria::GREATER_EQUAL); + if (isset($dbGroupId['min'])) { + $this->addUsingAlias(CcSchedulePeer::GROUP_ID, $dbGroupId['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($groupId['max'])) { - $this->addUsingAlias(CcSchedulePeer::GROUP_ID, $groupId['max'], Criteria::LESS_EQUAL); + if (isset($dbGroupId['max'])) { + $this->addUsingAlias(CcSchedulePeer::GROUP_ID, $dbGroupId['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -307,28 +307,28 @@ abstract class BaseCcScheduleQuery extends ModelCriteria $comparison = Criteria::IN; } } - return $this->addUsingAlias(CcSchedulePeer::GROUP_ID, $groupId, $comparison); + return $this->addUsingAlias(CcSchedulePeer::GROUP_ID, $dbGroupId, $comparison); } /** * Filter the query on the file_id column * - * @param int|array $fileId The value to use as filter. + * @param int|array $dbFileId The value to use as filter. * Accepts an associative array('min' => $minValue, 'max' => $maxValue) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return CcScheduleQuery The current query, for fluid interface */ - public function filterByFileId($fileId = null, $comparison = null) + public function filterByDbFileId($dbFileId = null, $comparison = null) { - if (is_array($fileId)) { + if (is_array($dbFileId)) { $useMinMax = false; - if (isset($fileId['min'])) { - $this->addUsingAlias(CcSchedulePeer::FILE_ID, $fileId['min'], Criteria::GREATER_EQUAL); + if (isset($dbFileId['min'])) { + $this->addUsingAlias(CcSchedulePeer::FILE_ID, $dbFileId['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($fileId['max'])) { - $this->addUsingAlias(CcSchedulePeer::FILE_ID, $fileId['max'], Criteria::LESS_EQUAL); + if (isset($dbFileId['max'])) { + $this->addUsingAlias(CcSchedulePeer::FILE_ID, $dbFileId['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -338,28 +338,28 @@ abstract class BaseCcScheduleQuery extends ModelCriteria $comparison = Criteria::IN; } } - return $this->addUsingAlias(CcSchedulePeer::FILE_ID, $fileId, $comparison); + return $this->addUsingAlias(CcSchedulePeer::FILE_ID, $dbFileId, $comparison); } /** * Filter the query on the clip_length column * - * @param string|array $clipLength The value to use as filter. + * @param string|array $dbClipLength The value to use as filter. * Accepts an associative array('min' => $minValue, 'max' => $maxValue) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return CcScheduleQuery The current query, for fluid interface */ - public function filterByClipLength($clipLength = null, $comparison = null) + public function filterByDbClipLength($dbClipLength = null, $comparison = null) { - if (is_array($clipLength)) { + if (is_array($dbClipLength)) { $useMinMax = false; - if (isset($clipLength['min'])) { - $this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $clipLength['min'], Criteria::GREATER_EQUAL); + if (isset($dbClipLength['min'])) { + $this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $dbClipLength['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($clipLength['max'])) { - $this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $clipLength['max'], Criteria::LESS_EQUAL); + if (isset($dbClipLength['max'])) { + $this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $dbClipLength['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -369,28 +369,28 @@ abstract class BaseCcScheduleQuery extends ModelCriteria $comparison = Criteria::IN; } } - return $this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $clipLength, $comparison); + return $this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $dbClipLength, $comparison); } /** * Filter the query on the fade_in column * - * @param string|array $fadeIn The value to use as filter. + * @param string|array $dbFadeIn The value to use as filter. * Accepts an associative array('min' => $minValue, 'max' => $maxValue) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return CcScheduleQuery The current query, for fluid interface */ - public function filterByFadeIn($fadeIn = null, $comparison = null) + public function filterByDbFadeIn($dbFadeIn = null, $comparison = null) { - if (is_array($fadeIn)) { + if (is_array($dbFadeIn)) { $useMinMax = false; - if (isset($fadeIn['min'])) { - $this->addUsingAlias(CcSchedulePeer::FADE_IN, $fadeIn['min'], Criteria::GREATER_EQUAL); + if (isset($dbFadeIn['min'])) { + $this->addUsingAlias(CcSchedulePeer::FADE_IN, $dbFadeIn['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($fadeIn['max'])) { - $this->addUsingAlias(CcSchedulePeer::FADE_IN, $fadeIn['max'], Criteria::LESS_EQUAL); + if (isset($dbFadeIn['max'])) { + $this->addUsingAlias(CcSchedulePeer::FADE_IN, $dbFadeIn['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -400,28 +400,28 @@ abstract class BaseCcScheduleQuery extends ModelCriteria $comparison = Criteria::IN; } } - return $this->addUsingAlias(CcSchedulePeer::FADE_IN, $fadeIn, $comparison); + return $this->addUsingAlias(CcSchedulePeer::FADE_IN, $dbFadeIn, $comparison); } /** * Filter the query on the fade_out column * - * @param string|array $fadeOut The value to use as filter. + * @param string|array $dbFadeOut The value to use as filter. * Accepts an associative array('min' => $minValue, 'max' => $maxValue) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return CcScheduleQuery The current query, for fluid interface */ - public function filterByFadeOut($fadeOut = null, $comparison = null) + public function filterByDbFadeOut($dbFadeOut = null, $comparison = null) { - if (is_array($fadeOut)) { + if (is_array($dbFadeOut)) { $useMinMax = false; - if (isset($fadeOut['min'])) { - $this->addUsingAlias(CcSchedulePeer::FADE_OUT, $fadeOut['min'], Criteria::GREATER_EQUAL); + if (isset($dbFadeOut['min'])) { + $this->addUsingAlias(CcSchedulePeer::FADE_OUT, $dbFadeOut['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($fadeOut['max'])) { - $this->addUsingAlias(CcSchedulePeer::FADE_OUT, $fadeOut['max'], Criteria::LESS_EQUAL); + if (isset($dbFadeOut['max'])) { + $this->addUsingAlias(CcSchedulePeer::FADE_OUT, $dbFadeOut['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -431,28 +431,28 @@ abstract class BaseCcScheduleQuery extends ModelCriteria $comparison = Criteria::IN; } } - return $this->addUsingAlias(CcSchedulePeer::FADE_OUT, $fadeOut, $comparison); + return $this->addUsingAlias(CcSchedulePeer::FADE_OUT, $dbFadeOut, $comparison); } /** * Filter the query on the cue_in column * - * @param string|array $cueIn The value to use as filter. + * @param string|array $dbCueIn The value to use as filter. * Accepts an associative array('min' => $minValue, 'max' => $maxValue) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return CcScheduleQuery The current query, for fluid interface */ - public function filterByCueIn($cueIn = null, $comparison = null) + public function filterByDbCueIn($dbCueIn = null, $comparison = null) { - if (is_array($cueIn)) { + if (is_array($dbCueIn)) { $useMinMax = false; - if (isset($cueIn['min'])) { - $this->addUsingAlias(CcSchedulePeer::CUE_IN, $cueIn['min'], Criteria::GREATER_EQUAL); + if (isset($dbCueIn['min'])) { + $this->addUsingAlias(CcSchedulePeer::CUE_IN, $dbCueIn['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($cueIn['max'])) { - $this->addUsingAlias(CcSchedulePeer::CUE_IN, $cueIn['max'], Criteria::LESS_EQUAL); + if (isset($dbCueIn['max'])) { + $this->addUsingAlias(CcSchedulePeer::CUE_IN, $dbCueIn['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -462,28 +462,28 @@ abstract class BaseCcScheduleQuery extends ModelCriteria $comparison = Criteria::IN; } } - return $this->addUsingAlias(CcSchedulePeer::CUE_IN, $cueIn, $comparison); + return $this->addUsingAlias(CcSchedulePeer::CUE_IN, $dbCueIn, $comparison); } /** * Filter the query on the cue_out column * - * @param string|array $cueOut The value to use as filter. + * @param string|array $dbCueOut The value to use as filter. * Accepts an associative array('min' => $minValue, 'max' => $maxValue) * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return CcScheduleQuery The current query, for fluid interface */ - public function filterByCueOut($cueOut = null, $comparison = null) + public function filterByDbCueOut($dbCueOut = null, $comparison = null) { - if (is_array($cueOut)) { + if (is_array($dbCueOut)) { $useMinMax = false; - if (isset($cueOut['min'])) { - $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $cueOut['min'], Criteria::GREATER_EQUAL); + if (isset($dbCueOut['min'])) { + $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $dbCueOut['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($cueOut['max'])) { - $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $cueOut['max'], Criteria::LESS_EQUAL); + if (isset($dbCueOut['max'])) { + $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $dbCueOut['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -493,7 +493,7 @@ abstract class BaseCcScheduleQuery extends ModelCriteria $comparison = Criteria::IN; } } - return $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $cueOut, $comparison); + return $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $dbCueOut, $comparison); } /** @@ -506,7 +506,7 @@ abstract class BaseCcScheduleQuery extends ModelCriteria public function prune($ccSchedule = null) { if ($ccSchedule) { - $this->addUsingAlias(CcSchedulePeer::ID, $ccSchedule->getId(), Criteria::NOT_EQUAL); + $this->addUsingAlias(CcSchedulePeer::ID, $ccSchedule->getDbId(), Criteria::NOT_EQUAL); } return $this; diff --git a/application/models/campcaster/om/BaseCcShow.php b/application/models/campcaster/om/BaseCcShow.php index 27b9d7836..acb78d170 100644 --- a/application/models/campcaster/om/BaseCcShow.php +++ b/application/models/campcaster/om/BaseCcShow.php @@ -59,6 +59,11 @@ abstract class BaseCcShow extends BaseObject implements Persistent */ protected $collCcShowHostss; + /** + * @var array CcShowSchedule[] Collection to store aggregation of CcShowSchedule objects. + */ + protected $collCcShowSchedules; + /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -328,6 +333,8 @@ abstract class BaseCcShow extends BaseObject implements Persistent $this->collCcShowHostss = null; + $this->collCcShowSchedules = null; + } // if (deep) } @@ -477,6 +484,14 @@ abstract class BaseCcShow extends BaseObject implements Persistent } } + if ($this->collCcShowSchedules !== null) { + foreach ($this->collCcShowSchedules as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + $this->alreadyInSave = false; } @@ -564,6 +579,14 @@ abstract class BaseCcShow extends BaseObject implements Persistent } } + if ($this->collCcShowSchedules !== null) { + foreach ($this->collCcShowSchedules as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + $this->alreadyInValidation = false; } @@ -804,6 +827,12 @@ abstract class BaseCcShow extends BaseObject implements Persistent } } + foreach ($this->getCcShowSchedules() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcShowSchedule($relObj->copy($deepCopy)); + } + } + } // if ($deepCopy) @@ -1092,6 +1121,115 @@ abstract class BaseCcShow extends BaseObject implements Persistent return $this->getCcShowHostss($query, $con); } + /** + * Clears out the collCcShowSchedules collection + * + * This does not modify the database; however, it will remove any associated objects, causing + * them to be refetched by subsequent calls to accessor method. + * + * @return void + * @see addCcShowSchedules() + */ + public function clearCcShowSchedules() + { + $this->collCcShowSchedules = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcShowSchedules collection. + * + * By default this just sets the collCcShowSchedules collection to an empty array (like clearcollCcShowSchedules()); + * however, you may wish to override this method in your stub class to provide setting appropriate + * to your application -- for example, setting the initial array to the values stored in database. + * + * @return void + */ + public function initCcShowSchedules() + { + $this->collCcShowSchedules = new PropelObjectCollection(); + $this->collCcShowSchedules->setModel('CcShowSchedule'); + } + + /** + * Gets an array of CcShowSchedule objects which contain a foreign key that references this object. + * + * If the $criteria is not null, it is used to always fetch the results from the database. + * Otherwise the results are fetched from the database the first time, then cached. + * Next time the same method is called without $criteria, the cached collection is returned. + * If this CcShow is new, it will return + * an empty collection or the current collection; the criteria is ignored on a new object. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @return PropelCollection|array CcShowSchedule[] List of CcShowSchedule objects + * @throws PropelException + */ + public function getCcShowSchedules($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcShowSchedules || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowSchedules) { + // return empty collection + $this->initCcShowSchedules(); + } else { + $collCcShowSchedules = CcShowScheduleQuery::create(null, $criteria) + ->filterByCcShow($this) + ->find($con); + if (null !== $criteria) { + return $collCcShowSchedules; + } + $this->collCcShowSchedules = $collCcShowSchedules; + } + } + return $this->collCcShowSchedules; + } + + /** + * Returns the number of related CcShowSchedule objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcShowSchedule objects. + * @throws PropelException + */ + public function countCcShowSchedules(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcShowSchedules || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowSchedules) { + return 0; + } else { + $query = CcShowScheduleQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcShow($this) + ->count($con); + } + } else { + return count($this->collCcShowSchedules); + } + } + + /** + * Method called to associate a CcShowSchedule object to this object + * through the CcShowSchedule foreign key attribute. + * + * @param CcShowSchedule $l CcShowSchedule + * @return void + * @throws PropelException + */ + public function addCcShowSchedule(CcShowSchedule $l) + { + if ($this->collCcShowSchedules === null) { + $this->initCcShowSchedules(); + } + if (!$this->collCcShowSchedules->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcShowSchedules[]= $l; + $l->setCcShow($this); + } + } + /** * Clears the current object and sets all attributes to their default values */ @@ -1132,10 +1270,16 @@ abstract class BaseCcShow extends BaseObject implements Persistent $o->clearAllReferences($deep); } } + if ($this->collCcShowSchedules) { + foreach ((array) $this->collCcShowSchedules as $o) { + $o->clearAllReferences($deep); + } + } } // if ($deep) $this->collCcShowDayss = null; $this->collCcShowHostss = null; + $this->collCcShowSchedules = null; } /** diff --git a/application/models/campcaster/om/BaseCcShowPeer.php b/application/models/campcaster/om/BaseCcShowPeer.php index 569e80648..b7663bc5d 100644 --- a/application/models/campcaster/om/BaseCcShowPeer.php +++ b/application/models/campcaster/om/BaseCcShowPeer.php @@ -359,6 +359,9 @@ abstract class BaseCcShowPeer { // Invalidate objects in CcShowHostsPeer instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. CcShowHostsPeer::clearInstancePool(); + // Invalidate objects in CcShowSchedulePeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcShowSchedulePeer::clearInstancePool(); } /** diff --git a/application/models/campcaster/om/BaseCcShowQuery.php b/application/models/campcaster/om/BaseCcShowQuery.php index eaa4c3a00..d6fd228c9 100644 --- a/application/models/campcaster/om/BaseCcShowQuery.php +++ b/application/models/campcaster/om/BaseCcShowQuery.php @@ -28,6 +28,10 @@ * @method CcShowQuery rightJoinCcShowHosts($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowHosts relation * @method CcShowQuery innerJoinCcShowHosts($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowHosts relation * + * @method CcShowQuery leftJoinCcShowSchedule($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowSchedule relation + * @method CcShowQuery rightJoinCcShowSchedule($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowSchedule relation + * @method CcShowQuery innerJoinCcShowSchedule($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowSchedule relation + * * @method CcShow findOne(PropelPDO $con = null) Return the first CcShow matching the query * @method CcShow findOneOrCreate(PropelPDO $con = null) Return the first CcShow matching the query, or a new CcShow object populated from the query conditions when no match is found * @@ -369,6 +373,70 @@ abstract class BaseCcShowQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'CcShowHosts', 'CcShowHostsQuery'); } + /** + * Filter the query by a related CcShowSchedule object + * + * @param CcShowSchedule $ccShowSchedule the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowQuery The current query, for fluid interface + */ + public function filterByCcShowSchedule($ccShowSchedule, $comparison = null) + { + return $this + ->addUsingAlias(CcShowPeer::ID, $ccShowSchedule->getDbShowId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcShowSchedule relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowQuery The current query, for fluid interface + */ + public function joinCcShowSchedule($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShowSchedule'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'CcShowSchedule'); + } + + return $this; + } + + /** + * Use the CcShowSchedule relation CcShowSchedule object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowScheduleQuery A secondary query class using the current class as primary query + */ + public function useCcShowScheduleQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCcShowSchedule($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShowSchedule', 'CcShowScheduleQuery'); + } + /** * Exclude object from result * diff --git a/application/models/campcaster/om/BaseCcShowSchedule.php b/application/models/campcaster/om/BaseCcShowSchedule.php new file mode 100644 index 000000000..4ac36f871 --- /dev/null +++ b/application/models/campcaster/om/BaseCcShowSchedule.php @@ -0,0 +1,857 @@ +id; + } + + /** + * Get the [show_id] column value. + * + * @return int + */ + public function getDbShowId() + { + return $this->show_id; + } + + /** + * Get the [group_id] column value. + * + * @return int + */ + public function getDbGroupId() + { + return $this->group_id; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return CcShowSchedule The current object (for fluent API support) + */ + public function setDbId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CcShowSchedulePeer::ID; + } + + return $this; + } // setDbId() + + /** + * Set the value of [show_id] column. + * + * @param int $v new value + * @return CcShowSchedule The current object (for fluent API support) + */ + public function setDbShowId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->show_id !== $v) { + $this->show_id = $v; + $this->modifiedColumns[] = CcShowSchedulePeer::SHOW_ID; + } + + if ($this->aCcShow !== null && $this->aCcShow->getDbId() !== $v) { + $this->aCcShow = null; + } + + return $this; + } // setDbShowId() + + /** + * Set the value of [group_id] column. + * + * @param int $v new value + * @return CcShowSchedule The current object (for fluent API support) + */ + public function setDbGroupId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->group_id !== $v) { + $this->group_id = $v; + $this->modifiedColumns[] = CcShowSchedulePeer::GROUP_ID; + } + + return $this; + } // setDbGroupId() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->show_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->group_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 3; // 3 = CcShowSchedulePeer::NUM_COLUMNS - CcShowSchedulePeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcShowSchedule object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aCcShow !== null && $this->show_id !== $this->aCcShow->getDbId()) { + $this->aCcShow = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcShowSchedulePeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aCcShow = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcShowScheduleQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcShowSchedulePeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcShow !== null) { + if ($this->aCcShow->isModified() || $this->aCcShow->isNew()) { + $affectedRows += $this->aCcShow->save($con); + } + $this->setCcShow($this->aCcShow); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = CcShowSchedulePeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + if ($criteria->keyContainsValue(CcShowSchedulePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcShowSchedulePeer::ID.')'); + } + + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows += 1; + $this->setDbId($pk); //[IMV] update autoincrement primary key + $this->setNew(false); + } else { + $affectedRows += CcShowSchedulePeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + // We call the validate method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcShow !== null) { + if (!$this->aCcShow->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcShow->getValidationFailures()); + } + } + + + if (($retval = CcShowSchedulePeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcShowSchedulePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getDbId(); + break; + case 1: + return $this->getDbShowId(); + break; + case 2: + return $this->getDbGroupId(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) + { + $keys = CcShowSchedulePeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbId(), + $keys[1] => $this->getDbShowId(), + $keys[2] => $this->getDbGroupId(), + ); + if ($includeForeignObjects) { + if (null !== $this->aCcShow) { + $result['CcShow'] = $this->aCcShow->toArray($keyType, $includeLazyLoadColumns, true); + } + } + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcShowSchedulePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setDbId($value); + break; + case 1: + $this->setDbShowId($value); + break; + case 2: + $this->setDbGroupId($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcShowSchedulePeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbShowId($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDbGroupId($arr[$keys[2]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcShowSchedulePeer::DATABASE_NAME); + + if ($this->isColumnModified(CcShowSchedulePeer::ID)) $criteria->add(CcShowSchedulePeer::ID, $this->id); + if ($this->isColumnModified(CcShowSchedulePeer::SHOW_ID)) $criteria->add(CcShowSchedulePeer::SHOW_ID, $this->show_id); + if ($this->isColumnModified(CcShowSchedulePeer::GROUP_ID)) $criteria->add(CcShowSchedulePeer::GROUP_ID, $this->group_id); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcShowSchedulePeer::DATABASE_NAME); + $criteria->add(CcShowSchedulePeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getDbId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getDbId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcShowSchedule (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setDbShowId($this->show_id); + $copyObj->setDbGroupId($this->group_id); + + $copyObj->setNew(true); + $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcShowSchedule Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcShowSchedulePeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcShowSchedulePeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a CcShow object. + * + * @param CcShow $v + * @return CcShowSchedule The current object (for fluent API support) + * @throws PropelException + */ + public function setCcShow(CcShow $v = null) + { + if ($v === null) { + $this->setDbShowId(NULL); + } else { + $this->setDbShowId($v->getDbId()); + } + + $this->aCcShow = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcShow object, it will not be re-added. + if ($v !== null) { + $v->addCcShowSchedule($this); + } + + return $this; + } + + + /** + * Get the associated CcShow object + * + * @param PropelPDO Optional Connection object. + * @return CcShow The associated CcShow object. + * @throws PropelException + */ + public function getCcShow(PropelPDO $con = null) + { + if ($this->aCcShow === null && ($this->show_id !== null)) { + $this->aCcShow = CcShowQuery::create()->findPk($this->show_id, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aCcShow->addCcShowSchedules($this); + */ + } + return $this->aCcShow; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->show_id = null; + $this->group_id = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aCcShow = null; + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcShowSchedule diff --git a/application/models/campcaster/om/BaseCcShowSchedulePeer.php b/application/models/campcaster/om/BaseCcShowSchedulePeer.php new file mode 100644 index 000000000..966cf400e --- /dev/null +++ b/application/models/campcaster/om/BaseCcShowSchedulePeer.php @@ -0,0 +1,978 @@ + array ('DbId', 'DbShowId', 'DbGroupId', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbShowId', 'dbGroupId', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::SHOW_ID, self::GROUP_ID, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'SHOW_ID', 'GROUP_ID', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'show_id', 'group_id', ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbShowId' => 1, 'DbGroupId' => 2, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbShowId' => 1, 'dbGroupId' => 2, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::SHOW_ID => 1, self::GROUP_ID => 2, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'SHOW_ID' => 1, 'GROUP_ID' => 2, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'show_id' => 1, 'group_id' => 2, ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcShowSchedulePeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcShowSchedulePeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcShowSchedulePeer::ID); + $criteria->addSelectColumn(CcShowSchedulePeer::SHOW_ID); + $criteria->addSelectColumn(CcShowSchedulePeer::GROUP_ID); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.SHOW_ID'); + $criteria->addSelectColumn($alias . '.GROUP_ID'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowSchedulePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowSchedulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcShowSchedule + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcShowSchedulePeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcShowSchedulePeer::populateObjects(CcShowSchedulePeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcShowSchedulePeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcShowSchedule $value A CcShowSchedule object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcShowSchedule $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcShowSchedule object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcShowSchedule) { + $key = (string) $value->getDbId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcShowSchedule object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcShowSchedule Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_show_schedule + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcShowSchedulePeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcShowSchedulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcShowSchedulePeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcShowSchedulePeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcShowSchedule object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcShowSchedulePeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcShowSchedulePeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcShowSchedulePeer::NUM_COLUMNS; + } else { + $cls = CcShowSchedulePeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcShowSchedulePeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + + /** + * Returns the number of rows matching criteria, joining the related CcShow table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinCcShow(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowSchedulePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowSchedulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowSchedulePeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcShowSchedule objects pre-filled with their CcShow objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowSchedule objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcShow(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowSchedulePeer::addSelectColumns($criteria); + $startcol = (CcShowSchedulePeer::NUM_COLUMNS - CcShowSchedulePeer::NUM_LAZY_LOAD_COLUMNS); + CcShowPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcShowSchedulePeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowSchedulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowSchedulePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcShowSchedulePeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowSchedulePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcShowPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcShowPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcShowPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcShowSchedule) to $obj2 (CcShow) + $obj2->addCcShowSchedule($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining all related tables + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowSchedulePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowSchedulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowSchedulePeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of CcShowSchedule objects pre-filled with all related objects. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowSchedule objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowSchedulePeer::addSelectColumns($criteria); + $startcol2 = (CcShowSchedulePeer::NUM_COLUMNS - CcShowSchedulePeer::NUM_LAZY_LOAD_COLUMNS); + + CcShowPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcShowSchedulePeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowSchedulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowSchedulePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcShowSchedulePeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowSchedulePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcShow rows + + $key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcShowPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcShowPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcShowPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (CcShowSchedule) to the collection in $obj2 (CcShow) + $obj2->addCcShowSchedule($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcShowSchedulePeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcShowSchedulePeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcShowScheduleTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcShowSchedulePeer::CLASS_DEFAULT : CcShowSchedulePeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcShowSchedule or Criteria object. + * + * @param mixed $values Criteria or CcShowSchedule object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcShowSchedule object + } + + if ($criteria->containsKey(CcShowSchedulePeer::ID) && $criteria->keyContainsValue(CcShowSchedulePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcShowSchedulePeer::ID.')'); + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcShowSchedule or Criteria object. + * + * @param mixed $values Criteria or CcShowSchedule object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcShowSchedulePeer::ID); + $value = $criteria->remove(CcShowSchedulePeer::ID); + if ($value) { + $selectCriteria->add(CcShowSchedulePeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcShowSchedulePeer::TABLE_NAME); + } + + } else { // $values is CcShowSchedule object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_show_schedule table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcShowSchedulePeer::TABLE_NAME, $con, CcShowSchedulePeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcShowSchedulePeer::clearInstancePool(); + CcShowSchedulePeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcShowSchedule or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcShowSchedule object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcShowSchedulePeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcShowSchedule) { // it's a model object + // invalidate the cache for this single object + CcShowSchedulePeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcShowSchedulePeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcShowSchedulePeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcShowSchedulePeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcShowSchedule object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcShowSchedule $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcShowSchedule $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcShowSchedulePeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcShowSchedulePeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcShowSchedulePeer::DATABASE_NAME, CcShowSchedulePeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcShowSchedule + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcShowSchedulePeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcShowSchedulePeer::DATABASE_NAME); + $criteria->add(CcShowSchedulePeer::ID, $pk); + + $v = CcShowSchedulePeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcShowSchedulePeer::DATABASE_NAME); + $criteria->add(CcShowSchedulePeer::ID, $pks, Criteria::IN); + $objs = CcShowSchedulePeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcShowSchedulePeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcShowSchedulePeer::buildTableMap(); + diff --git a/application/models/campcaster/om/BaseCcShowScheduleQuery.php b/application/models/campcaster/om/BaseCcShowScheduleQuery.php new file mode 100644 index 000000000..c2e4db1ca --- /dev/null +++ b/application/models/campcaster/om/BaseCcShowScheduleQuery.php @@ -0,0 +1,303 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcShowSchedule|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcShowSchedulePeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcShowScheduleQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcShowSchedulePeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcShowScheduleQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcShowSchedulePeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * @param int|array $dbId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowScheduleQuery The current query, for fluid interface + */ + public function filterByDbId($dbId = null, $comparison = null) + { + if (is_array($dbId) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcShowSchedulePeer::ID, $dbId, $comparison); + } + + /** + * Filter the query on the show_id column + * + * @param int|array $dbShowId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowScheduleQuery The current query, for fluid interface + */ + public function filterByDbShowId($dbShowId = null, $comparison = null) + { + if (is_array($dbShowId)) { + $useMinMax = false; + if (isset($dbShowId['min'])) { + $this->addUsingAlias(CcShowSchedulePeer::SHOW_ID, $dbShowId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbShowId['max'])) { + $this->addUsingAlias(CcShowSchedulePeer::SHOW_ID, $dbShowId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowSchedulePeer::SHOW_ID, $dbShowId, $comparison); + } + + /** + * Filter the query on the group_id column + * + * @param int|array $dbGroupId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowScheduleQuery The current query, for fluid interface + */ + public function filterByDbGroupId($dbGroupId = null, $comparison = null) + { + if (is_array($dbGroupId)) { + $useMinMax = false; + if (isset($dbGroupId['min'])) { + $this->addUsingAlias(CcShowSchedulePeer::GROUP_ID, $dbGroupId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbGroupId['max'])) { + $this->addUsingAlias(CcShowSchedulePeer::GROUP_ID, $dbGroupId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowSchedulePeer::GROUP_ID, $dbGroupId, $comparison); + } + + /** + * Filter the query by a related CcShow object + * + * @param CcShow $ccShow the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowScheduleQuery The current query, for fluid interface + */ + public function filterByCcShow($ccShow, $comparison = null) + { + return $this + ->addUsingAlias(CcShowSchedulePeer::SHOW_ID, $ccShow->getDbId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcShow relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowScheduleQuery The current query, for fluid interface + */ + public function joinCcShow($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShow'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'CcShow'); + } + + return $this; + } + + /** + * Use the CcShow relation CcShow object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowQuery A secondary query class using the current class as primary query + */ + public function useCcShowQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCcShow($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShow', 'CcShowQuery'); + } + + /** + * Exclude object from result + * + * @param CcShowSchedule $ccShowSchedule Object to remove from the list of results + * + * @return CcShowScheduleQuery The current query, for fluid interface + */ + public function prune($ccShowSchedule = null) + { + if ($ccShowSchedule) { + $this->addUsingAlias(CcShowSchedulePeer::ID, $ccShowSchedule->getDbId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcShowScheduleQuery diff --git a/build/build.properties b/build/build.properties index 3e7d17c6b..1647a215d 100644 --- a/build/build.properties +++ b/build/build.properties @@ -1,4 +1,4 @@ -project.home = /home/naomiaro/dev-campcaster/campcaster +project.home = /home/naomi/dev-campcaster/campcaster project.build = ${project.home}/build #Database driver diff --git a/build/schema.xml b/build/schema.xml index cea6a40e6..e913915ea 100644 --- a/build/schema.xml +++ b/build/schema.xml @@ -150,6 +150,14 @@ + + + + + + + +
@@ -200,17 +208,17 @@
- - - - - - - - - - - + + + + + + + + + + +
diff --git a/build/sql/schema.sql b/build/sql/schema.sql index fffa3356b..924c57ac3 100644 --- a/build/sql/schema.sql +++ b/build/sql/schema.sql @@ -212,6 +212,25 @@ CREATE TABLE "cc_show_hosts" COMMENT ON TABLE "cc_show_hosts" IS ''; +SET search_path TO public; +----------------------------------------------------------------------------- +-- cc_show_schedule +----------------------------------------------------------------------------- + +DROP TABLE "cc_show_schedule" CASCADE; + + +CREATE TABLE "cc_show_schedule" +( + "id" serial NOT NULL, + "show_id" INTEGER NOT NULL, + "group_id" INTEGER NOT NULL, + PRIMARY KEY ("id") +); + +COMMENT ON TABLE "cc_show_schedule" IS ''; + + SET search_path TO public; ----------------------------------------------------------------------------- -- cc_playlist @@ -443,6 +462,8 @@ ALTER TABLE "cc_show_hosts" ADD CONSTRAINT "cc_perm_show_fkey" FOREIGN KEY ("sho ALTER TABLE "cc_show_hosts" ADD CONSTRAINT "cc_perm_host_fkey" FOREIGN KEY ("subjs_id") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE; +ALTER TABLE "cc_show_schedule" ADD CONSTRAINT "cc_perm_show_fkey" FOREIGN KEY ("show_id") REFERENCES "cc_show" ("id") ON DELETE CASCADE; + ALTER TABLE "cc_playlist" ADD CONSTRAINT "cc_playlist_editedby_fkey" FOREIGN KEY ("editedby") REFERENCES "cc_subjs" ("id"); ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_file_id_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("id") ON DELETE CASCADE; diff --git a/public/js/campcaster/schedule/schedule.js b/public/js/campcaster/schedule/schedule.js index 12caef557..39dd33d45 100644 --- a/public/js/campcaster/schedule/schedule.js +++ b/public/js/campcaster/schedule/schedule.js @@ -84,11 +84,11 @@ function submitShow() { table.append(tr); }); - + dialog.append("Cannot add show. New show overlaps the following shows:"); dialog.append(table); } - + } else { $("#schedule_calendar").fullCalendar( 'refetchEvents' ); @@ -169,6 +169,7 @@ function makeScheduleDialog(playlists, event) { .addClass('ui-widget-content') .append('
'+val.name+'
') .append('
'+val.description+'
') + .append('
'+val.length+'
') .click(function(){ $(this).parent().find("li").removeClass("ui-state-active") $(this).addClass("ui-state-active"); @@ -274,8 +275,9 @@ function eventRender(event, element, view) { } function eventAfterRender( event, element, view ) { - - if(event.isHost === true) { + var today = new Date(); + + if(event.isHost === true && event.start > today) { $(element).contextMenu( {menu: 'schedule_event_host_menu'}, eventMenu );