beginning of making a separate ShowInstance vs Show class.
This commit is contained in:
parent
bc6dd374f4
commit
bfc1bccfdf
|
@ -2,7 +2,6 @@
|
|||
|
||||
class ScheduleController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
protected $sched_sess = null;
|
||||
|
||||
public function init()
|
||||
|
@ -51,9 +50,13 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$end = $this->_getParam('end', null);
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$show = new Show(new User($userInfo->id, $userInfo->type));
|
||||
$user = new User($userInfo->id, $userInfo->type);
|
||||
if($user->isAdmin())
|
||||
$editable = true;
|
||||
else
|
||||
$editable = false;
|
||||
|
||||
$this->view->events = $show->getFullCalendarEvents($start, $end);
|
||||
$this->view->events = Show::getFullCalendarEvents($start, $end, $editable);
|
||||
}
|
||||
|
||||
public function addShowDialogAction()
|
||||
|
@ -133,10 +136,8 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$deltaMin = $this->_getParam('min');
|
||||
$showInstanceId = $this->_getParam('showInstanceId');
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$show = new Show(new User($userInfo->id, $userInfo->type));
|
||||
|
||||
$error = $show->moveShow($showInstanceId, $deltaDay, $deltaMin);
|
||||
$show = new ShowInstance($showInstanceId);
|
||||
$error = $show->moveShow($deltaDay, $deltaMin);
|
||||
|
||||
if(isset($error))
|
||||
$this->view->error = $error;
|
||||
|
@ -148,10 +149,8 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$deltaMin = $this->_getParam('min');
|
||||
$showInstanceId = $this->_getParam('showInstanceId');
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$show = new Show(new User($userInfo->id, $userInfo->type));
|
||||
|
||||
$error = $show->resizeShow($showInstanceId, $deltaDay, $deltaMin);
|
||||
$show = new ShowInstance($showInstanceId);
|
||||
$error = $show->resizeShow($deltaDay, $deltaMin);
|
||||
|
||||
if(isset($error))
|
||||
$this->view->error = $error;
|
||||
|
@ -219,7 +218,9 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$user = new User($userInfo->id, $userInfo->type);
|
||||
$show = new Show($user, $showId);
|
||||
|
||||
$show->scheduleShow($start_timestamp, array($plId));
|
||||
if($user->isHost($showId)) {
|
||||
$show->scheduleShow($start_timestamp, array($plId));
|
||||
}
|
||||
|
||||
$this->view->showContent = $show->getShowContent($start_timestamp);
|
||||
$this->view->timeFilled = $show->getTimeScheduled($start_timestamp, $end_timestamp);
|
||||
|
|
|
@ -2,12 +2,10 @@
|
|||
|
||||
class Show {
|
||||
|
||||
private $_user;
|
||||
private $_showId;
|
||||
|
||||
public function __construct($user=NULL, $showId=NULL)
|
||||
public function __construct($showId=NULL)
|
||||
{
|
||||
$this->_user = $user;
|
||||
$this->_showId = $showId;
|
||||
}
|
||||
|
||||
|
@ -24,7 +22,7 @@ class Show {
|
|||
}
|
||||
|
||||
//end dates are non inclusive.
|
||||
public function addShow($data) {
|
||||
public static function addShow($data) {
|
||||
|
||||
$con = Propel::getConnection(CcShowPeer::DATABASE_NAME);
|
||||
|
||||
|
@ -55,14 +53,6 @@ class Show {
|
|||
$data['add_show_day_check'] = array($startDow);
|
||||
}
|
||||
|
||||
/*
|
||||
$overlap = $this->getShows($data['add_show_start_date'], $endDate, $data['add_show_day_check'], $data['add_show_start_time'], $endTime);
|
||||
|
||||
if(count($overlap) > 0) {
|
||||
return $overlap;
|
||||
}
|
||||
*/
|
||||
|
||||
if($data['add_show_repeats']) {
|
||||
$repeat_type = 0; //chnage this when supporting more than just a weekly show option.
|
||||
}
|
||||
|
@ -120,284 +110,6 @@ class Show {
|
|||
$this->populateShowUntilLastGeneratedDate($showId);
|
||||
}
|
||||
|
||||
public function moveShow($showInstanceId, $deltaDay, $deltaMin){
|
||||
global $CC_DBC;
|
||||
|
||||
$showInstance = CcShowInstancesQuery::create()->findPK($showInstanceId);
|
||||
|
||||
$hours = $deltaMin/60;
|
||||
if($hours > 0)
|
||||
$hours = floor($hours);
|
||||
else
|
||||
$hours = ceil($hours);
|
||||
|
||||
$mins = abs($deltaMin%60);
|
||||
|
||||
$starts = $showInstance->getDbStarts();
|
||||
$ends = $showInstance->getDbEnds();
|
||||
|
||||
$sql = "SELECT timestamp '{$starts}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'";
|
||||
$new_starts = $CC_DBC->GetOne($sql);
|
||||
|
||||
$sql = "SELECT timestamp '{$ends}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'";
|
||||
$new_ends = $CC_DBC->GetOne($sql);
|
||||
|
||||
$today_timestamp = date("Y-m-d H:i:s");
|
||||
if(strtotime($today_timestamp) > strtotime($new_starts)) {
|
||||
return "can't move show into past";
|
||||
}
|
||||
|
||||
$overlap = $this->getShows($new_starts, $new_ends, array($showInstanceId));
|
||||
|
||||
if(count($overlap) > 0) {
|
||||
return $overlap;
|
||||
}
|
||||
|
||||
$showInstance
|
||||
->setDbStarts($new_starts)
|
||||
->setDbEnds($new_ends)
|
||||
->save();
|
||||
}
|
||||
|
||||
public function resizeShow($showInstanceId, $deltaDay, $deltaMin){
|
||||
global $CC_DBC;
|
||||
|
||||
$showInstance = CcShowInstancesQuery::create()->findPK($showInstanceId);
|
||||
|
||||
$hours = $deltaMin/60;
|
||||
if($hours > 0)
|
||||
$hours = floor($hours);
|
||||
else
|
||||
$hours = ceil($hours);
|
||||
|
||||
$mins = abs($deltaMin%60);
|
||||
|
||||
$starts = $showInstance->getDbStarts();
|
||||
$ends = $showInstance->getDbEnds();
|
||||
|
||||
$sql = "SELECT timestamp '{$ends}' + interval '{$hours}:{$mins}'";
|
||||
$new_ends = $CC_DBC->GetOne($sql);
|
||||
|
||||
//only need to check overlap if show increased in size.
|
||||
if(strtotime($new_ends) > strtotime($ends)) {
|
||||
$overlap = $this->getShows($ends, $new_ends);
|
||||
|
||||
if(count($overlap) > 0) {
|
||||
return $overlap;
|
||||
}
|
||||
}
|
||||
|
||||
$showInstance
|
||||
->setDbEnds($new_ends)
|
||||
->save();
|
||||
|
||||
//needed if option is for all future shows.
|
||||
/*
|
||||
foreach($res as $row) {
|
||||
$show = CcShowDaysQuery::create()->findPK($row["id"]);
|
||||
$show->setDbStartTime($s_time);
|
||||
$show->setDbEndTime($e_time);
|
||||
$show->save();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private function getNextPos($day) {
|
||||
global $CC_DBC;
|
||||
|
||||
$timeinfo = explode(" ", $day);
|
||||
|
||||
$sql = "SELECT MAX(position)+1 from cc_show_schedule WHERE show_id = '{$this->_showId}' AND show_day = '{$timeinfo[0]}'";
|
||||
$res = $CC_DBC->GetOne($sql);
|
||||
|
||||
if(is_null($res))
|
||||
return 0;
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
private function getLastGroupId($start_timestamp) {
|
||||
global $CC_DBC;
|
||||
|
||||
$timeinfo = explode(" ", $start_timestamp);
|
||||
|
||||
$sql = "SELECT MAX(group_id) from cc_show_schedule WHERE show_id = '{$this->_showId}' AND show_day = '{$timeinfo[0]}'";
|
||||
$res = $CC_DBC->GetOne($sql);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function addPlaylistToShow($start_timestamp, $plId) {
|
||||
|
||||
$sched = new ScheduleGroup();
|
||||
$lastGroupId = $this->getLastGroupId($start_timestamp);
|
||||
|
||||
if(is_null($lastGroupId)) {
|
||||
|
||||
$groupId = $sched->add($start_timestamp, null, $plId);
|
||||
}
|
||||
else {
|
||||
$groupId = $sched->addPlaylistAfter($lastGroupId, $plId);
|
||||
}
|
||||
|
||||
$timeinfo = explode(" ", $start_timestamp);
|
||||
$day = $timeinfo[0];
|
||||
$pos = $this->getNextPos($day);
|
||||
|
||||
$groupsched = new CcShowSchedule();
|
||||
$groupsched->setDbShowId($this->_showId);
|
||||
$groupsched->setDbGroupId($groupId);
|
||||
$groupsched->setDbShowDay($day);
|
||||
$groupsched->setDbPosition($pos);
|
||||
$groupsched->save();
|
||||
}
|
||||
|
||||
public function scheduleShow($start_timestamp, $plIds) {
|
||||
if($this->_user->isHost($this->_showId)) {
|
||||
|
||||
foreach($plIds as $plId) {
|
||||
$this->addPlaylistToShow($start_timestamp, $plId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function removeGroupFromShow($start_timestamp, $group_id){
|
||||
global $CC_DBC, $CC_CONFIG;
|
||||
|
||||
$timeinfo = explode(" ", $start_timestamp);
|
||||
|
||||
$group = CcShowScheduleQuery::create()
|
||||
->filterByDbShowId($this->_showId)
|
||||
->filterByDbGroupId($group_id)
|
||||
->filterByDbShowDay($timeinfo[0])
|
||||
->findOne();
|
||||
|
||||
$position = $group->getDbPosition();
|
||||
|
||||
$sql = "SELECT group_id FROM cc_show_schedule
|
||||
WHERE show_id = '{$this->_showId}' AND show_day = '{$timeinfo[0]}'
|
||||
AND position > '{$position}'";
|
||||
$followingGroups = $CC_DBC->GetAll($sql);
|
||||
|
||||
$sql = "SELECT SUM(clip_length) FROM ".$CC_CONFIG["scheduleTable"]." WHERE group_id='{$group_id}'";
|
||||
$group_length = $CC_DBC->GetOne($sql);
|
||||
|
||||
$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]." WHERE group_id = '{$group_id}'";
|
||||
$CC_DBC->query($sql);
|
||||
|
||||
if(!is_null($followingGroups)) {
|
||||
$sql_opt = array();
|
||||
foreach ($followingGroups as $row) {
|
||||
$sql_opt[] = "group_id = {$row["group_id"]}";
|
||||
}
|
||||
$sql_group_ids = join(" OR ", $sql_opt);
|
||||
|
||||
$sql = "UPDATE ".$CC_CONFIG["scheduleTable"]."
|
||||
SET starts = (starts - INTERVAL '{$group_length}'), ends = (ends - INTERVAL '{$group_length}')
|
||||
WHERE " . $sql_group_ids;
|
||||
$CC_DBC->query($sql);
|
||||
}
|
||||
|
||||
$group->delete();
|
||||
|
||||
}
|
||||
|
||||
public function getTimeScheduled($start_timestamp, $end_timestamp) {
|
||||
|
||||
$time = Schedule::getTimeScheduledInRange($start_timestamp, $end_timestamp);
|
||||
|
||||
return $time;
|
||||
}
|
||||
|
||||
public function getTimeUnScheduled($start_timestamp, $end_timestamp) {
|
||||
|
||||
$time = Schedule::getTimeUnScheduledInRange($start_timestamp, $end_timestamp);
|
||||
|
||||
return $time;
|
||||
}
|
||||
|
||||
public function showHasContent($start_timestamp, $end_timestamp) {
|
||||
|
||||
$con = Propel::getConnection(CcShowPeer::DATABASE_NAME);
|
||||
$sql = "SELECT TIMESTAMP '{$end_timestamp}' - TIMESTAMP '{$start_timestamp}'";
|
||||
$r = $con->query($sql);
|
||||
$length = $r->fetchColumn(0);
|
||||
|
||||
return !Schedule::isScheduleEmptyInRange($start_timestamp, $length);
|
||||
}
|
||||
|
||||
public function getShowListContent($start_timestamp) {
|
||||
global $CC_DBC;
|
||||
|
||||
$timeinfo = explode(" ", $start_timestamp);
|
||||
|
||||
$sql = "SELECT *
|
||||
FROM (cc_show_schedule AS ss LEFT JOIN cc_schedule AS s USING(group_id)
|
||||
LEFT JOIN cc_files AS f ON f.id = s.file_id
|
||||
LEFT JOIN cc_playlist AS p ON p.id = s.playlist_id )
|
||||
|
||||
WHERE ss.show_day = '{$timeinfo[0]}' AND ss.show_id = '{$this->_showId}' ORDER BY starts";
|
||||
|
||||
return $CC_DBC->GetAll($sql);
|
||||
}
|
||||
|
||||
public function getShowContent($start_timestamp) {
|
||||
global $CC_DBC;
|
||||
|
||||
$res = $this->getShowListContent($start_timestamp);
|
||||
|
||||
if(count($res) <= 0) {
|
||||
return $res;
|
||||
}
|
||||
|
||||
$items = array();
|
||||
$currGroupId = -1;
|
||||
$pl_counter = -1;
|
||||
$f_counter = -1;
|
||||
foreach ($res as $row) {
|
||||
if($currGroupId != $row["group_id"]){
|
||||
$currGroupId = $row["group_id"];
|
||||
$pl_counter = $pl_counter + 1;
|
||||
$f_counter = -1;
|
||||
|
||||
$items[$pl_counter]["pl_name"] = $row["name"];
|
||||
$items[$pl_counter]["pl_creator"] = $row["creator"];
|
||||
$items[$pl_counter]["pl_description"] = $row["description"];
|
||||
$items[$pl_counter]["pl_group"] = $row["group_id"];
|
||||
|
||||
$sql = "SELECT SUM(clip_length) FROM cc_schedule WHERE group_id = '{$currGroupId}'";
|
||||
$length = $CC_DBC->GetOne($sql);
|
||||
|
||||
$items[$pl_counter]["pl_length"] = $length;
|
||||
}
|
||||
$f_counter = $f_counter + 1;
|
||||
|
||||
$items[$pl_counter]["pl_content"][$f_counter]["f_name"] = $row["track_title"];
|
||||
$items[$pl_counter]["pl_content"][$f_counter]["f_artist"] = $row["artist_name"];
|
||||
$items[$pl_counter]["pl_content"][$f_counter]["f_length"] = $row["length"];
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
public function clearShow($day) {
|
||||
$timeinfo = explode(" ", $day);
|
||||
|
||||
$groups = CcShowScheduleQuery::create()
|
||||
->filterByDbShowId($this->_showId)
|
||||
->filterByDbShowDay($timeinfo[0])
|
||||
->find();
|
||||
|
||||
foreach($groups as $group) {
|
||||
$groupId = $group->getDbGroupId();
|
||||
CcScheduleQuery::create()
|
||||
->filterByDbGroupId($groupId)
|
||||
->delete();
|
||||
|
||||
$group->delete();
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteShow($timestamp, $dayId=NULL) {
|
||||
global $CC_DBC;
|
||||
|
||||
|
@ -465,7 +177,7 @@ class Show {
|
|||
}
|
||||
}
|
||||
|
||||
public function getShows($start_timestamp, $end_timestamp, $excludeInstance=NULL) {
|
||||
public static function getShows($start_timestamp, $end_timestamp, $excludeInstance=NULL) {
|
||||
global $CC_DBC;
|
||||
|
||||
$sql = "SELECT starts, ends, show_id, name, description, color, background_color, cc_show_instances.id AS instance_id
|
||||
|
@ -490,7 +202,7 @@ class Show {
|
|||
}
|
||||
|
||||
//for a show with repeat_type == -1
|
||||
private function populateNonRepeatingShow($show_id, $first_show, $start_time, $duration, $day, $end_timestamp) {
|
||||
private static function populateNonRepeatingShow($show_id, $first_show, $start_time, $duration, $day, $end_timestamp) {
|
||||
global $CC_DBC;
|
||||
|
||||
$next_date = $first_show." ".$start_time;
|
||||
|
@ -511,7 +223,7 @@ class Show {
|
|||
}
|
||||
|
||||
//for a show with repeat_type == 0
|
||||
private function populateWeeklyShow($show_id, $next_pop_date, $first_show, $last_show, $start_time, $duration, $day, $end_timestamp) {
|
||||
private static function populateWeeklyShow($show_id, $next_pop_date, $first_show, $last_show, $start_time, $duration, $day, $end_timestamp) {
|
||||
global $CC_DBC;
|
||||
|
||||
if(isset($next_pop_date)) {
|
||||
|
@ -549,18 +261,18 @@ class Show {
|
|||
->save();
|
||||
}
|
||||
|
||||
private function populateShow($repeat_type, $show_id, $next_pop_date, $first_show, $last_show, $start_time, $duration, $day, $end_timestamp) {
|
||||
private static function populateShow($repeat_type, $show_id, $next_pop_date, $first_show, $last_show, $start_time, $duration, $day, $end_timestamp) {
|
||||
|
||||
if($repeat_type == -1) {
|
||||
$this->populateNonRepeatingShow($show_id, $first_show, $start_time, $duration, $day, $end_timestamp);
|
||||
Show::populateNonRepeatingShow($show_id, $first_show, $start_time, $duration, $day, $end_timestamp);
|
||||
}
|
||||
else if($repeat_type == 0) {
|
||||
$this->populateWeeklyShow($show_id, $next_pop_date, $first_show, $last_show, $start_time, $duration, $day, $end_timestamp);
|
||||
Show::populateWeeklyShow($show_id, $next_pop_date, $first_show, $last_show, $start_time, $duration, $day, $end_timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
//used to catch up a newly added show
|
||||
private function populateShowUntilLastGeneratedDate($show_id) {
|
||||
private static function populateShowUntilLastGeneratedDate($show_id) {
|
||||
global $CC_DBC;
|
||||
$showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil();
|
||||
|
||||
|
@ -568,12 +280,12 @@ class Show {
|
|||
$res = $CC_DBC->GetAll($sql);
|
||||
|
||||
foreach($res as $row) {
|
||||
$this->populateShow($row["repeat_type"], $row["show_id"], $row["next_pop_date"], $row["first_show"],
|
||||
Show::populateShow($row["repeat_type"], $row["show_id"], $row["next_pop_date"], $row["first_show"],
|
||||
$row["last_show"], $row["start_time"], $row["duration"], $row["day"], $showsPopUntil);
|
||||
}
|
||||
}
|
||||
|
||||
public function populateShowsUntil($pop_timestamp, $end_timestamp) {
|
||||
public static function populateShowsUntil($pop_timestamp, $end_timestamp) {
|
||||
global $CC_DBC;
|
||||
|
||||
if($pop_timestamp != "") {
|
||||
|
@ -592,12 +304,12 @@ class Show {
|
|||
$res = $CC_DBC->GetAll($sql);
|
||||
|
||||
foreach($res as $row) {
|
||||
$this->populateShow($row["repeat_type"], $row["show_id"], $row["next_pop_date"], $row["first_show"],
|
||||
Show::populateShow($row["repeat_type"], $row["show_id"], $row["next_pop_date"], $row["first_show"],
|
||||
$row["last_show"], $row["start_time"], $row["duration"], $row["day"], $end_timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
public function getFullCalendarEvents($start, $end) {
|
||||
public static function getFullCalendarEvents($start, $end, $editable=false) {
|
||||
|
||||
$events = array();
|
||||
$showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil();
|
||||
|
@ -605,20 +317,24 @@ class Show {
|
|||
//if fullcalendar is requesting shows past our previous populated until date, generate shows up until this point.
|
||||
if($showsPopUntil == "" || strtotime($showsPopUntil) < strtotime($end)) {
|
||||
|
||||
$this->populateShowsUntil($showsPopUntil, $end);
|
||||
Show::populateShowsUntil($showsPopUntil, $end);
|
||||
Application_Model_Preference::SetShowsPopulatedUntil($end);
|
||||
}
|
||||
|
||||
$shows = $this->getShows($start, $end);
|
||||
$shows = Show::getShows($start, $end);
|
||||
|
||||
$today_timestamp = date("Y-m-d H:i:s");
|
||||
foreach ($shows as $show) {
|
||||
$events[] = $this->makeFullCalendarEvent($show);
|
||||
if($editable && strtotime($today_timestamp) < strtotime($show["starts"]))
|
||||
$events[] = Show::makeFullCalendarEvent($show, array("editable" => true));
|
||||
else
|
||||
$events[] = Show::makeFullCalendarEvent($show);
|
||||
}
|
||||
|
||||
return $events;
|
||||
}
|
||||
|
||||
private function makeFullCalendarEvent($show, $options=array()) {
|
||||
private static function makeFullCalendarEvent($show, $options=array()) {
|
||||
global $CC_DBC;
|
||||
|
||||
$event = array(
|
||||
|
@ -637,25 +353,238 @@ class Show {
|
|||
$event[$key] = $value;
|
||||
}
|
||||
|
||||
if($this->_user->isAdmin()) {
|
||||
$today_timestamp = date("Y-m-d H:i:s");
|
||||
|
||||
if(strtotime($today_timestamp) < strtotime($show["starts"])) {
|
||||
$event["editable"] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if($this->_user->isHost($show["show_id"])) {
|
||||
$event["isHost"] = true;
|
||||
}
|
||||
|
||||
$percent = Schedule::getPercentScheduledInRange($show["starts"], $show["ends"]);
|
||||
$event["percent"] = $percent;
|
||||
|
||||
return $event;
|
||||
}
|
||||
}
|
||||
|
||||
public function getShowLength($start_timestamp, $end_timestamp){
|
||||
class ShowInstance {
|
||||
|
||||
private $_instanceId;
|
||||
|
||||
public function __construct($instanceId)
|
||||
{
|
||||
$this->_instanceId = $instanceId;
|
||||
}
|
||||
|
||||
public function moveShow($deltaDay, $deltaMin){
|
||||
global $CC_DBC;
|
||||
|
||||
$showInstance = CcShowInstancesQuery::create()->findPK($this->_instanceId);
|
||||
|
||||
$hours = $deltaMin/60;
|
||||
if($hours > 0)
|
||||
$hours = floor($hours);
|
||||
else
|
||||
$hours = ceil($hours);
|
||||
|
||||
$mins = abs($deltaMin%60);
|
||||
|
||||
$starts = $showInstance->getDbStarts();
|
||||
$ends = $showInstance->getDbEnds();
|
||||
|
||||
$sql = "SELECT timestamp '{$starts}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'";
|
||||
$new_starts = $CC_DBC->GetOne($sql);
|
||||
|
||||
$sql = "SELECT timestamp '{$ends}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'";
|
||||
$new_ends = $CC_DBC->GetOne($sql);
|
||||
|
||||
$today_timestamp = date("Y-m-d H:i:s");
|
||||
if(strtotime($today_timestamp) > strtotime($new_starts)) {
|
||||
return "can't move show into past";
|
||||
}
|
||||
|
||||
$overlap = Show::getShows($new_starts, $new_ends, array($this->_instanceId));
|
||||
|
||||
if(count($overlap) > 0) {
|
||||
return $overlap;
|
||||
}
|
||||
|
||||
$showInstance
|
||||
->setDbStarts($new_starts)
|
||||
->setDbEnds($new_ends)
|
||||
->save();
|
||||
}
|
||||
|
||||
public function resizeShow($deltaDay, $deltaMin){
|
||||
global $CC_DBC;
|
||||
|
||||
$showInstance = CcShowInstancesQuery::create()->findPK($this->_instanceId);
|
||||
|
||||
$hours = $deltaMin/60;
|
||||
if($hours > 0)
|
||||
$hours = floor($hours);
|
||||
else
|
||||
$hours = ceil($hours);
|
||||
|
||||
$mins = abs($deltaMin%60);
|
||||
|
||||
$starts = $showInstance->getDbStarts();
|
||||
$ends = $showInstance->getDbEnds();
|
||||
|
||||
$sql = "SELECT timestamp '{$ends}' + interval '{$hours}:{$mins}'";
|
||||
$new_ends = $CC_DBC->GetOne($sql);
|
||||
|
||||
//only need to check overlap if show increased in size.
|
||||
if(strtotime($new_ends) > strtotime($ends)) {
|
||||
$overlap = Show::getShows($ends, $new_ends);
|
||||
|
||||
if(count($overlap) > 0) {
|
||||
return $overlap;
|
||||
}
|
||||
}
|
||||
|
||||
$showInstance
|
||||
->setDbEnds($new_ends)
|
||||
->save();
|
||||
|
||||
}
|
||||
|
||||
private function getNextPos($instanceId) {
|
||||
global $CC_DBC;
|
||||
|
||||
$timeinfo = explode(" ", $day);
|
||||
|
||||
$sql = "SELECT MAX(position)+1 from cc_show_schedule WHERE instance_id = '{$instanceId}'";
|
||||
$res = $CC_DBC->GetOne($sql);
|
||||
|
||||
if(is_null($res))
|
||||
return 0;
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
private function getLastGroupId($start_timestamp) {
|
||||
global $CC_DBC;
|
||||
|
||||
$timeinfo = explode(" ", $start_timestamp);
|
||||
|
||||
$sql = "SELECT MAX(group_id) from cc_show_schedule WHERE show_id = '{$this->_showId}' AND show_day = '{$timeinfo[0]}'";
|
||||
$res = $CC_DBC->GetOne($sql);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function addPlaylistToShow($start_timestamp, $plId) {
|
||||
|
||||
$sched = new ScheduleGroup();
|
||||
$lastGroupId = $this->getLastGroupId($start_timestamp);
|
||||
|
||||
if(is_null($lastGroupId)) {
|
||||
|
||||
$groupId = $sched->add($start_timestamp, null, $plId);
|
||||
}
|
||||
else {
|
||||
$groupId = $sched->addPlaylistAfter($lastGroupId, $plId);
|
||||
}
|
||||
|
||||
$instance = CcShowInstancesQuery::create()
|
||||
->filterByDbStarts()
|
||||
->findOne();
|
||||
|
||||
$instanceId = $instance->getDbId();
|
||||
$pos = $this->getNextPos($day);
|
||||
|
||||
$groupsched = new CcShowSchedule();
|
||||
$groupsched->setDbInstanceId($instanceId);
|
||||
$groupsched->setDbGroupId($groupId);
|
||||
$groupsched->setDbPosition($pos);
|
||||
$groupsched->save();
|
||||
}
|
||||
|
||||
public function scheduleShow($start_timestamp, $plIds) {
|
||||
|
||||
foreach($plIds as $plId) {
|
||||
$this->addPlaylistToShow($start_timestamp, $plId);
|
||||
}
|
||||
}
|
||||
|
||||
public function removeGroupFromShow($start_timestamp, $group_id){
|
||||
global $CC_DBC, $CC_CONFIG;
|
||||
|
||||
$timeinfo = explode(" ", $start_timestamp);
|
||||
|
||||
$group = CcShowScheduleQuery::create()
|
||||
->filterByDbShowId($this->_showId)
|
||||
->filterByDbGroupId($group_id)
|
||||
->filterByDbShowDay($timeinfo[0])
|
||||
->findOne();
|
||||
|
||||
$position = $group->getDbPosition();
|
||||
|
||||
$sql = "SELECT group_id FROM cc_show_schedule
|
||||
WHERE show_id = '{$this->_showId}' AND show_day = '{$timeinfo[0]}'
|
||||
AND position > '{$position}'";
|
||||
$followingGroups = $CC_DBC->GetAll($sql);
|
||||
|
||||
$sql = "SELECT SUM(clip_length) FROM ".$CC_CONFIG["scheduleTable"]." WHERE group_id='{$group_id}'";
|
||||
$group_length = $CC_DBC->GetOne($sql);
|
||||
|
||||
$sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]." WHERE group_id = '{$group_id}'";
|
||||
$CC_DBC->query($sql);
|
||||
|
||||
if(!is_null($followingGroups)) {
|
||||
$sql_opt = array();
|
||||
foreach ($followingGroups as $row) {
|
||||
$sql_opt[] = "group_id = {$row["group_id"]}";
|
||||
}
|
||||
$sql_group_ids = join(" OR ", $sql_opt);
|
||||
|
||||
$sql = "UPDATE ".$CC_CONFIG["scheduleTable"]."
|
||||
SET starts = (starts - INTERVAL '{$group_length}'), ends = (ends - INTERVAL '{$group_length}')
|
||||
WHERE " . $sql_group_ids;
|
||||
$CC_DBC->query($sql);
|
||||
}
|
||||
|
||||
$group->delete();
|
||||
|
||||
}
|
||||
|
||||
public function clearShow($day) {
|
||||
$timeinfo = explode(" ", $day);
|
||||
|
||||
$groups = CcShowScheduleQuery::create()
|
||||
->filterByDbShowId($this->_showId)
|
||||
->filterByDbShowDay($timeinfo[0])
|
||||
->find();
|
||||
|
||||
foreach($groups as $group) {
|
||||
$groupId = $group->getDbGroupId();
|
||||
CcScheduleQuery::create()
|
||||
->filterByDbGroupId($groupId)
|
||||
->delete();
|
||||
|
||||
$group->delete();
|
||||
}
|
||||
}
|
||||
|
||||
public function getTimeScheduled($start_timestamp, $end_timestamp) {
|
||||
|
||||
$time = Schedule::getTimeScheduledInRange($start_timestamp, $end_timestamp);
|
||||
|
||||
return $time;
|
||||
}
|
||||
|
||||
public function getTimeUnScheduled($start_timestamp, $end_timestamp) {
|
||||
|
||||
$time = Schedule::getTimeUnScheduledInRange($start_timestamp, $end_timestamp);
|
||||
|
||||
return $time;
|
||||
}
|
||||
|
||||
public function showHasContent($start_timestamp, $end_timestamp) {
|
||||
|
||||
$con = Propel::getConnection(CcShowPeer::DATABASE_NAME);
|
||||
$sql = "SELECT TIMESTAMP '{$end_timestamp}' - TIMESTAMP '{$start_timestamp}'";
|
||||
$r = $con->query($sql);
|
||||
$length = $r->fetchColumn(0);
|
||||
|
||||
return !Schedule::isScheduleEmptyInRange($start_timestamp, $length);
|
||||
}
|
||||
|
||||
public function getShowLength($start_timestamp, $end_timestamp){
|
||||
global $CC_DBC;
|
||||
|
||||
$sql = "SELECT TIMESTAMP '{$end_timestamp}' - TIMESTAMP '{$start_timestamp}' ";
|
||||
|
@ -670,6 +599,58 @@ class Show {
|
|||
|
||||
return StoredFile::searchPlaylistsForSchedule($length, $datatables);
|
||||
}
|
||||
|
||||
public function getShowListContent() {
|
||||
global $CC_DBC;
|
||||
|
||||
$sql = "SELECT *
|
||||
FROM (cc_show_schedule AS ss LEFT JOIN cc_schedule AS s USING(group_id)
|
||||
LEFT JOIN cc_files AS f ON f.id = s.file_id
|
||||
LEFT JOIN cc_playlist AS p ON p.id = s.playlist_id )
|
||||
|
||||
WHERE ss.instance_id = '{$this->_instanceId}' ORDER BY starts";
|
||||
|
||||
return $CC_DBC->GetAll($sql);
|
||||
}
|
||||
|
||||
public function getShowContent() {
|
||||
global $CC_DBC;
|
||||
|
||||
$res = $this->getShowListContent();
|
||||
|
||||
if(count($res) <= 0) {
|
||||
return $res;
|
||||
}
|
||||
|
||||
$items = array();
|
||||
$currGroupId = -1;
|
||||
$pl_counter = -1;
|
||||
$f_counter = -1;
|
||||
foreach ($res as $row) {
|
||||
if($currGroupId != $row["group_id"]){
|
||||
$currGroupId = $row["group_id"];
|
||||
$pl_counter = $pl_counter + 1;
|
||||
$f_counter = -1;
|
||||
|
||||
$items[$pl_counter]["pl_name"] = $row["name"];
|
||||
$items[$pl_counter]["pl_creator"] = $row["creator"];
|
||||
$items[$pl_counter]["pl_description"] = $row["description"];
|
||||
$items[$pl_counter]["pl_group"] = $row["group_id"];
|
||||
|
||||
$sql = "SELECT SUM(clip_length) FROM cc_schedule WHERE group_id = '{$currGroupId}'";
|
||||
$length = $CC_DBC->GetOne($sql);
|
||||
|
||||
$items[$pl_counter]["pl_length"] = $length;
|
||||
}
|
||||
$f_counter = $f_counter + 1;
|
||||
|
||||
$items[$pl_counter]["pl_content"][$f_counter]["f_name"] = $row["track_title"];
|
||||
$items[$pl_counter]["pl_content"][$f_counter]["f_artist"] = $row["artist_name"];
|
||||
$items[$pl_counter]["pl_content"][$f_counter]["f_length"] = $row["length"];
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
|
||||
/* Show Data Access Layer */
|
||||
|
|
|
@ -51,6 +51,7 @@ class CcShowInstancesTableMap extends TableMap {
|
|||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CcShow', 'CcShow', RelationMap::MANY_TO_ONE, array('show_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcShowSchedule', 'CcShowSchedule', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // CcShowInstancesTableMap
|
||||
|
|
|
@ -39,8 +39,7 @@ class CcShowScheduleTableMap extends TableMap {
|
|||
$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('SHOW_DAY', 'DbShowDay', 'DATE', true, null, null);
|
||||
$this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', true, null, null);
|
||||
$this->addColumn('POSITION', 'DbPosition', 'INTEGER', false, null, null);
|
||||
$this->addColumn('GROUP_ID', 'DbGroupId', 'INTEGER', true, null, null);
|
||||
// validators
|
||||
|
@ -51,7 +50,7 @@ class CcShowScheduleTableMap extends TableMap {
|
|||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CcShow', 'CcShow', RelationMap::MANY_TO_ONE, array('show_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // CcShowScheduleTableMap
|
||||
|
|
|
@ -54,7 +54,6 @@ class CcShowTableMap extends TableMap {
|
|||
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null);
|
||||
$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
|
||||
|
|
|
@ -70,11 +70,6 @@ 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.
|
||||
|
@ -377,8 +372,6 @@ abstract class BaseCcShow extends BaseObject implements Persistent
|
|||
|
||||
$this->collCcShowHostss = null;
|
||||
|
||||
$this->collCcShowSchedules = null;
|
||||
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
|
@ -536,14 +529,6 @@ 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;
|
||||
|
||||
}
|
||||
|
@ -639,14 +624,6 @@ 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;
|
||||
}
|
||||
|
@ -903,12 +880,6 @@ 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)
|
||||
|
||||
|
||||
|
@ -1306,115 +1277,6 @@ 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
|
||||
*/
|
||||
|
@ -1461,17 +1323,11 @@ 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->collCcShowInstancess = null;
|
||||
$this->collCcShowDayss = null;
|
||||
$this->collCcShowHostss = null;
|
||||
$this->collCcShowSchedules = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,6 +53,11 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
*/
|
||||
protected $aCcShow;
|
||||
|
||||
/**
|
||||
* @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.
|
||||
|
@ -405,6 +410,8 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->aCcShow = null;
|
||||
$this->collCcShowSchedules = null;
|
||||
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
|
@ -550,6 +557,14 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
|
||||
}
|
||||
|
||||
if ($this->collCcShowSchedules !== null) {
|
||||
foreach ($this->collCcShowSchedules as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted()) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
}
|
||||
|
@ -633,6 +648,14 @@ abstract class BaseCcShowInstances 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;
|
||||
}
|
||||
|
@ -862,6 +885,20 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
$copyObj->setDbEnds($this->ends);
|
||||
$copyObj->setDbShowId($this->show_id);
|
||||
|
||||
if ($deepCopy) {
|
||||
// important: temporarily setNew(false) because this affects the behavior of
|
||||
// the getter/setter methods for fkey referrer objects.
|
||||
$copyObj->setNew(false);
|
||||
|
||||
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)
|
||||
|
||||
|
||||
$copyObj->setNew(true);
|
||||
$copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
|
||||
}
|
||||
|
@ -953,6 +990,115 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
return $this->aCcShow;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 CcShowInstances 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)
|
||||
->filterByCcShowInstances($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
|
||||
->filterByCcShowInstances($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->setCcShowInstances($this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current object and sets all attributes to their default values
|
||||
*/
|
||||
|
@ -982,8 +1128,14 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
public function clearAllReferences($deep = false)
|
||||
{
|
||||
if ($deep) {
|
||||
if ($this->collCcShowSchedules) {
|
||||
foreach ((array) $this->collCcShowSchedules as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
$this->collCcShowSchedules = null;
|
||||
$this->aCcShow = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -353,6 +353,9 @@ abstract class BaseCcShowInstancesPeer {
|
|||
*/
|
||||
public static function clearRelatedInstancePool()
|
||||
{
|
||||
// Invalidate objects in CcShowSchedulePeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
CcShowSchedulePeer::clearInstancePool();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
* @method CcShowInstancesQuery rightJoinCcShow($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShow relation
|
||||
* @method CcShowInstancesQuery innerJoinCcShow($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShow relation
|
||||
*
|
||||
* @method CcShowInstancesQuery leftJoinCcShowSchedule($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowSchedule relation
|
||||
* @method CcShowInstancesQuery rightJoinCcShowSchedule($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowSchedule relation
|
||||
* @method CcShowInstancesQuery innerJoinCcShowSchedule($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowSchedule relation
|
||||
*
|
||||
* @method CcShowInstances findOne(PropelPDO $con = null) Return the first CcShowInstances matching the query
|
||||
* @method CcShowInstances findOneOrCreate(PropelPDO $con = null) Return the first CcShowInstances matching the query, or a new CcShowInstances object populated from the query conditions when no match is found
|
||||
*
|
||||
|
@ -319,6 +323,70 @@ abstract class BaseCcShowInstancesQuery extends ModelCriteria
|
|||
->useQuery($relationAlias ? $relationAlias : 'CcShow', 'CcShowQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 CcShowInstancesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCcShowSchedule($ccShowSchedule, $comparison = null)
|
||||
{
|
||||
return $this
|
||||
->addUsingAlias(CcShowInstancesPeer::ID, $ccShowSchedule->getDbInstanceId(), $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 CcShowInstancesQuery 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
|
||||
*
|
||||
|
|
|
@ -367,9 +367,6 @@ 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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,10 +34,6 @@
|
|||
* @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
|
||||
*
|
||||
|
@ -458,70 +454,6 @@ 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
|
||||
*
|
||||
|
|
|
@ -31,16 +31,10 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
protected $id;
|
||||
|
||||
/**
|
||||
* The value for the show_id field.
|
||||
* The value for the instance_id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $show_id;
|
||||
|
||||
/**
|
||||
* The value for the show_day field.
|
||||
* @var string
|
||||
*/
|
||||
protected $show_day;
|
||||
protected $instance_id;
|
||||
|
||||
/**
|
||||
* The value for the position field.
|
||||
|
@ -55,9 +49,9 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
protected $group_id;
|
||||
|
||||
/**
|
||||
* @var CcShow
|
||||
* @var CcShowInstances
|
||||
*/
|
||||
protected $aCcShow;
|
||||
protected $aCcShowInstances;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
|
@ -84,46 +78,13 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the [show_id] column value.
|
||||
* Get the [instance_id] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDbShowId()
|
||||
public function getDbInstanceId()
|
||||
{
|
||||
return $this->show_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [show_day] column value.
|
||||
*
|
||||
*
|
||||
* @param string $format The date/time format string (either date()-style or strftime()-style).
|
||||
* If format is NULL, then the raw DateTime object will be returned.
|
||||
* @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 getDbShowDay($format = '%x')
|
||||
{
|
||||
if ($this->show_day === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
try {
|
||||
$dt = new DateTime($this->show_day);
|
||||
} catch (Exception $x) {
|
||||
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->show_day, true), $x);
|
||||
}
|
||||
|
||||
if ($format === null) {
|
||||
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
|
||||
return $dt;
|
||||
} elseif (strpos($format, '%') !== false) {
|
||||
return strftime($format, $dt->format('U'));
|
||||
} else {
|
||||
return $dt->format($format);
|
||||
}
|
||||
return $this->instance_id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -167,77 +128,28 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
} // setDbId()
|
||||
|
||||
/**
|
||||
* Set the value of [show_id] column.
|
||||
* Set the value of [instance_id] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return CcShowSchedule The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbShowId($v)
|
||||
public function setDbInstanceId($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->show_id !== $v) {
|
||||
$this->show_id = $v;
|
||||
$this->modifiedColumns[] = CcShowSchedulePeer::SHOW_ID;
|
||||
if ($this->instance_id !== $v) {
|
||||
$this->instance_id = $v;
|
||||
$this->modifiedColumns[] = CcShowSchedulePeer::INSTANCE_ID;
|
||||
}
|
||||
|
||||
if ($this->aCcShow !== null && $this->aCcShow->getDbId() !== $v) {
|
||||
$this->aCcShow = null;
|
||||
if ($this->aCcShowInstances !== null && $this->aCcShowInstances->getDbId() !== $v) {
|
||||
$this->aCcShowInstances = null;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // setDbShowId()
|
||||
|
||||
/**
|
||||
* Sets the value of [show_day] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
|
||||
* be treated as NULL for temporal objects.
|
||||
* @return CcShowSchedule The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbShowDay($v)
|
||||
{
|
||||
// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
|
||||
// -- which is unexpected, to say the least.
|
||||
if ($v === null || $v === '') {
|
||||
$dt = null;
|
||||
} elseif ($v instanceof DateTime) {
|
||||
$dt = $v;
|
||||
} else {
|
||||
// some string/numeric value passed; we normalize that so that we can
|
||||
// validate it.
|
||||
try {
|
||||
if (is_numeric($v)) { // if it's a unix timestamp
|
||||
$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
|
||||
// We have to explicitly specify and then change the time zone because of a
|
||||
// DateTime bug: http://bugs.php.net/bug.php?id=43003
|
||||
$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
|
||||
} else {
|
||||
$dt = new DateTime($v);
|
||||
}
|
||||
} catch (Exception $x) {
|
||||
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
|
||||
}
|
||||
}
|
||||
|
||||
if ( $this->show_day !== null || $dt !== null ) {
|
||||
// (nested ifs are a little easier to read in this case)
|
||||
|
||||
$currNorm = ($this->show_day !== null && $tmpDt = new DateTime($this->show_day)) ? $tmpDt->format('Y-m-d') : null;
|
||||
$newNorm = ($dt !== null) ? $dt->format('Y-m-d') : null;
|
||||
|
||||
if ( ($currNorm !== $newNorm) // normalized values don't match
|
||||
)
|
||||
{
|
||||
$this->show_day = ($dt ? $dt->format('Y-m-d') : null);
|
||||
$this->modifiedColumns[] = CcShowSchedulePeer::SHOW_DAY;
|
||||
}
|
||||
} // if either are not null
|
||||
|
||||
return $this;
|
||||
} // setDbShowDay()
|
||||
} // setDbInstanceId()
|
||||
|
||||
/**
|
||||
* Set the value of [position] column.
|
||||
|
@ -312,10 +224,9 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
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->show_day = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
|
||||
$this->position = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
|
||||
$this->group_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
|
||||
$this->instance_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
|
||||
$this->position = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
|
||||
$this->group_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
|
@ -324,7 +235,7 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 5; // 5 = CcShowSchedulePeer::NUM_COLUMNS - CcShowSchedulePeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
return $startcol + 4; // 4 = CcShowSchedulePeer::NUM_COLUMNS - CcShowSchedulePeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating CcShowSchedule object", $e);
|
||||
|
@ -347,8 +258,8 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
public function ensureConsistency()
|
||||
{
|
||||
|
||||
if ($this->aCcShow !== null && $this->show_id !== $this->aCcShow->getDbId()) {
|
||||
$this->aCcShow = null;
|
||||
if ($this->aCcShowInstances !== null && $this->instance_id !== $this->aCcShowInstances->getDbId()) {
|
||||
$this->aCcShowInstances = null;
|
||||
}
|
||||
} // ensureConsistency
|
||||
|
||||
|
@ -389,7 +300,7 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->aCcShow = null;
|
||||
$this->aCcShowInstances = null;
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
|
@ -505,11 +416,11 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
// 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);
|
||||
if ($this->aCcShowInstances !== null) {
|
||||
if ($this->aCcShowInstances->isModified() || $this->aCcShowInstances->isNew()) {
|
||||
$affectedRows += $this->aCcShowInstances->save($con);
|
||||
}
|
||||
$this->setCcShow($this->aCcShow);
|
||||
$this->setCcShowInstances($this->aCcShowInstances);
|
||||
}
|
||||
|
||||
if ($this->isNew() ) {
|
||||
|
@ -606,9 +517,9 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
// 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 ($this->aCcShowInstances !== null) {
|
||||
if (!$this->aCcShowInstances->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->aCcShowInstances->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -655,15 +566,12 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
return $this->getDbId();
|
||||
break;
|
||||
case 1:
|
||||
return $this->getDbShowId();
|
||||
return $this->getDbInstanceId();
|
||||
break;
|
||||
case 2:
|
||||
return $this->getDbShowDay();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getDbPosition();
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
return $this->getDbGroupId();
|
||||
break;
|
||||
default:
|
||||
|
@ -691,14 +599,13 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
$keys = CcShowSchedulePeer::getFieldNames($keyType);
|
||||
$result = array(
|
||||
$keys[0] => $this->getDbId(),
|
||||
$keys[1] => $this->getDbShowId(),
|
||||
$keys[2] => $this->getDbShowDay(),
|
||||
$keys[3] => $this->getDbPosition(),
|
||||
$keys[4] => $this->getDbGroupId(),
|
||||
$keys[1] => $this->getDbInstanceId(),
|
||||
$keys[2] => $this->getDbPosition(),
|
||||
$keys[3] => $this->getDbGroupId(),
|
||||
);
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->aCcShow) {
|
||||
$result['CcShow'] = $this->aCcShow->toArray($keyType, $includeLazyLoadColumns, true);
|
||||
if (null !== $this->aCcShowInstances) {
|
||||
$result['CcShowInstances'] = $this->aCcShowInstances->toArray($keyType, $includeLazyLoadColumns, true);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
|
@ -735,15 +642,12 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
$this->setDbId($value);
|
||||
break;
|
||||
case 1:
|
||||
$this->setDbShowId($value);
|
||||
$this->setDbInstanceId($value);
|
||||
break;
|
||||
case 2:
|
||||
$this->setDbShowDay($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setDbPosition($value);
|
||||
break;
|
||||
case 4:
|
||||
case 3:
|
||||
$this->setDbGroupId($value);
|
||||
break;
|
||||
} // switch()
|
||||
|
@ -771,10 +675,9 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
$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->setDbShowDay($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setDbPosition($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setDbGroupId($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setDbInstanceId($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setDbPosition($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setDbGroupId($arr[$keys[3]]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -787,8 +690,7 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
$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::SHOW_DAY)) $criteria->add(CcShowSchedulePeer::SHOW_DAY, $this->show_day);
|
||||
if ($this->isColumnModified(CcShowSchedulePeer::INSTANCE_ID)) $criteria->add(CcShowSchedulePeer::INSTANCE_ID, $this->instance_id);
|
||||
if ($this->isColumnModified(CcShowSchedulePeer::POSITION)) $criteria->add(CcShowSchedulePeer::POSITION, $this->position);
|
||||
if ($this->isColumnModified(CcShowSchedulePeer::GROUP_ID)) $criteria->add(CcShowSchedulePeer::GROUP_ID, $this->group_id);
|
||||
|
||||
|
@ -852,8 +754,7 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
*/
|
||||
public function copyInto($copyObj, $deepCopy = false)
|
||||
{
|
||||
$copyObj->setDbShowId($this->show_id);
|
||||
$copyObj->setDbShowDay($this->show_day);
|
||||
$copyObj->setDbInstanceId($this->instance_id);
|
||||
$copyObj->setDbPosition($this->position);
|
||||
$copyObj->setDbGroupId($this->group_id);
|
||||
|
||||
|
@ -900,24 +801,24 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
}
|
||||
|
||||
/**
|
||||
* Declares an association between this object and a CcShow object.
|
||||
* Declares an association between this object and a CcShowInstances object.
|
||||
*
|
||||
* @param CcShow $v
|
||||
* @param CcShowInstances $v
|
||||
* @return CcShowSchedule The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setCcShow(CcShow $v = null)
|
||||
public function setCcShowInstances(CcShowInstances $v = null)
|
||||
{
|
||||
if ($v === null) {
|
||||
$this->setDbShowId(NULL);
|
||||
$this->setDbInstanceId(NULL);
|
||||
} else {
|
||||
$this->setDbShowId($v->getDbId());
|
||||
$this->setDbInstanceId($v->getDbId());
|
||||
}
|
||||
|
||||
$this->aCcShow = $v;
|
||||
$this->aCcShowInstances = $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 this object has already been added to the CcShowInstances object, it will not be re-added.
|
||||
if ($v !== null) {
|
||||
$v->addCcShowSchedule($this);
|
||||
}
|
||||
|
@ -927,25 +828,25 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
|
||||
|
||||
/**
|
||||
* Get the associated CcShow object
|
||||
* Get the associated CcShowInstances object
|
||||
*
|
||||
* @param PropelPDO Optional Connection object.
|
||||
* @return CcShow The associated CcShow object.
|
||||
* @return CcShowInstances The associated CcShowInstances object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getCcShow(PropelPDO $con = null)
|
||||
public function getCcShowInstances(PropelPDO $con = null)
|
||||
{
|
||||
if ($this->aCcShow === null && ($this->show_id !== null)) {
|
||||
$this->aCcShow = CcShowQuery::create()->findPk($this->show_id, $con);
|
||||
if ($this->aCcShowInstances === null && ($this->instance_id !== null)) {
|
||||
$this->aCcShowInstances = CcShowInstancesQuery::create()->findPk($this->instance_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);
|
||||
$this->aCcShowInstances->addCcShowSchedules($this);
|
||||
*/
|
||||
}
|
||||
return $this->aCcShow;
|
||||
return $this->aCcShowInstances;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -954,8 +855,7 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
public function clear()
|
||||
{
|
||||
$this->id = null;
|
||||
$this->show_id = null;
|
||||
$this->show_day = null;
|
||||
$this->instance_id = null;
|
||||
$this->position = null;
|
||||
$this->group_id = null;
|
||||
$this->alreadyInSave = false;
|
||||
|
@ -980,7 +880,7 @@ abstract class BaseCcShowSchedule extends BaseObject implements Persistent
|
|||
if ($deep) {
|
||||
} // if ($deep)
|
||||
|
||||
$this->aCcShow = null;
|
||||
$this->aCcShowInstances = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,7 +26,7 @@ abstract class BaseCcShowSchedulePeer {
|
|||
const TM_CLASS = 'CcShowScheduleTableMap';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 5;
|
||||
const NUM_COLUMNS = 4;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
@ -34,11 +34,8 @@ abstract class BaseCcShowSchedulePeer {
|
|||
/** the column name for the ID field */
|
||||
const ID = 'cc_show_schedule.ID';
|
||||
|
||||
/** the column name for the SHOW_ID field */
|
||||
const SHOW_ID = 'cc_show_schedule.SHOW_ID';
|
||||
|
||||
/** the column name for the SHOW_DAY field */
|
||||
const SHOW_DAY = 'cc_show_schedule.SHOW_DAY';
|
||||
/** the column name for the INSTANCE_ID field */
|
||||
const INSTANCE_ID = 'cc_show_schedule.INSTANCE_ID';
|
||||
|
||||
/** the column name for the POSITION field */
|
||||
const POSITION = 'cc_show_schedule.POSITION';
|
||||
|
@ -62,12 +59,12 @@ abstract class BaseCcShowSchedulePeer {
|
|||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
private static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbShowId', 'DbShowDay', 'DbPosition', 'DbGroupId', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbShowId', 'dbShowDay', 'dbPosition', 'dbGroupId', ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID, self::SHOW_ID, self::SHOW_DAY, self::POSITION, self::GROUP_ID, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'SHOW_ID', 'SHOW_DAY', 'POSITION', 'GROUP_ID', ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'show_id', 'show_day', 'position', 'group_id', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbInstanceId', 'DbPosition', 'DbGroupId', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbInstanceId', 'dbPosition', 'dbGroupId', ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID, self::INSTANCE_ID, self::POSITION, self::GROUP_ID, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'INSTANCE_ID', 'POSITION', 'GROUP_ID', ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'instance_id', 'position', 'group_id', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -77,12 +74,12 @@ abstract class BaseCcShowSchedulePeer {
|
|||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
private static $fieldKeys = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbShowId' => 1, 'DbShowDay' => 2, 'DbPosition' => 3, 'DbGroupId' => 4, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbShowId' => 1, 'dbShowDay' => 2, 'dbPosition' => 3, 'dbGroupId' => 4, ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::SHOW_ID => 1, self::SHOW_DAY => 2, self::POSITION => 3, self::GROUP_ID => 4, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'SHOW_ID' => 1, 'SHOW_DAY' => 2, 'POSITION' => 3, 'GROUP_ID' => 4, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'show_id' => 1, 'show_day' => 2, 'position' => 3, 'group_id' => 4, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbInstanceId' => 1, 'DbPosition' => 2, 'DbGroupId' => 3, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbInstanceId' => 1, 'dbPosition' => 2, 'dbGroupId' => 3, ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::INSTANCE_ID => 1, self::POSITION => 2, self::GROUP_ID => 3, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'INSTANCE_ID' => 1, 'POSITION' => 2, 'GROUP_ID' => 3, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'instance_id' => 1, 'position' => 2, 'group_id' => 3, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -155,14 +152,12 @@ abstract class BaseCcShowSchedulePeer {
|
|||
{
|
||||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(CcShowSchedulePeer::ID);
|
||||
$criteria->addSelectColumn(CcShowSchedulePeer::SHOW_ID);
|
||||
$criteria->addSelectColumn(CcShowSchedulePeer::SHOW_DAY);
|
||||
$criteria->addSelectColumn(CcShowSchedulePeer::INSTANCE_ID);
|
||||
$criteria->addSelectColumn(CcShowSchedulePeer::POSITION);
|
||||
$criteria->addSelectColumn(CcShowSchedulePeer::GROUP_ID);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.SHOW_ID');
|
||||
$criteria->addSelectColumn($alias . '.SHOW_DAY');
|
||||
$criteria->addSelectColumn($alias . '.INSTANCE_ID');
|
||||
$criteria->addSelectColumn($alias . '.POSITION');
|
||||
$criteria->addSelectColumn($alias . '.GROUP_ID');
|
||||
}
|
||||
|
@ -451,7 +446,7 @@ abstract class BaseCcShowSchedulePeer {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related CcShow table
|
||||
* Returns the number of rows matching criteria, joining the related CcShowInstances table
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
|
||||
|
@ -459,7 +454,7 @@ abstract class BaseCcShowSchedulePeer {
|
|||
* @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)
|
||||
public static function doCountJoinCcShowInstances(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;
|
||||
|
@ -486,7 +481,7 @@ abstract class BaseCcShowSchedulePeer {
|
|||
$con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(CcShowSchedulePeer::SHOW_ID, CcShowPeer::ID, $join_behavior);
|
||||
$criteria->addJoin(CcShowSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doCount($criteria, $con);
|
||||
|
||||
|
@ -501,7 +496,7 @@ abstract class BaseCcShowSchedulePeer {
|
|||
|
||||
|
||||
/**
|
||||
* Selects a collection of CcShowSchedule objects pre-filled with their CcShow objects.
|
||||
* Selects a collection of CcShowSchedule objects pre-filled with their CcShowInstances objects.
|
||||
* @param Criteria $criteria
|
||||
* @param PropelPDO $con
|
||||
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
|
||||
|
@ -509,7 +504,7 @@ abstract class BaseCcShowSchedulePeer {
|
|||
* @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)
|
||||
public static function doSelectJoinCcShowInstances(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
|
||||
|
@ -520,9 +515,9 @@ abstract class BaseCcShowSchedulePeer {
|
|||
|
||||
CcShowSchedulePeer::addSelectColumns($criteria);
|
||||
$startcol = (CcShowSchedulePeer::NUM_COLUMNS - CcShowSchedulePeer::NUM_LAZY_LOAD_COLUMNS);
|
||||
CcShowPeer::addSelectColumns($criteria);
|
||||
CcShowInstancesPeer::addSelectColumns($criteria);
|
||||
|
||||
$criteria->addJoin(CcShowSchedulePeer::SHOW_ID, CcShowPeer::ID, $join_behavior);
|
||||
$criteria->addJoin(CcShowSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
@ -542,19 +537,19 @@ abstract class BaseCcShowSchedulePeer {
|
|||
CcShowSchedulePeer::addInstanceToPool($obj1, $key1);
|
||||
} // if $obj1 already loaded
|
||||
|
||||
$key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol);
|
||||
$key2 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol);
|
||||
if ($key2 !== null) {
|
||||
$obj2 = CcShowPeer::getInstanceFromPool($key2);
|
||||
$obj2 = CcShowInstancesPeer::getInstanceFromPool($key2);
|
||||
if (!$obj2) {
|
||||
|
||||
$cls = CcShowPeer::getOMClass(false);
|
||||
$cls = CcShowInstancesPeer::getOMClass(false);
|
||||
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($row, $startcol);
|
||||
CcShowPeer::addInstanceToPool($obj2, $key2);
|
||||
CcShowInstancesPeer::addInstanceToPool($obj2, $key2);
|
||||
} // if obj2 already loaded
|
||||
|
||||
// Add the $obj1 (CcShowSchedule) to $obj2 (CcShow)
|
||||
// Add the $obj1 (CcShowSchedule) to $obj2 (CcShowInstances)
|
||||
$obj2->addCcShowSchedule($obj1);
|
||||
|
||||
} // if joined row was not null
|
||||
|
@ -602,7 +597,7 @@ abstract class BaseCcShowSchedulePeer {
|
|||
$con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(CcShowSchedulePeer::SHOW_ID, CcShowPeer::ID, $join_behavior);
|
||||
$criteria->addJoin(CcShowSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doCount($criteria, $con);
|
||||
|
||||
|
@ -637,10 +632,10 @@ abstract class BaseCcShowSchedulePeer {
|
|||
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);
|
||||
CcShowInstancesPeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||
|
||||
$criteria->addJoin(CcShowSchedulePeer::SHOW_ID, CcShowPeer::ID, $join_behavior);
|
||||
$criteria->addJoin(CcShowSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
@ -659,21 +654,21 @@ abstract class BaseCcShowSchedulePeer {
|
|||
CcShowSchedulePeer::addInstanceToPool($obj1, $key1);
|
||||
} // if obj1 already loaded
|
||||
|
||||
// Add objects for joined CcShow rows
|
||||
// Add objects for joined CcShowInstances rows
|
||||
|
||||
$key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol2);
|
||||
$key2 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
|
||||
if ($key2 !== null) {
|
||||
$obj2 = CcShowPeer::getInstanceFromPool($key2);
|
||||
$obj2 = CcShowInstancesPeer::getInstanceFromPool($key2);
|
||||
if (!$obj2) {
|
||||
|
||||
$cls = CcShowPeer::getOMClass(false);
|
||||
$cls = CcShowInstancesPeer::getOMClass(false);
|
||||
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($row, $startcol2);
|
||||
CcShowPeer::addInstanceToPool($obj2, $key2);
|
||||
CcShowInstancesPeer::addInstanceToPool($obj2, $key2);
|
||||
} // if obj2 loaded
|
||||
|
||||
// Add the $obj1 (CcShowSchedule) to the collection in $obj2 (CcShow)
|
||||
// Add the $obj1 (CcShowSchedule) to the collection in $obj2 (CcShowInstances)
|
||||
$obj2->addCcShowSchedule($obj1);
|
||||
} // if joined row not null
|
||||
|
||||
|
|
|
@ -7,14 +7,12 @@
|
|||
*
|
||||
*
|
||||
* @method CcShowScheduleQuery orderByDbId($order = Criteria::ASC) Order by the id column
|
||||
* @method CcShowScheduleQuery orderByDbShowId($order = Criteria::ASC) Order by the show_id column
|
||||
* @method CcShowScheduleQuery orderByDbShowDay($order = Criteria::ASC) Order by the show_day column
|
||||
* @method CcShowScheduleQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column
|
||||
* @method CcShowScheduleQuery orderByDbPosition($order = Criteria::ASC) Order by the position column
|
||||
* @method CcShowScheduleQuery orderByDbGroupId($order = Criteria::ASC) Order by the group_id column
|
||||
*
|
||||
* @method CcShowScheduleQuery groupByDbId() Group by the id column
|
||||
* @method CcShowScheduleQuery groupByDbShowId() Group by the show_id column
|
||||
* @method CcShowScheduleQuery groupByDbShowDay() Group by the show_day column
|
||||
* @method CcShowScheduleQuery groupByDbInstanceId() Group by the instance_id column
|
||||
* @method CcShowScheduleQuery groupByDbPosition() Group by the position column
|
||||
* @method CcShowScheduleQuery groupByDbGroupId() Group by the group_id column
|
||||
*
|
||||
|
@ -22,22 +20,20 @@
|
|||
* @method CcShowScheduleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method CcShowScheduleQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method CcShowScheduleQuery leftJoinCcShow($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShow relation
|
||||
* @method CcShowScheduleQuery rightJoinCcShow($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShow relation
|
||||
* @method CcShowScheduleQuery innerJoinCcShow($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShow relation
|
||||
* @method CcShowScheduleQuery leftJoinCcShowInstances($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowInstances relation
|
||||
* @method CcShowScheduleQuery rightJoinCcShowInstances($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowInstances relation
|
||||
* @method CcShowScheduleQuery innerJoinCcShowInstances($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowInstances relation
|
||||
*
|
||||
* @method CcShowSchedule findOne(PropelPDO $con = null) Return the first CcShowSchedule matching the query
|
||||
* @method CcShowSchedule findOneOrCreate(PropelPDO $con = null) Return the first CcShowSchedule matching the query, or a new CcShowSchedule object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method CcShowSchedule findOneByDbId(int $id) Return the first CcShowSchedule filtered by the id column
|
||||
* @method CcShowSchedule findOneByDbShowId(int $show_id) Return the first CcShowSchedule filtered by the show_id column
|
||||
* @method CcShowSchedule findOneByDbShowDay(string $show_day) Return the first CcShowSchedule filtered by the show_day column
|
||||
* @method CcShowSchedule findOneByDbInstanceId(int $instance_id) Return the first CcShowSchedule filtered by the instance_id column
|
||||
* @method CcShowSchedule findOneByDbPosition(int $position) Return the first CcShowSchedule filtered by the position column
|
||||
* @method CcShowSchedule findOneByDbGroupId(int $group_id) Return the first CcShowSchedule filtered by the group_id column
|
||||
*
|
||||
* @method array findByDbId(int $id) Return CcShowSchedule objects filtered by the id column
|
||||
* @method array findByDbShowId(int $show_id) Return CcShowSchedule objects filtered by the show_id column
|
||||
* @method array findByDbShowDay(string $show_day) Return CcShowSchedule objects filtered by the show_day column
|
||||
* @method array findByDbInstanceId(int $instance_id) Return CcShowSchedule objects filtered by the instance_id column
|
||||
* @method array findByDbPosition(int $position) Return CcShowSchedule objects filtered by the position column
|
||||
* @method array findByDbGroupId(int $group_id) Return CcShowSchedule objects filtered by the group_id column
|
||||
*
|
||||
|
@ -167,24 +163,24 @@ abstract class BaseCcShowScheduleQuery extends ModelCriteria
|
|||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the show_id column
|
||||
* Filter the query on the instance_id column
|
||||
*
|
||||
* @param int|array $dbShowId The value to use as filter.
|
||||
* @param int|array $dbInstanceId 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)
|
||||
public function filterByDbInstanceId($dbInstanceId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($dbShowId)) {
|
||||
if (is_array($dbInstanceId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($dbShowId['min'])) {
|
||||
$this->addUsingAlias(CcShowSchedulePeer::SHOW_ID, $dbShowId['min'], Criteria::GREATER_EQUAL);
|
||||
if (isset($dbInstanceId['min'])) {
|
||||
$this->addUsingAlias(CcShowSchedulePeer::INSTANCE_ID, $dbInstanceId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($dbShowId['max'])) {
|
||||
$this->addUsingAlias(CcShowSchedulePeer::SHOW_ID, $dbShowId['max'], Criteria::LESS_EQUAL);
|
||||
if (isset($dbInstanceId['max'])) {
|
||||
$this->addUsingAlias(CcShowSchedulePeer::INSTANCE_ID, $dbInstanceId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
|
@ -194,38 +190,7 @@ abstract class BaseCcShowScheduleQuery extends ModelCriteria
|
|||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
return $this->addUsingAlias(CcShowSchedulePeer::SHOW_ID, $dbShowId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the show_day column
|
||||
*
|
||||
* @param string|array $dbShowDay 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 filterByDbShowDay($dbShowDay = null, $comparison = null)
|
||||
{
|
||||
if (is_array($dbShowDay)) {
|
||||
$useMinMax = false;
|
||||
if (isset($dbShowDay['min'])) {
|
||||
$this->addUsingAlias(CcShowSchedulePeer::SHOW_DAY, $dbShowDay['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($dbShowDay['max'])) {
|
||||
$this->addUsingAlias(CcShowSchedulePeer::SHOW_DAY, $dbShowDay['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
return $this->addUsingAlias(CcShowSchedulePeer::SHOW_DAY, $dbShowDay, $comparison);
|
||||
return $this->addUsingAlias(CcShowSchedulePeer::INSTANCE_ID, $dbInstanceId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -291,31 +256,31 @@ abstract class BaseCcShowScheduleQuery extends ModelCriteria
|
|||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related CcShow object
|
||||
* Filter the query by a related CcShowInstances object
|
||||
*
|
||||
* @param CcShow $ccShow the related object to use as filter
|
||||
* @param CcShowInstances $ccShowInstances 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)
|
||||
public function filterByCcShowInstances($ccShowInstances, $comparison = null)
|
||||
{
|
||||
return $this
|
||||
->addUsingAlias(CcShowSchedulePeer::SHOW_ID, $ccShow->getDbId(), $comparison);
|
||||
->addUsingAlias(CcShowSchedulePeer::INSTANCE_ID, $ccShowInstances->getDbId(), $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the CcShow relation
|
||||
* Adds a JOIN clause to the query using the CcShowInstances 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)
|
||||
public function joinCcShowInstances($relationAlias = '', $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('CcShow');
|
||||
$relationMap = $tableMap->getRelation('CcShowInstances');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
|
@ -330,14 +295,14 @@ abstract class BaseCcShowScheduleQuery extends ModelCriteria
|
|||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'CcShow');
|
||||
$this->addJoinObject($join, 'CcShowInstances');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the CcShow relation CcShow object
|
||||
* Use the CcShowInstances relation CcShowInstances object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
|
@ -345,13 +310,13 @@ abstract class BaseCcShowScheduleQuery extends ModelCriteria
|
|||
* 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
|
||||
* @return CcShowInstancesQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCcShowQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
|
||||
public function useCcShowInstancesQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCcShow($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'CcShow', 'CcShowQuery');
|
||||
->joinCcShowInstances($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'CcShowInstances', 'CcShowInstancesQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#Note: project.home is automatically generated by the propel-install script.
|
||||
#Any manual changes to this value will be overwritten.
|
||||
project.home = /home/naomi/dev-campcaster/campcaster
|
||||
project.home = /home/naomiaro/dev-campcaster/campcaster
|
||||
project.build = ${project.home}/build
|
||||
|
||||
#Database driver
|
||||
|
|
|
@ -164,12 +164,11 @@
|
|||
</table>
|
||||
<table name="cc_show_schedule" phpName="CcShowSchedule">
|
||||
<column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
|
||||
<column name="show_id" phpName="DbShowId" type="INTEGER" required="true"/>
|
||||
<column name="show_day" phpName="DbShowDay" type="DATE" required="true"/>
|
||||
<column name="instance_id" phpName="DbInstanceId" type="INTEGER" required="true"/>
|
||||
<column name="position" phpName="DbPosition" type="INTEGER" required="false"/>
|
||||
<column name="group_id" phpName="DbGroupId" type="INTEGER" required="true"/>
|
||||
<foreign-key foreignTable="cc_show" name="cc_perm_show_fkey" onDelete="CASCADE">
|
||||
<reference local="show_id" foreign="id"/>
|
||||
<foreign-key foreignTable="cc_show_instances" name="cc_show_inst_fkey" onDelete="CASCADE">
|
||||
<reference local="instance_id" foreign="id"/>
|
||||
</foreign-key>
|
||||
</table>
|
||||
<table name="cc_playlist" phpName="CcPlaylist">
|
||||
|
|
|
@ -246,8 +246,7 @@ DROP TABLE "cc_show_schedule" CASCADE;
|
|||
CREATE TABLE "cc_show_schedule"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"show_id" INTEGER NOT NULL,
|
||||
"show_day" DATE NOT NULL,
|
||||
"instance_id" INTEGER NOT NULL,
|
||||
"position" INTEGER,
|
||||
"group_id" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
|
@ -492,7 +491,7 @@ 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_show_schedule" ADD CONSTRAINT "cc_show_inst_fkey" FOREIGN KEY ("instance_id") REFERENCES "cc_show_instances" ("id") ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playlist" ADD CONSTRAINT "cc_playlist_editedby_fkey" FOREIGN KEY ("editedby") REFERENCES "cc_subjs" ("id");
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ function eventAfterRender( event, element, view ) {
|
|||
$(element)
|
||||
.jjmenu("rightClick",
|
||||
[{get:"/Schedule/make-context-menu/format/json/id/#id#/start/#start#/end/#end#"}],
|
||||
{id: event.showId, start: getStartTS, end: getEndTS},
|
||||
{id: event.id, start: getStartTS, end: getEndTS, showId: event.showId},
|
||||
{xposition: "mouse", yposition: "mouse"});
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue