From 6d71ec8c9cdd0ad5360762ee6e639c51dddfbbf2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 17 Feb 2012 11:13:34 -0500 Subject: [PATCH 01/35] CC-3331 : Optimize "Now Playing" to load in less than 1/2 second - The logic to build the NowPlaying list was updated to refactor the quering of the database for playlist tracks played from in the loop per show ID to outside the loop for a given duration. The resulting list was then partitioned off for each show. --- airtime_mvc/application/models/Nowplaying.php | 80 ++++++++++++++++++- .../application/models/ShowInstance.php | 36 +++++++++ airtime_mvc/public/.htaccess | 11 +++ 3 files changed, 123 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/models/Nowplaying.php b/airtime_mvc/application/models/Nowplaying.php index e88f0c40b..870cc4e81 100644 --- a/airtime_mvc/application/models/Nowplaying.php +++ b/airtime_mvc/application/models/Nowplaying.php @@ -54,13 +54,13 @@ class Application_Model_Nowplaying return array("r", "", "", "", $p_showInstance->getName(), "", "", "", "", "", ""); } - public static function GetDataGridData($viewType, $dateString){ + public static function GetDataGridData($viewType, $dateString){ if ($viewType == "now"){ $dateTime = new DateTime("now", new DateTimeZone("UTC")); $timeNow = $dateTime->format("Y-m-d H:i:s"); - - $startCutoff = 60; + + $startCutoff = 60; $endCutoff = 86400; //60*60*24 - seconds in a day } else { $date = new Application_Model_DateHelper; @@ -75,14 +75,84 @@ class Application_Model_Nowplaying $data = array(); $showIds = Application_Model_ShowInstance::GetShowsInstancesIdsInRange($timeNow, $startCutoff, $endCutoff); + + //get all the pieces to be played between the start cut off and the end cut off. + $scheduledItems = Application_Model_ShowInstance::getScheduleItemsForAllShowsInRange($timeNow, $startCutoff, $endCutoff); + $orderedScheduledItems; + foreach ($scheduledItems as $scheduledItem){ + $orderedScheduledItems[$scheduledItem['instance_id']][] = $scheduledItem; + } + foreach ($showIds as $showId){ $instanceId = $showId['id']; + //gets the show information $si = new Application_Model_ShowInstance($instanceId); - $showId = $si->getShowId(); + $showId = $si->getShowId(); $show = new Application_Model_Show($showId); + + $showStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowInstanceStart()); + $showEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowInstanceEnd()); + //append show header row + $data[] = self::CreateHeaderRow($show->getName(), $showStartDateTime->format("Y-m-d H:i:s"), $showEndDateTime->format("Y-m-d H:i:s")); + + $dataTablesRows = self::CreateDatatableRows($orderedScheduledItems[$instanceId]); + + //append show audio item rows + $data = array_merge($data, $dataTablesRows); + + //append show gap time row + $gapTime = self::FormatDuration($si->getShowEndGapTime(), true); + if ($si->isRecorded()) + $data[] = self::CreateRecordingRow($si); + else if ($gapTime > 0) + $data[] = self::CreateGapRow($gapTime); + } + + $rows = Application_Model_Show::GetCurrentShow($timeNow); + Application_Model_Show::ConvertToLocalTimeZone($rows, array("starts", "ends", "start_timestamp", "end_timestamp")); + return array("currentShow"=>$rows, "rows"=>$data); + } + + public static function GetDataGridDataOLD($viewType, $dateString){ + + if ($viewType == "now"){ + $dateTime = new DateTime("now", new DateTimeZone("UTC")); + $timeNow = $dateTime->format("Y-m-d H:i:s"); + + $startCutoff = 60; + //$endCutoff = 2592000; // 30 days + //$endCutoff = 604800; // 7 days + $endCutoff = 259200; // 3 days + //$endCutoff = 86400; //60*60*24 - seconds in a day + } else { + $date = new Application_Model_DateHelper; + $time = $date->getTime(); + $date->setDate($dateString." ".$time); + $timeNow = $date->getUtcTimestamp(); + + $startCutoff = $date->getNowDayStartDiff(); + $endCutoff = $date->getNowDayEndDiff(); + } + + $data = array(); + + $showIds = Application_Model_ShowInstance::GetShowsInstancesIdsInRange($timeNow, $startCutoff, $endCutoff); +//Logging::log(print_r($showIds, true)); + + foreach ($showIds as $showId){ + $instanceId = $showId['id']; + + //gets the show information + $si = new Application_Model_ShowInstance($instanceId); +//Logging::log(print_r($si, true)); + + $showId = $si->getShowId(); + $show = new Application_Model_Show($showId); +//Logging::log(print_r($show, true)); + $showStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowInstanceStart()); $showEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowInstanceEnd()); @@ -90,7 +160,9 @@ class Application_Model_Nowplaying $data[] = self::CreateHeaderRow($show->getName(), $showStartDateTime->format("Y-m-d H:i:s"), $showEndDateTime->format("Y-m-d H:i:s")); $scheduledItems = $si->getScheduleItemsInRange($timeNow, $startCutoff, $endCutoff); +//Logging::log(print_r($scheduledItems, true)); $dataTablesRows = self::CreateDatatableRows($scheduledItems); +//Logging::log(print_r($dataTablesRows, true)); //append show audio item rows $data = array_merge($data, $dataTablesRows); diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php index 984304c7b..7e11b3584 100644 --- a/airtime_mvc/application/models/ShowInstance.php +++ b/airtime_mvc/application/models/ShowInstance.php @@ -757,6 +757,42 @@ class Application_Model_ShowInstance { return $CC_DBC->GetAll($sql); } + + public static function getScheduleItemsForAllShowsInRange($timeNow, $start, $end) + { + global $CC_DBC, $CC_CONFIG; + + $sql = "SELECT" + ." si.starts as show_starts," + ." si.ends as show_ends," + ." si.rebroadcast as rebroadcast," + ." st.starts as item_starts," + ." st.ends as item_ends," + ." st.clip_length as clip_length," + ." ft.track_title as track_title," + ." ft.artist_name as artist_name," + ." ft.album_title as album_title," + ." s.name as show_name," + ." si.id as instance_id," + ." pt.name as playlist_name" + ." FROM $CC_CONFIG[showInstances] si" + ." LEFT JOIN $CC_CONFIG[scheduleTable] st" + ." ON st.instance_id = si.id" + ." LEFT JOIN $CC_CONFIG[playListTable] pt" + ." ON st.playlist_id = pt.id" + ." LEFT JOIN $CC_CONFIG[filesTable] ft" + ." ON st.file_id = ft.id" + ." LEFT JOIN $CC_CONFIG[showTable] s" + ." ON si.show_id = s.id" + ." WHERE ((si.starts < TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends > TIMESTAMP '$timeNow' - INTERVAL '$start seconds')" + ." OR (si.starts > TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends < TIMESTAMP '$timeNow' + INTERVAL '$end seconds')" + ." OR (si.starts < TIMESTAMP '$timeNow' + INTERVAL '$end seconds' AND si.ends > TIMESTAMP '$timeNow' + INTERVAL '$end seconds'))" + ." AND (st.starts < si.ends)" + ." ORDER BY si.id, si.starts, st.starts"; + + return $CC_DBC->GetAll($sql); + } + public function getLastAudioItemEnd(){ global $CC_DBC; diff --git a/airtime_mvc/public/.htaccess b/airtime_mvc/public/.htaccess index 4e327ae88..e60e50a67 100644 --- a/airtime_mvc/public/.htaccess +++ b/airtime_mvc/public/.htaccess @@ -12,3 +12,14 @@ RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L] RewriteBase / + +AddOutputFilterByType DEFLATE text/plain +AddOutputFilterByType DEFLATE text/html +AddOutputFilterByType DEFLATE text/xml +AddOutputFilterByType DEFLATE text/css +AddOutputFilterByType DEFLATE application/xml +AddOutputFilterByType DEFLATE application/xhtml+xml +AddOutputFilterByType DEFLATE application/rss+xml +AddOutputFilterByType DEFLATE application/javascript +AddOutputFilterByType DEFLATE application/x-javascript +AddOutputFilterByType DEFLATE application/json \ No newline at end of file From 0db3a45fcf7392e8cd2866e939399b23ba71c4cd Mon Sep 17 00:00:00 2001 From: James Date: Fri, 17 Feb 2012 15:39:31 -0500 Subject: [PATCH 02/35] SAAS-196: Stats: Check if easy_install installation method detection is working properly - fixed --- airtime_mvc/application/models/Preference.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 180ab0fa4..061c694c8 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -429,7 +429,7 @@ class Application_Model_Preference } public static function GetInstallMethod(){ - $easy_install = file_exists('/usr/bin/airtime-easy-install'); + $easy_install = file_exists('/usr/bin/airtime-easy-setup'); $debian_install = file_exists('/var/lib/dpkg/info/airtime.config'); if($debian_install){ if($easy_install){ From 5cb99e953237ab41853aeba50290772aa30dd8d0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 17 Feb 2012 16:47:12 -0500 Subject: [PATCH 03/35] CC-3331: Optimize "Now Playing" to load in less than 1/2 second - Reorganized the now playing to find all the scheduled items within two time frames instead of in a loop per show id. - I've cut the time in half --- airtime_mvc/application/models/Nowplaying.php | 119 +++++------------- airtime_mvc/application/models/Schedule.php | 94 +++++++++----- .../application/models/ShowInstance.php | 36 ------ 3 files changed, 92 insertions(+), 157 deletions(-) diff --git a/airtime_mvc/application/models/Nowplaying.php b/airtime_mvc/application/models/Nowplaying.php index 870cc4e81..871b83fd9 100644 --- a/airtime_mvc/application/models/Nowplaying.php +++ b/airtime_mvc/application/models/Nowplaying.php @@ -3,16 +3,16 @@ class Application_Model_Nowplaying { - private static function CreateHeaderRow($p_showName, $p_showStart, $p_showEnd){ - return array("h", "", $p_showStart, $p_showEnd, $p_showName, "", "", "", "", "", ""); - } + private static function CreateHeaderRow($p_showName, $p_showStart, $p_showEnd){ + return array("h", "", $p_showStart, $p_showEnd, $p_showName, "", "", "", "", "", ""); + } - private static function CreateDatatableRows($p_dbRows){ + private static function CreateDatatableRows($p_dbRows){ $dataTablesRows = array(); $epochNow = time(); - foreach ($p_dbRows as $dbRow){ + foreach ($p_dbRows as $dbRow) { $showStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['show_starts']); $showEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['show_ends']); @@ -43,24 +43,24 @@ class Application_Model_Nowplaying $dbRow['playlist_name'], $dbRow['show_name'], $status); } - return $dataTablesRows; - } + return $dataTablesRows; + } - private static function CreateGapRow($p_gapTime){ - return array("g", "", "", "", $p_gapTime, "", "", "", "", "", ""); - } + private static function CreateGapRow($p_gapTime){ + return array("g", "", "", "", $p_gapTime, "", "", "", "", "", ""); + } - private static function CreateRecordingRow($p_showInstance){ - return array("r", "", "", "", $p_showInstance->getName(), "", "", "", "", "", ""); - } + private static function CreateRecordingRow($p_showInstance){ + return array("r", "", "", "", $p_showInstance->getName(), "", "", "", "", "", ""); + } - public static function GetDataGridData($viewType, $dateString){ + public static function GetDataGridData($viewType, $dateString){ if ($viewType == "now"){ $dateTime = new DateTime("now", new DateTimeZone("UTC")); $timeNow = $dateTime->format("Y-m-d H:i:s"); - $startCutoff = 60; + $startCutoff = 60; $endCutoff = 86400; //60*60*24 - seconds in a day } else { $date = new Application_Model_DateHelper; @@ -75,21 +75,22 @@ class Application_Model_Nowplaying $data = array(); $showIds = Application_Model_ShowInstance::GetShowsInstancesIdsInRange($timeNow, $startCutoff, $endCutoff); - - //get all the pieces to be played between the start cut off and the end cut off. - $scheduledItems = Application_Model_ShowInstance::getScheduleItemsForAllShowsInRange($timeNow, $startCutoff, $endCutoff); - $orderedScheduledItems; - foreach ($scheduledItems as $scheduledItem){ - $orderedScheduledItems[$scheduledItem['instance_id']][] = $scheduledItem; - } - + + //get all the pieces to be played between the start cut off and the end cut off. + $scheduledItems = Application_Model_Schedule::getScheduleItemsInRange($timeNow, $startCutoff, $endCutoff); + + $orderedScheduledItems; + foreach ($scheduledItems as $scheduledItem){ + $orderedScheduledItems[$scheduledItem['instance_id']][] = $scheduledItem; + } + foreach ($showIds as $showId){ $instanceId = $showId['id']; - //gets the show information + //gets the show information $si = new Application_Model_ShowInstance($instanceId); - $showId = $si->getShowId(); + $showId = $si->getShowId(); $show = new Application_Model_Show($showId); $showStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowInstanceStart()); @@ -106,73 +107,9 @@ class Application_Model_Nowplaying //append show gap time row $gapTime = self::FormatDuration($si->getShowEndGapTime(), true); if ($si->isRecorded()) - $data[] = self::CreateRecordingRow($si); + $data[] = self::CreateRecordingRow($si); else if ($gapTime > 0) - $data[] = self::CreateGapRow($gapTime); - } - - $rows = Application_Model_Show::GetCurrentShow($timeNow); - Application_Model_Show::ConvertToLocalTimeZone($rows, array("starts", "ends", "start_timestamp", "end_timestamp")); - return array("currentShow"=>$rows, "rows"=>$data); - } - - public static function GetDataGridDataOLD($viewType, $dateString){ - - if ($viewType == "now"){ - $dateTime = new DateTime("now", new DateTimeZone("UTC")); - $timeNow = $dateTime->format("Y-m-d H:i:s"); - - $startCutoff = 60; - //$endCutoff = 2592000; // 30 days - //$endCutoff = 604800; // 7 days - $endCutoff = 259200; // 3 days - //$endCutoff = 86400; //60*60*24 - seconds in a day - } else { - $date = new Application_Model_DateHelper; - $time = $date->getTime(); - $date->setDate($dateString." ".$time); - $timeNow = $date->getUtcTimestamp(); - - $startCutoff = $date->getNowDayStartDiff(); - $endCutoff = $date->getNowDayEndDiff(); - } - - $data = array(); - - $showIds = Application_Model_ShowInstance::GetShowsInstancesIdsInRange($timeNow, $startCutoff, $endCutoff); -//Logging::log(print_r($showIds, true)); - - foreach ($showIds as $showId){ - $instanceId = $showId['id']; - - //gets the show information - $si = new Application_Model_ShowInstance($instanceId); -//Logging::log(print_r($si, true)); - - $showId = $si->getShowId(); - $show = new Application_Model_Show($showId); -//Logging::log(print_r($show, true)); - - $showStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowInstanceStart()); - $showEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowInstanceEnd()); - - //append show header row - $data[] = self::CreateHeaderRow($show->getName(), $showStartDateTime->format("Y-m-d H:i:s"), $showEndDateTime->format("Y-m-d H:i:s")); - - $scheduledItems = $si->getScheduleItemsInRange($timeNow, $startCutoff, $endCutoff); -//Logging::log(print_r($scheduledItems, true)); - $dataTablesRows = self::CreateDatatableRows($scheduledItems); -//Logging::log(print_r($dataTablesRows, true)); - - //append show audio item rows - $data = array_merge($data, $dataTablesRows); - - //append show gap time row - $gapTime = self::FormatDuration($si->getShowEndGapTime(), true); - if ($si->isRecorded()) - $data[] = self::CreateRecordingRow($si); - else if ($gapTime > 0) - $data[] = self::CreateGapRow($gapTime); + $data[] = self::CreateGapRow($gapTime); } $rows = Application_Model_Show::GetCurrentShow($timeNow); diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 725578348..b6e8317d2 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -276,24 +276,59 @@ class Application_Model_Schedule { ." WHERE st.starts < si.ends"; if ($timePeriod < 0){ - $sql .= " AND st.ends < TIMESTAMP '$timeStamp'" - ." AND st.ends > (TIMESTAMP '$timeStamp' - INTERVAL '$interval')" - ." ORDER BY st.starts DESC" - ." LIMIT $count"; - } else if ($timePeriod == 0){ - $sql .= " AND st.starts <= TIMESTAMP '$timeStamp'" - ." AND st.ends >= TIMESTAMP '$timeStamp'"; - } else if ($timePeriod > 0){ - $sql .= " AND st.starts > TIMESTAMP '$timeStamp'" - ." AND st.starts < (TIMESTAMP '$timeStamp' + INTERVAL '$interval')" - ." ORDER BY st.starts" - ." LIMIT $count"; - } + $sql .= " AND st.ends < TIMESTAMP '$timeStamp'" + ." AND st.ends > (TIMESTAMP '$timeStamp' - INTERVAL '$interval')" + ." ORDER BY st.starts DESC" + ." LIMIT $count"; + } else if ($timePeriod == 0){ + $sql .= " AND st.starts <= TIMESTAMP '$timeStamp'" + ." AND st.ends >= TIMESTAMP '$timeStamp'"; + } else if ($timePeriod > 0){ + $sql .= " AND st.starts > TIMESTAMP '$timeStamp'" + ." AND st.starts < (TIMESTAMP '$timeStamp' + INTERVAL '$interval')" + ." ORDER BY st.starts" + ." LIMIT $count"; + } $rows = $CC_DBC->GetAll($sql); return $rows; - } + } + + public static function getScheduleItemsInRange($timeNow, $start, $end) + { + global $CC_DBC, $CC_CONFIG; + + $sql = "SELECT" + ." si.starts as show_starts," + ." si.ends as show_ends," + ." si.rebroadcast as rebroadcast," + ." st.starts as item_starts," + ." st.ends as item_ends," + ." st.clip_length as clip_length," + ." ft.track_title as track_title," + ." ft.artist_name as artist_name," + ." ft.album_title as album_title," + ." s.name as show_name," + ." si.id as instance_id," + ." pt.name as playlist_name" + ." FROM ".$CC_CONFIG["showInstances"]." si" + ." LEFT JOIN ".$CC_CONFIG[scheduleTable]." st" + ." ON st.instance_id = si.id" + ." LEFT JOIN ".$CC_CONFIG[playListTable]." pt" + ." ON st.playlist_id = pt.id" + ." LEFT JOIN ".$CC_CONFIG[filesTable]." ft" + ." ON st.file_id = ft.id" + ." LEFT JOIN ".$CC_CONFIG[showTable]." s" + ." ON si.show_id = s.id" + ." WHERE ((si.starts < TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends > TIMESTAMP '$timeNow' - INTERVAL '$start seconds')" + ." OR (si.starts > TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends < TIMESTAMP '$timeNow' + INTERVAL '$end seconds')" + ." OR (si.starts < TIMESTAMP '$timeNow' + INTERVAL '$end seconds' AND si.ends > TIMESTAMP '$timeNow' + INTERVAL '$end seconds'))" + ." AND (st.starts < si.ends)" + ." ORDER BY si.id, si.starts, st.starts"; + + return $CC_DBC->GetAll($sql); + } public static function GetShowInstanceItems($instance_id) { global $CC_CONFIG, $CC_DBC; @@ -322,7 +357,7 @@ class Application_Model_Schedule { } public static function getSchduledPlaylistCount(){ - global $CC_CONFIG, $CC_DBC; + global $CC_CONFIG, $CC_DBC; $sql = "SELECT count(*) as cnt FROM ".$CC_CONFIG['scheduleTable']; return $CC_DBC->GetOne($sql); } @@ -535,16 +570,16 @@ class Application_Model_Schedule { $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true; $formWhat = new Application_Form_AddShowWhat(); - $formWho = new Application_Form_AddShowWho(); - $formWhen = new Application_Form_AddShowWhen(); - $formRepeats = new Application_Form_AddShowRepeats(); - $formStyle = new Application_Form_AddShowStyle(); + $formWho = new Application_Form_AddShowWho(); + $formWhen = new Application_Form_AddShowWhen(); + $formRepeats = new Application_Form_AddShowRepeats(); + $formStyle = new Application_Form_AddShowStyle(); - $formWhat->removeDecorator('DtDdWrapper'); - $formWho->removeDecorator('DtDdWrapper'); - $formWhen->removeDecorator('DtDdWrapper'); - $formRepeats->removeDecorator('DtDdWrapper'); - $formStyle->removeDecorator('DtDdWrapper'); + $formWhat->removeDecorator('DtDdWrapper'); + $formWho->removeDecorator('DtDdWrapper'); + $formWhen->removeDecorator('DtDdWrapper'); + $formRepeats->removeDecorator('DtDdWrapper'); + $formStyle->removeDecorator('DtDdWrapper'); $p_view->what = $formWhat; $p_view->when = $formWhen; @@ -555,12 +590,12 @@ class Application_Model_Schedule { $formWhat->populate(array('add_show_id' => '-1')); $formWhen->populate(array('add_show_start_date' => date("Y-m-d"), 'add_show_start_time' => '00:00', - 'add_show_end_date_no_repeate' => date("Y-m-d"), - 'add_show_end_time' => '01:00', + 'add_show_end_date_no_repeate' => date("Y-m-d"), + 'add_show_end_time' => '01:00', 'add_show_duration' => '1h')); - $formRepeats->populate(array('add_show_end_date' => date("Y-m-d"))); - + $formRepeats->populate(array('add_show_end_date' => date("Y-m-d"))); + if(!$isSaas){ $formRecord = new Application_Form_AddShowRR(); $formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates(); @@ -576,5 +611,4 @@ class Application_Model_Schedule { } $p_view->addNewShow = true; } -} - +} \ No newline at end of file diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php index 7e11b3584..0fbaa4666 100644 --- a/airtime_mvc/application/models/ShowInstance.php +++ b/airtime_mvc/application/models/ShowInstance.php @@ -756,42 +756,6 @@ class Application_Model_ShowInstance { return $CC_DBC->GetAll($sql); } - - - public static function getScheduleItemsForAllShowsInRange($timeNow, $start, $end) - { - global $CC_DBC, $CC_CONFIG; - - $sql = "SELECT" - ." si.starts as show_starts," - ." si.ends as show_ends," - ." si.rebroadcast as rebroadcast," - ." st.starts as item_starts," - ." st.ends as item_ends," - ." st.clip_length as clip_length," - ." ft.track_title as track_title," - ." ft.artist_name as artist_name," - ." ft.album_title as album_title," - ." s.name as show_name," - ." si.id as instance_id," - ." pt.name as playlist_name" - ." FROM $CC_CONFIG[showInstances] si" - ." LEFT JOIN $CC_CONFIG[scheduleTable] st" - ." ON st.instance_id = si.id" - ." LEFT JOIN $CC_CONFIG[playListTable] pt" - ." ON st.playlist_id = pt.id" - ." LEFT JOIN $CC_CONFIG[filesTable] ft" - ." ON st.file_id = ft.id" - ." LEFT JOIN $CC_CONFIG[showTable] s" - ." ON si.show_id = s.id" - ." WHERE ((si.starts < TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends > TIMESTAMP '$timeNow' - INTERVAL '$start seconds')" - ." OR (si.starts > TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends < TIMESTAMP '$timeNow' + INTERVAL '$end seconds')" - ." OR (si.starts < TIMESTAMP '$timeNow' + INTERVAL '$end seconds' AND si.ends > TIMESTAMP '$timeNow' + INTERVAL '$end seconds'))" - ." AND (st.starts < si.ends)" - ." ORDER BY si.id, si.starts, st.starts"; - - return $CC_DBC->GetAll($sql); - } public function getLastAudioItemEnd(){ global $CC_DBC; From c7f4b17e812cc8d0be6bca39cd501358516ea00e Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 17 Feb 2012 17:08:47 -0500 Subject: [PATCH 04/35] CC-3331: Optimize "Now Playing" to load in less than 1/2 second - cleaned up sql statement Schedule's getScheduleItemsInRange --- airtime_mvc/application/models/Schedule.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index b6e8317d2..f15ce4363 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -313,13 +313,13 @@ class Application_Model_Schedule { ." si.id as instance_id," ." pt.name as playlist_name" ." FROM ".$CC_CONFIG["showInstances"]." si" - ." LEFT JOIN ".$CC_CONFIG[scheduleTable]." st" + ." LEFT JOIN ".$CC_CONFIG["scheduleTable"]." st" ." ON st.instance_id = si.id" - ." LEFT JOIN ".$CC_CONFIG[playListTable]." pt" + ." LEFT JOIN ".$CC_CONFIG["playListTable"]." pt" ." ON st.playlist_id = pt.id" - ." LEFT JOIN ".$CC_CONFIG[filesTable]." ft" + ." LEFT JOIN ".$CC_CONFIG["filesTable"]." ft" ." ON st.file_id = ft.id" - ." LEFT JOIN ".$CC_CONFIG[showTable]." s" + ." LEFT JOIN ".$CC_CONFIG["showTable"]." s" ." ON si.show_id = s.id" ." WHERE ((si.starts < TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends > TIMESTAMP '$timeNow' - INTERVAL '$start seconds')" ." OR (si.starts > TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends < TIMESTAMP '$timeNow' + INTERVAL '$end seconds')" From 664584ec6b30704e0f7413949d5821bc3552aed2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 17 Feb 2012 17:58:19 -0500 Subject: [PATCH 05/35] CC-3331 : Optimize "Now Playing" to load in less than 1/2 second - updated the CreateDatatableRows do perform a check and set on the last items end time. If the end time of the last item exceeds the show time's end I set the items end time to the show's end time. --- airtime_mvc/application/models/Nowplaying.php | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/application/models/Nowplaying.php b/airtime_mvc/application/models/Nowplaying.php index 871b83fd9..ec80a91c7 100644 --- a/airtime_mvc/application/models/Nowplaying.php +++ b/airtime_mvc/application/models/Nowplaying.php @@ -12,15 +12,22 @@ class Application_Model_Nowplaying $epochNow = time(); - foreach ($p_dbRows as $dbRow) { - - $showStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['show_starts']); - $showEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['show_ends']); - $itemStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['item_starts']); - $itemEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['item_ends']); - + $lastRow = end($p_dbRows); + + //Information about show is true for all rows in parameter so only check the last row's show + //start and end times. + if (isset($lastRow)){ + $showStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($lastRow['show_starts']); + $showEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($lastRow['show_ends']); $showStarts = $showStartDateTime->format("Y-m-d H:i:s"); $showEnds = $showEndDateTime->format("Y-m-d H:i:s"); + } + + foreach ($p_dbRows as $dbRow) { + + $itemStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['item_starts']); + $itemEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['item_ends']); + $itemStarts = $itemStartDateTime->format("Y-m-d H:i:s"); $itemEnds = $itemEndDateTime->format("Y-m-d H:i:s"); @@ -43,6 +50,12 @@ class Application_Model_Nowplaying $dbRow['playlist_name'], $dbRow['show_name'], $status); } + //Modify the last entry in the data table to adjust its end time to be equal to the + //shows end time if it exceeds it. + $lastRow = end($dataTablesRows); + if (isset($lastRow) && strtotime($showEnds) < strtotime($lastRow[3])){ + $dataTablesRows[sizeof($dataTablesRows)-1][3] = $showEnds; + } return $dataTablesRows; } From 80e33ee533580895e75dd608c48c0ee1ca5646fc Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 22 Feb 2012 11:36:48 -0500 Subject: [PATCH 06/35] CC-3337: Optimize Schedule/get-current-playlist/format/json - I've updated the logic to query the cc_schedule table directly for the previous, next, current shows which makes look up time much faster. If that doesn't work then I revert back to the previous logic, incase nothing is scheduled within an hour of the current time. --- airtime_mvc/application/models/Schedule.php | 71 +++++++++++++++++++-- 1 file changed, 65 insertions(+), 6 deletions(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index f15ce4363..2e3ea8402 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -146,18 +146,77 @@ class Application_Model_Schedule { $date = new Application_Model_DateHelper; $timeNow = $date->getTimestamp(); $utcTimeNow = $date->getUtcTimestamp(); + $currentShow = Application_Model_Show::GetCurrentShow($utcTimeNow); + $results = Application_Model_Schedule::GetPrevCurrentNext($utcTimeNow); + $range = array("env"=>APPLICATION_ENV, "schedulerTime"=>$timeNow, - "previous"=>Application_Model_Dashboard::GetPreviousItem($utcTimeNow), - "current"=>Application_Model_Dashboard::GetCurrentItem($utcTimeNow), - "next"=>Application_Model_Dashboard::GetNextItem($utcTimeNow), - "currentShow"=>Application_Model_Show::GetCurrentShow($utcTimeNow), - "nextShow"=>Application_Model_Show::GetNextShows($utcTimeNow, 1), + "previous"=>$results['previous'], + "current"=>$results['current'], + "next"=>$results['next'], + "currentShow"=>$currentShow, + "nextShow"=>"",//Application_Model_Show::GetNextShows($utcTimeNow, 1), "timezone"=> date("T"), "timezoneOffset"=> date("Z")); - + return $range; } + + /** + * Queries the database for the set of schedules one hour before and after the given time. + * If a show starts and ends within that time that is considered the current show. Then the + * scheduled item before it is the previous show, and the scheduled item after it is the next + * show. This way the dashboard getCurrentPlaylist is very fast. But if any one of the three + * show types are not found through this mechanism a call is made to the old way of querying + * the database to find the track info. + **/ + public static function GetPrevCurrentNext($p_timeNow) + { + global $CC_CONFIG, $CC_DBC; + + + $sql = "Select ft.artist_name, ft.track_title, st.starts as starts, st.ends as ends, st.media_item_played as media_item_played + FROM cc_schedule st LEFT JOIN cc_files ft ON st.file_id = ft.id LEFT JOIN cc_show_instances sit ON st.instance_id = sit.id + WHERE st.starts > (TIMESTAMP '$p_timeNow'-INTERVAL '1 hours') AND st.starts < (TIMESTAMP '$p_timeNow'+INTERVAL '1 hours') AND st.starts < sit.ends + ORDER BY st.starts"; + $row = $CC_DBC->GetAll($sql); + + $numberOfRows = count($row); + $results; + + $timeNowAsMillis = strtotime($p_timeNow); + for( $i = 0; $i < $numberOfRows && !isset($results); ++$i ){ + if ((strtotime($row[$i]['starts']) <= $timeNowAsMillis) && (strtotime($row[$i]['ends']) >= $timeNowAsMillis)){ + if ( $i - 1 >= 0){ + $results['previous'] = array("name"=>$row[$i-1]["artist_name"]." - ".$row[$i-1]["track_title"], + "starts"=>$row[$i-1]["starts"], + "ends"=>$row[$i-1]["ends"]); + } + $results['current'] = array("name"=>$row[$i]["artist_name"]." - ".$row[$i]["track_title"], + "starts"=>$row[$i]["starts"], + "ends"=>$row[$i]["ends"], + "media_item_played"=>$row[0]["media_item_played"], + "record"=>0); + if ( $i +1 <= $numberOfRows){ + $results['next'] = array("name"=>$row[$i+1]["artist_name"]." - ".$row[$i+1]["track_title"], + "starts"=>$row[$i+1]["starts"], + "ends"=>$row[$i+1]["ends"]); + } + break; + } + } + + if (!isset($results['previous'])){ + $results['previous'] = Application_Model_Dashboard::GetPreviousItem($p_timeNow); + } + if (!isset($results['current'])){ + $results['current'] = Application_Model_Dashboard::GetCurrentItem($p_timeNow); + } + if (!isset($results['next'])) { + $results['next'] = Application_Model_Dashboard::GetNextItem($p_timeNow); + } + return $results; + } public static function GetLastScheduleItem($p_timeNow){ global $CC_CONFIG, $CC_DBC; From 8bbccb6f44abce9fde0b3c00f637fa76e7a475c0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 22 Feb 2012 14:32:59 -0500 Subject: [PATCH 07/35] CC-3338: Optimize week display The response time of the calendar varies depending on whether the week/day views filter or the month filter is used because of the additional percentage scheduled calculation per show instance. This added calculation results in more and heavier hits to the database, I've included the time_filled column in the original show query and have used that to calculate percentage and saved the db call. --- airtime_mvc/application/models/Show.php | 70 +++++++++++++++---------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 3e6f2a72c..efce86b2b 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -215,22 +215,22 @@ class Application_Model_Show { } foreach($showDays as $showDay) { - Logging::log("Local show day is: {$showDay->getDbDay()}"); + Logging::log("Local show day is: {$showDay->getDbDay()}"); Logging::log("First show day is: {$showDay->getDbFirstShow()}"); Logging::log("Id show days is: {$showDay->getDbId()}"); - if (in_array($showDay->getDbDay(), $p_uncheckedDays)) { - $showDay->reload(); - //Logging::log("Local show day is: {$showDay->getDbDay()}"); - //Logging::log("First show day is: {$showDay->getDbFirstShow()}"); - //Logging::log("Id show days is: {$showDay->getDbId()}"); - $startDay = new DateTime("{$showDay->getDbFirstShow()} {$showDay->getDbStartTime()}", new DateTimeZone($showDay->getDbTimezone())); - Logging::log("Show start day: {$startDay->format('Y-m-d H:i:s')}"); + if (in_array($showDay->getDbDay(), $p_uncheckedDays)) { + $showDay->reload(); + //Logging::log("Local show day is: {$showDay->getDbDay()}"); + //Logging::log("First show day is: {$showDay->getDbFirstShow()}"); + //Logging::log("Id show days is: {$showDay->getDbId()}"); + $startDay = new DateTime("{$showDay->getDbFirstShow()} {$showDay->getDbStartTime()}", new DateTimeZone($showDay->getDbTimezone())); + Logging::log("Show start day: {$startDay->format('Y-m-d H:i:s')}"); $startDay->setTimezone(new DateTimeZone("UTC")); Logging::log("Show start day UTC: {$startDay->format('Y-m-d H:i:s')}"); $daysRemovedUTC[] = $startDay->format('w'); Logging::log("UTC show day is: {$startDay->format('w')}"); - } + } } $uncheckedDaysImploded = implode(",", $daysRemovedUTC); @@ -843,18 +843,18 @@ class Application_Model_Show { } } - if ($p_data['add_show_start_date'] != $this->getStartDate() - || $p_data['add_show_start_time'] != $this->getStartTime()){ - //start date/time has changed + if ($p_data['add_show_start_date'] != $this->getStartDate() + || $p_data['add_show_start_time'] != $this->getStartTime()){ + //start date/time has changed - $newDate = strtotime($p_data['add_show_start_date']); - $oldDate = strtotime($this->getStartDate()); - if ($newDate > $oldDate){ - $this->removeAllInstancesBeforeDate($p_data['add_show_start_date']); - } + $newDate = strtotime($p_data['add_show_start_date']); + $oldDate = strtotime($this->getStartDate()); + if ($newDate > $oldDate){ + $this->removeAllInstancesBeforeDate($p_data['add_show_start_date']); + } - $this->updateStartDateTime($p_data, $p_endDate); - } + $this->updateStartDateTime($p_data, $p_endDate); + } } //Check if end date for the repeat option has changed. If so, need to take care @@ -1397,7 +1397,8 @@ class Application_Model_Show { } $sql = "SELECT starts, ends, record, rebroadcast, instance_id, show_id, name, - color, background_color, file_id, cc_show_instances.id AS instance_id + color, background_color, file_id, cc_show_instances.id AS instance_id, + time_filled FROM cc_show_instances LEFT JOIN cc_show ON cc_show.id = cc_show_instances.show_id WHERE cc_show_instances.modified_instance = FALSE"; @@ -1486,14 +1487,15 @@ class Application_Model_Show { * -in UTC time * @param boolean $editable */ - public static function getFullCalendarEvents($start, $end, $editable=false) + public static function getFullCalendarEvents($p_start, $p_end, $p_editable=false) { + $events = array(); - $interval = $start->diff($end); + $interval = $p_start->diff($p_end); $days = $interval->format('%a'); - $shows = Application_Model_Show::getShows($start, $end); + $shows = Application_Model_Show::getShows($p_start, $p_end); $today_timestamp = gmdate("Y-m-d H:i:s"); @@ -1501,21 +1503,33 @@ class Application_Model_Show { $options = array(); //only bother calculating percent for week or day view. - if(intval($days) <= 7) { - $show_instance = new Application_Model_ShowInstance($show["instance_id"]); - $options["percent"] = $show_instance->getPercentScheduled(); + + if(intval($days) <= 7) { + $options["percent"] = Application_Model_Show::getPercentScheduled($show["starts"], $show["ends"], $show["time_filled"]); } - if ($editable && (strtotime($today_timestamp) < strtotime($show["starts"]))) { + if ($p_editable && (strtotime($today_timestamp) < strtotime($show["starts"]))) { $options["editable"] = true; $events[] = Application_Model_Show::makeFullCalendarEvent($show, $options); } else { $events[] = Application_Model_Show::makeFullCalendarEvent($show, $options); } } - + return $events; } + + /** + * Calculates the percentage of a show scheduled given the start and end times in date/time format + * and the time_filled as the total time the schow is scheduled for in time format. + **/ + private static function getPercentScheduled($p_starts, $p_ends, $p_time_filled){ + $durationSeconds = (strtotime($p_ends) - strtotime($p_starts)); + $time_filled = Application_Model_Schedule::WallTimeToMillisecs($p_time_filled) / 1000; + $percent = ceil(( $time_filled / $durationSeconds) * 100); + + return $percent; + } private static function makeFullCalendarEvent($show, $options=array()) { From 1677bc68163b23b8e96b2014b2c6055f3246d0b0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 22 Feb 2012 16:06:06 -0500 Subject: [PATCH 08/35] CC-3334: Upgrade notification reports there is an upgrade when user has a later version than the official released version Updated the logic in Version Notify so that if the currently installed version of airtime is greater then the official version a notification does not appear saying Airtime needs to be updated. --- .../views/helpers/VersionNotify.php | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/airtime_mvc/application/views/helpers/VersionNotify.php b/airtime_mvc/application/views/helpers/VersionNotify.php index 430f7f2ed..a488c6e9b 100644 --- a/airtime_mvc/application/views/helpers/VersionNotify.php +++ b/airtime_mvc/application/views/helpers/VersionNotify.php @@ -20,27 +20,26 @@ class Airtime_View_Helper_VersionNotify extends Zend_View_Helper_Abstract{ $current = Application_Model_Preference::GetAirtimeVersion(); $latest = Application_Model_Preference::GetLatestVersion(); $link = Application_Model_Preference::GetLatestLink(); - $pattern = "/^([0-9]+)\.([0-9]+)\.[0-9]+/"; - preg_match($pattern, $current, $curMatch); - preg_match($pattern, $latest, $latestMatch); - if(count($curMatch) == 0 || count($latestMatch) == 0) { + $currentExploded = explode('.', $current); + $latestExploded = explode('.', $latest); + if(count($currentExploded) != 3 || count($latestExploded) != 3) { return ""; } - // Calculate major version diff; - // Example: if current = 1.9.5 and latest = 3.0.0, major diff = 11 + // Calculate the version difference; + // Example: if current = 1.9.5 and latest = 3.0.0, diff = 115 // Note: algorithm assumes the number after 1st dot never goes above 9 - $diff = (intval($latestMatch[1]) * 10 + intval($latestMatch[2])) - - (intval($curMatch[1]) * 10 + intval($curMatch[2])); + $versionDifference = (intval($latestExploded[0]) * 100 + intval($latestExploded[1]) *10 + intval($latestExploded[2])) + - (intval($currentExploded[0]) * 100 + intval($currentExploded[1] *10 + intval($currentExploded[2]))); - // Pick icon - if(($diff == 0 && $current == $latest) || $diff < 0) { - // current version is up to date + // Pick icon based on distance this version is to the latest version available + if($versionDifference <= 0) { + // current version is up to date or newer $class = "uptodate"; - } else if($diff <= 2) { + } else if($versionDifference <= 20) { // 2 or less major versions back $class = "update"; - } else if($diff == 3) { + } else if($versionDifference == 30) { // 3 major versions back $class = "update2"; } else { @@ -48,7 +47,7 @@ class Airtime_View_Helper_VersionNotify extends Zend_View_Helper_Abstract{ $class = "outdated"; } - $result = "" + $result = "" . "" . "" . "" From d5a8f63d363c93649309a4d422c97950ea9c6fd8 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 22 Feb 2012 17:56:17 -0500 Subject: [PATCH 09/35] CC-3342: Pypo: if a user doesn't update anything on calendar for 24 hrs, it could cause a problem. -fixed --- python_apps/pypo/pypofetch.py | 36 +++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py index 797669c0a..2d55206d5 100644 --- a/python_apps/pypo/pypofetch.py +++ b/python_apps/pypo/pypofetch.py @@ -14,6 +14,7 @@ from threading import Thread from subprocess import Popen, PIPE from datetime import datetime from datetime import timedelta +from Queue import Empty import filecmp # For RabbitMQ @@ -494,24 +495,47 @@ class PypoFetch(Thread): logger.error("Error connecting to RabbitMQ Server. Trying again in few seconds") time.sleep(5) - loops = 1 + loops = 1 while True: logger.info("Loop #%s", loops) try: try: - message = self.simple_queue.get(block=True) + """ + our simple_queue.get() requires a timeout, in which case we + fetch the Airtime schedule manually. It is important to fetch + the schedule periodically because if we didn't, we would only + get schedule updates via RabbitMq if the user was constantly + using the Airtime interface. + + If the user is not using the interface, RabbitMq messages are not + sent, and we will have very stale (or non-existent!) data about the + schedule. + + Currently we are checking every 3600 seconds (1 hour) + """ + message = self.simple_queue.get(block=True, timeout=3600) self.handle_message(message.payload) # ACK the message to take it off the queue message.ack() + except Empty, e: + """ + Queue timeout. Fetching data manually + """ + raise except MessageStateError, m: logger.error("Message ACK error: %s", m) + raise + except Exception, e: + """ + There is a problem with the RabbitMq messenger service. Let's + log the error and get the schedule via HTTP polling + """ + logger.error("Exception, %s", e) + raise except Exception, e: """ - There is a problem with the RabbitMq messenger service. Let's - log the error and get the schedule via HTTP polling + Fetch Airtime schedule manually """ - logger.error("Exception, %s", e) - status, self.schedule_data = self.api_client.get_schedule() if status == 1: self.process_schedule(self.schedule_data, "scheduler", False) From 54f81ca5de0cd72a4ce1331441afbc10fb7470f3 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 22 Feb 2012 19:23:48 -0500 Subject: [PATCH 10/35] CC-3342: Pypo: if a user doesn't update anything on calendar for 24 hrs, it could cause a problem. -make it so that we cannot use all CPU if spinning in while loop -remove Message Acknowledge exception --- python_apps/pypo/pypofetch.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py index 2d55206d5..12e27ddbe 100644 --- a/python_apps/pypo/pypofetch.py +++ b/python_apps/pypo/pypofetch.py @@ -522,10 +522,13 @@ class PypoFetch(Thread): Queue timeout. Fetching data manually """ raise - except MessageStateError, m: - logger.error("Message ACK error: %s", m) - raise except Exception, e: + """ + sleep 5 seconds so that we don't spin inside this + while loop and eat all the CPU + """ + time.sleep(5) + """ There is a problem with the RabbitMq messenger service. Let's log the error and get the schedule via HTTP polling From 695535ae64fbdbb8e3b11ce04b24e012dc6524fa Mon Sep 17 00:00:00 2001 From: James Date: Fri, 24 Feb 2012 13:12:50 -0500 Subject: [PATCH 11/35] CC-3346: Recorder: Merge recorder with pypo - Pypo fech works as msg listner for recroder now. - recorder is part of pypo and all it does is waiting for msg from pypo fetch and spwan a show recorder thread. - added new parameter logger to api client. This way apiclient will log into specific log file instead of grabbing current log file. - show recoder is removed from all check system/status page --- .../application/controllers/ApiController.php | 1 - .../controllers/SystemstatusController.php | 36 -- .../controllers/plugins/RabbitMqPlugin.php | 2 +- airtime_mvc/application/models/RabbitMq.php | 4 +- .../application/models/Systemstatus.php | 15 - install_minimal/include/AirtimeIni.php | 8 - install_minimal/include/AirtimeInstall.php | 5 +- install_minimal/include/airtime-copy-files.sh | 6 +- install_minimal/include/airtime-initialize.sh | 12 +- .../include/airtime-remove-files.sh | 4 +- .../include/airtime-uninitialize.sh | 6 +- python_apps/api_clients/api_client.py | 63 ++-- python_apps/pypo/install/pypo-copy-files.py | 3 + python_apps/pypo/logging.cfg | 24 +- python_apps/pypo/pypo-cli.py | 9 +- python_apps/pypo/pypo.cfg | 14 + python_apps/pypo/pypofetch.py | 56 ++- python_apps/pypo/recorder.py | 270 ++++++++++++++ .../show-recorder/airtime-show-recorder | 26 -- .../airtime-show-recorder-init-d | 71 ---- .../install/recorder-copy-files.py | 74 ---- .../install/recorder-initialize.py | 24 -- .../install/recorder-remove-files.py | 48 --- .../install/recorder-uninitialize.py | 19 - .../install/recorder-uninstall.py | 54 --- python_apps/show-recorder/logging.cfg | 22 -- .../monit-airtime-show-recorder.cfg | 9 - python_apps/show-recorder/recorder.cfg | 31 -- python_apps/show-recorder/recorder.py | 348 ------------------ utils/airtime-check-system.php | 11 - 30 files changed, 419 insertions(+), 856 deletions(-) create mode 100644 python_apps/pypo/recorder.py delete mode 100755 python_apps/show-recorder/airtime-show-recorder delete mode 100755 python_apps/show-recorder/airtime-show-recorder-init-d delete mode 100644 python_apps/show-recorder/install/recorder-copy-files.py delete mode 100644 python_apps/show-recorder/install/recorder-initialize.py delete mode 100644 python_apps/show-recorder/install/recorder-remove-files.py delete mode 100644 python_apps/show-recorder/install/recorder-uninitialize.py delete mode 100644 python_apps/show-recorder/install/recorder-uninstall.py delete mode 100644 python_apps/show-recorder/logging.cfg delete mode 100644 python_apps/show-recorder/monit-airtime-show-recorder.cfg delete mode 100644 python_apps/show-recorder/recorder.cfg delete mode 100644 python_apps/show-recorder/recorder.py diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index d15e3ca96..8bf9226bb 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -763,7 +763,6 @@ class ApiController extends Zend_Controller_Action "rabbitmq"=>Application_Model_Systemstatus::GetRabbitMqStatus(), "pypo"=>Application_Model_Systemstatus::GetPypoStatus(), "liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(), - "show_recorder"=>Application_Model_Systemstatus::GetShowRecorderStatus(), "media_monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus() ) ); diff --git a/airtime_mvc/application/controllers/SystemstatusController.php b/airtime_mvc/application/controllers/SystemstatusController.php index 8a04f2f9b..b660cd4e1 100644 --- a/airtime_mvc/application/controllers/SystemstatusController.php +++ b/airtime_mvc/application/controllers/SystemstatusController.php @@ -21,10 +21,6 @@ class SystemstatusController extends Zend_Controller_Action "media-monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus(), "rabbitmq-server"=>Application_Model_Systemstatus::GetRabbitMqStatus() ); - - if (!isset($_SERVER["AIRTIME_SRV"])){ - $services["show-recorder"]=Application_Model_Systemstatus::GetShowRecorderStatus(); - } $partitions = Application_Model_Systemstatus::GetDiskInfo(); @@ -32,36 +28,4 @@ class SystemstatusController extends Zend_Controller_Action $this->view->status->services = $services; $this->view->status->partitions = $partitions; } - - public function getLogFileAction() - { - $log_files = array("pypo"=>"/var/log/airtime/pypo/pypo.log", - "liquidsoap"=>"/var/log/airtime/pypo-liquidsoap/ls_script.log", - "media-monitor"=>"/var/log/airtime/media-monitor/media-monitor.log", - "show-recorder"=>"/var/log/airtime/show-recorder/show-recorder.log", - "icecast2"=>"/var/log/icecast2/error.log"); - - $id = $this->_getParam('id'); - Logging::log($id); - - if (array_key_exists($id, $log_files)){ - $filepath = $log_files[$id]; - $filename = basename($filepath); - header("Content-Disposition: attachment; filename=$filename"); - header("Content-Length: " . filesize($filepath)); - // !! binary mode !! - $fp = fopen($filepath, 'rb'); - - //We can have multiple levels of output buffering. Need to - //keep looping until all have been disabled!!! - //http://www.php.net/manual/en/function.ob-end-flush.php - while (@ob_end_flush()); - - fpassthru($fp); - fclose($fp); - - //make sure to exit here so that no other output is sent. - exit; - } - } } diff --git a/airtime_mvc/application/controllers/plugins/RabbitMqPlugin.php b/airtime_mvc/application/controllers/plugins/RabbitMqPlugin.php index 900f5a237..07f58c742 100644 --- a/airtime_mvc/application/controllers/plugins/RabbitMqPlugin.php +++ b/airtime_mvc/application/controllers/plugins/RabbitMqPlugin.php @@ -8,7 +8,7 @@ class RabbitMqPlugin extends Zend_Controller_Plugin_Abstract $md = array('schedule' => Application_Model_Schedule::GetScheduledPlaylists()); Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md); if (!isset($_SERVER['AIRTIME_SRV'])){ - Application_Model_RabbitMq::SendMessageToShowRecorder("update_schedule"); + Application_Model_RabbitMq::SendMessageToShowRecorder("update_recorder_schedule"); } } } diff --git a/airtime_mvc/application/models/RabbitMq.php b/airtime_mvc/application/models/RabbitMq.php index f3b823eb5..4d0e501a5 100644 --- a/airtime_mvc/application/models/RabbitMq.php +++ b/airtime_mvc/application/models/RabbitMq.php @@ -74,7 +74,7 @@ class Application_Model_RabbitMq $channel = $conn->channel(); $channel->access_request($CC_CONFIG["rabbitmq"]["vhost"], false, false, true, true); - $EXCHANGE = 'airtime-show-recorder'; + $EXCHANGE = 'airtime-pypo'; $channel->exchange_declare($EXCHANGE, 'direct', false, true); $now = new DateTime("@".time()); //in UTC timezone @@ -82,7 +82,7 @@ class Application_Model_RabbitMq $temp['event_type'] = $event_type; $temp['server_timezone'] = Application_Model_Preference::GetTimezone(); - if($event_type = "update_schedule"){ + if($event_type = "update_recorder_schedule"){ $temp['shows'] = Application_Model_Show::getShows($now, $end_timestamp, $excludeInstance=NULL, $onlyRecord=TRUE); } $data = json_encode($temp); diff --git a/airtime_mvc/application/models/Systemstatus.php b/airtime_mvc/application/models/Systemstatus.php index 601cbaa1f..8503a98d2 100644 --- a/airtime_mvc/application/models/Systemstatus.php +++ b/airtime_mvc/application/models/Systemstatus.php @@ -147,21 +147,6 @@ class Application_Model_Systemstatus } } - public static function GetShowRecorderStatus(){ - - $component = CcServiceRegisterQuery::create()->findOneByDbName("show-recorder"); - if (is_null($component)){ - return null; - } else { - $ip = $component->getDbIp(); - - $docRoot = self::GetMonitStatus($ip); - $data = self::ExtractServiceInformation($docRoot, "airtime-show-recorder"); - - return $data; - } - } - public static function GetMediaMonitorStatus(){ $component = CcServiceRegisterQuery::create()->findOneByDbName("media-monitor"); diff --git a/install_minimal/include/AirtimeIni.php b/install_minimal/include/AirtimeIni.php index d8395efc4..f66a3caa7 100644 --- a/install_minimal/include/AirtimeIni.php +++ b/install_minimal/include/AirtimeIni.php @@ -91,14 +91,6 @@ class AirtimeIni exit(1); } - if (!copy(__DIR__."/../../python_apps/show-recorder/recorder.cfg", AirtimeIni::CONF_FILE_RECORDER)){ - echo "Could not copy recorder.cfg to /etc/airtime/. Exiting."; - exit(1); - } else if (!self::ChangeFileOwnerGroupMod(AirtimeIni::CONF_FILE_RECORDER, self::CONF_PYPO_GRP)){ - echo "Could not set ownership of recorder.cfg to 'pypo'. Exiting."; - exit(1); - } - if (!copy(__DIR__."/../../python_apps/pypo/liquidsoap_scripts/liquidsoap.cfg", AirtimeIni::CONF_FILE_LIQUIDSOAP)){ echo "Could not copy liquidsoap.cfg to /etc/airtime/. Exiting."; exit(1); diff --git a/install_minimal/include/AirtimeInstall.php b/install_minimal/include/AirtimeInstall.php index 606d74e55..dc5869165 100644 --- a/install_minimal/include/AirtimeInstall.php +++ b/install_minimal/include/AirtimeInstall.php @@ -429,12 +429,9 @@ class AirtimeInstall AirtimeIni::CONF_FILE_PYPO, AirtimeIni::CONF_FILE_RECORDER, "/usr/lib/airtime/pypo", - "/usr/lib/airtime/show-recorder", "/var/log/airtime", "/var/log/airtime/pypo", - "/var/log/airtime/show-recorder", - "/var/tmp/airtime/pypo", - "/var/tmp/airtime/show-recorder"); + "/var/tmp/airtime/pypo"); foreach ($dirs as $f) { if (file_exists($f)) { echo "+ $f".PHP_EOL; diff --git a/install_minimal/include/airtime-copy-files.sh b/install_minimal/include/airtime-copy-files.sh index 5eab4a4ef..4f88cab72 100755 --- a/install_minimal/include/airtime-copy-files.sh +++ b/install_minimal/include/airtime-copy-files.sh @@ -63,9 +63,9 @@ if [ "$python_service" -eq "0" ]; then if [ "$pypo" = "t" ]; then python $AIRTIMEROOT/python_apps/pypo/install/pypo-copy-files.py fi - if [ "$showrecorder" = "t" ]; then - python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-copy-files.py - fi + #if [ "$showrecorder" = "t" ]; then + # python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-copy-files.py + #fi fi mkdir -p /usr/lib/airtime diff --git a/install_minimal/include/airtime-initialize.sh b/install_minimal/include/airtime-initialize.sh index dc69073bd..56be18066 100755 --- a/install_minimal/include/airtime-initialize.sh +++ b/install_minimal/include/airtime-initialize.sh @@ -36,9 +36,9 @@ fi if [ "$pypo" = "t" ]; then python $AIRTIMEROOT/python_apps/pypo/install/pypo-initialize.py fi -if [ "$showrecorder" = "t" ]; then - python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-initialize.py -fi +#if [ "$showrecorder" = "t" ]; then +# python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-initialize.py +#fi # Start monit if it is not running, or restart if it is. @@ -61,9 +61,9 @@ if [ "$disable_auto_start_services" = "f" ]; then monit monitor airtime-playout monit monitor airtime-liquidsoap fi - if [ "$showrecorder" = "t" ]; then - monit monitor airtime-show-recorder - fi +# if [ "$showrecorder" = "t" ]; then +# monit monitor airtime-show-recorder +# fi fi monit monitor rabbitmq-server diff --git a/install_minimal/include/airtime-remove-files.sh b/install_minimal/include/airtime-remove-files.sh index b7c6c54b8..93e9efb60 100755 --- a/install_minimal/include/airtime-remove-files.sh +++ b/install_minimal/include/airtime-remove-files.sh @@ -38,8 +38,8 @@ echo "* Pypo" python $AIRTIMEROOT/python_apps/pypo/install/pypo-remove-files.py echo "* Media-Monitor" python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-remove-files.py -echo "* Show-Recorder" -python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-remove-files.py +#echo "* Show-Recorder" +#python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-remove-files.py #remove symlinks rm -f /usr/bin/airtime-import diff --git a/install_minimal/include/airtime-uninitialize.sh b/install_minimal/include/airtime-uninitialize.sh index 2d0388b90..d26256367 100755 --- a/install_minimal/include/airtime-uninitialize.sh +++ b/install_minimal/include/airtime-uninitialize.sh @@ -19,8 +19,8 @@ set +e monit unmonitor airtime-media-monitor >/dev/null 2>&1 monit unmonitor airtime-liquidsoap >/dev/null 2>&1 monit unmonitor airtime-playout >/dev/null 2>&1 -monit unmonitor airtime-show-recorder >/dev/null 2>&1 -#monit unmonitor rabbitmq-server +#monit unmonitor airtime-show-recorder >/dev/null 2>&1 +monit unmonitor rabbitmq-server set -e #virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/" @@ -29,7 +29,7 @@ set -e #uninitialize Airtime services python $AIRTIMEROOT/python_apps/pypo/install/pypo-uninitialize.py python $AIRTIMEROOT/python_apps/media-monitor/install/media-monitor-uninitialize.py -python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-uninitialize.py +#python $AIRTIMEROOT/python_apps/show-recorder/install/recorder-uninitialize.py #call Airtime uninstall script php --php-ini ${SCRIPTPATH}/../airtime-php.ini ${SCRIPTPATH}/airtime-uninstall.php diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index b9eb7d11f..cea8062d4 100755 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -23,14 +23,17 @@ from configobj import ConfigObj AIRTIME_VERSION = "2.0.1" -def api_client_factory(config): - logger = logging.getLogger() +def api_client_factory(config, logger=None): + if logger != None: + temp_logger = logger + else: + temp_logger = logging.getLogger() if config["api_client"] == "airtime": - return AirTimeApiClient() + return AirTimeApiClient(temp_logger) elif config["api_client"] == "obp": return ObpApiClient() else: - logger.info('API Client "'+config["api_client"]+'" not supported. Please check your config file.\n') + temp_logger.info('API Client "'+config["api_client"]+'" not supported. Please check your config file.\n') sys.exit() def to_unicode(obj, encoding='utf-8'): @@ -160,17 +163,20 @@ class ApiClientInterface: class AirTimeApiClient(ApiClientInterface): - def __init__(self): + def __init__(self, logger=None): + if logger != None: + self.logger = logger + else: + self.logger = logging.getLogger() # loading config file try: self.config = ConfigObj('/etc/airtime/api_client.cfg') except Exception, e: - logger = logging.getLogger() - logger.error('Error loading config file: %s', e) + self.logger.error('Error loading config file: %s', e) sys.exit(1) def get_response_from_server(self, url): - logger = logging.getLogger() + logger = self.logger successful_response = False while not successful_response: @@ -190,7 +196,7 @@ class AirTimeApiClient(ApiClientInterface): def __get_airtime_version(self, verbose = True): - logger = logging.getLogger() + logger = self.logger url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["version_url"]) logger.debug("Trying to contact %s", url) url = url.replace("%%api_key%%", self.config["api_key"]) @@ -210,7 +216,7 @@ class AirTimeApiClient(ApiClientInterface): return version def test(self): - logger = logging.getLogger() + logger = self.logger status, items = self.get_schedule('2010-01-01-00-00-00', '2011-01-01-00-00-00') schedule = items["playlists"] logger.debug("Number of playlists found: %s", str(len(schedule))) @@ -226,7 +232,7 @@ class AirTimeApiClient(ApiClientInterface): def is_server_compatible(self, verbose = True): - logger = logging.getLogger() + logger = self.logger version = self.__get_airtime_version(verbose) if (version == -1): if (verbose): @@ -245,7 +251,7 @@ class AirTimeApiClient(ApiClientInterface): def get_schedule(self, start=None, end=None): - logger = logging.getLogger() + logger = self.logger # Construct the URL export_url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["export_url"]) @@ -266,7 +272,7 @@ class AirTimeApiClient(ApiClientInterface): def get_media(self, uri, dst): - logger = logging.getLogger() + logger = self.logger try: src = uri + "/api_key/%%api_key%%" @@ -283,7 +289,7 @@ class AirTimeApiClient(ApiClientInterface): Tell server that the scheduled *playlist* has started. """ def notify_scheduled_item_start_playing(self, pkey, schedule): - logger = logging.getLogger() + logger = self.logger playlist = schedule[pkey] schedule_id = playlist["schedule_id"] url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["update_item_url"]) @@ -310,7 +316,7 @@ class AirTimeApiClient(ApiClientInterface): liquidsoap in get_liquidsoap_data(). """ def notify_media_item_start_playing(self, data, media_id): - logger = logging.getLogger() + logger = self.logger response = '' try: schedule_id = data @@ -330,7 +336,7 @@ class AirTimeApiClient(ApiClientInterface): return response def get_liquidsoap_data(self, pkey, schedule): - logger = logging.getLogger() + logger = self.logger playlist = schedule[pkey] data = dict() try: @@ -340,13 +346,12 @@ class AirTimeApiClient(ApiClientInterface): return data def get_shows_to_record(self): - logger = logging.getLogger() + logger = self.logger response = None try: url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["show_schedule_url"]) logger.debug(url) url = url.replace("%%api_key%%", self.config["api_key"]) - response = self.get_response_from_server(url) response = json.loads(response) @@ -359,7 +364,7 @@ class AirTimeApiClient(ApiClientInterface): return response def upload_recorded_show(self, data, headers): - logger = logging.getLogger() + logger = self.logger response = '' retries = int(self.config["upload_retries"]) @@ -393,7 +398,7 @@ class AirTimeApiClient(ApiClientInterface): return response def setup_media_monitor(self): - logger = logging.getLogger() + logger = self.logger response = None try: @@ -410,7 +415,7 @@ class AirTimeApiClient(ApiClientInterface): return response def update_media_metadata(self, md, mode, is_record=False): - logger = logging.getLogger() + logger = self.logger response = None try: @@ -455,7 +460,7 @@ class AirTimeApiClient(ApiClientInterface): #Note that these are relative paths to the given directory. The full #path is not returned. def list_all_db_files(self, dir_id): - logger = logging.getLogger() + logger = self.logger try: url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["list_all_db_files"]) @@ -472,7 +477,7 @@ class AirTimeApiClient(ApiClientInterface): return response def list_all_watched_dirs(self): - logger = logging.getLogger() + logger = self.logger try: url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["list_all_watched_dirs"]) @@ -488,7 +493,7 @@ class AirTimeApiClient(ApiClientInterface): return response def add_watched_dir(self, path): - logger = logging.getLogger() + logger = self.logger try: url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["add_watched_dir"]) @@ -505,7 +510,7 @@ class AirTimeApiClient(ApiClientInterface): return response def remove_watched_dir(self, path): - logger = logging.getLogger() + logger = self.logger try: url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["remove_watched_dir"]) @@ -522,7 +527,7 @@ class AirTimeApiClient(ApiClientInterface): return response def set_storage_dir(self, path): - logger = logging.getLogger() + logger = self.logger try: url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["set_storage_dir"]) @@ -539,7 +544,7 @@ class AirTimeApiClient(ApiClientInterface): return response def get_stream_setting(self): - logger = logging.getLogger() + logger = self.logger try: url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["get_stream_setting"]) @@ -560,7 +565,7 @@ class AirTimeApiClient(ApiClientInterface): via a http server. """ def register_component(self, component): - logger = logging.getLogger() + logger = self.logger try: url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["register_component"]) @@ -572,7 +577,7 @@ class AirTimeApiClient(ApiClientInterface): logger.error("Exception: %s", e) def notify_liquidsoap_status(self, msg, stream_id, time): - logger = logging.getLogger() + logger = self.logger try: url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["update_liquidsoap_status"]) diff --git a/python_apps/pypo/install/pypo-copy-files.py b/python_apps/pypo/install/pypo-copy-files.py index 90d4705fb..1bef4d1de 100644 --- a/python_apps/pypo/install/pypo-copy-files.py +++ b/python_apps/pypo/install/pypo-copy-files.py @@ -60,6 +60,8 @@ try: create_dir(config['cache_dir']) create_dir(config['file_dir']) create_dir(config['tmp_dir']) + + create_dir(config["base_recorded_files"]) #copy files to bin dir copy_dir("%s/.."%current_script_dir, config["bin_dir"]+"/bin/") @@ -72,6 +74,7 @@ try: os.system("chmod 755 "+os.path.join(config["bin_dir"], "bin/liquidsoap_scripts/notify.sh")) os.system("chown -R pypo:pypo "+config["bin_dir"]) os.system("chown -R pypo:pypo "+config["cache_base_dir"]) + os.system("chown -R pypo:pypo "+config["base_recorded_files"]) #copy init.d script shutil.copy(config["bin_dir"]+"/bin/airtime-playout-init-d", "/etc/init.d/airtime-playout") diff --git a/python_apps/pypo/logging.cfg b/python_apps/pypo/logging.cfg index 3699d3dbf..acff7007d 100644 --- a/python_apps/pypo/logging.cfg +++ b/python_apps/pypo/logging.cfg @@ -1,34 +1,46 @@ [loggers] -keys=root,fetch,push +keys=root,fetch,push,recorder [handlers] -keys=fileOutHandler +keys=pypo,recorder [formatters] keys=simpleFormatter [logger_root] level=DEBUG -handlers=fileOutHandler +handlers=pypo [logger_fetch] level=DEBUG -handlers=fileOutHandler +handlers=pypo qualname=fetch propagate=0 [logger_push] level=DEBUG -handlers=fileOutHandler +handlers=pypo qualname=push propagate=0 -[handler_fileOutHandler] +[logger_recorder] +level=DEBUG +handlers=recorder +qualname=recorder +propagate=0 + +[handler_pypo] class=logging.handlers.RotatingFileHandler level=DEBUG formatter=simpleFormatter args=("/var/log/airtime/pypo/pypo.log", 'a', 1000000, 5,) +[handler_recorder] +class=logging.handlers.RotatingFileHandler +level=DEBUG +formatter=simpleFormatter +args=("/var/log/airtime/pypo/show-recorder.log", 'a', 1000000, 5,) + [formatter_simpleFormatter] format=%(asctime)s %(levelname)s - [%(filename)s : %(funcName)s() : line %(lineno)d] - %(message)s datefmt= diff --git a/python_apps/pypo/pypo-cli.py b/python_apps/pypo/pypo-cli.py index 4617a30f2..d82d0b782 100644 --- a/python_apps/pypo/pypo-cli.py +++ b/python_apps/pypo/pypo-cli.py @@ -15,6 +15,7 @@ from Queue import Queue from pypopush import PypoPush from pypofetch import PypoFetch +from recorder import Recorder from configobj import ConfigObj @@ -127,12 +128,18 @@ if __name__ == '__main__': api_client.register_component("pypo") q = Queue() + + recorder_q = Queue() pp = PypoPush(q) pp.daemon = True pp.start() - pf = PypoFetch(q) + recorder = Recorder(recorder_q) + recorder.daemon = True + recorder.start() + + pf = PypoFetch(q, recorder_q) pf.daemon = True pf.start() diff --git a/python_apps/pypo/pypo.cfg b/python_apps/pypo/pypo.cfg index 3280ba540..09ccdb197 100644 --- a/python_apps/pypo/pypo.cfg +++ b/python_apps/pypo/pypo.cfg @@ -71,3 +71,17 @@ push_interval = 1 # in seconds # while 'otf' (on the fly) cues while loading into ls # (needs the post_processor patch) cue_style = 'pre' + +############################################ +# Recorded Audio settings # +############################################ +record_bitrate = 256 +record_samplerate = 44100 +record_channels = 2 +record_sample_size = 16 + +#can be either ogg|mp3, mp3 recording requires installation of the package "lame" +record_file_type = 'ogg' + +# base path to store recordered shows at +base_recorded_files = '/var/tmp/airtime/show-recorder/' diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py index 12e27ddbe..ab12e8eef 100644 --- a/python_apps/pypo/pypofetch.py +++ b/python_apps/pypo/pypofetch.py @@ -43,11 +43,12 @@ except Exception, e: sys.exit() class PypoFetch(Thread): - def __init__(self, q): + def __init__(self, q, recorder_q): Thread.__init__(self) self.api_client = api_client.api_client_factory(config) self.set_export_source('scheduler') self.queue = q + self.recorder_queue = recorder_q self.schedule_data = [] logger = logging.getLogger('fetch') logger.info("PypoFetch: init complete") @@ -95,6 +96,12 @@ class PypoFetch(Thread): elif command == 'cancel_current_show': logger.info("Cancel current show command received...") self.stop_current_show() + elif command == 'update_recorder_schedule': + temp = m + if temp is not None: + self.parse_shows(temp) + elif command == 'cancel_recording': + self.recorder_queue.put('cancel_recording') except Exception, e: logger.error("Exception in handling RabbitMQ message: %s", e) @@ -313,6 +320,30 @@ class PypoFetch(Thread): # cleanup try: self.cleanup(self.export_source) except Exception, e: logger.error("%s", e) + + def getDateTimeObj(self,time): + timeinfo = time.split(" ") + date = timeinfo[0].split("-") + time = timeinfo[1].split(":") + + date = map(int, date) + time = map(int, time) + + return datetime(date[0], date[1], date[2], time[0], time[1], time[2], 0, None) + + def parse_shows(self, m): + logger = logging.getLogger('fetch') + logger.info("Parsing recording show schedules...") + shows_to_record = {} + shows = m['shows'] + for show in shows: + show_starts = self.getDateTimeObj(show[u'starts']) + show_end = self.getDateTimeObj(show[u'ends']) + time_delta = show_end - show_starts + + shows_to_record[show[u'starts']] = [time_delta, show[u'instance_id'], show[u'name'], m['server_timezone']] + self.recorder_queue.put(shows_to_record) + logger.info(shows_to_record) """ @@ -488,6 +519,17 @@ class PypoFetch(Thread): if status == 1: logger.info("Bootstrap schedule received: %s", self.schedule_data) self.process_schedule(self.schedule_data, "scheduler", True) + + # Bootstrap: since we are just starting up, we need to grab the + # most recent schedule. After that we can just wait for updates. + try: + temp = self.api_client.get_shows_to_record() + if temp is not None: + self.parse_shows(temp) + logger.info("Bootstrap recorder schedule received: %s", temp) + except Exception, e: + logger.error(e) + logger.info("Bootstrap complete: got initial copy of the schedule") @@ -542,8 +584,18 @@ class PypoFetch(Thread): status, self.schedule_data = self.api_client.get_schedule() if status == 1: self.process_schedule(self.schedule_data, "scheduler", False) + """ + Fetch recorder schedule + """ + try: + temp = self.api_client.get_shows_to_record() + if temp is not None: + self.parse_shows(temp) + logger.info("updated recorder schedule received: %s", temp) + except Exception, e: + logger.error(e) - loops += 1 + loops += 1 """ Main loop of the thread: diff --git a/python_apps/pypo/recorder.py b/python_apps/pypo/recorder.py new file mode 100644 index 000000000..6347c4f76 --- /dev/null +++ b/python_apps/pypo/recorder.py @@ -0,0 +1,270 @@ +import urllib +import logging +import logging.config +import json +import time +import datetime +import os +import sys +import shutil +import socket +import pytz +import signal +import math + +from configobj import ConfigObj + +from poster.encode import multipart_encode +from poster.streaminghttp import register_openers +import urllib2 + +from subprocess import Popen +from threading import Thread + +import mutagen + +from api_clients import api_client + +# For RabbitMQ +from kombu.connection import BrokerConnection +from kombu.messaging import Exchange, Queue, Consumer, Producer + +# loading config file +try: + config = ConfigObj('/etc/airtime/pypo.cfg') +except Exception, e: + self.logger.error('Error loading config file: %s', e) + sys.exit() + +def getDateTimeObj(time): + timeinfo = time.split(" ") + date = timeinfo[0].split("-") + time = timeinfo[1].split(":") + + date = map(int, date) + time = map(int, time) + + return datetime.datetime(date[0], date[1], date[2], time[0], time[1], time[2], 0, None) + +PUSH_INTERVAL = 2 + +class ShowRecorder(Thread): + + def __init__ (self, show_instance, show_name, filelength, start_time): + Thread.__init__(self) + self.logger = logging.getLogger('recorder') + self.api_client = api_client.api_client_factory(config, self.logger) + self.filelength = filelength + self.start_time = start_time + self.show_instance = show_instance + self.show_name = show_name + self.p = None + + def record_show(self): + length = str(self.filelength)+".0" + filename = self.start_time + filename = filename.replace(" ", "-") + + if config["record_file_type"] in ["mp3", "ogg"]: + filetype = config["record_file_type"] + else: + filetype = "ogg"; + + filepath = "%s%s.%s" % (config["base_recorded_files"], filename, filetype) + + br = config["record_bitrate"] + sr = config["record_samplerate"] + c = config["record_channels"] + ss = config["record_sample_size"] + + #-f:16,2,44100 + #-b:256 + command = "ecasound -f:%s,%s,%s -i alsa -o %s,%s000 -t:%s" % (ss, c, sr, filepath, br, length) + args = command.split(" ") + + self.logger.info("starting record") + self.logger.info("command " + command) + + self.p = Popen(args) + + #blocks at the following line until the child process + #quits + code = self.p.wait() + + self.logger.info("finishing record, return code %s", self.p.returncode) + code = self.p.returncode + + self.p = None + + return code, filepath + + def cancel_recording(self): + #add 3 second delay before actually cancelling the show. The reason + #for this is because it appears that ecasound starts 1 second later than + #it should, and therefore this method is sometimes incorrectly called 1 + #second before the show ends. + #time.sleep(3) + + #send signal interrupt (2) + self.logger.info("Show manually cancelled!") + if (self.p is not None): + self.p.send_signal(signal.SIGINT) + + #if self.p is defined, then the child process ecasound is recording + def is_recording(self): + return (self.p is not None) + + def upload_file(self, filepath): + + filename = os.path.split(filepath)[1] + + # Register the streaming http handlers with urllib2 + register_openers() + + # headers contains the necessary Content-Type and Content-Length + # datagen is a generator object that yields the encoded parameters + datagen, headers = multipart_encode({"file": open(filepath, "rb"), 'name': filename, 'show_instance': self.show_instance}) + + self.api_client.upload_recorded_show(datagen, headers) + + def set_metadata_and_save(self, filepath): + try: + date = self.start_time + md = date.split(" ") + time = md[1].replace(":", "-") + self.logger.info("time: %s" % time) + + name = time+"-"+self.show_name + artist = api_client.encode_to("Airtime Show Recorder",'utf-8') + + #set some metadata for our file daemon + recorded_file = mutagen.File(filepath, easy=True) + recorded_file['title'] = name + recorded_file['artist'] = artist + recorded_file['date'] = md[0] + recorded_file['tracknumber'] = self.show_instance + recorded_file.save() + + except Exception, e: + self.logger.error("Exception: %s", e) + + def run(self): + code, filepath = self.record_show() + + if code == 0: + try: + self.logger.info("Preparing to upload %s" % filepath) + + self.set_metadata_and_save(filepath) + + self.upload_file(filepath) + os.remove(filepath) + except Exception, e: + self.logger.error(e) + else: + self.logger.info("problem recording show") + os.remove(filepath) + +class Recorder(Thread): + def __init__(self, q): + Thread.__init__(self) + self.logger = logging.getLogger('recorder') + self.api_client = api_client.api_client_factory(config) + self.api_client.register_component("show-recorder") + self.sr = None + self.shows_to_record = {} + self.server_timezone = '' + self.queue = q + self.logger.info("RecorderFetch: init complete") + + def handle_message(self): + if not self.queue.empty(): + msg = self.queue.get() + self.logger.info("Receivied msg from Pypo Fetch: %s", msg) + if msg == 'cancel_recording': + if self.sr is not None and self.sr.is_recording(): + self.sr.cancel_recording() + else: + self.shows_to_record = msg + + if self.shows_to_record: + self.start_record() + + def get_time_till_next_show(self): + if len(self.shows_to_record) != 0: + tnow = datetime.datetime.utcnow() + sorted_show_keys = sorted(self.shows_to_record.keys()) + + start_time = sorted_show_keys[0] + next_show = getDateTimeObj(start_time) + + delta = next_show - tnow + out = delta.seconds + + if out < 5: + self.logger.debug("Shows %s", self.shows_to_record) + self.logger.debug("Next show %s", next_show) + self.logger.debug("Now %s", tnow) + return out + + def start_record(self): + if len(self.shows_to_record) != 0: + try: + delta = self.get_time_till_next_show() + if delta < 5: + self.logger.debug("sleeping %s seconds until show", delta) + time.sleep(delta) + + sorted_show_keys = sorted(self.shows_to_record.keys()) + start_time = sorted_show_keys[0] + show_length = self.shows_to_record[start_time][0] + show_instance = self.shows_to_record[start_time][1] + show_name = self.shows_to_record[start_time][2] + server_timezone = self.shows_to_record[start_time][3] + + T = pytz.timezone(server_timezone) + start_time_on_UTC = getDateTimeObj(start_time) + start_time_on_server = start_time_on_UTC.replace(tzinfo=pytz.utc).astimezone(T) + start_time_formatted = '%(year)d-%(month)02d-%(day)02d %(hour)02d:%(min)02d:%(sec)02d' % \ + {'year': start_time_on_server.year, 'month': start_time_on_server.month, 'day': start_time_on_server.day,\ + 'hour': start_time_on_server.hour, 'min': start_time_on_server.minute, 'sec': start_time_on_server.second} + self.sr = ShowRecorder(show_instance, show_name, show_length.seconds, start_time_formatted) + self.sr.start() + #remove show from shows to record. + del self.shows_to_record[start_time] + #self.time_till_next_show = self.get_time_till_next_show() + except Exception,e : + import traceback + top = traceback.format_exc() + self.logger.error('Exception: %s', e) + self.logger.error("traceback: %s", top) + + """ + Main loop of the thread: + Wait for schedule updates from RabbitMQ, but in case there arent any, + poll the server to get the upcoming schedule. + """ + def run(self): + try: + self.logger.info("Started...") + + recording = False + + loops = 0 + heartbeat_period = math.floor(30/PUSH_INTERVAL) + + while True: + if loops % heartbeat_period == 0: + self.logger.info("heartbeat") + loops = 0 + try: self.handle_message() + except Exception, e: + self.logger.error('Pypo Recorder Exception: %s', e) + time.sleep(PUSH_INTERVAL) + loops += 1 + except Exception,e : + import traceback + top = traceback.format_exc() + self.logger.error('Exception: %s', e) + self.logger.error("traceback: %s", top) + diff --git a/python_apps/show-recorder/airtime-show-recorder b/python_apps/show-recorder/airtime-show-recorder deleted file mode 100755 index db0165649..000000000 --- a/python_apps/show-recorder/airtime-show-recorder +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/" -. ${virtualenv_bin}activate - -recorder_user="pypo" - - -# Location of pypo_cli.py Python script -recorder_path="/usr/lib/airtime/show-recorder/" -recorder_script="recorder.py" - -api_client_path="/usr/lib/airtime/" -cd ${recorder_path} - -exec 2>&1 - -export HOME="/var/tmp/airtime/show-recorder/" -export TERM=xterm -export PYTHONPATH=${api_client_path} - -#this line works: su ${recorder_user} -c "python -u ${recorder_path}${recorder_script}" -# Note the -u when calling python! we need it to get unbuffered binary stdout and stderr -exec python -u ${recorder_path}${recorder_script} > /var/log/airtime/show-recorder/py-interpreter.log 2>&1 - -# EOF diff --git a/python_apps/show-recorder/airtime-show-recorder-init-d b/python_apps/show-recorder/airtime-show-recorder-init-d deleted file mode 100755 index 2fb8f4666..000000000 --- a/python_apps/show-recorder/airtime-show-recorder-init-d +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -### BEGIN INIT INFO -# Provides: airtime-show-recorder -# Required-Start: $local_fs $remote_fs $network $syslog -# Required-Stop: $local_fs $remote_fs $network $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Manage airtime-show-recorder daemon -### END INIT INFO - -USERID=pypo -GROUPID=pypo -NAME=Airtime\ Show\ Recorder - -DAEMON=/usr/lib/airtime/show-recorder/airtime-show-recorder -PIDFILE=/var/run/airtime-show-recorder.pid - -start () { - start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --make-pidfile --pidfile $PIDFILE --startas $DAEMON - monit monitor airtime-show-recorder >/dev/null 2>&1 -} - -stop () { - # Send TERM after 5 seconds, wait at most 30 seconds. - - monit unmonitor airtime-show-recorder >/dev/null 2>&1 - start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE - rm -f $PIDFILE -} - -start_no_monit() { - start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --make-pidfile --pidfile $PIDFILE --startas $DAEMON -} - - -case "${1:-''}" in - 'start') - # start commands here - echo -n "Starting $NAME: " - start - echo "Done." - ;; - 'stop') - # stop commands here - echo -n "Stopping $NAME: " - stop - echo "Done." - ;; - 'restart') - # restart commands here - echo -n "Restarting $NAME: " - stop - start - echo "Done." - ;; - 'start-no-monit') - # restart commands here - echo -n "Starting $NAME: " - start_no_monit - echo "Done." - ;; - 'status') - # status commands here - /usr/bin/airtime-check-system - ;; - *) # no parameter specified - echo "Usage: $SELF start|stop|restart|status" - exit 1 - ;; -esac diff --git a/python_apps/show-recorder/install/recorder-copy-files.py b/python_apps/show-recorder/install/recorder-copy-files.py deleted file mode 100644 index 44ae93cc9..000000000 --- a/python_apps/show-recorder/install/recorder-copy-files.py +++ /dev/null @@ -1,74 +0,0 @@ -import os -import shutil -import sys -from configobj import ConfigObj - -if os.geteuid() != 0: - print "Please run this as root." - sys.exit(1) - -def get_current_script_dir(): - current_script_dir = os.path.realpath(__file__) - index = current_script_dir.rindex('/') - return current_script_dir[0:index] - -def copy_dir(src_dir, dest_dir): - if (os.path.exists(dest_dir)) and (dest_dir != "/"): - shutil.rmtree(dest_dir) - if not (os.path.exists(dest_dir)): - #print "Copying directory "+os.path.realpath(src_dir)+" to "+os.path.realpath(dest_dir) - shutil.copytree(src_dir, dest_dir) - -def create_dir(path): - try: - os.makedirs(path) - except Exception, e: - pass - -PATH_INI_FILE = '/etc/airtime/recorder.cfg' - -try: - # Absolute path this script is in - current_script_dir = get_current_script_dir() - - if not os.path.exists(PATH_INI_FILE): - shutil.copy('%s/../recorder.cfg'%current_script_dir, PATH_INI_FILE) - - # load config file - try: - config = ConfigObj(PATH_INI_FILE) - except Exception, e: - print 'Error loading config file: ', e - sys.exit(1) - - - #copy monit files - shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/') - if os.environ["disable_auto_start_services"] == "f": - shutil.copy('%s/../monit-airtime-show-recorder.cfg'%current_script_dir, '/etc/monit/conf.d/') - - #create temporary media-storage directory - #print "Creating temporary media storage directory" - create_dir(config["base_recorded_files"]) - #os.system("chmod -R 755 "+config["base_recorded_files"]) - os.system("chown -R pypo:pypo "+config["base_recorded_files"]) - - #create log directories - #print "Creating log directories" - create_dir(config["log_dir"]) - os.system("chmod -R 755 " + config["log_dir"]) - os.system("chown -R pypo:pypo "+config["log_dir"]) - - #copy python files - copy_dir("%s/.."%current_script_dir, config["bin_dir"]) - - #set python file permissions - #print "Setting permissions" - os.system("chmod -R 755 "+config["bin_dir"]) - os.system("chown -R pypo:pypo "+config["bin_dir"]) - - #copy init.d script - shutil.copy(config["bin_dir"]+"/airtime-show-recorder-init-d", "/etc/init.d/airtime-show-recorder") - -except Exception, e: - print e diff --git a/python_apps/show-recorder/install/recorder-initialize.py b/python_apps/show-recorder/install/recorder-initialize.py deleted file mode 100644 index dd0c8bdf4..000000000 --- a/python_apps/show-recorder/install/recorder-initialize.py +++ /dev/null @@ -1,24 +0,0 @@ -from subprocess import Popen -import os -import sys - -if os.geteuid() != 0: - print "Please run this as root." - sys.exit(1) - -try: - if os.environ["disable_auto_start_services"] == "f": - #register init.d script - p = Popen("update-rc.d airtime-show-recorder defaults >/dev/null 2>&1", shell=True) - sts = os.waitpid(p.pid, 0)[1] - - #start daemon - print "* Waiting for show-recorder processes to start..." - """ - p = Popen("/etc/init.d/airtime-show-recorder stop", shell=True) - sts = os.waitpid(p.pid, 0)[1] - """ - p = Popen("/etc/init.d/airtime-show-recorder start-no-monit", shell=True) - sts = os.waitpid(p.pid, 0)[1] -except Exception, e: - print e diff --git a/python_apps/show-recorder/install/recorder-remove-files.py b/python_apps/show-recorder/install/recorder-remove-files.py deleted file mode 100644 index feaf574eb..000000000 --- a/python_apps/show-recorder/install/recorder-remove-files.py +++ /dev/null @@ -1,48 +0,0 @@ -import os -import shutil -import sys -from configobj import ConfigObj - -if os.geteuid() != 0: - print "Please run this as root." - sys.exit(1) - -def remove_file(path): - try: - os.remove(path) - except Exception, e: - pass - -PATH_INI_FILE = '/etc/airtime/recorder.cfg' - -# load config file -try: - config = ConfigObj(PATH_INI_FILE) -except Exception, e: - print 'Error loading config file: ', e - sys.exit(1) - -try: - #remove init.d script - print " * Removing Show-Recorder init.d Script" - remove_file('/etc/init.d/airtime-show-recorder') - - #remove bin dir - print " * Removing Show-Recorder Program Directory" - shutil.rmtree(config["bin_dir"], ignore_errors=True) - - #remove log dir - print " * Removing Show-Recorder Log Directory" - shutil.rmtree(config["log_dir"], ignore_errors=True) - - #remove temporary media-storage dir - print " * Removing Show-Recorder Temporary Directory" - shutil.rmtree(config["base_recorded_files"], ignore_errors=True) - - #remove monit files - print " * Removing Show-Recorder Monit Files" - remove_file("/etc/monit/conf.d/monit-airtime-show-recorder.cfg") - remove_file("/etc/monit/conf.d/monit-airtime-generic.cfg") - -except Exception, e: - print "Error %s" % e diff --git a/python_apps/show-recorder/install/recorder-uninitialize.py b/python_apps/show-recorder/install/recorder-uninitialize.py deleted file mode 100644 index 168ff14b8..000000000 --- a/python_apps/show-recorder/install/recorder-uninitialize.py +++ /dev/null @@ -1,19 +0,0 @@ -from subprocess import Popen -import os -import sys - -if os.geteuid() != 0: - print "Please run this as root." - sys.exit(1) - -try: - print "Waiting for show-recorder processes to stop...", - if (os.path.exists('/etc/init.d/airtime-show-recorder')): - p = Popen("/etc/init.d/airtime-show-recorder stop", shell=True) - sts = os.waitpid(p.pid, 0)[1] - print "OK" - else: - print "Wasn't running" -except Exception, e: - print e - diff --git a/python_apps/show-recorder/install/recorder-uninstall.py b/python_apps/show-recorder/install/recorder-uninstall.py deleted file mode 100644 index d778f8d07..000000000 --- a/python_apps/show-recorder/install/recorder-uninstall.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -import os -import sys -from configobj import ConfigObj - -if os.geteuid() != 0: - print "Please run this as root." - sys.exit(1) - -PATH_INI_FILE = '/etc/airtime/recorder.cfg' - -def remove_path(path): - os.system('rm -rf "%s"' % path) - -def get_current_script_dir(): - current_script_dir = os.path.realpath(__file__) - index = current_script_dir.rindex('/') - return current_script_dir[0:index] - -def remove_monit_file(): - os.system("rm -f /etc/monit/conf.d/monit-airtime-show-recorder.cfg") - - -try: - # load config file - try: - config = ConfigObj(PATH_INI_FILE) - except Exception, e: - print 'Error loading config file: ', e - sys.exit(1) - - os.system("/etc/init.d/airtime-show-recorder stop") - os.system("rm -f /etc/init.d/airtime-show-recorder") - os.system("update-rc.d -f airtime-show-recorder remove >/dev/null 2>&1") - - print "Removing monit file" - remove_monit_file() - - print "Removing log directories" - remove_path(config["log_dir"]) - - print "Removing symlinks" - os.system("rm -f /usr/bin/airtime-show-recorder") - - print "Removing application files" - remove_path(config["bin_dir"]) - - print "Removing media files" - remove_path(config["base_recorded_files"]) - - print "Uninstall complete." -except Exception, e: - print "exception:" + str(e) diff --git a/python_apps/show-recorder/logging.cfg b/python_apps/show-recorder/logging.cfg deleted file mode 100644 index 766f56972..000000000 --- a/python_apps/show-recorder/logging.cfg +++ /dev/null @@ -1,22 +0,0 @@ -[loggers] -keys=root - -[handlers] -keys=fileOutHandler - -[formatters] -keys=simpleFormatter - -[logger_root] -level=DEBUG -handlers=fileOutHandler - -[handler_fileOutHandler] -class=logging.handlers.RotatingFileHandler -level=DEBUG -formatter=simpleFormatter -args=("/var/log/airtime/show-recorder/show-recorder.log", 'a', 1000000, 5,) - -[formatter_simpleFormatter] -format=%(asctime)s %(levelname)s - [%(filename)s : %(funcName)s() : line %(lineno)d] - %(message)s -datefmt= diff --git a/python_apps/show-recorder/monit-airtime-show-recorder.cfg b/python_apps/show-recorder/monit-airtime-show-recorder.cfg deleted file mode 100644 index 137e56c03..000000000 --- a/python_apps/show-recorder/monit-airtime-show-recorder.cfg +++ /dev/null @@ -1,9 +0,0 @@ - set daemon 10 # Poll at 5 second intervals - set logfile /var/log/monit.log - - set httpd port 2812 - - check process airtime-show-recorder - with pidfile "/var/run/airtime-show-recorder.pid" - start program = "/etc/init.d/airtime-show-recorder start" with timeout 10 seconds - stop program = "/etc/init.d/airtime-show-recorder stop" diff --git a/python_apps/show-recorder/recorder.cfg b/python_apps/show-recorder/recorder.cfg deleted file mode 100644 index d817a32b2..000000000 --- a/python_apps/show-recorder/recorder.cfg +++ /dev/null @@ -1,31 +0,0 @@ -api_client = "airtime" - -# where the binary files live -bin_dir = '/usr/lib/airtime/show-recorder' - -# base path to store recordered shows at -base_recorded_files = '/var/tmp/airtime/show-recorder/' - -# where the logging files live -log_dir = '/var/log/airtime/show-recorder' - -############################################ -# RabbitMQ settings # -############################################ -rabbitmq_host = 'localhost' -rabbitmq_user = 'guest' -rabbitmq_password = 'guest' -rabbitmq_vhost = '/' - -############################################ -# Recorded Audio settings # -############################################ -record_bitrate = 256 -record_samplerate = 44100 -record_channels = 2 -record_sample_size = 16 -record_timeout = 3600 - -#can be either ogg|mp3, mp3 recording requires installation of the package "lame" -record_file_type = 'ogg' - diff --git a/python_apps/show-recorder/recorder.py b/python_apps/show-recorder/recorder.py deleted file mode 100644 index 3ec1caf39..000000000 --- a/python_apps/show-recorder/recorder.py +++ /dev/null @@ -1,348 +0,0 @@ -import urllib -import logging -import logging.config -import json -import time -import datetime -import os -import sys -import shutil -import socket -import pytz -import signal - -from configobj import ConfigObj - -from poster.encode import multipart_encode -from poster.streaminghttp import register_openers -import urllib2 - -from subprocess import Popen -from threading import Thread - -import mutagen - -from api_clients import api_client - -# For RabbitMQ -from kombu.connection import BrokerConnection -from kombu.messaging import Exchange, Queue, Consumer, Producer - -# configure logging -try: - logging.config.fileConfig("logging.cfg") -except Exception, e: - print 'Error configuring logging: ', e - sys.exit() - -# loading config file -try: - config = ConfigObj('/etc/airtime/recorder.cfg') -except Exception, e: - logger = logging.getLogger() - logger.error('Error loading config file: %s', e) - sys.exit() - -def getDateTimeObj(time): - timeinfo = time.split(" ") - date = timeinfo[0].split("-") - time = timeinfo[1].split(":") - - date = map(int, date) - time = map(int, time) - - return datetime.datetime(date[0], date[1], date[2], time[0], time[1], time[2], 0, None) - -class ShowRecorder(Thread): - - def __init__ (self, show_instance, show_name, filelength, start_time): - Thread.__init__(self) - self.api_client = api_client.api_client_factory(config) - self.filelength = filelength - self.start_time = start_time - self.show_instance = show_instance - self.show_name = show_name - self.logger = logging.getLogger('root') - self.p = None - - def record_show(self): - length = str(self.filelength)+".0" - filename = self.start_time - filename = filename.replace(" ", "-") - - if config["record_file_type"] in ["mp3", "ogg"]: - filetype = config["record_file_type"] - else: - filetype = "ogg"; - - filepath = "%s%s.%s" % (config["base_recorded_files"], filename, filetype) - - br = config["record_bitrate"] - sr = config["record_samplerate"] - c = config["record_channels"] - ss = config["record_sample_size"] - - #-f:16,2,44100 - #-b:256 - command = "ecasound -f:%s,%s,%s -i alsa -o %s,%s000 -t:%s" % (ss, c, sr, filepath, br, length) - args = command.split(" ") - - self.logger.info("starting record") - self.logger.info("command " + command) - - self.p = Popen(args) - - #blocks at the following line until the child process - #quits - code = self.p.wait() - - self.logger.info("finishing record, return code %s", self.p.returncode) - code = self.p.returncode - - self.p = None - - return code, filepath - - def cancel_recording(self): - #add 3 second delay before actually cancelling the show. The reason - #for this is because it appears that ecasound starts 1 second later than - #it should, and therefore this method is sometimes incorrectly called 1 - #second before the show ends. - #time.sleep(3) - - #send signal interrupt (2) - self.logger.info("Show manually cancelled!") - if (self.p is not None): - self.p.send_signal(signal.SIGINT) - - #if self.p is defined, then the child process ecasound is recording - def is_recording(self): - return (self.p is not None) - - def upload_file(self, filepath): - - filename = os.path.split(filepath)[1] - - # Register the streaming http handlers with urllib2 - register_openers() - - # headers contains the necessary Content-Type and Content-Length - # datagen is a generator object that yields the encoded parameters - datagen, headers = multipart_encode({"file": open(filepath, "rb"), 'name': filename, 'show_instance': self.show_instance}) - - self.api_client.upload_recorded_show(datagen, headers) - - def set_metadata_and_save(self, filepath): - try: - date = self.start_time - md = date.split(" ") - time = md[1].replace(":", "-") - self.logger.info("time: %s" % time) - - name = time+"-"+self.show_name - artist = api_client.encode_to("Airtime Show Recorder",'utf-8') - - #set some metadata for our file daemon - recorded_file = mutagen.File(filepath, easy=True) - recorded_file['title'] = name - recorded_file['artist'] = artist - recorded_file['date'] = md[0] - recorded_file['tracknumber'] = self.show_instance - recorded_file.save() - - except Exception, e: - self.logger.error("Exception: %s", e) - - def run(self): - code, filepath = self.record_show() - - if code == 0: - try: - self.logger.info("Preparing to upload %s" % filepath) - - self.set_metadata_and_save(filepath) - - self.upload_file(filepath) - os.remove(filepath) - except Exception, e: - self.logger.error(e) - else: - self.logger.info("problem recording show") - os.remove(filepath) - -class CommandListener(): - def __init__(self): - #Thread.__init__(self) - self.api_client = api_client.api_client_factory(config) - self.api_client.register_component("show-recorder") - self.logger = logging.getLogger('root') - self.sr = None - self.current_schedule = {} - self.shows_to_record = {} - self.time_till_next_show = config["record_timeout"] - self.logger.info("RecorderFetch: init complete") - self.server_timezone = ''; - - def init_rabbit_mq(self): - self.logger.info("Initializing RabbitMQ stuff") - try: - schedule_exchange = Exchange("airtime-show-recorder", "direct", durable=True, auto_delete=True) - schedule_queue = Queue("recorder-fetch", exchange=schedule_exchange, key="foo") - self.connection = BrokerConnection(config["rabbitmq_host"], config["rabbitmq_user"], config["rabbitmq_password"], config["rabbitmq_vhost"]) - channel = self.connection.channel() - consumer = Consumer(channel, schedule_queue) - consumer.register_callback(self.handle_message) - consumer.consume() - except Exception, e: - self.logger.error(e) - return False - - return True - - def handle_message(self, body, message): - # ACK the message to take it off the queue - message.ack() - self.logger.info("Received command from RabbitMQ: " + message.body) - m = json.loads(message.body) - command = m['event_type'] - self.logger.info("Handling command: " + command) - - if(command == 'update_schedule'): - temp = m['shows'] - if temp is not None: - self.parse_shows(temp) - self.server_timezone = m['server_timezone'] - elif(command == 'cancel_recording'): - if self.sr is not None and self.sr.is_recording(): - self.sr.cancel_recording() - - def parse_shows(self, shows): - self.logger.info("Parsing show schedules...") - self.shows_to_record = {} - for show in shows: - show_starts = getDateTimeObj(show[u'starts']) - show_end = getDateTimeObj(show[u'ends']) - time_delta = show_end - show_starts - - self.shows_to_record[show[u'starts']] = [time_delta, show[u'instance_id'], show[u'name']] - delta = self.get_time_till_next_show() - # awake at least 5 seconds prior to the show start - self.time_till_next_show = delta - 5 - - self.logger.info(self.shows_to_record) - - def get_time_till_next_show(self): - if len(self.shows_to_record) != 0: - tnow = datetime.datetime.utcnow() - sorted_show_keys = sorted(self.shows_to_record.keys()) - - start_time = sorted_show_keys[0] - next_show = getDateTimeObj(start_time) - - delta = next_show - tnow - out = delta.seconds - - self.logger.debug("Next show %s", next_show) - self.logger.debug("Now %s", tnow) - else: - out = config["record_timeout"] - return out - - def start_record(self): - if len(self.shows_to_record) != 0: - try: - delta = self.get_time_till_next_show() - - self.logger.debug("sleeping %s seconds until show", delta) - time.sleep(delta) - - sorted_show_keys = sorted(self.shows_to_record.keys()) - start_time = sorted_show_keys[0] - show_length = self.shows_to_record[start_time][0] - show_instance = self.shows_to_record[start_time][1] - show_name = self.shows_to_record[start_time][2] - - T = pytz.timezone(self.server_timezone) - start_time_on_UTC = getDateTimeObj(start_time) - start_time_on_server = start_time_on_UTC.replace(tzinfo=pytz.utc).astimezone(T) - start_time_formatted = '%(year)d-%(month)02d-%(day)02d %(hour)02d:%(min)02d:%(sec)02d' % \ - {'year': start_time_on_server.year, 'month': start_time_on_server.month, 'day': start_time_on_server.day,\ - 'hour': start_time_on_server.hour, 'min': start_time_on_server.minute, 'sec': start_time_on_server.second} - self.sr = ShowRecorder(show_instance, show_name, show_length.seconds, start_time_formatted) - self.sr.start() - #remove show from shows to record. - del self.shows_to_record[start_time] - self.time_till_next_show = self.get_time_till_next_show() - except Exception,e : - import traceback - top = traceback.format_exc() - self.logger.error('Exception: %s', e) - self.logger.error("traceback: %s", top) - else: - self.logger.debug("No recording scheduled...") - - """ - Main loop of the thread: - Wait for schedule updates from RabbitMQ, but in case there arent any, - poll the server to get the upcoming schedule. - """ - def run(self): - self.logger.info("Started...") - while not self.init_rabbit_mq(): - self.logger.error("Error connecting to RabbitMQ Server. Trying again in few seconds") - time.sleep(5) - - # Bootstrap: since we are just starting up, we need to grab the - # most recent schedule. After that we can just wait for updates. - try: - temp = self.api_client.get_shows_to_record() - if temp is not None: - shows = temp['shows'] - self.server_timezone = temp['server_timezone'] - self.parse_shows(shows) - self.logger.info("Bootstrap complete: got initial copy of the schedule") - except Exception, e: - self.logger.error(e) - - loops = 1 - recording = False - - while True: - self.logger.info("Loop #%s", loops) - try: - # block until 5 seconds before the next show start - self.connection.drain_events(timeout=int(self.time_till_next_show)) - except socket.timeout, s: - self.logger.info(s) - - # start_record set time_till_next_show to config["record_timeout"] so we should check before - # if timeout amount was 1 hr.. - update_schedule = False - if int(self.time_till_next_show) == int(config["record_timeout"]) : - update_schedule = True - - # start recording - self.start_record() - - # if real timeout happended get show schedule from airtime - if update_schedule : - temp = self.api_client.get_shows_to_record() - if temp is not None: - shows = temp['shows'] - self.server_timezone = temp['server_timezone'] - self.parse_shows(shows) - self.logger.info("Real Timeout: the schedule has updated") - - except Exception, e: - import traceback - top = traceback.format_exc() - self.logger.error('Exception: %s', e) - self.logger.error("traceback: %s", top) - time.sleep(3) - loops += 1 - -if __name__ == '__main__': - cl = CommandListener() - cl.run() - - diff --git a/utils/airtime-check-system.php b/utils/airtime-check-system.php index ae1b11641..4f7237fc0 100644 --- a/utils/airtime-check-system.php +++ b/utils/airtime-check-system.php @@ -189,17 +189,6 @@ class AirtimeCheck { self::output_status("MEDIA_MONITOR_MEM_PERC", "0%"); self::output_status("MEDIA_MONITOR_CPU_PERC", "0%"); } - if (isset($services->show_recorder)) { - self::output_status("SHOW_RECORDER_PROCESS_ID", $data->services->show_recorder->process_id); - self::output_status("SHOW_RECORDER_RUNNING_SECONDS", $data->services->show_recorder->uptime_seconds); - self::output_status("SHOW_RECORDER_MEM_PERC", $data->services->show_recorder->memory_perc); - self::output_status("SHOW_RECORDER_CPU_PERC", $data->services->show_recorder->cpu_perc); - } else { - self::output_status("SHOW_RECORDER_PROCESS_ID", "FAILED"); - self::output_status("SHOW_RECORDER_RUNNING_SECONDS", "0"); - self::output_status("SHOW_RECORDER_MEM_PERC", "0%"); - self::output_status("SHOW_RECORDER_CPU_PERC", "0%"); - } if (isset($services->rabbitmq)) { self::output_status("RABBITMQ_PROCESS_ID", $data->services->rabbitmq->process_id); self::output_status("RABBITMQ_RUNNING_SECONDS", $data->services->rabbitmq->uptime_seconds); From 06c825479bfd53c81019a6e8e3bfe25663768c4a Mon Sep 17 00:00:00 2001 From: James Date: Fri, 24 Feb 2012 14:10:27 -0500 Subject: [PATCH 12/35] CC-3345: Enter unusable state when liquidsoap value has an '=' character in it. - fixed --- python_apps/pypo/pypofetch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py index ab12e8eef..10e3891f4 100644 --- a/python_apps/pypo/pypofetch.py +++ b/python_apps/pypo/pypofetch.py @@ -135,7 +135,7 @@ class PypoFetch(Thread): # if empty line if not line: continue - key, value = line.split('=') + key, value = line.split(' = ') key = key.strip() value = value.strip() value = value.replace('"', '') From 4e72c1150d61c7e866b2570ccbde95dbf5d012b6 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 24 Feb 2012 16:24:12 -0500 Subject: [PATCH 13/35] CC-3346: Recorder: Merge recorder with pypo - Upgrade for 2.0.2 --- VERSION | 2 +- install_minimal/include/airtime-constants.php | 2 +- install_minimal/include/airtime-copy-files.sh | 2 +- install_minimal/include/airtime-upgrade.php | 4 + .../upgrades/airtime-2.0.2/UpgradeCommon.php | 252 + .../airtime-2.0.2/airtime-monit.cfg.202 | 24 + .../airtime-2.0.2/airtime-upgrade-old.php | 586 +++ .../airtime-2.0.2/airtime-upgrade.php | 81 + .../upgrades/airtime-2.0.2/airtime.conf.202 | 23 + .../upgrades/airtime-2.0.2/api_client.cfg.202 | 117 + .../upgrades/airtime-2.0.2/liquidsoap.cfg.202 | 69 + .../airtime-2.0.2/media-monitor.cfg.202 | 22 + .../airtime-2.0.2/propel/airtime-conf.php | 28 + .../airtime-2.0.2/propel/airtime/CcAccess.php | 18 + .../propel/airtime/CcAccessPeer.php | 18 + .../propel/airtime/CcAccessQuery.php | 18 + .../airtime-2.0.2/propel/airtime/CcBackup.php | 18 + .../propel/airtime/CcBackupPeer.php | 18 + .../propel/airtime/CcBackupQuery.php | 18 + .../propel/airtime/CcCountry.php | 18 + .../propel/airtime/CcCountryPeer.php | 18 + .../propel/airtime/CcCountryQuery.php | 18 + .../airtime-2.0.2/propel/airtime/CcFiles.php | 31 + .../propel/airtime/CcFilesPeer.php | 18 + .../propel/airtime/CcFilesQuery.php | 18 + .../propel/airtime/CcLoginAttempts.php | 18 + .../propel/airtime/CcLoginAttemptsPeer.php | 18 + .../propel/airtime/CcLoginAttemptsQuery.php | 18 + .../propel/airtime/CcMusicDirs.php | 18 + .../propel/airtime/CcMusicDirsPeer.php | 18 + .../propel/airtime/CcMusicDirsQuery.php | 18 + .../airtime-2.0.2/propel/airtime/CcPerms.php | 18 + .../propel/airtime/CcPermsPeer.php | 18 + .../propel/airtime/CcPermsQuery.php | 18 + .../propel/airtime/CcPlaylist.php | 48 + .../propel/airtime/CcPlaylistPeer.php | 18 + .../propel/airtime/CcPlaylistQuery.php | 18 + .../propel/airtime/CcPlaylistcontents.php | 81 + .../propel/airtime/CcPlaylistcontentsPeer.php | 18 + .../airtime/CcPlaylistcontentsQuery.php | 18 + .../airtime-2.0.2/propel/airtime/CcPref.php | 18 + .../propel/airtime/CcPrefPeer.php | 18 + .../propel/airtime/CcPrefQuery.php | 18 + .../propel/airtime/CcSchedule.php | 18 + .../propel/airtime/CcSchedulePeer.php | 18 + .../propel/airtime/CcScheduleQuery.php | 18 + .../propel/airtime/CcServiceRegister.php | 18 + .../propel/airtime/CcServiceRegisterPeer.php | 18 + .../propel/airtime/CcServiceRegisterQuery.php | 18 + .../airtime-2.0.2/propel/airtime/CcSess.php | 18 + .../propel/airtime/CcSessPeer.php | 18 + .../propel/airtime/CcSessQuery.php | 18 + .../airtime-2.0.2/propel/airtime/CcShow.php | 18 + .../propel/airtime/CcShowDays.php | 18 + .../propel/airtime/CcShowDaysPeer.php | 18 + .../propel/airtime/CcShowDaysQuery.php | 18 + .../propel/airtime/CcShowHosts.php | 18 + .../propel/airtime/CcShowHostsPeer.php | 18 + .../propel/airtime/CcShowHostsQuery.php | 18 + .../propel/airtime/CcShowInstances.php | 18 + .../propel/airtime/CcShowInstancesPeer.php | 18 + .../propel/airtime/CcShowInstancesQuery.php | 18 + .../propel/airtime/CcShowPeer.php | 18 + .../propel/airtime/CcShowQuery.php | 18 + .../propel/airtime/CcShowRebroadcast.php | 18 + .../propel/airtime/CcShowRebroadcastPeer.php | 18 + .../propel/airtime/CcShowRebroadcastQuery.php | 18 + .../propel/airtime/CcShowSchedule.php | 18 + .../propel/airtime/CcShowSchedulePeer.php | 18 + .../propel/airtime/CcShowScheduleQuery.php | 18 + .../airtime-2.0.2/propel/airtime/CcSmemb.php | 18 + .../propel/airtime/CcSmembPeer.php | 18 + .../propel/airtime/CcSmembQuery.php | 18 + .../propel/airtime/CcStreamSetting.php | 18 + .../propel/airtime/CcStreamSettingPeer.php | 18 + .../propel/airtime/CcStreamSettingQuery.php | 18 + .../airtime-2.0.2/propel/airtime/CcSubjs.php | 18 + .../propel/airtime/CcSubjsPeer.php | 18 + .../propel/airtime/CcSubjsQuery.php | 18 + .../airtime-2.0.2/propel/airtime/CcTrans.php | 18 + .../propel/airtime/CcTransPeer.php | 18 + .../propel/airtime/CcTransQuery.php | 18 + .../airtime-2.0.2/propel/airtime/Common.php | 19 + .../propel/airtime/map/CcAccessTableMap.php | 61 + .../propel/airtime/map/CcBackupTableMap.php | 55 + .../propel/airtime/map/CcCountryTableMap.php | 52 + .../propel/airtime/map/CcFilesTableMap.php | 115 + .../airtime/map/CcLoginAttemptsTableMap.php | 52 + .../airtime/map/CcMusicDirsTableMap.php | 55 + .../propel/airtime/map/CcPermsTableMap.php | 56 + .../propel/airtime/map/CcPlaylistTableMap.php | 61 + .../map/CcPlaylistcontentsTableMap.php | 62 + .../propel/airtime/map/CcPrefTableMap.php | 56 + .../propel/airtime/map/CcScheduleTableMap.php | 80 + .../airtime/map/CcServiceRegisterTableMap.php | 52 + .../propel/airtime/map/CcSessTableMap.php | 55 + .../propel/airtime/map/CcShowDaysTableMap.php | 63 + .../airtime/map/CcShowHostsTableMap.php | 56 + .../airtime/map/CcShowInstancesTableMap.php | 79 + .../airtime/map/CcShowRebroadcastTableMap.php | 56 + .../airtime/map/CcShowScheduleTableMap.php | 56 + .../propel/airtime/map/CcShowTableMap.php | 62 + .../propel/airtime/map/CcSmembTableMap.php | 55 + .../airtime/map/CcStreamSettingTableMap.php | 53 + .../propel/airtime/map/CcSubjsTableMap.php | 70 + .../propel/airtime/map/CcTransTableMap.php | 75 + .../propel/airtime/om/BaseCcAccess.php | 1236 +++++ .../propel/airtime/om/BaseCcAccessPeer.php | 1008 ++++ .../propel/airtime/om/BaseCcAccessQuery.php | 477 ++ .../propel/airtime/om/BaseCcBackup.php | 956 ++++ .../propel/airtime/om/BaseCcBackupPeer.php | 750 +++ .../propel/airtime/om/BaseCcBackupQuery.php | 292 ++ .../propel/airtime/om/BaseCcCountry.php | 708 +++ .../propel/airtime/om/BaseCcCountryPeer.php | 735 +++ .../propel/airtime/om/BaseCcCountryQuery.php | 196 + .../propel/airtime/om/BaseCcFiles.php | 4325 +++++++++++++++++ .../propel/airtime/om/BaseCcFilesPeer.php | 1654 +++++++ .../propel/airtime/om/BaseCcFilesQuery.php | 2094 ++++++++ .../propel/airtime/om/BaseCcLoginAttempts.php | 735 +++ .../airtime/om/BaseCcLoginAttemptsPeer.php | 735 +++ .../airtime/om/BaseCcLoginAttemptsQuery.php | 205 + .../propel/airtime/om/BaseCcMusicDirs.php | 941 ++++ .../propel/airtime/om/BaseCcMusicDirsPeer.php | 747 +++ .../airtime/om/BaseCcMusicDirsQuery.php | 285 ++ .../propel/airtime/om/BaseCcPerms.php | 945 ++++ .../propel/airtime/om/BaseCcPermsPeer.php | 984 ++++ .../propel/airtime/om/BaseCcPermsQuery.php | 355 ++ .../propel/airtime/om/BaseCcPlaylist.php | 1365 ++++++ .../propel/airtime/om/BaseCcPlaylistPeer.php | 1006 ++++ .../propel/airtime/om/BaseCcPlaylistQuery.php | 510 ++ .../airtime/om/BaseCcPlaylistcontents.php | 1540 ++++++ .../airtime/om/BaseCcPlaylistcontentsPeer.php | 1395 ++++++ .../om/BaseCcPlaylistcontentsQuery.php | 581 +++ .../propel/airtime/om/BaseCcPref.php | 905 ++++ .../propel/airtime/om/BaseCcPrefPeer.php | 983 ++++ .../propel/airtime/om/BaseCcPrefQuery.php | 320 ++ .../propel/airtime/om/BaseCcSchedule.php | 1923 ++++++++ .../propel/airtime/om/BaseCcSchedulePeer.php | 1420 ++++++ .../propel/airtime/om/BaseCcScheduleQuery.php | 814 ++++ .../airtime/om/BaseCcServiceRegister.php | 708 +++ .../airtime/om/BaseCcServiceRegisterPeer.php | 735 +++ .../airtime/om/BaseCcServiceRegisterQuery.php | 196 + .../propel/airtime/om/BaseCcSess.php | 949 ++++ .../propel/airtime/om/BaseCcSessPeer.php | 979 ++++ .../propel/airtime/om/BaseCcSessQuery.php | 334 ++ .../propel/airtime/om/BaseCcShow.php | 1654 +++++++ .../propel/airtime/om/BaseCcShowDays.php | 1476 ++++++ .../propel/airtime/om/BaseCcShowDaysPeer.php | 1018 ++++ .../propel/airtime/om/BaseCcShowDaysQuery.php | 565 +++ .../propel/airtime/om/BaseCcShowHosts.php | 936 ++++ .../propel/airtime/om/BaseCcShowHostsPeer.php | 1365 ++++++ .../airtime/om/BaseCcShowHostsQuery.php | 371 ++ .../propel/airtime/om/BaseCcShowInstances.php | 1945 ++++++++ .../airtime/om/BaseCcShowInstancesPeer.php | 1555 ++++++ .../airtime/om/BaseCcShowInstancesQuery.php | 806 +++ .../propel/airtime/om/BaseCcShowPeer.php | 776 +++ .../propel/airtime/om/BaseCcShowQuery.php | 593 +++ .../airtime/om/BaseCcShowRebroadcast.php | 957 ++++ .../airtime/om/BaseCcShowRebroadcastPeer.php | 983 ++++ .../airtime/om/BaseCcShowRebroadcastQuery.php | 329 ++ .../propel/airtime/om/BaseCcShowSchedule.php | 905 ++++ .../airtime/om/BaseCcShowSchedulePeer.php | 983 ++++ .../airtime/om/BaseCcShowScheduleQuery.php | 338 ++ .../propel/airtime/om/BaseCcSmemb.php | 891 ++++ .../propel/airtime/om/BaseCcSmembPeer.php | 750 +++ .../propel/airtime/om/BaseCcSmembQuery.php | 305 ++ .../propel/airtime/om/BaseCcStreamSetting.php | 756 +++ .../airtime/om/BaseCcStreamSettingPeer.php | 740 +++ .../airtime/om/BaseCcStreamSettingQuery.php | 222 + .../propel/airtime/om/BaseCcSubjs.php | 2423 +++++++++ .../propel/airtime/om/BaseCcSubjsPeer.php | 801 +++ .../propel/airtime/om/BaseCcSubjsQuery.php | 954 ++++ .../propel/airtime/om/BaseCcTrans.php | 1903 ++++++++ .../propel/airtime/om/BaseCcTransPeer.php | 849 ++++ .../propel/airtime/om/BaseCcTransQuery.php | 826 ++++ .../propel/airtime/om/CcFiles.php | 31 + .../propel/airtime/om/CcPlaylist.php | 48 + .../propel/airtime/om/CcPlaylistcontents.php | 81 + .../propel/airtime/om/Common.php | 19 + .../propel/classmap-airtime-conf.php | 144 + .../upgrades/airtime-2.0.2/pypo.cfg.202 | 87 + python_apps/api_clients/api_client.py | 2 +- 182 files changed, 70425 insertions(+), 4 deletions(-) create mode 100644 install_minimal/upgrades/airtime-2.0.2/UpgradeCommon.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/airtime-monit.cfg.202 create mode 100644 install_minimal/upgrades/airtime-2.0.2/airtime-upgrade-old.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/airtime-upgrade.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/airtime.conf.202 create mode 100644 install_minimal/upgrades/airtime-2.0.2/api_client.cfg.202 create mode 100644 install_minimal/upgrades/airtime-2.0.2/liquidsoap.cfg.202 create mode 100644 install_minimal/upgrades/airtime-2.0.2/media-monitor.cfg.202 create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime-conf.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcAccess.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcAccessPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcAccessQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcBackup.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcBackupPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcBackupQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcCountry.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcCountryPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcCountryQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcFiles.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcFilesPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcFilesQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcLoginAttempts.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcLoginAttemptsPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcLoginAttemptsQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcMusicDirs.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcMusicDirsPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcMusicDirsQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcPerms.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcPermsPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcPermsQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcPlaylist.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcPlaylistPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcPlaylistQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcPlaylistcontents.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcPlaylistcontentsPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcPlaylistcontentsQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcPref.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcPrefPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcPrefQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcSchedule.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcSchedulePeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcScheduleQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcServiceRegister.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcServiceRegisterPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcServiceRegisterQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcSess.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcSessPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcSessQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcShow.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcShowDays.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcShowDaysPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcShowDaysQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcShowHosts.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcShowHostsPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcShowHostsQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcShowInstances.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcShowInstancesPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcShowInstancesQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcShowPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcShowQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcShowRebroadcast.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcShowRebroadcastPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcShowRebroadcastQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcShowSchedule.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcShowSchedulePeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcShowScheduleQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcSmemb.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcSmembPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcSmembQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcStreamSetting.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcStreamSettingPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcStreamSettingQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcSubjs.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcSubjsPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcSubjsQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcTrans.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcTransPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcTransQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/Common.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcAccessTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcBackupTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcCountryTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcFilesTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcLoginAttemptsTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcMusicDirsTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcPermsTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcPlaylistTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcPlaylistcontentsTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcPrefTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcScheduleTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcServiceRegisterTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcSessTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowDaysTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowHostsTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowInstancesTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowRebroadcastTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowScheduleTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcSmembTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcStreamSettingTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcSubjsTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcTransTableMap.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcAccess.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcAccessPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcAccessQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcBackup.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcBackupPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcBackupQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcCountry.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcCountryPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcCountryQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcFiles.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcFilesPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcFilesQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcLoginAttempts.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcLoginAttemptsPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcLoginAttemptsQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcMusicDirs.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcMusicDirsPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcMusicDirsQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPerms.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPermsPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPermsQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylist.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistcontents.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistcontentsPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistcontentsQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPref.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPrefPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPrefQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSchedule.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSchedulePeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcScheduleQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcServiceRegister.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcServiceRegisterPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcServiceRegisterQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSess.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSessPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSessQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShow.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowDays.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowDaysPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowDaysQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowHosts.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowHostsPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowHostsQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowInstances.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowInstancesPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowInstancesQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowRebroadcast.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowRebroadcastPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowRebroadcastQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowSchedule.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowSchedulePeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowScheduleQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSmemb.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSmembPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSmembQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcStreamSetting.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcStreamSettingPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcStreamSettingQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSubjs.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSubjsPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSubjsQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcTrans.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcTransPeer.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcTransQuery.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/CcFiles.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/CcPlaylist.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/CcPlaylistcontents.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/Common.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/propel/classmap-airtime-conf.php create mode 100644 install_minimal/upgrades/airtime-2.0.2/pypo.cfg.202 diff --git a/VERSION b/VERSION index 70fa4bdb2..8c022aa72 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ PRODUCT_ID=Airtime -PRODUCT_RELEASE=2.0.1 +PRODUCT_RELEASE=2.0.2 diff --git a/install_minimal/include/airtime-constants.php b/install_minimal/include/airtime-constants.php index 8c9d67c35..b1e5720f8 100644 --- a/install_minimal/include/airtime-constants.php +++ b/install_minimal/include/airtime-constants.php @@ -1,3 +1,3 @@ /etc/cron.d/airtime-crons echo "* Creating /usr/lib/airtime" - +rm -rf "/usr/lib/airtime" if [ "$python_service" -eq "0" ]; then python $AIRTIMEROOT/python_apps/api_clients/install/api_client_install.py diff --git a/install_minimal/include/airtime-upgrade.php b/install_minimal/include/airtime-upgrade.php index c0b7fc866..fa1c867e3 100644 --- a/install_minimal/include/airtime-upgrade.php +++ b/install_minimal/include/airtime-upgrade.php @@ -107,6 +107,10 @@ if (strcmp($version, "2.0.1") < 0){ passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.0.1/airtime-upgrade.php"); pause(); } +if (strcmp($version, "2.0.2") < 0){ + passthru("php --php-ini $SCRIPTPATH/../airtime-php.ini $SCRIPTPATH/../upgrades/airtime-2.0.2/airtime-upgrade.php"); + pause(); +} //set the new version in the database. $sql = "DELETE FROM cc_pref WHERE keystr = 'system_version'"; diff --git a/install_minimal/upgrades/airtime-2.0.2/UpgradeCommon.php b/install_minimal/upgrades/airtime-2.0.2/UpgradeCommon.php new file mode 100644 index 000000000..75fe5012c --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/UpgradeCommon.php @@ -0,0 +1,252 @@ +getMessage().PHP_EOL; + echo $CC_DBC->getUserInfo().PHP_EOL; + echo "Database connection problem.".PHP_EOL; + echo "Check if database '{$CC_CONFIG['dsn']['database']}' exists". + " with corresponding permissions.".PHP_EOL; + if ($p_exitOnError) { + exit(1); + } + } else { + $CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); + } + } + + + public static function DbTableExists($p_name) + { + global $CC_DBC; + $sql = "SELECT * FROM ".$p_name; + $result = $CC_DBC->GetOne($sql); + if (PEAR::isError($result)) { + return false; + } + return true; + } + + private static function GetAirtimeSrcDir() + { + return __DIR__."/../../../airtime_mvc"; + } + + public static function MigrateTablesToVersion($dir, $version) + { + echo "Upgrading database, may take several minutes, please wait".PHP_EOL; + + $appDir = self::GetAirtimeSrcDir(); + $command = "php --php-ini $dir/../../airtime-php.ini ". + "$appDir/library/doctrine/migrations/doctrine-migrations.phar ". + "--configuration=$dir/../../DoctrineMigrations/migrations.xml ". + "--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ". + "--no-interaction migrations:migrate $version"; + system($command); + } + + public static function BypassMigrations($dir, $version) + { + $appDir = self::GetAirtimeSrcDir(); + $command = "php --php-ini $dir/../../airtime-php.ini ". + "$appDir/library/doctrine/migrations/doctrine-migrations.phar ". + "--configuration=$dir/../../DoctrineMigrations/migrations.xml ". + "--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ". + "--no-interaction --add migrations:version $version"; + system($command); + } + + public static function upgradeConfigFiles(){ + + $configFiles = array(UpgradeCommon::CONF_FILE_AIRTIME, + UpgradeCommon::CONF_FILE_PYPO, + UpgradeCommon::CONF_FILE_LIQUIDSOAP, + UpgradeCommon::CONF_FILE_MEDIAMONITOR, + UpgradeCommon::CONF_FILE_API_CLIENT); + + // Backup the config files + $suffix = date("Ymdhis")."-".UpgradeCommon::VERSION_NUMBER; + foreach ($configFiles as $conf) { + // do not back up monit cfg + if (file_exists($conf)) { + echo "Backing up $conf to $conf$suffix.bak".PHP_EOL; + //copy($conf, $conf.$suffix.".bak"); + exec("cp -p $conf $conf$suffix.bak"); //use cli version to preserve file attributes + } + } + + self::CreateIniFiles(UpgradeCommon::CONF_BACKUP_SUFFIX); + self::MergeConfigFiles($configFiles, $suffix); + } + + /** + * This function creates the /etc/airtime configuration folder + * and copies the default config files to it. + */ + public static function CreateIniFiles($suffix) + { + if (!file_exists("/etc/airtime/")){ + if (!mkdir("/etc/airtime/", 0755, true)){ + echo "Could not create /etc/airtime/ directory. Exiting."; + exit(1); + } + } + + if (!copy(__DIR__."/airtime.conf.$suffix", self::CONF_FILE_AIRTIME)){ + echo "Could not copy airtime.conf to /etc/airtime/. Exiting."; + exit(1); + } + if (!copy(__DIR__."/pypo.cfg.$suffix", self::CONF_FILE_PYPO)){ + echo "Could not copy pypo.cfg to /etc/airtime/. Exiting."; + exit(1); + } + if (!copy(__DIR__."/media-monitor.cfg.$suffix", self::CONF_FILE_MEDIAMONITOR)){ + echo "Could not copy meadia-monitor.cfg to /etc/airtime/. Exiting."; + exit(1); + } + if (!copy(__DIR__."/api_client.cfg.$suffix", self::CONF_FILE_API_CLIENT)){ + echo "Could not copy api_client.cfg to /etc/monit/conf.d/. Exiting."; + exit(1); + } + } + + private static function MergeConfigFiles($configFiles, $suffix) { + foreach ($configFiles as $conf) { + // we want to use new liquidsoap.cfg so don't merge + // also for monit + if( $conf == self::CONF_FILE_LIQUIDSOAP){ + continue; + } + if (file_exists("$conf$suffix.bak")) { + + if($conf === self::CONF_FILE_AIRTIME) { + // Parse with sections + $newSettings = parse_ini_file($conf, true); + $oldSettings = parse_ini_file("$conf$suffix.bak", true); + } + else { + $newSettings = self::ReadPythonConfig($conf); + $oldSettings = self::ReadPythonConfig("$conf$suffix.bak"); + } + + $settings = array_keys($newSettings); + + foreach($settings as $section) { + if(isset($oldSettings[$section])) { + if(is_array($oldSettings[$section])) { + $sectionKeys = array_keys($newSettings[$section]); + foreach($sectionKeys as $sectionKey) { + // skip airtim_dir as we want to use new value + if($sectionKey != "airtime_dir"){ + if(isset($oldSettings[$section][$sectionKey])) { + self::UpdateIniValue($conf, $sectionKey, $oldSettings[$section][$sectionKey]); + } + } + } + } + else { + self::UpdateIniValue($conf, $section, $oldSettings[$section]); + } + } + } + } + } + } + + private static function ReadPythonConfig($p_filename) + { + $values = array(); + + $fh = fopen($p_filename, 'r'); + + while(!feof($fh)){ + $line = fgets($fh); + if(substr(trim($line), 0, 1) == '#' || trim($line) == ""){ + continue; + }else{ + $info = explode('=', $line, 2); + $values[trim($info[0])] = trim($info[1]); + } + } + + return $values; + } + + /** + * This function updates an INI style config file. + * + * A property and the value the property should be changed to are + * supplied. If the property is not found, then no changes are made. + * + * @param string $p_filename + * The path the to the file. + * @param string $p_property + * The property to look for in order to change its value. + * @param string $p_value + * The value the property should be changed to. + * + */ + private static function UpdateIniValue($p_filename, $p_property, $p_value) + { + $lines = file($p_filename); + $n=count($lines); + foreach ($lines as &$line) { + if ($line[0] != "#"){ + $key_value = explode("=", $line); + $key = trim($key_value[0]); + + if ($key == $p_property){ + $line = "$p_property = $p_value".PHP_EOL; + } + } + } + + $fp=fopen($p_filename, 'w'); + for($i=0; $i<$n; $i++){ + fwrite($fp, $lines[$i]); + } + fclose($fp); + } + + public static function queryDb($p_sql){ + global $CC_DBC; + + $result = $CC_DBC->getRow($p_sql, $fetchmode=DB_FETCHMODE_ASSOC); + if (PEAR::isError($result)) { + echo "Error executing $sql. Exiting."; + exit(1); + } + + return $result; + } +} diff --git a/install_minimal/upgrades/airtime-2.0.2/airtime-monit.cfg.202 b/install_minimal/upgrades/airtime-2.0.2/airtime-monit.cfg.202 new file mode 100644 index 000000000..ba4f0878d --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/airtime-monit.cfg.202 @@ -0,0 +1,24 @@ + set daemon 10 # Poll at 10 second intervals + #set logfile syslog facility log_daemon + set logfile /var/log/monit.log + + set httpd port 2812 and use address 127.0.0.1 + allow localhost + allow admin:monit + + check process airtime-playout + with pidfile "/var/run/airtime-playout.pid" + start program = "/etc/init.d/airtime-playout monit-restart" with timeout 5 seconds + stop program = "/etc/init.d/airtime-playout stop" + check process airtime-liquidsoap + with pidfile "/var/run/airtime-liquidsoap.pid" + start program = "/etc/init.d/airtime-playout monit-restart" with timeout 5 seconds + stop program = "/etc/init.d/airtime-playout stop" + check process airtime-media-monitor + with pidfile "/var/run/airtime-media-monitor.pid" + start program = "/etc/init.d/airtime-media-monitor start" with timeout 10 seconds + stop program = "/etc/init.d/airtime-media-monitor stop" + check process airtime-show-recorder + with pidfile "/var/run/airtime-show-recorder.pid" + start program = "/etc/init.d/airtime-show-recorder start" with timeout 10 seconds + stop program = "/etc/init.d/airtime-show-recorder stop" diff --git a/install_minimal/upgrades/airtime-2.0.2/airtime-upgrade-old.php b/install_minimal/upgrades/airtime-2.0.2/airtime-upgrade-old.php new file mode 100644 index 000000000..b540021dc --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/airtime-upgrade-old.php @@ -0,0 +1,586 @@ +query($sql); + if (PEAR::isError($result)) { + return false; + } + return true; + } + + public static function GetUtilsSrcDir() + { + return __DIR__."/../../../utils"; + } + + public static function InstallBinaries() + { + echo "* Installing binaries to ".AirtimeInstall::CONF_DIR_BINARIES.PHP_EOL; + exec("mkdir -p ".AirtimeInstall::CONF_DIR_BINARIES); + exec("cp -R ".AirtimeInstall::GetUtilsSrcDir()." ".AirtimeInstall::CONF_DIR_BINARIES); + } + + public static function CreateSymlinksToUtils() + { + echo "* Installing airtime-log".PHP_EOL; + $dir = AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-log"; + copy(AirtimeInstall::GetUtilsSrcDir()."/airtime-log.php", AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-log.php"); + + exec("ln -s $dir /usr/bin/airtime-log"); + } + + public static function SetDefaultStreamSetting() + { + global $CC_DBC; + + echo "* Setting up default stream setting".PHP_EOL; + $sql = "INSERT INTO cc_pref(keystr, valstr) VALUES('stream_type', 'ogg, mp3'); + INSERT INTO cc_pref(keystr, valstr) VALUES('stream_bitrate', '24, 32, 48, 64, 96, 128, 160, 192, 224, 256, 320'); + INSERT INTO cc_pref(keystr, valstr) VALUES('num_of_streams', '3'); + INSERT INTO cc_pref(keystr, valstr) VALUES('max_bitrate', '128'); + INSERT INTO cc_pref(keystr, valstr) VALUES('plan_level', 'disabled'); + + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('output_sound_device', 'false', 'boolean'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('icecast_vorbis_metadata', 'false', 'boolean'); + + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_output', 'icecast', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_type', 'ogg', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_bitrate', '128', 'integer'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_host', '127.0.0.1', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_port', '8000', 'integer'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_user', '', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_pass', 'hackme', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_mount', 'airtime_128', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_url', 'http://airtime.sourcefabric.org', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_description', 'Airtime Radio! Stream #1', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_genre', 'genre', 'string'); + + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_output', 'disabled', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_type', '', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_bitrate', '', 'integer'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_host', '', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_port', '', 'integer'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_user', '', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_pass', '', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_mount', '', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_url', '', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_description', '', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_genre', '', 'string'); + + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_output', 'disabled', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_type', '', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_bitrate', '', 'integer'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_host', '', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_port', '', 'integer'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_user', '', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_pass', '', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_mount', '', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_url', '', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_description', '', 'string'); + INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_genre', '', 'string');"; + $result = $CC_DBC->query($sql); + if (PEAR::isError($result)) { + return false; + } + return true; + } + + public static function BypassMigrations($dir, $version) + { + $appDir = AirtimeInstall::GetAirtimeSrcDir(); + $command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ". + "--configuration=$dir/../../DoctrineMigrations/migrations.xml ". + "--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ". + "--no-interaction --add migrations:version $version"; + system($command); + } + + public static function MigrateTablesToVersion($dir, $version) + { + $appDir = AirtimeInstall::GetAirtimeSrcDir(); + $command = "php $appDir/library/doctrine/migrations/doctrine-migrations.phar ". + "--configuration=$dir/../../DoctrineMigrations/migrations.xml ". + "--db-configuration=$appDir/library/doctrine/migrations/migrations-db.php ". + "--no-interaction migrations:migrate $version"; + system($command); + } + + public static function GetAirtimeSrcDir() + { + return __DIR__."/../../../airtime_mvc"; + } + + public static function DbTableExists($p_name) + { + global $CC_DBC; + $sql = "SELECT * FROM ".$p_name; + $result = $CC_DBC->GetOne($sql); + if (PEAR::isError($result)) { + return false; + } + return true; + } + public static function GetOldLiquidsoapCfgAndUpdate(){ + global $CC_DBC; + echo "* Retrieving old liquidsoap configuration".PHP_EOL; + $map = array(); + $fh = fopen("/etc/airtime/liquidsoap.cfg", 'r'); + $newConfigMap = array(); + + while(!feof($fh)){ + $line = fgets($fh); + if(substr(trim($line), 0, 1) == '#' || trim($line) == ""){ + continue; + }else{ + $info = explode('=', $line, 2); + $map[trim($info[0])] = trim($info[1]); + } + } + $newConfigMap['output_sound_device'] = $map['output_sound_device']; + $newConfigMap['icecast_vorbis_metadata'] = $map['output_icecast_vorbis_metadata']; + $newConfigMap['log_file'] = $map['log_file']; + + $count = 1; + if( $map['output_icecast_vorbis'] == 'true'){ + $newConfigMap['s'.$count.'_output'] = 'icecast'; + $newConfigMap['s'.$count.'_host'] = $map['icecast_host']; + $newConfigMap['s'.$count.'_port'] = $map['icecast_port']; + $newConfigMap['s'.$count.'_pass'] = $map['icecast_pass']; + $newConfigMap['s'.$count.'_mount'] = $map['mount_point_vorbis']; + $newConfigMap['s'.$count.'_url'] = $map['icecast_url']; + $newConfigMap['s'.$count.'_description'] = $map['icecast_description']; + $newConfigMap['s'.$count.'_genre'] = $map['icecast_genre']; + $newConfigMap['s'.$count.'_type'] = "ogg"; + $newConfigMap['s'.$count.'_bitrate'] = "128"; + $count++; + } + if($map['output_icecast_mp3'] == 'true'){ + $newConfigMap['s'.$count.'_output'] = 'icecast'; + $newConfigMap['s'.$count.'_host'] = $map['icecast_host']; + $newConfigMap['s'.$count.'_port'] = $map['icecast_port']; + $newConfigMap['s'.$count.'_pass'] = $map['icecast_pass']; + $newConfigMap['s'.$count.'_mount'] = $map['mount_point_mp3']; + $newConfigMap['s'.$count.'_url'] = $map['icecast_url']; + $newConfigMap['s'.$count.'_description'] = $map['icecast_description']; + $newConfigMap['s'.$count.'_genre'] = $map['icecast_genre']; + $newConfigMap['s'.$count.'_type'] = "mp3"; + $newConfigMap['s'.$count.'_bitrate'] = "128"; + $count++; + } + if($map['output_shoutcast'] == 'true'){ + $newConfigMap['s'.$count.'_output'] = 'shoutcast'; + $newConfigMap['s'.$count.'_host'] = $map['shoutcast_host']; + $newConfigMap['s'.$count.'_port'] = $map['shoutcast_port']; + $newConfigMap['s'.$count.'_pass'] = $map['shoutcast_pass']; + $newConfigMap['s'.$count.'_url'] = $map['shoutcast_url']; + $newConfigMap['s'.$count.'_genre'] = $map['shoutcast_genre']; + $newConfigMap['s'.$count.'_type'] = "mp3"; + $newConfigMap['s'.$count.'_bitrate'] = "128"; + $count++; + } + + $sql = ""; + foreach( $newConfigMap as $key=>$val){ + if(substr($val, 0, 1) == '"' && substr($val, strlen($val)-1,1)){ + $val = ltrim($val, '"'); + $val = rtrim($val, '"'); + } + $sql .= "UPDATE cc_stream_setting SET value='$val' WHERE keyname='$key';"; + } + $result = $CC_DBC->query($sql); + if (PEAR::isError($result)) { + return false; + } + return true; + } +} + +class Airtime200Upgrade{ + + public static function connectToDatabase(){ + global $CC_DBC, $CC_CONFIG; + + $values = parse_ini_file('/etc/airtime/airtime.conf', true); + + // Database config + $CC_CONFIG['dsn']['username'] = $values['database']['dbuser']; + $CC_CONFIG['dsn']['password'] = $values['database']['dbpass']; + $CC_CONFIG['dsn']['hostspec'] = $values['database']['host']; + $CC_CONFIG['dsn']['phptype'] = 'pgsql'; + $CC_CONFIG['dsn']['database'] = $values['database']['dbname']; + + $CC_DBC = DB::connect($CC_CONFIG['dsn'], FALSE); + } + + public static function InstallAirtimePhpServerCode($phpDir) + { + + $AIRTIME_SRC = realpath(__DIR__.'/../../../airtime_mvc'); + + // delete old files + exec("rm -rf ".$phpDir); + echo "* Installing PHP code to ".$phpDir.PHP_EOL; + exec("mkdir -p ".$phpDir); + exec("cp -R ".$AIRTIME_SRC."/* ".$phpDir); + } + + public static function RemoveOldMonitFile(){ + unlink("/etc/monit/conf.d/airtime-monit.cfg"); + } +} + +class ConvertToUtc{ + + public static function setPhpDefaultTimeZoneToSystemTimezone(){ + //we can get the default system timezone on debian/ubuntu by reading "/etc/timezone" + $filename = "/etc/timezone"; + $handle = fopen($filename, "r"); + $contents = trim(fread($handle, filesize($filename))); + echo "System timezone detected as: $contents".PHP_EOL; + fclose($handle); + + date_default_timezone_set($contents); + } + + public static function convert_cc_playlist(){ + /* cc_playlist has a field that keeps track of when the playlist was last modified. */ + $playlists = CcPlaylistQuery::create()->find(); + + foreach ($playlists as $pl){ + $dt = new DateTime($pl->getDbMtime(), new DateTimeZone(date_default_timezone_get())); + $dt->setTimezone(new DateTimeZone("UTC")); + $pl->setDbMtime($dt); + + $pl->save(); + } + } + + public static function convert_cc_schedule(){ + /* cc_schedule has start and end fields that need to be changed to UTC. */ + $schedules = CcScheduleQuery::create()->find(); + + foreach ($schedules as $s){ + $dt = new DateTime($s->getDbStarts(), new DateTimeZone(date_default_timezone_get())); + $dt->setTimezone(new DateTimeZone("UTC")); + $s->setDbStarts($dt); + + $dt = new DateTime($s->getDbEnds(), new DateTimeZone(date_default_timezone_get())); + $dt->setTimezone(new DateTimeZone("UTC")); + $s->setDbEnds($dt); + + $s->save(); + } + } + + public static function convert_cc_show_days(){ + /* cc_show_days has first_show, last_show and start_time fields that need to be changed to UTC. */ + $showDays = CcShowDaysQuery::create()->find(); + + foreach ($showDays as $sd){ + $dt = new DateTime($sd->getDbFirstShow()." ".$sd->getDbStartTime(), new DateTimeZone(date_default_timezone_get())); + $dt->setTimezone(new DateTimeZone("UTC")); + $sd->setDbFirstShow($dt->format("Y-m-d")); + $sd->setDbStartTime($dt->format("H:i:s")); + + $dt = new DateTime($sd->getDbLastShow()." ".$sd->getDbStartTime(), new DateTimeZone(date_default_timezone_get())); + $dt->setTimezone(new DateTimeZone("UTC")); + $sd->setDbLastShow($dt->format("Y-m-d")); + + $sd->save(); + } + } + + public static function convert_cc_show_instances(){ + /* convert_cc_show_instances has starts and ends fields that need to be changed to UTC. */ + $showInstances = CcShowInstancesQuery::create()->find(); + + foreach ($showInstances as $si){ + $dt = new DateTime($si->getDbStarts(), new DateTimeZone(date_default_timezone_get())); + $dt->setTimezone(new DateTimeZone("UTC")); + $si->setDbStarts($dt); + + $dt = new DateTime($si->getDbEnds(), new DateTimeZone(date_default_timezone_get())); + $dt->setTimezone(new DateTimeZone("UTC")); + $si->setDbEnds($dt); + + $si->save(); + } + } +} + +class AirtimeIni200{ + + const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf"; + const CONF_FILE_PYPO = "/etc/airtime/pypo.cfg"; + const CONF_FILE_RECORDER = "/etc/airtime/recorder.cfg"; + const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg"; + const CONF_FILE_MEDIAMONITOR = "/etc/airtime/media-monitor.cfg"; + const CONF_FILE_API_CLIENT = "/etc/airtime/api_client.cfg"; + + const CONF_PYPO_GRP = "pypo"; + const CONF_WWW_DATA_GRP = "www-data"; + + /** + * This function updates an INI style config file. + * + * A property and the value the property should be changed to are + * supplied. If the property is not found, then no changes are made. + * + * @param string $p_filename + * The path the to the file. + * @param string $p_property + * The property to look for in order to change its value. + * @param string $p_value + * The value the property should be changed to. + * + */ + public static function UpdateIniValue($p_filename, $p_property, $p_value) + { + $lines = file($p_filename); + $n=count($lines); + foreach ($lines as &$line) { + if ($line[0] != "#"){ + $key_value = explode("=", $line); + $key = trim($key_value[0]); + + if ($key == $p_property){ + $line = "$p_property = $p_value".PHP_EOL; + } + } + } + + $fp=fopen($p_filename, 'w'); + for($i=0; $i<$n; $i++){ + fwrite($fp, $lines[$i]); + } + fclose($fp); + } + + public static function ReadPythonConfig($p_filename) + { + $values = array(); + + $fh = fopen($p_filename, 'r'); + + while(!feof($fh)){ + $line = fgets($fh); + if(substr(trim($line), 0, 1) == '#' || trim($line) == ""){ + continue; + }else{ + $info = explode('=', $line, 2); + $values[trim($info[0])] = trim($info[1]); + } + } + + return $values; + } + + public static function MergeConfigFiles($configFiles, $suffix) { + foreach ($configFiles as $conf) { + // we want to use new liquidsoap.cfg so don't merge + // also for monit + if( $conf == AirtimeIni200::CONF_FILE_LIQUIDSOAP){ + continue; + } + if (file_exists("$conf$suffix.bak")) { + + if($conf === AirtimeIni200::CONF_FILE_AIRTIME) { + // Parse with sections + $newSettings = parse_ini_file($conf, true); + $oldSettings = parse_ini_file("$conf$suffix.bak", true); + } + else { + $newSettings = AirtimeIni200::ReadPythonConfig($conf); + $oldSettings = AirtimeIni200::ReadPythonConfig("$conf$suffix.bak"); + } + + $settings = array_keys($newSettings); + + foreach($settings as $section) { + if(isset($oldSettings[$section])) { + if(is_array($oldSettings[$section])) { + $sectionKeys = array_keys($newSettings[$section]); + foreach($sectionKeys as $sectionKey) { + // skip airtim_dir as we want to use new value + if($sectionKey != "airtime_dir"){ + if(isset($oldSettings[$section][$sectionKey])) { + AirtimeIni200::UpdateIniValue($conf, $sectionKey, $oldSettings[$section][$sectionKey]); + } + } + } + } + else { + AirtimeIni200::UpdateIniValue($conf, $section, $oldSettings[$section]); + } + } + } + } + } + } + + /* Re: http://dev.sourcefabric.org/browse/CC-2797 + * We don't want config files to be world-readable so we + * set the strictest permissions possible. */ + public static function changeConfigFilePermissions(){ + if (!self::ChangeFileOwnerGroupMod(AirtimeIni200::CONF_FILE_AIRTIME, self::CONF_WWW_DATA_GRP)){ + echo "Could not set ownership of api_client.cfg to 'pypo'. Exiting."; + exit(1); + } + if (!self::ChangeFileOwnerGroupMod(AirtimeIni200::CONF_FILE_API_CLIENT, self::CONF_PYPO_GRP)){ + echo "Could not set ownership of api_client.cfg to 'pypo'. Exiting."; + exit(1); + } + if (!self::ChangeFileOwnerGroupMod(AirtimeIni200::CONF_FILE_PYPO, self::CONF_PYPO_GRP)){ + echo "Could not set ownership of pypo.cfg to 'pypo'. Exiting."; + exit(1); + } + if (!self::ChangeFileOwnerGroupMod(AirtimeIni200::CONF_FILE_RECORDER, self::CONF_PYPO_GRP)){ + echo "Could not set ownership of recorder.cfg to 'pypo'. Exiting."; + exit(1); + } + if (!self::ChangeFileOwnerGroupMod(AirtimeIni200::CONF_FILE_LIQUIDSOAP, self::CONF_PYPO_GRP)){ + echo "Could not set ownership of liquidsoap.cfg to 'pypo'. Exiting."; + exit(1); + } + if (!self::ChangeFileOwnerGroupMod(AirtimeIni200::CONF_FILE_MEDIAMONITOR, self::CONF_PYPO_GRP)){ + echo "Could not set ownership of media-monitor.cfg to 'pypo'. Exiting."; + exit(1); + } + } + + public static function ChangeFileOwnerGroupMod($filename, $user){ + return (chown($filename, $user) && + chgrp($filename, $user) && + chmod($filename, 0640)); + } + + public static function upgradeConfigFiles(){ + + $configFiles = array(AirtimeIni200::CONF_FILE_AIRTIME, + AirtimeIni200::CONF_FILE_PYPO, + AirtimeIni200::CONF_FILE_RECORDER, + AirtimeIni200::CONF_FILE_LIQUIDSOAP, + AirtimeIni200::CONF_FILE_MEDIAMONITOR, + AirtimeIni200::CONF_FILE_API_CLIENT); + + // Backup the config files + $suffix = date("Ymdhis")."-2.0.0"; + foreach ($configFiles as $conf) { + // do not back up monit cfg + if (file_exists($conf)) { + echo "Backing up $conf to $conf$suffix.bak".PHP_EOL; + //copy($conf, $conf.$suffix.".bak"); + exec("cp -p $conf $conf$suffix.bak"); //use cli version to preserve file attributes + } + } + + $default_suffix = "200"; + AirtimeIni200::CreateIniFiles($default_suffix); + AirtimeIni200::MergeConfigFiles($configFiles, $suffix); + } + + /** + * This function creates the /etc/airtime configuration folder + * and copies the default config files to it. + */ + public static function CreateIniFiles($suffix) + { + if (!file_exists("/etc/airtime/")){ + if (!mkdir("/etc/airtime/", 0755, true)){ + echo "Could not create /etc/airtime/ directory. Exiting."; + exit(1); + } + } + + if (!copy(__DIR__."/airtime.conf.$suffix", AirtimeIni200::CONF_FILE_AIRTIME)){ + echo "Could not copy airtime.conf to /etc/airtime/. Exiting."; + exit(1); + } + if (!copy(__DIR__."/pypo.cfg.$suffix", AirtimeIni200::CONF_FILE_PYPO)){ + echo "Could not copy pypo.cfg to /etc/airtime/. Exiting."; + exit(1); + } + if (!copy(__DIR__."/recorder.cfg.$suffix", AirtimeIni200::CONF_FILE_RECORDER)){ + echo "Could not copy recorder.cfg to /etc/airtime/. Exiting."; + exit(1); + } + /*if (!copy(__DIR__."/liquidsoap.cfg.$suffix", AirtimeIni200::CONF_FILE_LIQUIDSOAP)){ + echo "Could not copy liquidsoap.cfg to /etc/airtime/. Exiting."; + exit(1); + }*/ + if (!copy(__DIR__."/api_client.cfg.$suffix", AirtimeIni200::CONF_FILE_API_CLIENT)){ + echo "Could not copy airtime-monit.cfg to /etc/monit/conf.d/. Exiting."; + exit(1); + } + } +} + +Airtime200Upgrade::connectToDatabase(); +AirtimeInstall::SetDefaultTimezone(); + +AirtimeInstall::InstallBinaries(); +AirtimeInstall::CreateSymlinksToUtils(); + +/* Airtime 2.0.0 starts interpreting all database times in UTC format. Prior to this, all the times + * were stored using the local time zone. Let's convert to UTC time. */ +ConvertToUtc::setPhpDefaultTimeZoneToSystemTimezone(); +ConvertToUtc::convert_cc_playlist(); +ConvertToUtc::convert_cc_schedule(); +ConvertToUtc::convert_cc_show_days(); +ConvertToUtc::convert_cc_show_instances(); + +// merging/updating config files +echo "* Updating configFiles\n"; +AirtimeIni200::changeConfigFilePermissions(); +AirtimeIni200::upgradeConfigFiles(); + +$values = parse_ini_file(AirtimeIni200::CONF_FILE_AIRTIME, true); +$phpDir = $values['general']['airtime_dir']; +Airtime200Upgrade::InstallAirtimePhpServerCode($phpDir); + +if(AirtimeInstall::DbTableExists('doctrine_migration_versions') === false) { + $migrations = array('20110312121200', '20110331111708', '20110402164819', '20110406182005', '20110629143017', '20110711161043', '20110713161043'); + foreach($migrations as $migration) { + AirtimeInstall::BypassMigrations(__DIR__, $migration); + } +} + +AirtimeInstall::MigrateTablesToVersion(__DIR__, '20110925171256'); + +AirtimeInstall::SetDefaultStreamSetting(); + +AirtimeInstall::GetOldLiquidsoapCfgAndUpdate(); + +AirtimeUpgrade::RemoveOldMonitFile(); + +// restart monit +exec("service monit restart"); + + + + diff --git a/install_minimal/upgrades/airtime-2.0.2/airtime-upgrade.php b/install_minimal/upgrades/airtime-2.0.2/airtime-upgrade.php new file mode 100644 index 000000000..85e56b3d1 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/airtime-upgrade.php @@ -0,0 +1,81 @@ +.log" +#log_level = 3 + +########################################### +# Icecast Stream settings # +########################################### +s1_host = "127.0.0.1" +s2_host = "127.0.0.1" +s3_host = "127.0.0.1" +s1_port = 8000 +s2_port = 8000 +s3_port = 8000 +s1_user = "" +s2_user = "" +s3_user = "" +s1_pass = "hackme" +s2_pass = "hackme" +s3_pass = "hackme" + +# Icecast mountpoint names +s1_mount = "airtime_128.ogg" +s2_mount = "airtime_128.ogg" +s3_mount = "airtime_160.mp3" + +# Webstream metadata settings +s1_url = "http://airtime.sourcefabric.org" +s2_url = "http://airtime.sourcefabric.org" +s3_url = "http://airtime.sourcefabric.org" +s1_description = "Airtime Radio! stream1" +s2_description = "Airtime Radio! stream2" +s3_description = "Airtime Radio! stream3" +s1_genre = "genre" +s2_genre = "genre" +s3_genre = "genre" + +# Audio stream metadata for vorbis/ogg is disabled by default +# due to a number of client media players that disconnect +# when the metadata changes to a new track. Some versions of +# mplayer and VLC have this problem. Enable this option at your +# own risk! +icecast_vorbis_metadata = false diff --git a/install_minimal/upgrades/airtime-2.0.2/media-monitor.cfg.202 b/install_minimal/upgrades/airtime-2.0.2/media-monitor.cfg.202 new file mode 100644 index 000000000..44819833b --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/media-monitor.cfg.202 @@ -0,0 +1,22 @@ +api_client = "airtime" + +# where the binary files live +bin_dir = '/usr/lib/airtime/media-monitor' + +# where the logging files live +log_dir = '/var/log/airtime/media-monitor' + + +############################################ +# RabbitMQ settings # +############################################ +rabbitmq_host = 'localhost' +rabbitmq_user = 'guest' +rabbitmq_password = 'guest' +rabbitmq_vhost = '/' + +############################################ +# Media-Monitor preferences # +############################################ +check_filesystem_events = 5 #how long to queue up events performed on the files themselves. +check_airtime_events = 30 #how long to queue metadata input from airtime. diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime-conf.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime-conf.php new file mode 100644 index 000000000..a25701479 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime-conf.php @@ -0,0 +1,28 @@ + + array ( + 'airtime' => + array ( + 'adapter' => 'pgsql', + 'connection' => + array ( + 'dsn' => "pgsql:host=$dbhost;port=5432;dbname=$dbname;user=$dbuser;password=$dbpass", + ), + ), + 'default' => 'airtime', + ), + 'generator_version' => '1.5.2', +); +$conf['classmap'] = include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classmap-airtime-conf.php'); +return $conf; diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcAccess.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcAccess.php new file mode 100644 index 000000000..2b3d4443d --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcAccess.php @@ -0,0 +1,18 @@ +length; + } + + public function setDbLength($time) + { + $this->length = $time; + //$this->modifiedColumns[] = CcPlaylistcontentsPeer::LENGTH; + return Common::setTimeInSub($this, 'LENGTH', $time); + } + + +} // CcFiles diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcFilesPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcFilesPeer.php new file mode 100644 index 000000000..0e2fbbe86 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcFilesPeer.php @@ -0,0 +1,18 @@ +prepare($sql); + $stmt->bindValue(':p1', $this->getDbId()); + $stmt->execute(); + return $stmt->fetchColumn(); + } + + public function computeLength() + { + $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME); + + $sql = 'SELECT SUM('.CcPlaylistcontentsPeer::CLIPLENGTH.') AS length' + . ' FROM ' .CcPlaylistcontentsPeer::TABLE_NAME + . ' WHERE ' .CcPlaylistcontentsPeer::PLAYLIST_ID. ' = :p1'; + + $stmt = $con->prepare($sql); + $stmt->bindValue(':p1', $this->getDbId()); + $stmt->execute(); + return $stmt->fetchColumn(); + } + + +} // CcPlaylist diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcPlaylistPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcPlaylistPeer.php new file mode 100644 index 000000000..4f7c82791 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcPlaylistPeer.php @@ -0,0 +1,18 @@ +fadein; + } + + public function setDbFadein($time) + { + $this->fadein = $time; + //$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN; + Common::setTimeInSub($this, 'FADEIN', $time); + } + + public function getDbFadeout() + { + return $this->fadeout; + } + + public function setDbFadeout($time) + { + $this->fadeout = $time; + //$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT; + Common::setTimeInSub($this, 'FADEOUT', $time); + } + + public function getDbCuein() + { + return $this->cuein; + } + + public function setDbCuein($time) + { + $this->cuein = $time; + //$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN; + Common::setTimeInSub($this, 'CUEIN', $time); + } + + public function getDbCueout() + { + return $this->cueout; + } + + public function setDbCueout($time) + { + $this->cueout = $time; + //$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT; + Common::setTimeInSub($this, 'CUEOUT', $time); + } + + public function getDbCliplength() + { + return $this->cliplength; + } + + public function setDbCliplength($time) + { + $this->cliplength = $time; + //$this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH; + Common::setTimeInSub($this, 'CLIPLENGTH', $time); + } + + + + +} // CcPlaylistcontents diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcPlaylistcontentsPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcPlaylistcontentsPeer.php new file mode 100644 index 000000000..00210575b --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/CcPlaylistcontentsPeer.php @@ -0,0 +1,18 @@ +prepare($sql); + $stmt->bindValue(':f1', $time); + $stmt->bindValue(':p1', $row->getDbId()); + $stmt->execute(); + } +} diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcAccessTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcAccessTableMap.php new file mode 100644 index 000000000..5b0584f3f --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcAccessTableMap.php @@ -0,0 +1,61 @@ +setName('cc_access'); + $this->setPhpName('CcAccess'); + $this->setClassname('CcAccess'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('cc_access_id_seq'); + // columns + $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); + $this->addColumn('GUNID', 'Gunid', 'CHAR', false, 32, null); + $this->addColumn('TOKEN', 'Token', 'BIGINT', false, null, null); + $this->addColumn('CHSUM', 'Chsum', 'CHAR', true, 32, ''); + $this->addColumn('EXT', 'Ext', 'VARCHAR', true, 128, ''); + $this->addColumn('TYPE', 'Type', 'VARCHAR', true, 20, ''); + $this->addColumn('PARENT', 'Parent', 'BIGINT', false, null, null); + $this->addForeignKey('OWNER', 'Owner', 'INTEGER', 'cc_subjs', 'ID', false, null, null); + $this->addColumn('TS', 'Ts', 'TIMESTAMP', false, null, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner' => 'id', ), null, null); + } // buildRelations() + +} // CcAccessTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcBackupTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcBackupTableMap.php new file mode 100644 index 000000000..35ea58159 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcBackupTableMap.php @@ -0,0 +1,55 @@ +setName('cc_backup'); + $this->setPhpName('CcBackup'); + $this->setClassname('CcBackup'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(false); + // columns + $this->addPrimaryKey('TOKEN', 'Token', 'VARCHAR', true, 64, null); + $this->addColumn('SESSIONID', 'Sessionid', 'VARCHAR', true, 64, null); + $this->addColumn('STATUS', 'Status', 'VARCHAR', true, 32, null); + $this->addColumn('FROMTIME', 'Fromtime', 'TIMESTAMP', true, null, null); + $this->addColumn('TOTIME', 'Totime', 'TIMESTAMP', true, null, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + } // buildRelations() + +} // CcBackupTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcCountryTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcCountryTableMap.php new file mode 100644 index 000000000..b839d0359 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcCountryTableMap.php @@ -0,0 +1,52 @@ +setName('cc_country'); + $this->setPhpName('CcCountry'); + $this->setClassname('CcCountry'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(false); + // columns + $this->addPrimaryKey('ISOCODE', 'DbIsoCode', 'CHAR', true, 3, null); + $this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + } // buildRelations() + +} // CcCountryTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcFilesTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcFilesTableMap.php new file mode 100644 index 000000000..38d2e3955 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcFilesTableMap.php @@ -0,0 +1,115 @@ +setName('cc_files'); + $this->setPhpName('CcFiles'); + $this->setClassname('CcFiles'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('cc_files_id_seq'); + // columns + $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); + $this->addColumn('GUNID', 'DbGunid', 'CHAR', true, 32, null); + $this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, ''); + $this->addColumn('MIME', 'DbMime', 'VARCHAR', true, 255, ''); + $this->addColumn('FTYPE', 'DbFtype', 'VARCHAR', true, 128, ''); + $this->addForeignKey('DIRECTORY', 'DbDirectory', 'INTEGER', 'cc_music_dirs', 'ID', false, null, null); + $this->addColumn('FILEPATH', 'DbFilepath', 'LONGVARCHAR', false, null, ''); + $this->addColumn('STATE', 'DbState', 'VARCHAR', true, 128, 'empty'); + $this->addColumn('CURRENTLYACCESSING', 'DbCurrentlyaccessing', 'INTEGER', true, null, 0); + $this->addForeignKey('EDITEDBY', 'DbEditedby', 'INTEGER', 'cc_subjs', 'ID', false, null, null); + $this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', false, 6, null); + $this->addColumn('MD5', 'DbMd5', 'CHAR', false, 32, null); + $this->addColumn('TRACK_TITLE', 'DbTrackTitle', 'VARCHAR', false, 512, null); + $this->addColumn('ARTIST_NAME', 'DbArtistName', 'VARCHAR', false, 512, null); + $this->addColumn('BIT_RATE', 'DbBitRate', 'VARCHAR', false, 32, null); + $this->addColumn('SAMPLE_RATE', 'DbSampleRate', 'VARCHAR', false, 32, null); + $this->addColumn('FORMAT', 'DbFormat', 'VARCHAR', false, 128, null); + $this->addColumn('LENGTH', 'DbLength', 'TIME', false, null, null); + $this->addColumn('ALBUM_TITLE', 'DbAlbumTitle', 'VARCHAR', false, 512, null); + $this->addColumn('GENRE', 'DbGenre', 'VARCHAR', false, 64, null); + $this->addColumn('COMMENTS', 'DbComments', 'LONGVARCHAR', false, null, null); + $this->addColumn('YEAR', 'DbYear', 'VARCHAR', false, 16, null); + $this->addColumn('TRACK_NUMBER', 'DbTrackNumber', 'INTEGER', false, null, null); + $this->addColumn('CHANNELS', 'DbChannels', 'INTEGER', false, null, null); + $this->addColumn('URL', 'DbUrl', 'VARCHAR', false, 1024, null); + $this->addColumn('BPM', 'DbBpm', 'VARCHAR', false, 8, null); + $this->addColumn('RATING', 'DbRating', 'VARCHAR', false, 8, null); + $this->addColumn('ENCODED_BY', 'DbEncodedBy', 'VARCHAR', false, 255, null); + $this->addColumn('DISC_NUMBER', 'DbDiscNumber', 'VARCHAR', false, 8, null); + $this->addColumn('MOOD', 'DbMood', 'VARCHAR', false, 64, null); + $this->addColumn('LABEL', 'DbLabel', 'VARCHAR', false, 512, null); + $this->addColumn('COMPOSER', 'DbComposer', 'VARCHAR', false, 512, null); + $this->addColumn('ENCODER', 'DbEncoder', 'VARCHAR', false, 64, null); + $this->addColumn('CHECKSUM', 'DbChecksum', 'VARCHAR', false, 256, null); + $this->addColumn('LYRICS', 'DbLyrics', 'LONGVARCHAR', false, null, null); + $this->addColumn('ORCHESTRA', 'DbOrchestra', 'VARCHAR', false, 512, null); + $this->addColumn('CONDUCTOR', 'DbConductor', 'VARCHAR', false, 512, null); + $this->addColumn('LYRICIST', 'DbLyricist', 'VARCHAR', false, 512, null); + $this->addColumn('ORIGINAL_LYRICIST', 'DbOriginalLyricist', 'VARCHAR', false, 512, null); + $this->addColumn('RADIO_STATION_NAME', 'DbRadioStationName', 'VARCHAR', false, 512, null); + $this->addColumn('INFO_URL', 'DbInfoUrl', 'VARCHAR', false, 512, null); + $this->addColumn('ARTIST_URL', 'DbArtistUrl', 'VARCHAR', false, 512, null); + $this->addColumn('AUDIO_SOURCE_URL', 'DbAudioSourceUrl', 'VARCHAR', false, 512, null); + $this->addColumn('RADIO_STATION_URL', 'DbRadioStationUrl', 'VARCHAR', false, 512, null); + $this->addColumn('BUY_THIS_URL', 'DbBuyThisUrl', 'VARCHAR', false, 512, null); + $this->addColumn('ISRC_NUMBER', 'DbIsrcNumber', 'VARCHAR', false, 512, null); + $this->addColumn('CATALOG_NUMBER', 'DbCatalogNumber', 'VARCHAR', false, 512, null); + $this->addColumn('ORIGINAL_ARTIST', 'DbOriginalArtist', 'VARCHAR', false, 512, null); + $this->addColumn('COPYRIGHT', 'DbCopyright', 'VARCHAR', false, 512, null); + $this->addColumn('REPORT_DATETIME', 'DbReportDatetime', 'VARCHAR', false, 32, null); + $this->addColumn('REPORT_LOCATION', 'DbReportLocation', 'VARCHAR', false, 512, null); + $this->addColumn('REPORT_ORGANIZATION', 'DbReportOrganization', 'VARCHAR', false, 512, null); + $this->addColumn('SUBJECT', 'DbSubject', 'VARCHAR', false, 512, null); + $this->addColumn('CONTRIBUTOR', 'DbContributor', 'VARCHAR', false, 512, null); + $this->addColumn('LANGUAGE', 'DbLanguage', 'VARCHAR', false, 512, null); + $this->addColumn('SOUNDCLOUD_ID', 'DbSoundcloudId', 'INTEGER', false, null, null); + $this->addColumn('SOUNDCLOUD_ERROR_CODE', 'DbSoundcloudErrorCode', 'INTEGER', false, null, null); + $this->addColumn('SOUNDCLOUD_ERROR_MSG', 'DbSoundcloudErrorMsg', 'VARCHAR', false, 512, null); + $this->addColumn('SOUNDCLOUD_LINK_TO_FILE', 'DbSoundcloudLinkToFile', 'VARCHAR', false, 4096, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null); + $this->addRelation('CcMusicDirs', 'CcMusicDirs', RelationMap::MANY_TO_ONE, array('directory' => 'id', ), 'CASCADE', null); + $this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null); + $this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null); + $this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null); + } // buildRelations() + +} // CcFilesTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcLoginAttemptsTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcLoginAttemptsTableMap.php new file mode 100644 index 000000000..32ce73743 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcLoginAttemptsTableMap.php @@ -0,0 +1,52 @@ +setName('cc_login_attempts'); + $this->setPhpName('CcLoginAttempts'); + $this->setClassname('CcLoginAttempts'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(false); + // columns + $this->addPrimaryKey('IP', 'DbIP', 'VARCHAR', true, 32, null); + $this->addColumn('ATTEMPTS', 'DbAttempts', 'INTEGER', false, null, 0); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + } // buildRelations() + +} // CcLoginAttemptsTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcMusicDirsTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcMusicDirsTableMap.php new file mode 100644 index 000000000..022ef658c --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcMusicDirsTableMap.php @@ -0,0 +1,55 @@ +setName('cc_music_dirs'); + $this->setPhpName('CcMusicDirs'); + $this->setClassname('CcMusicDirs'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('cc_music_dirs_id_seq'); + // columns + $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); + $this->addColumn('DIRECTORY', 'Directory', 'LONGVARCHAR', false, null, null); + $this->addColumn('TYPE', 'Type', 'VARCHAR', false, 255, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('CcFiles', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'directory', ), 'CASCADE', null); + } // buildRelations() + +} // CcMusicDirsTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcPermsTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcPermsTableMap.php new file mode 100644 index 000000000..481d17c96 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcPermsTableMap.php @@ -0,0 +1,56 @@ +setName('cc_perms'); + $this->setPhpName('CcPerms'); + $this->setClassname('CcPerms'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(false); + // columns + $this->addPrimaryKey('PERMID', 'Permid', 'INTEGER', true, null, null); + $this->addForeignKey('SUBJ', 'Subj', 'INTEGER', 'cc_subjs', 'ID', false, null, null); + $this->addColumn('ACTION', 'Action', 'VARCHAR', false, 20, null); + $this->addColumn('OBJ', 'Obj', 'INTEGER', false, null, null); + $this->addColumn('TYPE', 'Type', 'CHAR', false, 1, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('subj' => 'id', ), 'CASCADE', null); + } // buildRelations() + +} // CcPermsTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcPlaylistTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcPlaylistTableMap.php new file mode 100644 index 000000000..e4ad1bbd5 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcPlaylistTableMap.php @@ -0,0 +1,61 @@ +setName('cc_playlist'); + $this->setPhpName('CcPlaylist'); + $this->setClassname('CcPlaylist'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('cc_playlist_id_seq'); + // columns + $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); + $this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, ''); + $this->addColumn('STATE', 'DbState', 'VARCHAR', true, 128, 'empty'); + $this->addColumn('CURRENTLYACCESSING', 'DbCurrentlyaccessing', 'INTEGER', true, null, 0); + $this->addForeignKey('EDITEDBY', 'DbEditedby', 'INTEGER', 'cc_subjs', 'ID', false, null, null); + $this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', false, 6, null); + $this->addColumn('CREATOR', 'DbCreator', 'VARCHAR', false, 32, null); + $this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', false, 512, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null); + $this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'playlist_id', ), 'CASCADE', null); + } // buildRelations() + +} // CcPlaylistTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcPlaylistcontentsTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcPlaylistcontentsTableMap.php new file mode 100644 index 000000000..b00f39ade --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcPlaylistcontentsTableMap.php @@ -0,0 +1,62 @@ +setName('cc_playlistcontents'); + $this->setPhpName('CcPlaylistcontents'); + $this->setClassname('CcPlaylistcontents'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('cc_playlistcontents_id_seq'); + // columns + $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); + $this->addForeignKey('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', 'cc_playlist', 'ID', false, null, null); + $this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null); + $this->addColumn('POSITION', 'DbPosition', 'INTEGER', false, null, null); + $this->addColumn('CLIPLENGTH', 'DbCliplength', 'TIME', false, null, '00:00:00'); + $this->addColumn('CUEIN', 'DbCuein', 'TIME', false, null, '00:00:00'); + $this->addColumn('CUEOUT', 'DbCueout', 'TIME', false, null, '00:00:00'); + $this->addColumn('FADEIN', 'DbFadein', 'TIME', false, null, '00:00:00'); + $this->addColumn('FADEOUT', 'DbFadeout', 'TIME', false, null, '00:00:00'); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null); + $this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::MANY_TO_ONE, array('playlist_id' => 'id', ), 'CASCADE', null); + } // buildRelations() + +} // CcPlaylistcontentsTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcPrefTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcPrefTableMap.php new file mode 100644 index 000000000..1d22a122d --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcPrefTableMap.php @@ -0,0 +1,56 @@ +setName('cc_pref'); + $this->setPhpName('CcPref'); + $this->setClassname('CcPref'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('cc_pref_id_seq'); + // columns + $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); + $this->addForeignKey('SUBJID', 'Subjid', 'INTEGER', 'cc_subjs', 'ID', false, null, null); + $this->addColumn('KEYSTR', 'Keystr', 'VARCHAR', false, 255, null); + $this->addColumn('VALSTR', 'Valstr', 'LONGVARCHAR', false, null, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('subjid' => 'id', ), 'CASCADE', null); + } // buildRelations() + +} // CcPrefTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcScheduleTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcScheduleTableMap.php new file mode 100644 index 000000000..12fa8d712 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcScheduleTableMap.php @@ -0,0 +1,80 @@ +setName('cc_schedule'); + $this->setPhpName('CcSchedule'); + $this->setClassname('CcSchedule'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('cc_schedule_id_seq'); + // columns + $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); + $this->addColumn('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', false, null, null); + $this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null); + $this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null); + $this->addColumn('GROUP_ID', 'DbGroupId', 'INTEGER', false, null, null); + $this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null); + $this->addColumn('CLIP_LENGTH', 'DbClipLength', 'TIME', false, null, '00:00:00'); + $this->addColumn('FADE_IN', 'DbFadeIn', 'TIME', false, null, '00:00:00'); + $this->addColumn('FADE_OUT', 'DbFadeOut', 'TIME', false, null, '00:00:00'); + $this->addColumn('CUE_IN', 'DbCueIn', 'TIME', false, null, '00:00:00'); + $this->addColumn('CUE_OUT', 'DbCueOut', 'TIME', false, null, '00:00:00'); + $this->addColumn('SCHEDULE_GROUP_PLAYED', 'DbScheduleGroupPlayed', 'BOOLEAN', false, null, false); + $this->addColumn('MEDIA_ITEM_PLAYED', 'DbMediaItemPlayed', 'BOOLEAN', false, null, false); + $this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', true, null, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'CASCADE', null); + $this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null); + } // buildRelations() + + /** + * + * Gets the list of behaviors registered for this table + * + * @return array Associative array (name => parameters) of behaviors + */ + public function getBehaviors() + { + return array( + 'aggregate_column_relation' => array('foreign_table' => 'cc_show_instances', 'update_method' => 'updateDbTimeFilled', ), + ); + } // getBehaviors() + +} // CcScheduleTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcServiceRegisterTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcServiceRegisterTableMap.php new file mode 100644 index 000000000..f4eae5e60 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcServiceRegisterTableMap.php @@ -0,0 +1,52 @@ +setName('cc_service_register'); + $this->setPhpName('CcServiceRegister'); + $this->setClassname('CcServiceRegister'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(false); + // columns + $this->addPrimaryKey('NAME', 'DbName', 'VARCHAR', true, 32, null); + $this->addColumn('IP', 'DbIp', 'VARCHAR', true, 18, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + } // buildRelations() + +} // CcServiceRegisterTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcSessTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcSessTableMap.php new file mode 100644 index 000000000..66605b4eb --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcSessTableMap.php @@ -0,0 +1,55 @@ +setName('cc_sess'); + $this->setPhpName('CcSess'); + $this->setClassname('CcSess'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(false); + // columns + $this->addPrimaryKey('SESSID', 'Sessid', 'CHAR', true, 32, null); + $this->addForeignKey('USERID', 'Userid', 'INTEGER', 'cc_subjs', 'ID', false, null, null); + $this->addColumn('LOGIN', 'Login', 'VARCHAR', false, 255, null); + $this->addColumn('TS', 'Ts', 'TIMESTAMP', false, null, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('userid' => 'id', ), 'CASCADE', null); + } // buildRelations() + +} // CcSessTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowDaysTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowDaysTableMap.php new file mode 100644 index 000000000..7d6b8a10e --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowDaysTableMap.php @@ -0,0 +1,63 @@ +setName('cc_show_days'); + $this->setPhpName('CcShowDays'); + $this->setClassname('CcShowDays'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('cc_show_days_id_seq'); + // columns + $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); + $this->addColumn('FIRST_SHOW', 'DbFirstShow', 'DATE', true, null, null); + $this->addColumn('LAST_SHOW', 'DbLastShow', 'DATE', false, null, null); + $this->addColumn('START_TIME', 'DbStartTime', 'TIME', true, null, null); + $this->addColumn('TIMEZONE', 'DbTimezone', 'VARCHAR', true, 255, null); + $this->addColumn('DURATION', 'DbDuration', 'VARCHAR', true, 255, null); + $this->addColumn('DAY', 'DbDay', 'TINYINT', false, null, null); + $this->addColumn('REPEAT_TYPE', 'DbRepeatType', 'TINYINT', true, null, null); + $this->addColumn('NEXT_POP_DATE', 'DbNextPopDate', 'DATE', false, null, null); + $this->addForeignKey('SHOW_ID', 'DbShowId', 'INTEGER', 'cc_show', 'ID', true, null, null); + $this->addColumn('RECORD', 'DbRecord', 'TINYINT', false, null, 0); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('CcShow', 'CcShow', RelationMap::MANY_TO_ONE, array('show_id' => 'id', ), 'CASCADE', null); + } // buildRelations() + +} // CcShowDaysTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowHostsTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowHostsTableMap.php new file mode 100644 index 000000000..c76efdbd3 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowHostsTableMap.php @@ -0,0 +1,56 @@ +setName('cc_show_hosts'); + $this->setPhpName('CcShowHosts'); + $this->setClassname('CcShowHosts'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('cc_show_hosts_id_seq'); + // columns + $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); + $this->addForeignKey('SHOW_ID', 'DbShow', 'INTEGER', 'cc_show', 'ID', true, null, null); + $this->addForeignKey('SUBJS_ID', 'DbHost', 'INTEGER', 'cc_subjs', 'ID', true, null, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('CcShow', 'CcShow', RelationMap::MANY_TO_ONE, array('show_id' => 'id', ), 'CASCADE', null); + $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('subjs_id' => 'id', ), 'CASCADE', null); + } // buildRelations() + +} // CcShowHostsTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowInstancesTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowInstancesTableMap.php new file mode 100644 index 000000000..75e7da2c7 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowInstancesTableMap.php @@ -0,0 +1,79 @@ +setName('cc_show_instances'); + $this->setPhpName('CcShowInstances'); + $this->setClassname('CcShowInstances'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('cc_show_instances_id_seq'); + // columns + $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); + $this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null); + $this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null); + $this->addForeignKey('SHOW_ID', 'DbShowId', 'INTEGER', 'cc_show', 'ID', true, null, null); + $this->addColumn('RECORD', 'DbRecord', 'TINYINT', false, null, 0); + $this->addColumn('REBROADCAST', 'DbRebroadcast', 'TINYINT', false, null, 0); + $this->addForeignKey('INSTANCE_ID', 'DbOriginalShow', 'INTEGER', 'cc_show_instances', 'ID', false, null, null); + $this->addForeignKey('FILE_ID', 'DbRecordedFile', 'INTEGER', 'cc_files', 'ID', false, null, null); + $this->addColumn('TIME_FILLED', 'DbTimeFilled', 'TIME', false, null, null); + $this->addColumn('MODIFIED_INSTANCE', 'DbModifiedInstance', 'BOOLEAN', true, null, false); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('CcShow', 'CcShow', RelationMap::MANY_TO_ONE, array('show_id' => 'id', ), 'CASCADE', null); + $this->addRelation('CcShowInstancesRelatedByDbOriginalShow', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'CASCADE', null); + $this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null); + $this->addRelation('CcShowInstancesRelatedByDbId', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null); + $this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null); + } // buildRelations() + + /** + * + * Gets the list of behaviors registered for this table + * + * @return array Associative array (name => parameters) of behaviors + */ + public function getBehaviors() + { + return array( + 'aggregate_column' => array('name' => 'time_filled', 'expression' => 'SUM(clip_length)', 'foreign_table' => 'cc_schedule', ), + ); + } // getBehaviors() + +} // CcShowInstancesTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowRebroadcastTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowRebroadcastTableMap.php new file mode 100644 index 000000000..60a9ba980 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowRebroadcastTableMap.php @@ -0,0 +1,56 @@ +setName('cc_show_rebroadcast'); + $this->setPhpName('CcShowRebroadcast'); + $this->setClassname('CcShowRebroadcast'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('cc_show_rebroadcast_id_seq'); + // columns + $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); + $this->addColumn('DAY_OFFSET', 'DbDayOffset', 'VARCHAR', true, 255, null); + $this->addColumn('START_TIME', 'DbStartTime', 'TIME', true, null, null); + $this->addForeignKey('SHOW_ID', 'DbShowId', 'INTEGER', 'cc_show', 'ID', true, null, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('CcShow', 'CcShow', RelationMap::MANY_TO_ONE, array('show_id' => 'id', ), 'CASCADE', null); + } // buildRelations() + +} // CcShowRebroadcastTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowScheduleTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowScheduleTableMap.php new file mode 100644 index 000000000..96528559c --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowScheduleTableMap.php @@ -0,0 +1,56 @@ +setName('cc_show_schedule'); + $this->setPhpName('CcShowSchedule'); + $this->setClassname('CcShowSchedule'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('cc_show_schedule_id_seq'); + // columns + $this->addPrimaryKey('ID', 'DbId', 'INTEGER', 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 + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'CASCADE', null); + } // buildRelations() + +} // CcShowScheduleTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowTableMap.php new file mode 100644 index 000000000..b558b6e93 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcShowTableMap.php @@ -0,0 +1,62 @@ +setName('cc_show'); + $this->setPhpName('CcShow'); + $this->setClassname('CcShow'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('cc_show_id_seq'); + // columns + $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); + $this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, ''); + $this->addColumn('URL', 'DbUrl', 'VARCHAR', false, 255, ''); + $this->addColumn('GENRE', 'DbGenre', 'VARCHAR', false, 255, ''); + $this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', false, 512, null); + $this->addColumn('COLOR', 'DbColor', 'VARCHAR', false, 6, null); + $this->addColumn('BACKGROUND_COLOR', 'DbBackgroundColor', 'VARCHAR', false, 6, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $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('CcShowRebroadcast', 'CcShowRebroadcast', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null); + $this->addRelation('CcShowHosts', 'CcShowHosts', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null); + } // buildRelations() + +} // CcShowTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcSmembTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcSmembTableMap.php new file mode 100644 index 000000000..236cdd016 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcSmembTableMap.php @@ -0,0 +1,55 @@ +setName('cc_smemb'); + $this->setPhpName('CcSmemb'); + $this->setClassname('CcSmemb'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(false); + // columns + $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); + $this->addColumn('UID', 'Uid', 'INTEGER', true, null, 0); + $this->addColumn('GID', 'Gid', 'INTEGER', true, null, 0); + $this->addColumn('LEVEL', 'Level', 'INTEGER', true, null, 0); + $this->addColumn('MID', 'Mid', 'INTEGER', false, null, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + } // buildRelations() + +} // CcSmembTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcStreamSettingTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcStreamSettingTableMap.php new file mode 100644 index 000000000..d401ce096 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcStreamSettingTableMap.php @@ -0,0 +1,53 @@ +setName('cc_stream_setting'); + $this->setPhpName('CcStreamSetting'); + $this->setClassname('CcStreamSetting'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(false); + // columns + $this->addPrimaryKey('KEYNAME', 'DbKeyName', 'VARCHAR', true, 64, null); + $this->addColumn('VALUE', 'DbValue', 'VARCHAR', false, 255, null); + $this->addColumn('TYPE', 'DbType', 'VARCHAR', true, 16, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + } // buildRelations() + +} // CcStreamSettingTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcSubjsTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcSubjsTableMap.php new file mode 100644 index 000000000..49e883968 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcSubjsTableMap.php @@ -0,0 +1,70 @@ +setName('cc_subjs'); + $this->setPhpName('CcSubjs'); + $this->setClassname('CcSubjs'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('cc_subjs_id_seq'); + // columns + $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); + $this->addColumn('LOGIN', 'DbLogin', 'VARCHAR', true, 255, ''); + $this->addColumn('PASS', 'DbPass', 'VARCHAR', true, 255, ''); + $this->addColumn('TYPE', 'DbType', 'CHAR', true, 1, 'U'); + $this->addColumn('FIRST_NAME', 'DbFirstName', 'VARCHAR', true, 255, ''); + $this->addColumn('LAST_NAME', 'DbLastName', 'VARCHAR', true, 255, ''); + $this->addColumn('LASTLOGIN', 'DbLastlogin', 'TIMESTAMP', false, null, null); + $this->addColumn('LASTFAIL', 'DbLastfail', 'TIMESTAMP', false, null, null); + $this->addColumn('SKYPE_CONTACT', 'DbSkypeContact', 'VARCHAR', false, 255, null); + $this->addColumn('JABBER_CONTACT', 'DbJabberContact', 'VARCHAR', false, 255, null); + $this->addColumn('EMAIL', 'DbEmail', 'VARCHAR', false, 255, null); + $this->addColumn('LOGIN_ATTEMPTS', 'DbLoginAttempts', 'INTEGER', false, null, 0); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('CcAccess', 'CcAccess', RelationMap::ONE_TO_MANY, array('id' => 'owner', ), null, null); + $this->addRelation('CcFiles', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'editedby', ), null, null); + $this->addRelation('CcPerms', 'CcPerms', RelationMap::ONE_TO_MANY, array('id' => 'subj', ), 'CASCADE', null); + $this->addRelation('CcShowHosts', 'CcShowHosts', RelationMap::ONE_TO_MANY, array('id' => 'subjs_id', ), 'CASCADE', null); + $this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::ONE_TO_MANY, array('id' => 'editedby', ), null, null); + $this->addRelation('CcPref', 'CcPref', RelationMap::ONE_TO_MANY, array('id' => 'subjid', ), 'CASCADE', null); + $this->addRelation('CcSess', 'CcSess', RelationMap::ONE_TO_MANY, array('id' => 'userid', ), 'CASCADE', null); + } // buildRelations() + +} // CcSubjsTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcTransTableMap.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcTransTableMap.php new file mode 100644 index 000000000..4c5d35e1a --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/map/CcTransTableMap.php @@ -0,0 +1,75 @@ +setName('cc_trans'); + $this->setPhpName('CcTrans'); + $this->setClassname('CcTrans'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('cc_trans_id_seq'); + // columns + $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); + $this->addColumn('TRTOK', 'Trtok', 'CHAR', true, 16, null); + $this->addColumn('DIRECTION', 'Direction', 'VARCHAR', true, 128, null); + $this->addColumn('STATE', 'State', 'VARCHAR', true, 128, null); + $this->addColumn('TRTYPE', 'Trtype', 'VARCHAR', true, 128, null); + $this->addColumn('LOCK', 'Lock', 'CHAR', true, 1, 'N'); + $this->addColumn('TARGET', 'Target', 'VARCHAR', false, 255, null); + $this->addColumn('RTRTOK', 'Rtrtok', 'CHAR', false, 16, null); + $this->addColumn('MDTRTOK', 'Mdtrtok', 'CHAR', false, 16, null); + $this->addColumn('GUNID', 'Gunid', 'CHAR', false, 32, null); + $this->addColumn('PDTOKEN', 'Pdtoken', 'BIGINT', false, null, null); + $this->addColumn('URL', 'Url', 'VARCHAR', false, 255, null); + $this->addColumn('LOCALFILE', 'Localfile', 'VARCHAR', false, 255, null); + $this->addColumn('FNAME', 'Fname', 'VARCHAR', false, 255, null); + $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null); + $this->addColumn('EXPECTEDSUM', 'Expectedsum', 'CHAR', false, 32, null); + $this->addColumn('REALSUM', 'Realsum', 'CHAR', false, 32, null); + $this->addColumn('EXPECTEDSIZE', 'Expectedsize', 'INTEGER', false, null, null); + $this->addColumn('REALSIZE', 'Realsize', 'INTEGER', false, null, null); + $this->addColumn('UID', 'Uid', 'INTEGER', false, null, null); + $this->addColumn('ERRMSG', 'Errmsg', 'VARCHAR', false, 255, null); + $this->addColumn('JOBPID', 'Jobpid', 'INTEGER', false, null, null); + $this->addColumn('START', 'Start', 'TIMESTAMP', false, null, null); + $this->addColumn('TS', 'Ts', 'TIMESTAMP', false, null, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + } // buildRelations() + +} // CcTransTableMap diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcAccess.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcAccess.php new file mode 100644 index 000000000..8f2de9dca --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcAccess.php @@ -0,0 +1,1236 @@ +chsum = ''; + $this->ext = ''; + $this->type = ''; + } + + /** + * Initializes internal state of BaseCcAccess object. + * @see applyDefaults() + */ + public function __construct() + { + parent::__construct(); + $this->applyDefaultValues(); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [gunid] column value. + * + * @return string + */ + public function getGunid() + { + return $this->gunid; + } + + /** + * Get the [token] column value. + * + * @return string + */ + public function getToken() + { + return $this->token; + } + + /** + * Get the [chsum] column value. + * + * @return string + */ + public function getChsum() + { + return $this->chsum; + } + + /** + * Get the [ext] column value. + * + * @return string + */ + public function getExt() + { + return $this->ext; + } + + /** + * Get the [type] column value. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Get the [parent] column value. + * + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Get the [owner] column value. + * + * @return int + */ + public function getOwner() + { + return $this->owner; + } + + /** + * Get the [optionally formatted] temporal [ts] 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 getTs($format = 'Y-m-d H:i:s') + { + if ($this->ts === null) { + return null; + } + + + + try { + $dt = new DateTime($this->ts); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->ts, 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); + } + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return CcAccess The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CcAccessPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [gunid] column. + * + * @param string $v new value + * @return CcAccess The current object (for fluent API support) + */ + public function setGunid($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->gunid !== $v) { + $this->gunid = $v; + $this->modifiedColumns[] = CcAccessPeer::GUNID; + } + + return $this; + } // setGunid() + + /** + * Set the value of [token] column. + * + * @param string $v new value + * @return CcAccess The current object (for fluent API support) + */ + public function setToken($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->token !== $v) { + $this->token = $v; + $this->modifiedColumns[] = CcAccessPeer::TOKEN; + } + + return $this; + } // setToken() + + /** + * Set the value of [chsum] column. + * + * @param string $v new value + * @return CcAccess The current object (for fluent API support) + */ + public function setChsum($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->chsum !== $v || $this->isNew()) { + $this->chsum = $v; + $this->modifiedColumns[] = CcAccessPeer::CHSUM; + } + + return $this; + } // setChsum() + + /** + * Set the value of [ext] column. + * + * @param string $v new value + * @return CcAccess The current object (for fluent API support) + */ + public function setExt($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->ext !== $v || $this->isNew()) { + $this->ext = $v; + $this->modifiedColumns[] = CcAccessPeer::EXT; + } + + return $this; + } // setExt() + + /** + * Set the value of [type] column. + * + * @param string $v new value + * @return CcAccess The current object (for fluent API support) + */ + public function setType($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->type !== $v || $this->isNew()) { + $this->type = $v; + $this->modifiedColumns[] = CcAccessPeer::TYPE; + } + + return $this; + } // setType() + + /** + * Set the value of [parent] column. + * + * @param string $v new value + * @return CcAccess The current object (for fluent API support) + */ + public function setParent($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->parent !== $v) { + $this->parent = $v; + $this->modifiedColumns[] = CcAccessPeer::PARENT; + } + + return $this; + } // setParent() + + /** + * Set the value of [owner] column. + * + * @param int $v new value + * @return CcAccess The current object (for fluent API support) + */ + public function setOwner($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->owner !== $v) { + $this->owner = $v; + $this->modifiedColumns[] = CcAccessPeer::OWNER; + } + + if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) { + $this->aCcSubjs = null; + } + + return $this; + } // setOwner() + + /** + * Sets the value of [ts] 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 CcAccess The current object (for fluent API support) + */ + public function setTs($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->ts !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->ts !== null && $tmpDt = new DateTime($this->ts)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->ts = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); + $this->modifiedColumns[] = CcAccessPeer::TS; + } + } // if either are not null + + return $this; + } // setTs() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + if ($this->chsum !== '') { + return false; + } + + if ($this->ext !== '') { + return false; + } + + if ($this->type !== '') { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->gunid = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->token = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->chsum = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->ext = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->type = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->parent = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->owner = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null; + $this->ts = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 9; // 9 = CcAccessPeer::NUM_COLUMNS - CcAccessPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcAccess object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aCcSubjs !== null && $this->owner !== $this->aCcSubjs->getDbId()) { + $this->aCcSubjs = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcAccessPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aCcSubjs = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcAccessQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcAccessPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcSubjs !== null) { + if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { + $affectedRows += $this->aCcSubjs->save($con); + } + $this->setCcSubjs($this->aCcSubjs); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = CcAccessPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + if ($criteria->keyContainsValue(CcAccessPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcAccessPeer::ID.')'); + } + + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows += 1; + $this->setId($pk); //[IMV] update autoincrement primary key + $this->setNew(false); + } else { + $affectedRows += CcAccessPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + // We call the validate method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcSubjs !== null) { + if (!$this->aCcSubjs->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures()); + } + } + + + if (($retval = CcAccessPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcAccessPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getGunid(); + break; + case 2: + return $this->getToken(); + break; + case 3: + return $this->getChsum(); + break; + case 4: + return $this->getExt(); + break; + case 5: + return $this->getType(); + break; + case 6: + return $this->getParent(); + break; + case 7: + return $this->getOwner(); + break; + case 8: + return $this->getTs(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) + { + $keys = CcAccessPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getGunid(), + $keys[2] => $this->getToken(), + $keys[3] => $this->getChsum(), + $keys[4] => $this->getExt(), + $keys[5] => $this->getType(), + $keys[6] => $this->getParent(), + $keys[7] => $this->getOwner(), + $keys[8] => $this->getTs(), + ); + if ($includeForeignObjects) { + if (null !== $this->aCcSubjs) { + $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, true); + } + } + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcAccessPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setId($value); + break; + case 1: + $this->setGunid($value); + break; + case 2: + $this->setToken($value); + break; + case 3: + $this->setChsum($value); + break; + case 4: + $this->setExt($value); + break; + case 5: + $this->setType($value); + break; + case 6: + $this->setParent($value); + break; + case 7: + $this->setOwner($value); + break; + case 8: + $this->setTs($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcAccessPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setGunid($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setToken($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setChsum($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setExt($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setType($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setParent($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setOwner($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setTs($arr[$keys[8]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcAccessPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcAccessPeer::ID)) $criteria->add(CcAccessPeer::ID, $this->id); + if ($this->isColumnModified(CcAccessPeer::GUNID)) $criteria->add(CcAccessPeer::GUNID, $this->gunid); + if ($this->isColumnModified(CcAccessPeer::TOKEN)) $criteria->add(CcAccessPeer::TOKEN, $this->token); + if ($this->isColumnModified(CcAccessPeer::CHSUM)) $criteria->add(CcAccessPeer::CHSUM, $this->chsum); + if ($this->isColumnModified(CcAccessPeer::EXT)) $criteria->add(CcAccessPeer::EXT, $this->ext); + if ($this->isColumnModified(CcAccessPeer::TYPE)) $criteria->add(CcAccessPeer::TYPE, $this->type); + if ($this->isColumnModified(CcAccessPeer::PARENT)) $criteria->add(CcAccessPeer::PARENT, $this->parent); + if ($this->isColumnModified(CcAccessPeer::OWNER)) $criteria->add(CcAccessPeer::OWNER, $this->owner); + if ($this->isColumnModified(CcAccessPeer::TS)) $criteria->add(CcAccessPeer::TS, $this->ts); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcAccessPeer::DATABASE_NAME); + $criteria->add(CcAccessPeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcAccess (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setGunid($this->gunid); + $copyObj->setToken($this->token); + $copyObj->setChsum($this->chsum); + $copyObj->setExt($this->ext); + $copyObj->setType($this->type); + $copyObj->setParent($this->parent); + $copyObj->setOwner($this->owner); + $copyObj->setTs($this->ts); + + $copyObj->setNew(true); + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcAccess Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcAccessPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcAccessPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a CcSubjs object. + * + * @param CcSubjs $v + * @return CcAccess The current object (for fluent API support) + * @throws PropelException + */ + public function setCcSubjs(CcSubjs $v = null) + { + if ($v === null) { + $this->setOwner(NULL); + } else { + $this->setOwner($v->getDbId()); + } + + $this->aCcSubjs = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcSubjs object, it will not be re-added. + if ($v !== null) { + $v->addCcAccess($this); + } + + return $this; + } + + + /** + * Get the associated CcSubjs object + * + * @param PropelPDO Optional Connection object. + * @return CcSubjs The associated CcSubjs object. + * @throws PropelException + */ + public function getCcSubjs(PropelPDO $con = null) + { + if ($this->aCcSubjs === null && ($this->owner !== null)) { + $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->owner, $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->aCcSubjs->addCcAccesss($this); + */ + } + return $this->aCcSubjs; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->gunid = null; + $this->token = null; + $this->chsum = null; + $this->ext = null; + $this->type = null; + $this->parent = null; + $this->owner = null; + $this->ts = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->applyDefaultValues(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aCcSubjs = null; + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcAccess diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcAccessPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcAccessPeer.php new file mode 100644 index 000000000..c14312b14 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcAccessPeer.php @@ -0,0 +1,1008 @@ + array ('Id', 'Gunid', 'Token', 'Chsum', 'Ext', 'Type', 'Parent', 'Owner', 'Ts', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'gunid', 'token', 'chsum', 'ext', 'type', 'parent', 'owner', 'ts', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::GUNID, self::TOKEN, self::CHSUM, self::EXT, self::TYPE, self::PARENT, self::OWNER, self::TS, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'GUNID', 'TOKEN', 'CHSUM', 'EXT', 'TYPE', 'PARENT', 'OWNER', 'TS', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'gunid', 'token', 'chsum', 'ext', 'type', 'parent', 'owner', 'ts', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Gunid' => 1, 'Token' => 2, 'Chsum' => 3, 'Ext' => 4, 'Type' => 5, 'Parent' => 6, 'Owner' => 7, 'Ts' => 8, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'gunid' => 1, 'token' => 2, 'chsum' => 3, 'ext' => 4, 'type' => 5, 'parent' => 6, 'owner' => 7, 'ts' => 8, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::GUNID => 1, self::TOKEN => 2, self::CHSUM => 3, self::EXT => 4, self::TYPE => 5, self::PARENT => 6, self::OWNER => 7, self::TS => 8, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'GUNID' => 1, 'TOKEN' => 2, 'CHSUM' => 3, 'EXT' => 4, 'TYPE' => 5, 'PARENT' => 6, 'OWNER' => 7, 'TS' => 8, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'gunid' => 1, 'token' => 2, 'chsum' => 3, 'ext' => 4, 'type' => 5, 'parent' => 6, 'owner' => 7, 'ts' => 8, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcAccessPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcAccessPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcAccessPeer::ID); + $criteria->addSelectColumn(CcAccessPeer::GUNID); + $criteria->addSelectColumn(CcAccessPeer::TOKEN); + $criteria->addSelectColumn(CcAccessPeer::CHSUM); + $criteria->addSelectColumn(CcAccessPeer::EXT); + $criteria->addSelectColumn(CcAccessPeer::TYPE); + $criteria->addSelectColumn(CcAccessPeer::PARENT); + $criteria->addSelectColumn(CcAccessPeer::OWNER); + $criteria->addSelectColumn(CcAccessPeer::TS); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.GUNID'); + $criteria->addSelectColumn($alias . '.TOKEN'); + $criteria->addSelectColumn($alias . '.CHSUM'); + $criteria->addSelectColumn($alias . '.EXT'); + $criteria->addSelectColumn($alias . '.TYPE'); + $criteria->addSelectColumn($alias . '.PARENT'); + $criteria->addSelectColumn($alias . '.OWNER'); + $criteria->addSelectColumn($alias . '.TS'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcAccessPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcAccessPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcAccess + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcAccessPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcAccessPeer::populateObjects(CcAccessPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcAccessPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcAccess $value A CcAccess object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcAccess $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcAccess object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcAccess) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcAccess object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcAccess Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_access + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcAccessPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcAccessPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcAccessPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcAccessPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcAccess object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcAccessPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcAccessPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcAccessPeer::NUM_COLUMNS; + } else { + $cls = CcAccessPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcAccessPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + + /** + * Returns the number of rows matching criteria, joining the related CcSubjs table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcAccessPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcAccessPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcAccessPeer::OWNER, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcAccess objects pre-filled with their CcSubjs objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcAccess objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcAccessPeer::addSelectColumns($criteria); + $startcol = (CcAccessPeer::NUM_COLUMNS - CcAccessPeer::NUM_LAZY_LOAD_COLUMNS); + CcSubjsPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcAccessPeer::OWNER, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcAccessPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcAccessPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcAccessPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcAccessPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcSubjsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcSubjsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcSubjsPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcAccess) to $obj2 (CcSubjs) + $obj2->addCcAccess($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining all related tables + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcAccessPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcAccessPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcAccessPeer::OWNER, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of CcAccess objects pre-filled with all related objects. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcAccess objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcAccessPeer::addSelectColumns($criteria); + $startcol2 = (CcAccessPeer::NUM_COLUMNS - CcAccessPeer::NUM_LAZY_LOAD_COLUMNS); + + CcSubjsPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcAccessPeer::OWNER, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcAccessPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcAccessPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcAccessPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcAccessPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcSubjs rows + + $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcSubjsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcSubjsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcSubjsPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (CcAccess) to the collection in $obj2 (CcSubjs) + $obj2->addCcAccess($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcAccessPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcAccessPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcAccessTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcAccessPeer::CLASS_DEFAULT : CcAccessPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcAccess or Criteria object. + * + * @param mixed $values Criteria or CcAccess object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcAccess object + } + + if ($criteria->containsKey(CcAccessPeer::ID) && $criteria->keyContainsValue(CcAccessPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcAccessPeer::ID.')'); + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcAccess or Criteria object. + * + * @param mixed $values Criteria or CcAccess object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcAccessPeer::ID); + $value = $criteria->remove(CcAccessPeer::ID); + if ($value) { + $selectCriteria->add(CcAccessPeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcAccessPeer::TABLE_NAME); + } + + } else { // $values is CcAccess object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_access table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcAccessPeer::TABLE_NAME, $con, CcAccessPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcAccessPeer::clearInstancePool(); + CcAccessPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcAccess or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcAccess object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcAccessPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcAccess) { // it's a model object + // invalidate the cache for this single object + CcAccessPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcAccessPeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcAccessPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcAccessPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcAccess object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcAccess $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcAccess $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcAccessPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcAccessPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcAccessPeer::DATABASE_NAME, CcAccessPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcAccess + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcAccessPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcAccessPeer::DATABASE_NAME); + $criteria->add(CcAccessPeer::ID, $pk); + + $v = CcAccessPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcAccessPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcAccessPeer::DATABASE_NAME); + $criteria->add(CcAccessPeer::ID, $pks, Criteria::IN); + $objs = CcAccessPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcAccessPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcAccessPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcAccessQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcAccessQuery.php new file mode 100644 index 000000000..652550f18 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcAccessQuery.php @@ -0,0 +1,477 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcAccess|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcAccessPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcAccessQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcAccessPeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcAccessQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcAccessPeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * @param int|array $id 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 CcAccessQuery The current query, for fluid interface + */ + public function filterById($id = null, $comparison = null) + { + if (is_array($id) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcAccessPeer::ID, $id, $comparison); + } + + /** + * Filter the query on the gunid column + * + * @param string $gunid The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcAccessQuery The current query, for fluid interface + */ + public function filterByGunid($gunid = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($gunid)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $gunid)) { + $gunid = str_replace('*', '%', $gunid); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcAccessPeer::GUNID, $gunid, $comparison); + } + + /** + * Filter the query on the token column + * + * @param string|array $token 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 CcAccessQuery The current query, for fluid interface + */ + public function filterByToken($token = null, $comparison = null) + { + if (is_array($token)) { + $useMinMax = false; + if (isset($token['min'])) { + $this->addUsingAlias(CcAccessPeer::TOKEN, $token['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($token['max'])) { + $this->addUsingAlias(CcAccessPeer::TOKEN, $token['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcAccessPeer::TOKEN, $token, $comparison); + } + + /** + * Filter the query on the chsum column + * + * @param string $chsum The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcAccessQuery The current query, for fluid interface + */ + public function filterByChsum($chsum = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($chsum)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $chsum)) { + $chsum = str_replace('*', '%', $chsum); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcAccessPeer::CHSUM, $chsum, $comparison); + } + + /** + * Filter the query on the ext column + * + * @param string $ext The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcAccessQuery The current query, for fluid interface + */ + public function filterByExt($ext = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($ext)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $ext)) { + $ext = str_replace('*', '%', $ext); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcAccessPeer::EXT, $ext, $comparison); + } + + /** + * Filter the query on the type column + * + * @param string $type The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcAccessQuery The current query, for fluid interface + */ + public function filterByType($type = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($type)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $type)) { + $type = str_replace('*', '%', $type); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcAccessPeer::TYPE, $type, $comparison); + } + + /** + * Filter the query on the parent column + * + * @param string|array $parent 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 CcAccessQuery The current query, for fluid interface + */ + public function filterByParent($parent = null, $comparison = null) + { + if (is_array($parent)) { + $useMinMax = false; + if (isset($parent['min'])) { + $this->addUsingAlias(CcAccessPeer::PARENT, $parent['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($parent['max'])) { + $this->addUsingAlias(CcAccessPeer::PARENT, $parent['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcAccessPeer::PARENT, $parent, $comparison); + } + + /** + * Filter the query on the owner column + * + * @param int|array $owner 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 CcAccessQuery The current query, for fluid interface + */ + public function filterByOwner($owner = null, $comparison = null) + { + if (is_array($owner)) { + $useMinMax = false; + if (isset($owner['min'])) { + $this->addUsingAlias(CcAccessPeer::OWNER, $owner['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($owner['max'])) { + $this->addUsingAlias(CcAccessPeer::OWNER, $owner['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcAccessPeer::OWNER, $owner, $comparison); + } + + /** + * Filter the query on the ts column + * + * @param string|array $ts 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 CcAccessQuery The current query, for fluid interface + */ + public function filterByTs($ts = null, $comparison = null) + { + if (is_array($ts)) { + $useMinMax = false; + if (isset($ts['min'])) { + $this->addUsingAlias(CcAccessPeer::TS, $ts['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($ts['max'])) { + $this->addUsingAlias(CcAccessPeer::TS, $ts['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcAccessPeer::TS, $ts, $comparison); + } + + /** + * Filter the query by a related CcSubjs object + * + * @param CcSubjs $ccSubjs the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcAccessQuery The current query, for fluid interface + */ + public function filterByCcSubjs($ccSubjs, $comparison = null) + { + return $this + ->addUsingAlias(CcAccessPeer::OWNER, $ccSubjs->getDbId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcSubjs relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcAccessQuery The current query, for fluid interface + */ + public function joinCcSubjs($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcSubjs'); + + // 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, 'CcSubjs'); + } + + return $this; + } + + /** + * Use the CcSubjs relation CcSubjs 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 CcSubjsQuery A secondary query class using the current class as primary query + */ + public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcSubjs($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); + } + + /** + * Exclude object from result + * + * @param CcAccess $ccAccess Object to remove from the list of results + * + * @return CcAccessQuery The current query, for fluid interface + */ + public function prune($ccAccess = null) + { + if ($ccAccess) { + $this->addUsingAlias(CcAccessPeer::ID, $ccAccess->getId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcAccessQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcBackup.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcBackup.php new file mode 100644 index 000000000..41be024bb --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcBackup.php @@ -0,0 +1,956 @@ +token; + } + + /** + * Get the [sessionid] column value. + * + * @return string + */ + public function getSessionid() + { + return $this->sessionid; + } + + /** + * Get the [status] column value. + * + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * Get the [optionally formatted] temporal [fromtime] 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 getFromtime($format = 'Y-m-d H:i:s') + { + if ($this->fromtime === null) { + return null; + } + + + + try { + $dt = new DateTime($this->fromtime); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->fromtime, 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); + } + } + + /** + * Get the [optionally formatted] temporal [totime] 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 getTotime($format = 'Y-m-d H:i:s') + { + if ($this->totime === null) { + return null; + } + + + + try { + $dt = new DateTime($this->totime); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->totime, 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); + } + } + + /** + * Set the value of [token] column. + * + * @param string $v new value + * @return CcBackup The current object (for fluent API support) + */ + public function setToken($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->token !== $v) { + $this->token = $v; + $this->modifiedColumns[] = CcBackupPeer::TOKEN; + } + + return $this; + } // setToken() + + /** + * Set the value of [sessionid] column. + * + * @param string $v new value + * @return CcBackup The current object (for fluent API support) + */ + public function setSessionid($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->sessionid !== $v) { + $this->sessionid = $v; + $this->modifiedColumns[] = CcBackupPeer::SESSIONID; + } + + return $this; + } // setSessionid() + + /** + * Set the value of [status] column. + * + * @param string $v new value + * @return CcBackup The current object (for fluent API support) + */ + public function setStatus($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->status !== $v) { + $this->status = $v; + $this->modifiedColumns[] = CcBackupPeer::STATUS; + } + + return $this; + } // setStatus() + + /** + * Sets the value of [fromtime] 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 CcBackup The current object (for fluent API support) + */ + public function setFromtime($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->fromtime !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->fromtime !== null && $tmpDt = new DateTime($this->fromtime)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->fromtime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); + $this->modifiedColumns[] = CcBackupPeer::FROMTIME; + } + } // if either are not null + + return $this; + } // setFromtime() + + /** + * Sets the value of [totime] 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 CcBackup The current object (for fluent API support) + */ + public function setTotime($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->totime !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->totime !== null && $tmpDt = new DateTime($this->totime)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->totime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); + $this->modifiedColumns[] = CcBackupPeer::TOTIME; + } + } // if either are not null + + return $this; + } // setTotime() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->token = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null; + $this->sessionid = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->status = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->fromtime = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->totime = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 5; // 5 = CcBackupPeer::NUM_COLUMNS - CcBackupPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcBackup object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcBackupPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcBackupQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcBackupPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows = 1; + $this->setNew(false); + } else { + $affectedRows = CcBackupPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = CcBackupPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcBackupPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getToken(); + break; + case 1: + return $this->getSessionid(); + break; + case 2: + return $this->getStatus(); + break; + case 3: + return $this->getFromtime(); + break; + case 4: + return $this->getTotime(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = CcBackupPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getToken(), + $keys[1] => $this->getSessionid(), + $keys[2] => $this->getStatus(), + $keys[3] => $this->getFromtime(), + $keys[4] => $this->getTotime(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcBackupPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setToken($value); + break; + case 1: + $this->setSessionid($value); + break; + case 2: + $this->setStatus($value); + break; + case 3: + $this->setFromtime($value); + break; + case 4: + $this->setTotime($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcBackupPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setToken($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setSessionid($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setStatus($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setFromtime($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setTotime($arr[$keys[4]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcBackupPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcBackupPeer::TOKEN)) $criteria->add(CcBackupPeer::TOKEN, $this->token); + if ($this->isColumnModified(CcBackupPeer::SESSIONID)) $criteria->add(CcBackupPeer::SESSIONID, $this->sessionid); + if ($this->isColumnModified(CcBackupPeer::STATUS)) $criteria->add(CcBackupPeer::STATUS, $this->status); + if ($this->isColumnModified(CcBackupPeer::FROMTIME)) $criteria->add(CcBackupPeer::FROMTIME, $this->fromtime); + if ($this->isColumnModified(CcBackupPeer::TOTIME)) $criteria->add(CcBackupPeer::TOTIME, $this->totime); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcBackupPeer::DATABASE_NAME); + $criteria->add(CcBackupPeer::TOKEN, $this->token); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return string + */ + public function getPrimaryKey() + { + return $this->getToken(); + } + + /** + * Generic method to set the primary key (token column). + * + * @param string $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setToken($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getToken(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcBackup (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setToken($this->token); + $copyObj->setSessionid($this->sessionid); + $copyObj->setStatus($this->status); + $copyObj->setFromtime($this->fromtime); + $copyObj->setTotime($this->totime); + + $copyObj->setNew(true); + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcBackup Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcBackupPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcBackupPeer(); + } + return self::$peer; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->token = null; + $this->sessionid = null; + $this->status = null; + $this->fromtime = null; + $this->totime = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcBackup diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcBackupPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcBackupPeer.php new file mode 100644 index 000000000..304acc302 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcBackupPeer.php @@ -0,0 +1,750 @@ + array ('Token', 'Sessionid', 'Status', 'Fromtime', 'Totime', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('token', 'sessionid', 'status', 'fromtime', 'totime', ), + BasePeer::TYPE_COLNAME => array (self::TOKEN, self::SESSIONID, self::STATUS, self::FROMTIME, self::TOTIME, ), + BasePeer::TYPE_RAW_COLNAME => array ('TOKEN', 'SESSIONID', 'STATUS', 'FROMTIME', 'TOTIME', ), + BasePeer::TYPE_FIELDNAME => array ('token', 'sessionid', 'status', 'fromtime', 'totime', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('Token' => 0, 'Sessionid' => 1, 'Status' => 2, 'Fromtime' => 3, 'Totime' => 4, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('token' => 0, 'sessionid' => 1, 'status' => 2, 'fromtime' => 3, 'totime' => 4, ), + BasePeer::TYPE_COLNAME => array (self::TOKEN => 0, self::SESSIONID => 1, self::STATUS => 2, self::FROMTIME => 3, self::TOTIME => 4, ), + BasePeer::TYPE_RAW_COLNAME => array ('TOKEN' => 0, 'SESSIONID' => 1, 'STATUS' => 2, 'FROMTIME' => 3, 'TOTIME' => 4, ), + BasePeer::TYPE_FIELDNAME => array ('token' => 0, 'sessionid' => 1, 'status' => 2, 'fromtime' => 3, 'totime' => 4, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcBackupPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcBackupPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcBackupPeer::TOKEN); + $criteria->addSelectColumn(CcBackupPeer::SESSIONID); + $criteria->addSelectColumn(CcBackupPeer::STATUS); + $criteria->addSelectColumn(CcBackupPeer::FROMTIME); + $criteria->addSelectColumn(CcBackupPeer::TOTIME); + } else { + $criteria->addSelectColumn($alias . '.TOKEN'); + $criteria->addSelectColumn($alias . '.SESSIONID'); + $criteria->addSelectColumn($alias . '.STATUS'); + $criteria->addSelectColumn($alias . '.FROMTIME'); + $criteria->addSelectColumn($alias . '.TOTIME'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcBackupPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcBackupPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcBackup + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcBackupPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcBackupPeer::populateObjects(CcBackupPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcBackupPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcBackup $value A CcBackup object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcBackup $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getToken(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcBackup object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcBackup) { + $key = (string) $value->getToken(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcBackup object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcBackup Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_backup + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (string) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcBackupPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcBackupPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcBackupPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcBackupPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcBackup object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcBackupPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcBackupPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcBackupPeer::NUM_COLUMNS; + } else { + $cls = CcBackupPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcBackupPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcBackupPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcBackupPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcBackupTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcBackupPeer::CLASS_DEFAULT : CcBackupPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcBackup or Criteria object. + * + * @param mixed $values Criteria or CcBackup object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcBackup object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcBackup or Criteria object. + * + * @param mixed $values Criteria or CcBackup object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcBackupPeer::TOKEN); + $value = $criteria->remove(CcBackupPeer::TOKEN); + if ($value) { + $selectCriteria->add(CcBackupPeer::TOKEN, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcBackupPeer::TABLE_NAME); + } + + } else { // $values is CcBackup object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_backup table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcBackupPeer::TABLE_NAME, $con, CcBackupPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcBackupPeer::clearInstancePool(); + CcBackupPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcBackup or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcBackup object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcBackupPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcBackup) { // it's a model object + // invalidate the cache for this single object + CcBackupPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcBackupPeer::TOKEN, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcBackupPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcBackupPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcBackup object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcBackup $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcBackup $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcBackupPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcBackupPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcBackupPeer::DATABASE_NAME, CcBackupPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param string $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcBackup + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcBackupPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcBackupPeer::DATABASE_NAME); + $criteria->add(CcBackupPeer::TOKEN, $pk); + + $v = CcBackupPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcBackupPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcBackupPeer::DATABASE_NAME); + $criteria->add(CcBackupPeer::TOKEN, $pks, Criteria::IN); + $objs = CcBackupPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcBackupPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcBackupPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcBackupQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcBackupQuery.php new file mode 100644 index 000000000..2e80333fb --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcBackupQuery.php @@ -0,0 +1,292 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcBackup|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcBackupPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcBackupQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcBackupPeer::TOKEN, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcBackupQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcBackupPeer::TOKEN, $keys, Criteria::IN); + } + + /** + * Filter the query on the token column + * + * @param string $token The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcBackupQuery The current query, for fluid interface + */ + public function filterByToken($token = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($token)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $token)) { + $token = str_replace('*', '%', $token); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcBackupPeer::TOKEN, $token, $comparison); + } + + /** + * Filter the query on the sessionid column + * + * @param string $sessionid The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcBackupQuery The current query, for fluid interface + */ + public function filterBySessionid($sessionid = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($sessionid)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $sessionid)) { + $sessionid = str_replace('*', '%', $sessionid); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcBackupPeer::SESSIONID, $sessionid, $comparison); + } + + /** + * Filter the query on the status column + * + * @param string $status The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcBackupQuery The current query, for fluid interface + */ + public function filterByStatus($status = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($status)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $status)) { + $status = str_replace('*', '%', $status); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcBackupPeer::STATUS, $status, $comparison); + } + + /** + * Filter the query on the fromtime column + * + * @param string|array $fromtime 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 CcBackupQuery The current query, for fluid interface + */ + public function filterByFromtime($fromtime = null, $comparison = null) + { + if (is_array($fromtime)) { + $useMinMax = false; + if (isset($fromtime['min'])) { + $this->addUsingAlias(CcBackupPeer::FROMTIME, $fromtime['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($fromtime['max'])) { + $this->addUsingAlias(CcBackupPeer::FROMTIME, $fromtime['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcBackupPeer::FROMTIME, $fromtime, $comparison); + } + + /** + * Filter the query on the totime column + * + * @param string|array $totime 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 CcBackupQuery The current query, for fluid interface + */ + public function filterByTotime($totime = null, $comparison = null) + { + if (is_array($totime)) { + $useMinMax = false; + if (isset($totime['min'])) { + $this->addUsingAlias(CcBackupPeer::TOTIME, $totime['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($totime['max'])) { + $this->addUsingAlias(CcBackupPeer::TOTIME, $totime['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcBackupPeer::TOTIME, $totime, $comparison); + } + + /** + * Exclude object from result + * + * @param CcBackup $ccBackup Object to remove from the list of results + * + * @return CcBackupQuery The current query, for fluid interface + */ + public function prune($ccBackup = null) + { + if ($ccBackup) { + $this->addUsingAlias(CcBackupPeer::TOKEN, $ccBackup->getToken(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcBackupQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcCountry.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcCountry.php new file mode 100644 index 000000000..3f92c5493 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcCountry.php @@ -0,0 +1,708 @@ +isocode; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getDbName() + { + return $this->name; + } + + /** + * Set the value of [isocode] column. + * + * @param string $v new value + * @return CcCountry The current object (for fluent API support) + */ + public function setDbIsoCode($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->isocode !== $v) { + $this->isocode = $v; + $this->modifiedColumns[] = CcCountryPeer::ISOCODE; + } + + return $this; + } // setDbIsoCode() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return CcCountry The current object (for fluent API support) + */ + public function setDbName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = CcCountryPeer::NAME; + } + + return $this; + } // setDbName() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->isocode = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null; + $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 2; // 2 = CcCountryPeer::NUM_COLUMNS - CcCountryPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcCountry object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcCountryPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcCountryQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcCountryPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows = 1; + $this->setNew(false); + } else { + $affectedRows = CcCountryPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = CcCountryPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcCountryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getDbIsoCode(); + break; + case 1: + return $this->getDbName(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = CcCountryPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbIsoCode(), + $keys[1] => $this->getDbName(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcCountryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setDbIsoCode($value); + break; + case 1: + $this->setDbName($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcCountryPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbIsoCode($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbName($arr[$keys[1]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcCountryPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcCountryPeer::ISOCODE)) $criteria->add(CcCountryPeer::ISOCODE, $this->isocode); + if ($this->isColumnModified(CcCountryPeer::NAME)) $criteria->add(CcCountryPeer::NAME, $this->name); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcCountryPeer::DATABASE_NAME); + $criteria->add(CcCountryPeer::ISOCODE, $this->isocode); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return string + */ + public function getPrimaryKey() + { + return $this->getDbIsoCode(); + } + + /** + * Generic method to set the primary key (isocode column). + * + * @param string $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbIsoCode($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getDbIsoCode(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcCountry (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setDbIsoCode($this->isocode); + $copyObj->setDbName($this->name); + + $copyObj->setNew(true); + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcCountry Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcCountryPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcCountryPeer(); + } + return self::$peer; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->isocode = null; + $this->name = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcCountry diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcCountryPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcCountryPeer.php new file mode 100644 index 000000000..ee16e55bf --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcCountryPeer.php @@ -0,0 +1,735 @@ + array ('DbIsoCode', 'DbName', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbIsoCode', 'dbName', ), + BasePeer::TYPE_COLNAME => array (self::ISOCODE, self::NAME, ), + BasePeer::TYPE_RAW_COLNAME => array ('ISOCODE', 'NAME', ), + BasePeer::TYPE_FIELDNAME => array ('isocode', 'name', ), + BasePeer::TYPE_NUM => array (0, 1, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbIsoCode' => 0, 'DbName' => 1, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbIsoCode' => 0, 'dbName' => 1, ), + BasePeer::TYPE_COLNAME => array (self::ISOCODE => 0, self::NAME => 1, ), + BasePeer::TYPE_RAW_COLNAME => array ('ISOCODE' => 0, 'NAME' => 1, ), + BasePeer::TYPE_FIELDNAME => array ('isocode' => 0, 'name' => 1, ), + BasePeer::TYPE_NUM => array (0, 1, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcCountryPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcCountryPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcCountryPeer::ISOCODE); + $criteria->addSelectColumn(CcCountryPeer::NAME); + } else { + $criteria->addSelectColumn($alias . '.ISOCODE'); + $criteria->addSelectColumn($alias . '.NAME'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcCountryPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcCountryPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcCountry + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcCountryPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcCountryPeer::populateObjects(CcCountryPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcCountryPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcCountry $value A CcCountry object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcCountry $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbIsoCode(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcCountry object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcCountry) { + $key = (string) $value->getDbIsoCode(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcCountry object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcCountry Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_country + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (string) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcCountryPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcCountryPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcCountryPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcCountryPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcCountry object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcCountryPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcCountryPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcCountryPeer::NUM_COLUMNS; + } else { + $cls = CcCountryPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcCountryPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcCountryPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcCountryPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcCountryTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcCountryPeer::CLASS_DEFAULT : CcCountryPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcCountry or Criteria object. + * + * @param mixed $values Criteria or CcCountry object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcCountry object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcCountry or Criteria object. + * + * @param mixed $values Criteria or CcCountry object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcCountryPeer::ISOCODE); + $value = $criteria->remove(CcCountryPeer::ISOCODE); + if ($value) { + $selectCriteria->add(CcCountryPeer::ISOCODE, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcCountryPeer::TABLE_NAME); + } + + } else { // $values is CcCountry object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_country table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcCountryPeer::TABLE_NAME, $con, CcCountryPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcCountryPeer::clearInstancePool(); + CcCountryPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcCountry or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcCountry object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcCountryPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcCountry) { // it's a model object + // invalidate the cache for this single object + CcCountryPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcCountryPeer::ISOCODE, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcCountryPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcCountryPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcCountry object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcCountry $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcCountry $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcCountryPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcCountryPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcCountryPeer::DATABASE_NAME, CcCountryPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param string $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcCountry + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcCountryPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcCountryPeer::DATABASE_NAME); + $criteria->add(CcCountryPeer::ISOCODE, $pk); + + $v = CcCountryPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcCountryPeer::DATABASE_NAME); + $criteria->add(CcCountryPeer::ISOCODE, $pks, Criteria::IN); + $objs = CcCountryPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcCountryPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcCountryPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcCountryQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcCountryQuery.php new file mode 100644 index 000000000..4e634ea19 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcCountryQuery.php @@ -0,0 +1,196 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcCountry|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcCountryPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcCountryQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcCountryPeer::ISOCODE, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcCountryQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcCountryPeer::ISOCODE, $keys, Criteria::IN); + } + + /** + * Filter the query on the isocode column + * + * @param string $dbIsoCode The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcCountryQuery The current query, for fluid interface + */ + public function filterByDbIsoCode($dbIsoCode = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbIsoCode)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbIsoCode)) { + $dbIsoCode = str_replace('*', '%', $dbIsoCode); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcCountryPeer::ISOCODE, $dbIsoCode, $comparison); + } + + /** + * Filter the query on the name column + * + * @param string $dbName The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcCountryQuery The current query, for fluid interface + */ + public function filterByDbName($dbName = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbName)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbName)) { + $dbName = str_replace('*', '%', $dbName); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcCountryPeer::NAME, $dbName, $comparison); + } + + /** + * Exclude object from result + * + * @param CcCountry $ccCountry Object to remove from the list of results + * + * @return CcCountryQuery The current query, for fluid interface + */ + public function prune($ccCountry = null) + { + if ($ccCountry) { + $this->addUsingAlias(CcCountryPeer::ISOCODE, $ccCountry->getDbIsoCode(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcCountryQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcFiles.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcFiles.php new file mode 100644 index 000000000..0882018d1 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcFiles.php @@ -0,0 +1,4325 @@ +name = ''; + $this->mime = ''; + $this->ftype = ''; + $this->filepath = ''; + $this->state = 'empty'; + $this->currentlyaccessing = 0; + } + + /** + * Initializes internal state of BaseCcFiles object. + * @see applyDefaults() + */ + public function __construct() + { + parent::__construct(); + $this->applyDefaultValues(); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getDbId() + { + return $this->id; + } + + /** + * Get the [gunid] column value. + * + * @return string + */ + public function getDbGunid() + { + return $this->gunid; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getDbName() + { + return $this->name; + } + + /** + * Get the [mime] column value. + * + * @return string + */ + public function getDbMime() + { + return $this->mime; + } + + /** + * Get the [ftype] column value. + * + * @return string + */ + public function getDbFtype() + { + return $this->ftype; + } + + /** + * Get the [directory] column value. + * + * @return int + */ + public function getDbDirectory() + { + return $this->directory; + } + + /** + * Get the [filepath] column value. + * + * @return string + */ + public function getDbFilepath() + { + return $this->filepath; + } + + /** + * Get the [state] column value. + * + * @return string + */ + public function getDbState() + { + return $this->state; + } + + /** + * Get the [currentlyaccessing] column value. + * + * @return int + */ + public function getDbCurrentlyaccessing() + { + return $this->currentlyaccessing; + } + + /** + * Get the [editedby] column value. + * + * @return int + */ + public function getDbEditedby() + { + return $this->editedby; + } + + /** + * Get the [optionally formatted] temporal [mtime] 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 getDbMtime($format = 'Y-m-d H:i:s') + { + if ($this->mtime === null) { + return null; + } + + + + try { + $dt = new DateTime($this->mtime); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->mtime, 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); + } + } + + /** + * Get the [md5] column value. + * + * @return string + */ + public function getDbMd5() + { + return $this->md5; + } + + /** + * Get the [track_title] column value. + * + * @return string + */ + public function getDbTrackTitle() + { + return $this->track_title; + } + + /** + * Get the [artist_name] column value. + * + * @return string + */ + public function getDbArtistName() + { + return $this->artist_name; + } + + /** + * Get the [bit_rate] column value. + * + * @return string + */ + public function getDbBitRate() + { + return $this->bit_rate; + } + + /** + * Get the [sample_rate] column value. + * + * @return string + */ + public function getDbSampleRate() + { + return $this->sample_rate; + } + + /** + * Get the [format] column value. + * + * @return string + */ + public function getDbFormat() + { + return $this->format; + } + + /** + * Get the [optionally formatted] temporal [length] 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 getDbLength($format = '%X') + { + if ($this->length === null) { + return null; + } + + + + try { + $dt = new DateTime($this->length); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->length, 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); + } + } + + /** + * Get the [album_title] column value. + * + * @return string + */ + public function getDbAlbumTitle() + { + return $this->album_title; + } + + /** + * Get the [genre] column value. + * + * @return string + */ + public function getDbGenre() + { + return $this->genre; + } + + /** + * Get the [comments] column value. + * + * @return string + */ + public function getDbComments() + { + return $this->comments; + } + + /** + * Get the [year] column value. + * + * @return string + */ + public function getDbYear() + { + return $this->year; + } + + /** + * Get the [track_number] column value. + * + * @return int + */ + public function getDbTrackNumber() + { + return $this->track_number; + } + + /** + * Get the [channels] column value. + * + * @return int + */ + public function getDbChannels() + { + return $this->channels; + } + + /** + * Get the [url] column value. + * + * @return string + */ + public function getDbUrl() + { + return $this->url; + } + + /** + * Get the [bpm] column value. + * + * @return string + */ + public function getDbBpm() + { + return $this->bpm; + } + + /** + * Get the [rating] column value. + * + * @return string + */ + public function getDbRating() + { + return $this->rating; + } + + /** + * Get the [encoded_by] column value. + * + * @return string + */ + public function getDbEncodedBy() + { + return $this->encoded_by; + } + + /** + * Get the [disc_number] column value. + * + * @return string + */ + public function getDbDiscNumber() + { + return $this->disc_number; + } + + /** + * Get the [mood] column value. + * + * @return string + */ + public function getDbMood() + { + return $this->mood; + } + + /** + * Get the [label] column value. + * + * @return string + */ + public function getDbLabel() + { + return $this->label; + } + + /** + * Get the [composer] column value. + * + * @return string + */ + public function getDbComposer() + { + return $this->composer; + } + + /** + * Get the [encoder] column value. + * + * @return string + */ + public function getDbEncoder() + { + return $this->encoder; + } + + /** + * Get the [checksum] column value. + * + * @return string + */ + public function getDbChecksum() + { + return $this->checksum; + } + + /** + * Get the [lyrics] column value. + * + * @return string + */ + public function getDbLyrics() + { + return $this->lyrics; + } + + /** + * Get the [orchestra] column value. + * + * @return string + */ + public function getDbOrchestra() + { + return $this->orchestra; + } + + /** + * Get the [conductor] column value. + * + * @return string + */ + public function getDbConductor() + { + return $this->conductor; + } + + /** + * Get the [lyricist] column value. + * + * @return string + */ + public function getDbLyricist() + { + return $this->lyricist; + } + + /** + * Get the [original_lyricist] column value. + * + * @return string + */ + public function getDbOriginalLyricist() + { + return $this->original_lyricist; + } + + /** + * Get the [radio_station_name] column value. + * + * @return string + */ + public function getDbRadioStationName() + { + return $this->radio_station_name; + } + + /** + * Get the [info_url] column value. + * + * @return string + */ + public function getDbInfoUrl() + { + return $this->info_url; + } + + /** + * Get the [artist_url] column value. + * + * @return string + */ + public function getDbArtistUrl() + { + return $this->artist_url; + } + + /** + * Get the [audio_source_url] column value. + * + * @return string + */ + public function getDbAudioSourceUrl() + { + return $this->audio_source_url; + } + + /** + * Get the [radio_station_url] column value. + * + * @return string + */ + public function getDbRadioStationUrl() + { + return $this->radio_station_url; + } + + /** + * Get the [buy_this_url] column value. + * + * @return string + */ + public function getDbBuyThisUrl() + { + return $this->buy_this_url; + } + + /** + * Get the [isrc_number] column value. + * + * @return string + */ + public function getDbIsrcNumber() + { + return $this->isrc_number; + } + + /** + * Get the [catalog_number] column value. + * + * @return string + */ + public function getDbCatalogNumber() + { + return $this->catalog_number; + } + + /** + * Get the [original_artist] column value. + * + * @return string + */ + public function getDbOriginalArtist() + { + return $this->original_artist; + } + + /** + * Get the [copyright] column value. + * + * @return string + */ + public function getDbCopyright() + { + return $this->copyright; + } + + /** + * Get the [report_datetime] column value. + * + * @return string + */ + public function getDbReportDatetime() + { + return $this->report_datetime; + } + + /** + * Get the [report_location] column value. + * + * @return string + */ + public function getDbReportLocation() + { + return $this->report_location; + } + + /** + * Get the [report_organization] column value. + * + * @return string + */ + public function getDbReportOrganization() + { + return $this->report_organization; + } + + /** + * Get the [subject] column value. + * + * @return string + */ + public function getDbSubject() + { + return $this->subject; + } + + /** + * Get the [contributor] column value. + * + * @return string + */ + public function getDbContributor() + { + return $this->contributor; + } + + /** + * Get the [language] column value. + * + * @return string + */ + public function getDbLanguage() + { + return $this->language; + } + + /** + * Get the [soundcloud_id] column value. + * + * @return int + */ + public function getDbSoundcloudId() + { + return $this->soundcloud_id; + } + + /** + * Get the [soundcloud_error_code] column value. + * + * @return int + */ + public function getDbSoundcloudErrorCode() + { + return $this->soundcloud_error_code; + } + + /** + * Get the [soundcloud_error_msg] column value. + * + * @return string + */ + public function getDbSoundcloudErrorMsg() + { + return $this->soundcloud_error_msg; + } + + /** + * Get the [soundcloud_link_to_file] column value. + * + * @return string + */ + public function getDbSoundcloudLinkToFile() + { + return $this->soundcloud_link_to_file; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CcFilesPeer::ID; + } + + return $this; + } // setDbId() + + /** + * Set the value of [gunid] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbGunid($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->gunid !== $v) { + $this->gunid = $v; + $this->modifiedColumns[] = CcFilesPeer::GUNID; + } + + return $this; + } // setDbGunid() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v || $this->isNew()) { + $this->name = $v; + $this->modifiedColumns[] = CcFilesPeer::NAME; + } + + return $this; + } // setDbName() + + /** + * Set the value of [mime] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbMime($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->mime !== $v || $this->isNew()) { + $this->mime = $v; + $this->modifiedColumns[] = CcFilesPeer::MIME; + } + + return $this; + } // setDbMime() + + /** + * Set the value of [ftype] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbFtype($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->ftype !== $v || $this->isNew()) { + $this->ftype = $v; + $this->modifiedColumns[] = CcFilesPeer::FTYPE; + } + + return $this; + } // setDbFtype() + + /** + * Set the value of [directory] column. + * + * @param int $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbDirectory($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->directory !== $v) { + $this->directory = $v; + $this->modifiedColumns[] = CcFilesPeer::DIRECTORY; + } + + if ($this->aCcMusicDirs !== null && $this->aCcMusicDirs->getId() !== $v) { + $this->aCcMusicDirs = null; + } + + return $this; + } // setDbDirectory() + + /** + * Set the value of [filepath] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbFilepath($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->filepath !== $v || $this->isNew()) { + $this->filepath = $v; + $this->modifiedColumns[] = CcFilesPeer::FILEPATH; + } + + return $this; + } // setDbFilepath() + + /** + * Set the value of [state] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbState($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->state !== $v || $this->isNew()) { + $this->state = $v; + $this->modifiedColumns[] = CcFilesPeer::STATE; + } + + return $this; + } // setDbState() + + /** + * Set the value of [currentlyaccessing] column. + * + * @param int $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbCurrentlyaccessing($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->currentlyaccessing !== $v || $this->isNew()) { + $this->currentlyaccessing = $v; + $this->modifiedColumns[] = CcFilesPeer::CURRENTLYACCESSING; + } + + return $this; + } // setDbCurrentlyaccessing() + + /** + * Set the value of [editedby] column. + * + * @param int $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbEditedby($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->editedby !== $v) { + $this->editedby = $v; + $this->modifiedColumns[] = CcFilesPeer::EDITEDBY; + } + + if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) { + $this->aCcSubjs = null; + } + + return $this; + } // setDbEditedby() + + /** + * Sets the value of [mtime] 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 CcFiles The current object (for fluent API support) + */ + public function setDbMtime($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->mtime !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->mtime !== null && $tmpDt = new DateTime($this->mtime)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->mtime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); + $this->modifiedColumns[] = CcFilesPeer::MTIME; + } + } // if either are not null + + return $this; + } // setDbMtime() + + /** + * Set the value of [md5] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbMd5($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->md5 !== $v) { + $this->md5 = $v; + $this->modifiedColumns[] = CcFilesPeer::MD5; + } + + return $this; + } // setDbMd5() + + /** + * Set the value of [track_title] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbTrackTitle($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->track_title !== $v) { + $this->track_title = $v; + $this->modifiedColumns[] = CcFilesPeer::TRACK_TITLE; + } + + return $this; + } // setDbTrackTitle() + + /** + * Set the value of [artist_name] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbArtistName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->artist_name !== $v) { + $this->artist_name = $v; + $this->modifiedColumns[] = CcFilesPeer::ARTIST_NAME; + } + + return $this; + } // setDbArtistName() + + /** + * Set the value of [bit_rate] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbBitRate($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->bit_rate !== $v) { + $this->bit_rate = $v; + $this->modifiedColumns[] = CcFilesPeer::BIT_RATE; + } + + return $this; + } // setDbBitRate() + + /** + * Set the value of [sample_rate] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbSampleRate($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->sample_rate !== $v) { + $this->sample_rate = $v; + $this->modifiedColumns[] = CcFilesPeer::SAMPLE_RATE; + } + + return $this; + } // setDbSampleRate() + + /** + * Set the value of [format] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbFormat($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->format !== $v) { + $this->format = $v; + $this->modifiedColumns[] = CcFilesPeer::FORMAT; + } + + return $this; + } // setDbFormat() + + /** + * Sets the value of [length] 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 CcFiles The current object (for fluent API support) + */ + public function setDbLength($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->length !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->length !== null && $tmpDt = new DateTime($this->length)) ? $tmpDt->format('H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->length = ($dt ? $dt->format('H:i:s') : null); + $this->modifiedColumns[] = CcFilesPeer::LENGTH; + } + } // if either are not null + + return $this; + } // setDbLength() + + /** + * Set the value of [album_title] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbAlbumTitle($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->album_title !== $v) { + $this->album_title = $v; + $this->modifiedColumns[] = CcFilesPeer::ALBUM_TITLE; + } + + return $this; + } // setDbAlbumTitle() + + /** + * Set the value of [genre] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbGenre($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->genre !== $v) { + $this->genre = $v; + $this->modifiedColumns[] = CcFilesPeer::GENRE; + } + + return $this; + } // setDbGenre() + + /** + * Set the value of [comments] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbComments($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->comments !== $v) { + $this->comments = $v; + $this->modifiedColumns[] = CcFilesPeer::COMMENTS; + } + + return $this; + } // setDbComments() + + /** + * Set the value of [year] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbYear($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->year !== $v) { + $this->year = $v; + $this->modifiedColumns[] = CcFilesPeer::YEAR; + } + + return $this; + } // setDbYear() + + /** + * Set the value of [track_number] column. + * + * @param int $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbTrackNumber($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->track_number !== $v) { + $this->track_number = $v; + $this->modifiedColumns[] = CcFilesPeer::TRACK_NUMBER; + } + + return $this; + } // setDbTrackNumber() + + /** + * Set the value of [channels] column. + * + * @param int $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbChannels($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->channels !== $v) { + $this->channels = $v; + $this->modifiedColumns[] = CcFilesPeer::CHANNELS; + } + + return $this; + } // setDbChannels() + + /** + * Set the value of [url] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->url !== $v) { + $this->url = $v; + $this->modifiedColumns[] = CcFilesPeer::URL; + } + + return $this; + } // setDbUrl() + + /** + * Set the value of [bpm] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbBpm($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->bpm !== $v) { + $this->bpm = $v; + $this->modifiedColumns[] = CcFilesPeer::BPM; + } + + return $this; + } // setDbBpm() + + /** + * Set the value of [rating] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbRating($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->rating !== $v) { + $this->rating = $v; + $this->modifiedColumns[] = CcFilesPeer::RATING; + } + + return $this; + } // setDbRating() + + /** + * Set the value of [encoded_by] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbEncodedBy($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->encoded_by !== $v) { + $this->encoded_by = $v; + $this->modifiedColumns[] = CcFilesPeer::ENCODED_BY; + } + + return $this; + } // setDbEncodedBy() + + /** + * Set the value of [disc_number] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbDiscNumber($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->disc_number !== $v) { + $this->disc_number = $v; + $this->modifiedColumns[] = CcFilesPeer::DISC_NUMBER; + } + + return $this; + } // setDbDiscNumber() + + /** + * Set the value of [mood] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbMood($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->mood !== $v) { + $this->mood = $v; + $this->modifiedColumns[] = CcFilesPeer::MOOD; + } + + return $this; + } // setDbMood() + + /** + * Set the value of [label] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbLabel($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->label !== $v) { + $this->label = $v; + $this->modifiedColumns[] = CcFilesPeer::LABEL; + } + + return $this; + } // setDbLabel() + + /** + * Set the value of [composer] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbComposer($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->composer !== $v) { + $this->composer = $v; + $this->modifiedColumns[] = CcFilesPeer::COMPOSER; + } + + return $this; + } // setDbComposer() + + /** + * Set the value of [encoder] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbEncoder($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->encoder !== $v) { + $this->encoder = $v; + $this->modifiedColumns[] = CcFilesPeer::ENCODER; + } + + return $this; + } // setDbEncoder() + + /** + * Set the value of [checksum] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbChecksum($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->checksum !== $v) { + $this->checksum = $v; + $this->modifiedColumns[] = CcFilesPeer::CHECKSUM; + } + + return $this; + } // setDbChecksum() + + /** + * Set the value of [lyrics] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbLyrics($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->lyrics !== $v) { + $this->lyrics = $v; + $this->modifiedColumns[] = CcFilesPeer::LYRICS; + } + + return $this; + } // setDbLyrics() + + /** + * Set the value of [orchestra] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbOrchestra($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->orchestra !== $v) { + $this->orchestra = $v; + $this->modifiedColumns[] = CcFilesPeer::ORCHESTRA; + } + + return $this; + } // setDbOrchestra() + + /** + * Set the value of [conductor] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbConductor($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->conductor !== $v) { + $this->conductor = $v; + $this->modifiedColumns[] = CcFilesPeer::CONDUCTOR; + } + + return $this; + } // setDbConductor() + + /** + * Set the value of [lyricist] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbLyricist($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->lyricist !== $v) { + $this->lyricist = $v; + $this->modifiedColumns[] = CcFilesPeer::LYRICIST; + } + + return $this; + } // setDbLyricist() + + /** + * Set the value of [original_lyricist] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbOriginalLyricist($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->original_lyricist !== $v) { + $this->original_lyricist = $v; + $this->modifiedColumns[] = CcFilesPeer::ORIGINAL_LYRICIST; + } + + return $this; + } // setDbOriginalLyricist() + + /** + * Set the value of [radio_station_name] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbRadioStationName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->radio_station_name !== $v) { + $this->radio_station_name = $v; + $this->modifiedColumns[] = CcFilesPeer::RADIO_STATION_NAME; + } + + return $this; + } // setDbRadioStationName() + + /** + * Set the value of [info_url] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbInfoUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->info_url !== $v) { + $this->info_url = $v; + $this->modifiedColumns[] = CcFilesPeer::INFO_URL; + } + + return $this; + } // setDbInfoUrl() + + /** + * Set the value of [artist_url] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbArtistUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->artist_url !== $v) { + $this->artist_url = $v; + $this->modifiedColumns[] = CcFilesPeer::ARTIST_URL; + } + + return $this; + } // setDbArtistUrl() + + /** + * Set the value of [audio_source_url] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbAudioSourceUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->audio_source_url !== $v) { + $this->audio_source_url = $v; + $this->modifiedColumns[] = CcFilesPeer::AUDIO_SOURCE_URL; + } + + return $this; + } // setDbAudioSourceUrl() + + /** + * Set the value of [radio_station_url] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbRadioStationUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->radio_station_url !== $v) { + $this->radio_station_url = $v; + $this->modifiedColumns[] = CcFilesPeer::RADIO_STATION_URL; + } + + return $this; + } // setDbRadioStationUrl() + + /** + * Set the value of [buy_this_url] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbBuyThisUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->buy_this_url !== $v) { + $this->buy_this_url = $v; + $this->modifiedColumns[] = CcFilesPeer::BUY_THIS_URL; + } + + return $this; + } // setDbBuyThisUrl() + + /** + * Set the value of [isrc_number] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbIsrcNumber($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->isrc_number !== $v) { + $this->isrc_number = $v; + $this->modifiedColumns[] = CcFilesPeer::ISRC_NUMBER; + } + + return $this; + } // setDbIsrcNumber() + + /** + * Set the value of [catalog_number] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbCatalogNumber($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->catalog_number !== $v) { + $this->catalog_number = $v; + $this->modifiedColumns[] = CcFilesPeer::CATALOG_NUMBER; + } + + return $this; + } // setDbCatalogNumber() + + /** + * Set the value of [original_artist] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbOriginalArtist($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->original_artist !== $v) { + $this->original_artist = $v; + $this->modifiedColumns[] = CcFilesPeer::ORIGINAL_ARTIST; + } + + return $this; + } // setDbOriginalArtist() + + /** + * Set the value of [copyright] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbCopyright($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->copyright !== $v) { + $this->copyright = $v; + $this->modifiedColumns[] = CcFilesPeer::COPYRIGHT; + } + + return $this; + } // setDbCopyright() + + /** + * Set the value of [report_datetime] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbReportDatetime($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->report_datetime !== $v) { + $this->report_datetime = $v; + $this->modifiedColumns[] = CcFilesPeer::REPORT_DATETIME; + } + + return $this; + } // setDbReportDatetime() + + /** + * Set the value of [report_location] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbReportLocation($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->report_location !== $v) { + $this->report_location = $v; + $this->modifiedColumns[] = CcFilesPeer::REPORT_LOCATION; + } + + return $this; + } // setDbReportLocation() + + /** + * Set the value of [report_organization] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbReportOrganization($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->report_organization !== $v) { + $this->report_organization = $v; + $this->modifiedColumns[] = CcFilesPeer::REPORT_ORGANIZATION; + } + + return $this; + } // setDbReportOrganization() + + /** + * Set the value of [subject] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbSubject($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->subject !== $v) { + $this->subject = $v; + $this->modifiedColumns[] = CcFilesPeer::SUBJECT; + } + + return $this; + } // setDbSubject() + + /** + * Set the value of [contributor] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbContributor($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->contributor !== $v) { + $this->contributor = $v; + $this->modifiedColumns[] = CcFilesPeer::CONTRIBUTOR; + } + + return $this; + } // setDbContributor() + + /** + * Set the value of [language] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbLanguage($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->language !== $v) { + $this->language = $v; + $this->modifiedColumns[] = CcFilesPeer::LANGUAGE; + } + + return $this; + } // setDbLanguage() + + /** + * Set the value of [soundcloud_id] column. + * + * @param int $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbSoundcloudId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->soundcloud_id !== $v) { + $this->soundcloud_id = $v; + $this->modifiedColumns[] = CcFilesPeer::SOUNDCLOUD_ID; + } + + return $this; + } // setDbSoundcloudId() + + /** + * Set the value of [soundcloud_error_code] column. + * + * @param int $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbSoundcloudErrorCode($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->soundcloud_error_code !== $v) { + $this->soundcloud_error_code = $v; + $this->modifiedColumns[] = CcFilesPeer::SOUNDCLOUD_ERROR_CODE; + } + + return $this; + } // setDbSoundcloudErrorCode() + + /** + * Set the value of [soundcloud_error_msg] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbSoundcloudErrorMsg($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->soundcloud_error_msg !== $v) { + $this->soundcloud_error_msg = $v; + $this->modifiedColumns[] = CcFilesPeer::SOUNDCLOUD_ERROR_MSG; + } + + return $this; + } // setDbSoundcloudErrorMsg() + + /** + * Set the value of [soundcloud_link_to_file] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbSoundcloudLinkToFile($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->soundcloud_link_to_file !== $v) { + $this->soundcloud_link_to_file = $v; + $this->modifiedColumns[] = CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE; + } + + return $this; + } // setDbSoundcloudLinkToFile() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + if ($this->name !== '') { + return false; + } + + if ($this->mime !== '') { + return false; + } + + if ($this->ftype !== '') { + return false; + } + + if ($this->filepath !== '') { + return false; + } + + if ($this->state !== 'empty') { + return false; + } + + if ($this->currentlyaccessing !== 0) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->gunid = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->name = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->mime = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->ftype = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->directory = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null; + $this->filepath = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->state = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; + $this->currentlyaccessing = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null; + $this->editedby = ($row[$startcol + 9] !== null) ? (int) $row[$startcol + 9] : null; + $this->mtime = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; + $this->md5 = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; + $this->track_title = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null; + $this->artist_name = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null; + $this->bit_rate = ($row[$startcol + 14] !== null) ? (string) $row[$startcol + 14] : null; + $this->sample_rate = ($row[$startcol + 15] !== null) ? (string) $row[$startcol + 15] : null; + $this->format = ($row[$startcol + 16] !== null) ? (string) $row[$startcol + 16] : null; + $this->length = ($row[$startcol + 17] !== null) ? (string) $row[$startcol + 17] : null; + $this->album_title = ($row[$startcol + 18] !== null) ? (string) $row[$startcol + 18] : null; + $this->genre = ($row[$startcol + 19] !== null) ? (string) $row[$startcol + 19] : null; + $this->comments = ($row[$startcol + 20] !== null) ? (string) $row[$startcol + 20] : null; + $this->year = ($row[$startcol + 21] !== null) ? (string) $row[$startcol + 21] : null; + $this->track_number = ($row[$startcol + 22] !== null) ? (int) $row[$startcol + 22] : null; + $this->channels = ($row[$startcol + 23] !== null) ? (int) $row[$startcol + 23] : null; + $this->url = ($row[$startcol + 24] !== null) ? (string) $row[$startcol + 24] : null; + $this->bpm = ($row[$startcol + 25] !== null) ? (string) $row[$startcol + 25] : null; + $this->rating = ($row[$startcol + 26] !== null) ? (string) $row[$startcol + 26] : null; + $this->encoded_by = ($row[$startcol + 27] !== null) ? (string) $row[$startcol + 27] : null; + $this->disc_number = ($row[$startcol + 28] !== null) ? (string) $row[$startcol + 28] : null; + $this->mood = ($row[$startcol + 29] !== null) ? (string) $row[$startcol + 29] : null; + $this->label = ($row[$startcol + 30] !== null) ? (string) $row[$startcol + 30] : null; + $this->composer = ($row[$startcol + 31] !== null) ? (string) $row[$startcol + 31] : null; + $this->encoder = ($row[$startcol + 32] !== null) ? (string) $row[$startcol + 32] : null; + $this->checksum = ($row[$startcol + 33] !== null) ? (string) $row[$startcol + 33] : null; + $this->lyrics = ($row[$startcol + 34] !== null) ? (string) $row[$startcol + 34] : null; + $this->orchestra = ($row[$startcol + 35] !== null) ? (string) $row[$startcol + 35] : null; + $this->conductor = ($row[$startcol + 36] !== null) ? (string) $row[$startcol + 36] : null; + $this->lyricist = ($row[$startcol + 37] !== null) ? (string) $row[$startcol + 37] : null; + $this->original_lyricist = ($row[$startcol + 38] !== null) ? (string) $row[$startcol + 38] : null; + $this->radio_station_name = ($row[$startcol + 39] !== null) ? (string) $row[$startcol + 39] : null; + $this->info_url = ($row[$startcol + 40] !== null) ? (string) $row[$startcol + 40] : null; + $this->artist_url = ($row[$startcol + 41] !== null) ? (string) $row[$startcol + 41] : null; + $this->audio_source_url = ($row[$startcol + 42] !== null) ? (string) $row[$startcol + 42] : null; + $this->radio_station_url = ($row[$startcol + 43] !== null) ? (string) $row[$startcol + 43] : null; + $this->buy_this_url = ($row[$startcol + 44] !== null) ? (string) $row[$startcol + 44] : null; + $this->isrc_number = ($row[$startcol + 45] !== null) ? (string) $row[$startcol + 45] : null; + $this->catalog_number = ($row[$startcol + 46] !== null) ? (string) $row[$startcol + 46] : null; + $this->original_artist = ($row[$startcol + 47] !== null) ? (string) $row[$startcol + 47] : null; + $this->copyright = ($row[$startcol + 48] !== null) ? (string) $row[$startcol + 48] : null; + $this->report_datetime = ($row[$startcol + 49] !== null) ? (string) $row[$startcol + 49] : null; + $this->report_location = ($row[$startcol + 50] !== null) ? (string) $row[$startcol + 50] : null; + $this->report_organization = ($row[$startcol + 51] !== null) ? (string) $row[$startcol + 51] : null; + $this->subject = ($row[$startcol + 52] !== null) ? (string) $row[$startcol + 52] : null; + $this->contributor = ($row[$startcol + 53] !== null) ? (string) $row[$startcol + 53] : null; + $this->language = ($row[$startcol + 54] !== null) ? (string) $row[$startcol + 54] : null; + $this->soundcloud_id = ($row[$startcol + 55] !== null) ? (int) $row[$startcol + 55] : null; + $this->soundcloud_error_code = ($row[$startcol + 56] !== null) ? (int) $row[$startcol + 56] : null; + $this->soundcloud_error_msg = ($row[$startcol + 57] !== null) ? (string) $row[$startcol + 57] : null; + $this->soundcloud_link_to_file = ($row[$startcol + 58] !== null) ? (string) $row[$startcol + 58] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 59; // 59 = CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcFiles object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aCcMusicDirs !== null && $this->directory !== $this->aCcMusicDirs->getId()) { + $this->aCcMusicDirs = null; + } + if ($this->aCcSubjs !== null && $this->editedby !== $this->aCcSubjs->getDbId()) { + $this->aCcSubjs = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcFilesPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aCcSubjs = null; + $this->aCcMusicDirs = null; + $this->collCcShowInstancess = null; + + $this->collCcPlaylistcontentss = null; + + $this->collCcSchedules = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcFilesQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcFilesPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcSubjs !== null) { + if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { + $affectedRows += $this->aCcSubjs->save($con); + } + $this->setCcSubjs($this->aCcSubjs); + } + + if ($this->aCcMusicDirs !== null) { + if ($this->aCcMusicDirs->isModified() || $this->aCcMusicDirs->isNew()) { + $affectedRows += $this->aCcMusicDirs->save($con); + } + $this->setCcMusicDirs($this->aCcMusicDirs); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = CcFilesPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + if ($criteria->keyContainsValue(CcFilesPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcFilesPeer::ID.')'); + } + + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows += 1; + $this->setDbId($pk); //[IMV] update autoincrement primary key + $this->setNew(false); + } else { + $affectedRows += CcFilesPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collCcShowInstancess !== null) { + foreach ($this->collCcShowInstancess as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collCcPlaylistcontentss !== null) { + foreach ($this->collCcPlaylistcontentss as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collCcSchedules !== null) { + foreach ($this->collCcSchedules as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + // We call the validate method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcSubjs !== null) { + if (!$this->aCcSubjs->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures()); + } + } + + if ($this->aCcMusicDirs !== null) { + if (!$this->aCcMusicDirs->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcMusicDirs->getValidationFailures()); + } + } + + + if (($retval = CcFilesPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collCcShowInstancess !== null) { + foreach ($this->collCcShowInstancess as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collCcPlaylistcontentss !== null) { + foreach ($this->collCcPlaylistcontentss as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collCcSchedules !== null) { + foreach ($this->collCcSchedules as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcFilesPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getDbId(); + break; + case 1: + return $this->getDbGunid(); + break; + case 2: + return $this->getDbName(); + break; + case 3: + return $this->getDbMime(); + break; + case 4: + return $this->getDbFtype(); + break; + case 5: + return $this->getDbDirectory(); + break; + case 6: + return $this->getDbFilepath(); + break; + case 7: + return $this->getDbState(); + break; + case 8: + return $this->getDbCurrentlyaccessing(); + break; + case 9: + return $this->getDbEditedby(); + break; + case 10: + return $this->getDbMtime(); + break; + case 11: + return $this->getDbMd5(); + break; + case 12: + return $this->getDbTrackTitle(); + break; + case 13: + return $this->getDbArtistName(); + break; + case 14: + return $this->getDbBitRate(); + break; + case 15: + return $this->getDbSampleRate(); + break; + case 16: + return $this->getDbFormat(); + break; + case 17: + return $this->getDbLength(); + break; + case 18: + return $this->getDbAlbumTitle(); + break; + case 19: + return $this->getDbGenre(); + break; + case 20: + return $this->getDbComments(); + break; + case 21: + return $this->getDbYear(); + break; + case 22: + return $this->getDbTrackNumber(); + break; + case 23: + return $this->getDbChannels(); + break; + case 24: + return $this->getDbUrl(); + break; + case 25: + return $this->getDbBpm(); + break; + case 26: + return $this->getDbRating(); + break; + case 27: + return $this->getDbEncodedBy(); + break; + case 28: + return $this->getDbDiscNumber(); + break; + case 29: + return $this->getDbMood(); + break; + case 30: + return $this->getDbLabel(); + break; + case 31: + return $this->getDbComposer(); + break; + case 32: + return $this->getDbEncoder(); + break; + case 33: + return $this->getDbChecksum(); + break; + case 34: + return $this->getDbLyrics(); + break; + case 35: + return $this->getDbOrchestra(); + break; + case 36: + return $this->getDbConductor(); + break; + case 37: + return $this->getDbLyricist(); + break; + case 38: + return $this->getDbOriginalLyricist(); + break; + case 39: + return $this->getDbRadioStationName(); + break; + case 40: + return $this->getDbInfoUrl(); + break; + case 41: + return $this->getDbArtistUrl(); + break; + case 42: + return $this->getDbAudioSourceUrl(); + break; + case 43: + return $this->getDbRadioStationUrl(); + break; + case 44: + return $this->getDbBuyThisUrl(); + break; + case 45: + return $this->getDbIsrcNumber(); + break; + case 46: + return $this->getDbCatalogNumber(); + break; + case 47: + return $this->getDbOriginalArtist(); + break; + case 48: + return $this->getDbCopyright(); + break; + case 49: + return $this->getDbReportDatetime(); + break; + case 50: + return $this->getDbReportLocation(); + break; + case 51: + return $this->getDbReportOrganization(); + break; + case 52: + return $this->getDbSubject(); + break; + case 53: + return $this->getDbContributor(); + break; + case 54: + return $this->getDbLanguage(); + break; + case 55: + return $this->getDbSoundcloudId(); + break; + case 56: + return $this->getDbSoundcloudErrorCode(); + break; + case 57: + return $this->getDbSoundcloudErrorMsg(); + break; + case 58: + return $this->getDbSoundcloudLinkToFile(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) + { + $keys = CcFilesPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbId(), + $keys[1] => $this->getDbGunid(), + $keys[2] => $this->getDbName(), + $keys[3] => $this->getDbMime(), + $keys[4] => $this->getDbFtype(), + $keys[5] => $this->getDbDirectory(), + $keys[6] => $this->getDbFilepath(), + $keys[7] => $this->getDbState(), + $keys[8] => $this->getDbCurrentlyaccessing(), + $keys[9] => $this->getDbEditedby(), + $keys[10] => $this->getDbMtime(), + $keys[11] => $this->getDbMd5(), + $keys[12] => $this->getDbTrackTitle(), + $keys[13] => $this->getDbArtistName(), + $keys[14] => $this->getDbBitRate(), + $keys[15] => $this->getDbSampleRate(), + $keys[16] => $this->getDbFormat(), + $keys[17] => $this->getDbLength(), + $keys[18] => $this->getDbAlbumTitle(), + $keys[19] => $this->getDbGenre(), + $keys[20] => $this->getDbComments(), + $keys[21] => $this->getDbYear(), + $keys[22] => $this->getDbTrackNumber(), + $keys[23] => $this->getDbChannels(), + $keys[24] => $this->getDbUrl(), + $keys[25] => $this->getDbBpm(), + $keys[26] => $this->getDbRating(), + $keys[27] => $this->getDbEncodedBy(), + $keys[28] => $this->getDbDiscNumber(), + $keys[29] => $this->getDbMood(), + $keys[30] => $this->getDbLabel(), + $keys[31] => $this->getDbComposer(), + $keys[32] => $this->getDbEncoder(), + $keys[33] => $this->getDbChecksum(), + $keys[34] => $this->getDbLyrics(), + $keys[35] => $this->getDbOrchestra(), + $keys[36] => $this->getDbConductor(), + $keys[37] => $this->getDbLyricist(), + $keys[38] => $this->getDbOriginalLyricist(), + $keys[39] => $this->getDbRadioStationName(), + $keys[40] => $this->getDbInfoUrl(), + $keys[41] => $this->getDbArtistUrl(), + $keys[42] => $this->getDbAudioSourceUrl(), + $keys[43] => $this->getDbRadioStationUrl(), + $keys[44] => $this->getDbBuyThisUrl(), + $keys[45] => $this->getDbIsrcNumber(), + $keys[46] => $this->getDbCatalogNumber(), + $keys[47] => $this->getDbOriginalArtist(), + $keys[48] => $this->getDbCopyright(), + $keys[49] => $this->getDbReportDatetime(), + $keys[50] => $this->getDbReportLocation(), + $keys[51] => $this->getDbReportOrganization(), + $keys[52] => $this->getDbSubject(), + $keys[53] => $this->getDbContributor(), + $keys[54] => $this->getDbLanguage(), + $keys[55] => $this->getDbSoundcloudId(), + $keys[56] => $this->getDbSoundcloudErrorCode(), + $keys[57] => $this->getDbSoundcloudErrorMsg(), + $keys[58] => $this->getDbSoundcloudLinkToFile(), + ); + if ($includeForeignObjects) { + if (null !== $this->aCcSubjs) { + $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, true); + } + if (null !== $this->aCcMusicDirs) { + $result['CcMusicDirs'] = $this->aCcMusicDirs->toArray($keyType, $includeLazyLoadColumns, true); + } + } + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcFilesPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setDbId($value); + break; + case 1: + $this->setDbGunid($value); + break; + case 2: + $this->setDbName($value); + break; + case 3: + $this->setDbMime($value); + break; + case 4: + $this->setDbFtype($value); + break; + case 5: + $this->setDbDirectory($value); + break; + case 6: + $this->setDbFilepath($value); + break; + case 7: + $this->setDbState($value); + break; + case 8: + $this->setDbCurrentlyaccessing($value); + break; + case 9: + $this->setDbEditedby($value); + break; + case 10: + $this->setDbMtime($value); + break; + case 11: + $this->setDbMd5($value); + break; + case 12: + $this->setDbTrackTitle($value); + break; + case 13: + $this->setDbArtistName($value); + break; + case 14: + $this->setDbBitRate($value); + break; + case 15: + $this->setDbSampleRate($value); + break; + case 16: + $this->setDbFormat($value); + break; + case 17: + $this->setDbLength($value); + break; + case 18: + $this->setDbAlbumTitle($value); + break; + case 19: + $this->setDbGenre($value); + break; + case 20: + $this->setDbComments($value); + break; + case 21: + $this->setDbYear($value); + break; + case 22: + $this->setDbTrackNumber($value); + break; + case 23: + $this->setDbChannels($value); + break; + case 24: + $this->setDbUrl($value); + break; + case 25: + $this->setDbBpm($value); + break; + case 26: + $this->setDbRating($value); + break; + case 27: + $this->setDbEncodedBy($value); + break; + case 28: + $this->setDbDiscNumber($value); + break; + case 29: + $this->setDbMood($value); + break; + case 30: + $this->setDbLabel($value); + break; + case 31: + $this->setDbComposer($value); + break; + case 32: + $this->setDbEncoder($value); + break; + case 33: + $this->setDbChecksum($value); + break; + case 34: + $this->setDbLyrics($value); + break; + case 35: + $this->setDbOrchestra($value); + break; + case 36: + $this->setDbConductor($value); + break; + case 37: + $this->setDbLyricist($value); + break; + case 38: + $this->setDbOriginalLyricist($value); + break; + case 39: + $this->setDbRadioStationName($value); + break; + case 40: + $this->setDbInfoUrl($value); + break; + case 41: + $this->setDbArtistUrl($value); + break; + case 42: + $this->setDbAudioSourceUrl($value); + break; + case 43: + $this->setDbRadioStationUrl($value); + break; + case 44: + $this->setDbBuyThisUrl($value); + break; + case 45: + $this->setDbIsrcNumber($value); + break; + case 46: + $this->setDbCatalogNumber($value); + break; + case 47: + $this->setDbOriginalArtist($value); + break; + case 48: + $this->setDbCopyright($value); + break; + case 49: + $this->setDbReportDatetime($value); + break; + case 50: + $this->setDbReportLocation($value); + break; + case 51: + $this->setDbReportOrganization($value); + break; + case 52: + $this->setDbSubject($value); + break; + case 53: + $this->setDbContributor($value); + break; + case 54: + $this->setDbLanguage($value); + break; + case 55: + $this->setDbSoundcloudId($value); + break; + case 56: + $this->setDbSoundcloudErrorCode($value); + break; + case 57: + $this->setDbSoundcloudErrorMsg($value); + break; + case 58: + $this->setDbSoundcloudLinkToFile($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcFilesPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbGunid($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDbName($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDbMime($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setDbFtype($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setDbDirectory($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setDbFilepath($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setDbState($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setDbCurrentlyaccessing($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setDbEditedby($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setDbMtime($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setDbMd5($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setDbTrackTitle($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setDbArtistName($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setDbBitRate($arr[$keys[14]]); + if (array_key_exists($keys[15], $arr)) $this->setDbSampleRate($arr[$keys[15]]); + if (array_key_exists($keys[16], $arr)) $this->setDbFormat($arr[$keys[16]]); + if (array_key_exists($keys[17], $arr)) $this->setDbLength($arr[$keys[17]]); + if (array_key_exists($keys[18], $arr)) $this->setDbAlbumTitle($arr[$keys[18]]); + if (array_key_exists($keys[19], $arr)) $this->setDbGenre($arr[$keys[19]]); + if (array_key_exists($keys[20], $arr)) $this->setDbComments($arr[$keys[20]]); + if (array_key_exists($keys[21], $arr)) $this->setDbYear($arr[$keys[21]]); + if (array_key_exists($keys[22], $arr)) $this->setDbTrackNumber($arr[$keys[22]]); + if (array_key_exists($keys[23], $arr)) $this->setDbChannels($arr[$keys[23]]); + if (array_key_exists($keys[24], $arr)) $this->setDbUrl($arr[$keys[24]]); + if (array_key_exists($keys[25], $arr)) $this->setDbBpm($arr[$keys[25]]); + if (array_key_exists($keys[26], $arr)) $this->setDbRating($arr[$keys[26]]); + if (array_key_exists($keys[27], $arr)) $this->setDbEncodedBy($arr[$keys[27]]); + if (array_key_exists($keys[28], $arr)) $this->setDbDiscNumber($arr[$keys[28]]); + if (array_key_exists($keys[29], $arr)) $this->setDbMood($arr[$keys[29]]); + if (array_key_exists($keys[30], $arr)) $this->setDbLabel($arr[$keys[30]]); + if (array_key_exists($keys[31], $arr)) $this->setDbComposer($arr[$keys[31]]); + if (array_key_exists($keys[32], $arr)) $this->setDbEncoder($arr[$keys[32]]); + if (array_key_exists($keys[33], $arr)) $this->setDbChecksum($arr[$keys[33]]); + if (array_key_exists($keys[34], $arr)) $this->setDbLyrics($arr[$keys[34]]); + if (array_key_exists($keys[35], $arr)) $this->setDbOrchestra($arr[$keys[35]]); + if (array_key_exists($keys[36], $arr)) $this->setDbConductor($arr[$keys[36]]); + if (array_key_exists($keys[37], $arr)) $this->setDbLyricist($arr[$keys[37]]); + if (array_key_exists($keys[38], $arr)) $this->setDbOriginalLyricist($arr[$keys[38]]); + if (array_key_exists($keys[39], $arr)) $this->setDbRadioStationName($arr[$keys[39]]); + if (array_key_exists($keys[40], $arr)) $this->setDbInfoUrl($arr[$keys[40]]); + if (array_key_exists($keys[41], $arr)) $this->setDbArtistUrl($arr[$keys[41]]); + if (array_key_exists($keys[42], $arr)) $this->setDbAudioSourceUrl($arr[$keys[42]]); + if (array_key_exists($keys[43], $arr)) $this->setDbRadioStationUrl($arr[$keys[43]]); + if (array_key_exists($keys[44], $arr)) $this->setDbBuyThisUrl($arr[$keys[44]]); + if (array_key_exists($keys[45], $arr)) $this->setDbIsrcNumber($arr[$keys[45]]); + if (array_key_exists($keys[46], $arr)) $this->setDbCatalogNumber($arr[$keys[46]]); + if (array_key_exists($keys[47], $arr)) $this->setDbOriginalArtist($arr[$keys[47]]); + if (array_key_exists($keys[48], $arr)) $this->setDbCopyright($arr[$keys[48]]); + if (array_key_exists($keys[49], $arr)) $this->setDbReportDatetime($arr[$keys[49]]); + if (array_key_exists($keys[50], $arr)) $this->setDbReportLocation($arr[$keys[50]]); + if (array_key_exists($keys[51], $arr)) $this->setDbReportOrganization($arr[$keys[51]]); + if (array_key_exists($keys[52], $arr)) $this->setDbSubject($arr[$keys[52]]); + if (array_key_exists($keys[53], $arr)) $this->setDbContributor($arr[$keys[53]]); + if (array_key_exists($keys[54], $arr)) $this->setDbLanguage($arr[$keys[54]]); + if (array_key_exists($keys[55], $arr)) $this->setDbSoundcloudId($arr[$keys[55]]); + if (array_key_exists($keys[56], $arr)) $this->setDbSoundcloudErrorCode($arr[$keys[56]]); + if (array_key_exists($keys[57], $arr)) $this->setDbSoundcloudErrorMsg($arr[$keys[57]]); + if (array_key_exists($keys[58], $arr)) $this->setDbSoundcloudLinkToFile($arr[$keys[58]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcFilesPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcFilesPeer::ID)) $criteria->add(CcFilesPeer::ID, $this->id); + if ($this->isColumnModified(CcFilesPeer::GUNID)) $criteria->add(CcFilesPeer::GUNID, $this->gunid); + if ($this->isColumnModified(CcFilesPeer::NAME)) $criteria->add(CcFilesPeer::NAME, $this->name); + if ($this->isColumnModified(CcFilesPeer::MIME)) $criteria->add(CcFilesPeer::MIME, $this->mime); + if ($this->isColumnModified(CcFilesPeer::FTYPE)) $criteria->add(CcFilesPeer::FTYPE, $this->ftype); + if ($this->isColumnModified(CcFilesPeer::DIRECTORY)) $criteria->add(CcFilesPeer::DIRECTORY, $this->directory); + if ($this->isColumnModified(CcFilesPeer::FILEPATH)) $criteria->add(CcFilesPeer::FILEPATH, $this->filepath); + if ($this->isColumnModified(CcFilesPeer::STATE)) $criteria->add(CcFilesPeer::STATE, $this->state); + if ($this->isColumnModified(CcFilesPeer::CURRENTLYACCESSING)) $criteria->add(CcFilesPeer::CURRENTLYACCESSING, $this->currentlyaccessing); + if ($this->isColumnModified(CcFilesPeer::EDITEDBY)) $criteria->add(CcFilesPeer::EDITEDBY, $this->editedby); + if ($this->isColumnModified(CcFilesPeer::MTIME)) $criteria->add(CcFilesPeer::MTIME, $this->mtime); + if ($this->isColumnModified(CcFilesPeer::MD5)) $criteria->add(CcFilesPeer::MD5, $this->md5); + if ($this->isColumnModified(CcFilesPeer::TRACK_TITLE)) $criteria->add(CcFilesPeer::TRACK_TITLE, $this->track_title); + if ($this->isColumnModified(CcFilesPeer::ARTIST_NAME)) $criteria->add(CcFilesPeer::ARTIST_NAME, $this->artist_name); + if ($this->isColumnModified(CcFilesPeer::BIT_RATE)) $criteria->add(CcFilesPeer::BIT_RATE, $this->bit_rate); + if ($this->isColumnModified(CcFilesPeer::SAMPLE_RATE)) $criteria->add(CcFilesPeer::SAMPLE_RATE, $this->sample_rate); + if ($this->isColumnModified(CcFilesPeer::FORMAT)) $criteria->add(CcFilesPeer::FORMAT, $this->format); + if ($this->isColumnModified(CcFilesPeer::LENGTH)) $criteria->add(CcFilesPeer::LENGTH, $this->length); + if ($this->isColumnModified(CcFilesPeer::ALBUM_TITLE)) $criteria->add(CcFilesPeer::ALBUM_TITLE, $this->album_title); + if ($this->isColumnModified(CcFilesPeer::GENRE)) $criteria->add(CcFilesPeer::GENRE, $this->genre); + if ($this->isColumnModified(CcFilesPeer::COMMENTS)) $criteria->add(CcFilesPeer::COMMENTS, $this->comments); + if ($this->isColumnModified(CcFilesPeer::YEAR)) $criteria->add(CcFilesPeer::YEAR, $this->year); + if ($this->isColumnModified(CcFilesPeer::TRACK_NUMBER)) $criteria->add(CcFilesPeer::TRACK_NUMBER, $this->track_number); + if ($this->isColumnModified(CcFilesPeer::CHANNELS)) $criteria->add(CcFilesPeer::CHANNELS, $this->channels); + if ($this->isColumnModified(CcFilesPeer::URL)) $criteria->add(CcFilesPeer::URL, $this->url); + if ($this->isColumnModified(CcFilesPeer::BPM)) $criteria->add(CcFilesPeer::BPM, $this->bpm); + if ($this->isColumnModified(CcFilesPeer::RATING)) $criteria->add(CcFilesPeer::RATING, $this->rating); + if ($this->isColumnModified(CcFilesPeer::ENCODED_BY)) $criteria->add(CcFilesPeer::ENCODED_BY, $this->encoded_by); + if ($this->isColumnModified(CcFilesPeer::DISC_NUMBER)) $criteria->add(CcFilesPeer::DISC_NUMBER, $this->disc_number); + if ($this->isColumnModified(CcFilesPeer::MOOD)) $criteria->add(CcFilesPeer::MOOD, $this->mood); + if ($this->isColumnModified(CcFilesPeer::LABEL)) $criteria->add(CcFilesPeer::LABEL, $this->label); + if ($this->isColumnModified(CcFilesPeer::COMPOSER)) $criteria->add(CcFilesPeer::COMPOSER, $this->composer); + if ($this->isColumnModified(CcFilesPeer::ENCODER)) $criteria->add(CcFilesPeer::ENCODER, $this->encoder); + if ($this->isColumnModified(CcFilesPeer::CHECKSUM)) $criteria->add(CcFilesPeer::CHECKSUM, $this->checksum); + if ($this->isColumnModified(CcFilesPeer::LYRICS)) $criteria->add(CcFilesPeer::LYRICS, $this->lyrics); + if ($this->isColumnModified(CcFilesPeer::ORCHESTRA)) $criteria->add(CcFilesPeer::ORCHESTRA, $this->orchestra); + if ($this->isColumnModified(CcFilesPeer::CONDUCTOR)) $criteria->add(CcFilesPeer::CONDUCTOR, $this->conductor); + if ($this->isColumnModified(CcFilesPeer::LYRICIST)) $criteria->add(CcFilesPeer::LYRICIST, $this->lyricist); + if ($this->isColumnModified(CcFilesPeer::ORIGINAL_LYRICIST)) $criteria->add(CcFilesPeer::ORIGINAL_LYRICIST, $this->original_lyricist); + if ($this->isColumnModified(CcFilesPeer::RADIO_STATION_NAME)) $criteria->add(CcFilesPeer::RADIO_STATION_NAME, $this->radio_station_name); + if ($this->isColumnModified(CcFilesPeer::INFO_URL)) $criteria->add(CcFilesPeer::INFO_URL, $this->info_url); + if ($this->isColumnModified(CcFilesPeer::ARTIST_URL)) $criteria->add(CcFilesPeer::ARTIST_URL, $this->artist_url); + if ($this->isColumnModified(CcFilesPeer::AUDIO_SOURCE_URL)) $criteria->add(CcFilesPeer::AUDIO_SOURCE_URL, $this->audio_source_url); + if ($this->isColumnModified(CcFilesPeer::RADIO_STATION_URL)) $criteria->add(CcFilesPeer::RADIO_STATION_URL, $this->radio_station_url); + if ($this->isColumnModified(CcFilesPeer::BUY_THIS_URL)) $criteria->add(CcFilesPeer::BUY_THIS_URL, $this->buy_this_url); + if ($this->isColumnModified(CcFilesPeer::ISRC_NUMBER)) $criteria->add(CcFilesPeer::ISRC_NUMBER, $this->isrc_number); + if ($this->isColumnModified(CcFilesPeer::CATALOG_NUMBER)) $criteria->add(CcFilesPeer::CATALOG_NUMBER, $this->catalog_number); + if ($this->isColumnModified(CcFilesPeer::ORIGINAL_ARTIST)) $criteria->add(CcFilesPeer::ORIGINAL_ARTIST, $this->original_artist); + if ($this->isColumnModified(CcFilesPeer::COPYRIGHT)) $criteria->add(CcFilesPeer::COPYRIGHT, $this->copyright); + if ($this->isColumnModified(CcFilesPeer::REPORT_DATETIME)) $criteria->add(CcFilesPeer::REPORT_DATETIME, $this->report_datetime); + if ($this->isColumnModified(CcFilesPeer::REPORT_LOCATION)) $criteria->add(CcFilesPeer::REPORT_LOCATION, $this->report_location); + if ($this->isColumnModified(CcFilesPeer::REPORT_ORGANIZATION)) $criteria->add(CcFilesPeer::REPORT_ORGANIZATION, $this->report_organization); + if ($this->isColumnModified(CcFilesPeer::SUBJECT)) $criteria->add(CcFilesPeer::SUBJECT, $this->subject); + if ($this->isColumnModified(CcFilesPeer::CONTRIBUTOR)) $criteria->add(CcFilesPeer::CONTRIBUTOR, $this->contributor); + if ($this->isColumnModified(CcFilesPeer::LANGUAGE)) $criteria->add(CcFilesPeer::LANGUAGE, $this->language); + if ($this->isColumnModified(CcFilesPeer::SOUNDCLOUD_ID)) $criteria->add(CcFilesPeer::SOUNDCLOUD_ID, $this->soundcloud_id); + if ($this->isColumnModified(CcFilesPeer::SOUNDCLOUD_ERROR_CODE)) $criteria->add(CcFilesPeer::SOUNDCLOUD_ERROR_CODE, $this->soundcloud_error_code); + if ($this->isColumnModified(CcFilesPeer::SOUNDCLOUD_ERROR_MSG)) $criteria->add(CcFilesPeer::SOUNDCLOUD_ERROR_MSG, $this->soundcloud_error_msg); + if ($this->isColumnModified(CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE)) $criteria->add(CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE, $this->soundcloud_link_to_file); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcFilesPeer::DATABASE_NAME); + $criteria->add(CcFilesPeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getDbId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getDbId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcFiles (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setDbGunid($this->gunid); + $copyObj->setDbName($this->name); + $copyObj->setDbMime($this->mime); + $copyObj->setDbFtype($this->ftype); + $copyObj->setDbDirectory($this->directory); + $copyObj->setDbFilepath($this->filepath); + $copyObj->setDbState($this->state); + $copyObj->setDbCurrentlyaccessing($this->currentlyaccessing); + $copyObj->setDbEditedby($this->editedby); + $copyObj->setDbMtime($this->mtime); + $copyObj->setDbMd5($this->md5); + $copyObj->setDbTrackTitle($this->track_title); + $copyObj->setDbArtistName($this->artist_name); + $copyObj->setDbBitRate($this->bit_rate); + $copyObj->setDbSampleRate($this->sample_rate); + $copyObj->setDbFormat($this->format); + $copyObj->setDbLength($this->length); + $copyObj->setDbAlbumTitle($this->album_title); + $copyObj->setDbGenre($this->genre); + $copyObj->setDbComments($this->comments); + $copyObj->setDbYear($this->year); + $copyObj->setDbTrackNumber($this->track_number); + $copyObj->setDbChannels($this->channels); + $copyObj->setDbUrl($this->url); + $copyObj->setDbBpm($this->bpm); + $copyObj->setDbRating($this->rating); + $copyObj->setDbEncodedBy($this->encoded_by); + $copyObj->setDbDiscNumber($this->disc_number); + $copyObj->setDbMood($this->mood); + $copyObj->setDbLabel($this->label); + $copyObj->setDbComposer($this->composer); + $copyObj->setDbEncoder($this->encoder); + $copyObj->setDbChecksum($this->checksum); + $copyObj->setDbLyrics($this->lyrics); + $copyObj->setDbOrchestra($this->orchestra); + $copyObj->setDbConductor($this->conductor); + $copyObj->setDbLyricist($this->lyricist); + $copyObj->setDbOriginalLyricist($this->original_lyricist); + $copyObj->setDbRadioStationName($this->radio_station_name); + $copyObj->setDbInfoUrl($this->info_url); + $copyObj->setDbArtistUrl($this->artist_url); + $copyObj->setDbAudioSourceUrl($this->audio_source_url); + $copyObj->setDbRadioStationUrl($this->radio_station_url); + $copyObj->setDbBuyThisUrl($this->buy_this_url); + $copyObj->setDbIsrcNumber($this->isrc_number); + $copyObj->setDbCatalogNumber($this->catalog_number); + $copyObj->setDbOriginalArtist($this->original_artist); + $copyObj->setDbCopyright($this->copyright); + $copyObj->setDbReportDatetime($this->report_datetime); + $copyObj->setDbReportLocation($this->report_location); + $copyObj->setDbReportOrganization($this->report_organization); + $copyObj->setDbSubject($this->subject); + $copyObj->setDbContributor($this->contributor); + $copyObj->setDbLanguage($this->language); + $copyObj->setDbSoundcloudId($this->soundcloud_id); + $copyObj->setDbSoundcloudErrorCode($this->soundcloud_error_code); + $copyObj->setDbSoundcloudErrorMsg($this->soundcloud_error_msg); + $copyObj->setDbSoundcloudLinkToFile($this->soundcloud_link_to_file); + + 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->getCcShowInstancess() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcShowInstances($relObj->copy($deepCopy)); + } + } + + foreach ($this->getCcPlaylistcontentss() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcPlaylistcontents($relObj->copy($deepCopy)); + } + } + + foreach ($this->getCcSchedules() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcSchedule($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcFiles Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcFilesPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcFilesPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a CcSubjs object. + * + * @param CcSubjs $v + * @return CcFiles The current object (for fluent API support) + * @throws PropelException + */ + public function setCcSubjs(CcSubjs $v = null) + { + if ($v === null) { + $this->setDbEditedby(NULL); + } else { + $this->setDbEditedby($v->getDbId()); + } + + $this->aCcSubjs = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcSubjs object, it will not be re-added. + if ($v !== null) { + $v->addCcFiles($this); + } + + return $this; + } + + + /** + * Get the associated CcSubjs object + * + * @param PropelPDO Optional Connection object. + * @return CcSubjs The associated CcSubjs object. + * @throws PropelException + */ + public function getCcSubjs(PropelPDO $con = null) + { + if ($this->aCcSubjs === null && ($this->editedby !== null)) { + $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->editedby, $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->aCcSubjs->addCcFiless($this); + */ + } + return $this->aCcSubjs; + } + + /** + * Declares an association between this object and a CcMusicDirs object. + * + * @param CcMusicDirs $v + * @return CcFiles The current object (for fluent API support) + * @throws PropelException + */ + public function setCcMusicDirs(CcMusicDirs $v = null) + { + if ($v === null) { + $this->setDbDirectory(NULL); + } else { + $this->setDbDirectory($v->getId()); + } + + $this->aCcMusicDirs = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcMusicDirs object, it will not be re-added. + if ($v !== null) { + $v->addCcFiles($this); + } + + return $this; + } + + + /** + * Get the associated CcMusicDirs object + * + * @param PropelPDO Optional Connection object. + * @return CcMusicDirs The associated CcMusicDirs object. + * @throws PropelException + */ + public function getCcMusicDirs(PropelPDO $con = null) + { + if ($this->aCcMusicDirs === null && ($this->directory !== null)) { + $this->aCcMusicDirs = CcMusicDirsQuery::create()->findPk($this->directory, $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->aCcMusicDirs->addCcFiless($this); + */ + } + return $this->aCcMusicDirs; + } + + /** + * Clears out the collCcShowInstancess 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 addCcShowInstancess() + */ + public function clearCcShowInstancess() + { + $this->collCcShowInstancess = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcShowInstancess collection. + * + * By default this just sets the collCcShowInstancess collection to an empty array (like clearcollCcShowInstancess()); + * 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 initCcShowInstancess() + { + $this->collCcShowInstancess = new PropelObjectCollection(); + $this->collCcShowInstancess->setModel('CcShowInstances'); + } + + /** + * Gets an array of CcShowInstances 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 CcFiles 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 CcShowInstances[] List of CcShowInstances objects + * @throws PropelException + */ + public function getCcShowInstancess($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcShowInstancess || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowInstancess) { + // return empty collection + $this->initCcShowInstancess(); + } else { + $collCcShowInstancess = CcShowInstancesQuery::create(null, $criteria) + ->filterByCcFiles($this) + ->find($con); + if (null !== $criteria) { + return $collCcShowInstancess; + } + $this->collCcShowInstancess = $collCcShowInstancess; + } + } + return $this->collCcShowInstancess; + } + + /** + * Returns the number of related CcShowInstances objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcShowInstances objects. + * @throws PropelException + */ + public function countCcShowInstancess(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcShowInstancess || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowInstancess) { + return 0; + } else { + $query = CcShowInstancesQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcFiles($this) + ->count($con); + } + } else { + return count($this->collCcShowInstancess); + } + } + + /** + * Method called to associate a CcShowInstances object to this object + * through the CcShowInstances foreign key attribute. + * + * @param CcShowInstances $l CcShowInstances + * @return void + * @throws PropelException + */ + public function addCcShowInstances(CcShowInstances $l) + { + if ($this->collCcShowInstancess === null) { + $this->initCcShowInstancess(); + } + if (!$this->collCcShowInstancess->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcShowInstancess[]= $l; + $l->setCcFiles($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcFiles is new, it will return + * an empty collection; or if this CcFiles has previously + * been saved, it will retrieve related CcShowInstancess from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcFiles. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowInstances[] List of CcShowInstances objects + */ + public function getCcShowInstancessJoinCcShow($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowInstancesQuery::create(null, $criteria); + $query->joinWith('CcShow', $join_behavior); + + return $this->getCcShowInstancess($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcFiles is new, it will return + * an empty collection; or if this CcFiles has previously + * been saved, it will retrieve related CcShowInstancess from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcFiles. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowInstances[] List of CcShowInstances objects + */ + public function getCcShowInstancessJoinCcShowInstancesRelatedByDbOriginalShow($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowInstancesQuery::create(null, $criteria); + $query->joinWith('CcShowInstancesRelatedByDbOriginalShow', $join_behavior); + + return $this->getCcShowInstancess($query, $con); + } + + /** + * Clears out the collCcPlaylistcontentss 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 addCcPlaylistcontentss() + */ + public function clearCcPlaylistcontentss() + { + $this->collCcPlaylistcontentss = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcPlaylistcontentss collection. + * + * By default this just sets the collCcPlaylistcontentss collection to an empty array (like clearcollCcPlaylistcontentss()); + * 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 initCcPlaylistcontentss() + { + $this->collCcPlaylistcontentss = new PropelObjectCollection(); + $this->collCcPlaylistcontentss->setModel('CcPlaylistcontents'); + } + + /** + * Gets an array of CcPlaylistcontents 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 CcFiles 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 CcPlaylistcontents[] List of CcPlaylistcontents objects + * @throws PropelException + */ + public function getCcPlaylistcontentss($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcPlaylistcontentss || null !== $criteria) { + if ($this->isNew() && null === $this->collCcPlaylistcontentss) { + // return empty collection + $this->initCcPlaylistcontentss(); + } else { + $collCcPlaylistcontentss = CcPlaylistcontentsQuery::create(null, $criteria) + ->filterByCcFiles($this) + ->find($con); + if (null !== $criteria) { + return $collCcPlaylistcontentss; + } + $this->collCcPlaylistcontentss = $collCcPlaylistcontentss; + } + } + return $this->collCcPlaylistcontentss; + } + + /** + * Returns the number of related CcPlaylistcontents objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcPlaylistcontents objects. + * @throws PropelException + */ + public function countCcPlaylistcontentss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcPlaylistcontentss || null !== $criteria) { + if ($this->isNew() && null === $this->collCcPlaylistcontentss) { + return 0; + } else { + $query = CcPlaylistcontentsQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcFiles($this) + ->count($con); + } + } else { + return count($this->collCcPlaylistcontentss); + } + } + + /** + * Method called to associate a CcPlaylistcontents object to this object + * through the CcPlaylistcontents foreign key attribute. + * + * @param CcPlaylistcontents $l CcPlaylistcontents + * @return void + * @throws PropelException + */ + public function addCcPlaylistcontents(CcPlaylistcontents $l) + { + if ($this->collCcPlaylistcontentss === null) { + $this->initCcPlaylistcontentss(); + } + if (!$this->collCcPlaylistcontentss->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcPlaylistcontentss[]= $l; + $l->setCcFiles($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcFiles is new, it will return + * an empty collection; or if this CcFiles has previously + * been saved, it will retrieve related CcPlaylistcontentss from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcFiles. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcPlaylistcontents[] List of CcPlaylistcontents objects + */ + public function getCcPlaylistcontentssJoinCcPlaylist($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcPlaylistcontentsQuery::create(null, $criteria); + $query->joinWith('CcPlaylist', $join_behavior); + + return $this->getCcPlaylistcontentss($query, $con); + } + + /** + * Clears out the collCcSchedules 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 addCcSchedules() + */ + public function clearCcSchedules() + { + $this->collCcSchedules = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcSchedules collection. + * + * By default this just sets the collCcSchedules collection to an empty array (like clearcollCcSchedules()); + * 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 initCcSchedules() + { + $this->collCcSchedules = new PropelObjectCollection(); + $this->collCcSchedules->setModel('CcSchedule'); + } + + /** + * Gets an array of CcSchedule 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 CcFiles 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 CcSchedule[] List of CcSchedule objects + * @throws PropelException + */ + public function getCcSchedules($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcSchedules || null !== $criteria) { + if ($this->isNew() && null === $this->collCcSchedules) { + // return empty collection + $this->initCcSchedules(); + } else { + $collCcSchedules = CcScheduleQuery::create(null, $criteria) + ->filterByCcFiles($this) + ->find($con); + if (null !== $criteria) { + return $collCcSchedules; + } + $this->collCcSchedules = $collCcSchedules; + } + } + return $this->collCcSchedules; + } + + /** + * Returns the number of related CcSchedule objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcSchedule objects. + * @throws PropelException + */ + public function countCcSchedules(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcSchedules || null !== $criteria) { + if ($this->isNew() && null === $this->collCcSchedules) { + return 0; + } else { + $query = CcScheduleQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcFiles($this) + ->count($con); + } + } else { + return count($this->collCcSchedules); + } + } + + /** + * Method called to associate a CcSchedule object to this object + * through the CcSchedule foreign key attribute. + * + * @param CcSchedule $l CcSchedule + * @return void + * @throws PropelException + */ + public function addCcSchedule(CcSchedule $l) + { + if ($this->collCcSchedules === null) { + $this->initCcSchedules(); + } + if (!$this->collCcSchedules->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcSchedules[]= $l; + $l->setCcFiles($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcFiles is new, it will return + * an empty collection; or if this CcFiles has previously + * been saved, it will retrieve related CcSchedules from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcFiles. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcSchedule[] List of CcSchedule objects + */ + public function getCcSchedulesJoinCcShowInstances($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcScheduleQuery::create(null, $criteria); + $query->joinWith('CcShowInstances', $join_behavior); + + return $this->getCcSchedules($query, $con); + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->gunid = null; + $this->name = null; + $this->mime = null; + $this->ftype = null; + $this->directory = null; + $this->filepath = null; + $this->state = null; + $this->currentlyaccessing = null; + $this->editedby = null; + $this->mtime = null; + $this->md5 = null; + $this->track_title = null; + $this->artist_name = null; + $this->bit_rate = null; + $this->sample_rate = null; + $this->format = null; + $this->length = null; + $this->album_title = null; + $this->genre = null; + $this->comments = null; + $this->year = null; + $this->track_number = null; + $this->channels = null; + $this->url = null; + $this->bpm = null; + $this->rating = null; + $this->encoded_by = null; + $this->disc_number = null; + $this->mood = null; + $this->label = null; + $this->composer = null; + $this->encoder = null; + $this->checksum = null; + $this->lyrics = null; + $this->orchestra = null; + $this->conductor = null; + $this->lyricist = null; + $this->original_lyricist = null; + $this->radio_station_name = null; + $this->info_url = null; + $this->artist_url = null; + $this->audio_source_url = null; + $this->radio_station_url = null; + $this->buy_this_url = null; + $this->isrc_number = null; + $this->catalog_number = null; + $this->original_artist = null; + $this->copyright = null; + $this->report_datetime = null; + $this->report_location = null; + $this->report_organization = null; + $this->subject = null; + $this->contributor = null; + $this->language = null; + $this->soundcloud_id = null; + $this->soundcloud_error_code = null; + $this->soundcloud_error_msg = null; + $this->soundcloud_link_to_file = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->applyDefaultValues(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collCcShowInstancess) { + foreach ((array) $this->collCcShowInstancess as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collCcPlaylistcontentss) { + foreach ((array) $this->collCcPlaylistcontentss as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collCcSchedules) { + foreach ((array) $this->collCcSchedules as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collCcShowInstancess = null; + $this->collCcPlaylistcontentss = null; + $this->collCcSchedules = null; + $this->aCcSubjs = null; + $this->aCcMusicDirs = null; + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcFiles diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcFilesPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcFilesPeer.php new file mode 100644 index 000000000..e08728cfd --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcFilesPeer.php @@ -0,0 +1,1654 @@ + array ('DbId', 'DbGunid', 'DbName', 'DbMime', 'DbFtype', 'DbDirectory', 'DbFilepath', 'DbState', 'DbCurrentlyaccessing', 'DbEditedby', 'DbMtime', 'DbMd5', 'DbTrackTitle', 'DbArtistName', 'DbBitRate', 'DbSampleRate', 'DbFormat', 'DbLength', 'DbAlbumTitle', 'DbGenre', 'DbComments', 'DbYear', 'DbTrackNumber', 'DbChannels', 'DbUrl', 'DbBpm', 'DbRating', 'DbEncodedBy', 'DbDiscNumber', 'DbMood', 'DbLabel', 'DbComposer', 'DbEncoder', 'DbChecksum', 'DbLyrics', 'DbOrchestra', 'DbConductor', 'DbLyricist', 'DbOriginalLyricist', 'DbRadioStationName', 'DbInfoUrl', 'DbArtistUrl', 'DbAudioSourceUrl', 'DbRadioStationUrl', 'DbBuyThisUrl', 'DbIsrcNumber', 'DbCatalogNumber', 'DbOriginalArtist', 'DbCopyright', 'DbReportDatetime', 'DbReportLocation', 'DbReportOrganization', 'DbSubject', 'DbContributor', 'DbLanguage', 'DbSoundcloudId', 'DbSoundcloudErrorCode', 'DbSoundcloudErrorMsg', 'DbSoundcloudLinkToFile', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbGunid', 'dbName', 'dbMime', 'dbFtype', 'dbDirectory', 'dbFilepath', 'dbState', 'dbCurrentlyaccessing', 'dbEditedby', 'dbMtime', 'dbMd5', 'dbTrackTitle', 'dbArtistName', 'dbBitRate', 'dbSampleRate', 'dbFormat', 'dbLength', 'dbAlbumTitle', 'dbGenre', 'dbComments', 'dbYear', 'dbTrackNumber', 'dbChannels', 'dbUrl', 'dbBpm', 'dbRating', 'dbEncodedBy', 'dbDiscNumber', 'dbMood', 'dbLabel', 'dbComposer', 'dbEncoder', 'dbChecksum', 'dbLyrics', 'dbOrchestra', 'dbConductor', 'dbLyricist', 'dbOriginalLyricist', 'dbRadioStationName', 'dbInfoUrl', 'dbArtistUrl', 'dbAudioSourceUrl', 'dbRadioStationUrl', 'dbBuyThisUrl', 'dbIsrcNumber', 'dbCatalogNumber', 'dbOriginalArtist', 'dbCopyright', 'dbReportDatetime', 'dbReportLocation', 'dbReportOrganization', 'dbSubject', 'dbContributor', 'dbLanguage', 'dbSoundcloudId', 'dbSoundcloudErrorCode', 'dbSoundcloudErrorMsg', 'dbSoundcloudLinkToFile', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::GUNID, self::NAME, self::MIME, self::FTYPE, self::DIRECTORY, self::FILEPATH, self::STATE, self::CURRENTLYACCESSING, self::EDITEDBY, self::MTIME, self::MD5, self::TRACK_TITLE, self::ARTIST_NAME, self::BIT_RATE, self::SAMPLE_RATE, self::FORMAT, self::LENGTH, self::ALBUM_TITLE, self::GENRE, self::COMMENTS, self::YEAR, self::TRACK_NUMBER, self::CHANNELS, self::URL, self::BPM, self::RATING, self::ENCODED_BY, self::DISC_NUMBER, self::MOOD, self::LABEL, self::COMPOSER, self::ENCODER, self::CHECKSUM, self::LYRICS, self::ORCHESTRA, self::CONDUCTOR, self::LYRICIST, self::ORIGINAL_LYRICIST, self::RADIO_STATION_NAME, self::INFO_URL, self::ARTIST_URL, self::AUDIO_SOURCE_URL, self::RADIO_STATION_URL, self::BUY_THIS_URL, self::ISRC_NUMBER, self::CATALOG_NUMBER, self::ORIGINAL_ARTIST, self::COPYRIGHT, self::REPORT_DATETIME, self::REPORT_LOCATION, self::REPORT_ORGANIZATION, self::SUBJECT, self::CONTRIBUTOR, self::LANGUAGE, self::SOUNDCLOUD_ID, self::SOUNDCLOUD_ERROR_CODE, self::SOUNDCLOUD_ERROR_MSG, self::SOUNDCLOUD_LINK_TO_FILE, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'GUNID', 'NAME', 'MIME', 'FTYPE', 'DIRECTORY', 'FILEPATH', 'STATE', 'CURRENTLYACCESSING', 'EDITEDBY', 'MTIME', 'MD5', 'TRACK_TITLE', 'ARTIST_NAME', 'BIT_RATE', 'SAMPLE_RATE', 'FORMAT', 'LENGTH', 'ALBUM_TITLE', 'GENRE', 'COMMENTS', 'YEAR', 'TRACK_NUMBER', 'CHANNELS', 'URL', 'BPM', 'RATING', 'ENCODED_BY', 'DISC_NUMBER', 'MOOD', 'LABEL', 'COMPOSER', 'ENCODER', 'CHECKSUM', 'LYRICS', 'ORCHESTRA', 'CONDUCTOR', 'LYRICIST', 'ORIGINAL_LYRICIST', 'RADIO_STATION_NAME', 'INFO_URL', 'ARTIST_URL', 'AUDIO_SOURCE_URL', 'RADIO_STATION_URL', 'BUY_THIS_URL', 'ISRC_NUMBER', 'CATALOG_NUMBER', 'ORIGINAL_ARTIST', 'COPYRIGHT', 'REPORT_DATETIME', 'REPORT_LOCATION', 'REPORT_ORGANIZATION', 'SUBJECT', 'CONTRIBUTOR', 'LANGUAGE', 'SOUNDCLOUD_ID', 'SOUNDCLOUD_ERROR_CODE', 'SOUNDCLOUD_ERROR_MSG', 'SOUNDCLOUD_LINK_TO_FILE', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'gunid', 'name', 'mime', 'ftype', 'directory', 'filepath', 'state', 'currentlyaccessing', 'editedby', 'mtime', 'md5', 'track_title', 'artist_name', 'bit_rate', 'sample_rate', 'format', 'length', 'album_title', 'genre', 'comments', 'year', 'track_number', 'channels', 'url', 'bpm', 'rating', 'encoded_by', 'disc_number', 'mood', 'label', 'composer', 'encoder', 'checksum', 'lyrics', 'orchestra', 'conductor', 'lyricist', 'original_lyricist', 'radio_station_name', 'info_url', 'artist_url', 'audio_source_url', 'radio_station_url', 'buy_this_url', 'isrc_number', 'catalog_number', 'original_artist', 'copyright', 'report_datetime', 'report_location', 'report_organization', 'subject', 'contributor', 'language', 'soundcloud_id', 'soundcloud_error_code', 'soundcloud_error_msg', 'soundcloud_link_to_file', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbGunid' => 1, 'DbName' => 2, 'DbMime' => 3, 'DbFtype' => 4, 'DbDirectory' => 5, 'DbFilepath' => 6, 'DbState' => 7, 'DbCurrentlyaccessing' => 8, 'DbEditedby' => 9, 'DbMtime' => 10, 'DbMd5' => 11, 'DbTrackTitle' => 12, 'DbArtistName' => 13, 'DbBitRate' => 14, 'DbSampleRate' => 15, 'DbFormat' => 16, 'DbLength' => 17, 'DbAlbumTitle' => 18, 'DbGenre' => 19, 'DbComments' => 20, 'DbYear' => 21, 'DbTrackNumber' => 22, 'DbChannels' => 23, 'DbUrl' => 24, 'DbBpm' => 25, 'DbRating' => 26, 'DbEncodedBy' => 27, 'DbDiscNumber' => 28, 'DbMood' => 29, 'DbLabel' => 30, 'DbComposer' => 31, 'DbEncoder' => 32, 'DbChecksum' => 33, 'DbLyrics' => 34, 'DbOrchestra' => 35, 'DbConductor' => 36, 'DbLyricist' => 37, 'DbOriginalLyricist' => 38, 'DbRadioStationName' => 39, 'DbInfoUrl' => 40, 'DbArtistUrl' => 41, 'DbAudioSourceUrl' => 42, 'DbRadioStationUrl' => 43, 'DbBuyThisUrl' => 44, 'DbIsrcNumber' => 45, 'DbCatalogNumber' => 46, 'DbOriginalArtist' => 47, 'DbCopyright' => 48, 'DbReportDatetime' => 49, 'DbReportLocation' => 50, 'DbReportOrganization' => 51, 'DbSubject' => 52, 'DbContributor' => 53, 'DbLanguage' => 54, 'DbSoundcloudId' => 55, 'DbSoundcloudErrorCode' => 56, 'DbSoundcloudErrorMsg' => 57, 'DbSoundcloudLinkToFile' => 58, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbGunid' => 1, 'dbName' => 2, 'dbMime' => 3, 'dbFtype' => 4, 'dbDirectory' => 5, 'dbFilepath' => 6, 'dbState' => 7, 'dbCurrentlyaccessing' => 8, 'dbEditedby' => 9, 'dbMtime' => 10, 'dbMd5' => 11, 'dbTrackTitle' => 12, 'dbArtistName' => 13, 'dbBitRate' => 14, 'dbSampleRate' => 15, 'dbFormat' => 16, 'dbLength' => 17, 'dbAlbumTitle' => 18, 'dbGenre' => 19, 'dbComments' => 20, 'dbYear' => 21, 'dbTrackNumber' => 22, 'dbChannels' => 23, 'dbUrl' => 24, 'dbBpm' => 25, 'dbRating' => 26, 'dbEncodedBy' => 27, 'dbDiscNumber' => 28, 'dbMood' => 29, 'dbLabel' => 30, 'dbComposer' => 31, 'dbEncoder' => 32, 'dbChecksum' => 33, 'dbLyrics' => 34, 'dbOrchestra' => 35, 'dbConductor' => 36, 'dbLyricist' => 37, 'dbOriginalLyricist' => 38, 'dbRadioStationName' => 39, 'dbInfoUrl' => 40, 'dbArtistUrl' => 41, 'dbAudioSourceUrl' => 42, 'dbRadioStationUrl' => 43, 'dbBuyThisUrl' => 44, 'dbIsrcNumber' => 45, 'dbCatalogNumber' => 46, 'dbOriginalArtist' => 47, 'dbCopyright' => 48, 'dbReportDatetime' => 49, 'dbReportLocation' => 50, 'dbReportOrganization' => 51, 'dbSubject' => 52, 'dbContributor' => 53, 'dbLanguage' => 54, 'dbSoundcloudId' => 55, 'dbSoundcloudErrorCode' => 56, 'dbSoundcloudErrorMsg' => 57, 'dbSoundcloudLinkToFile' => 58, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::GUNID => 1, self::NAME => 2, self::MIME => 3, self::FTYPE => 4, self::DIRECTORY => 5, self::FILEPATH => 6, self::STATE => 7, self::CURRENTLYACCESSING => 8, self::EDITEDBY => 9, self::MTIME => 10, self::MD5 => 11, self::TRACK_TITLE => 12, self::ARTIST_NAME => 13, self::BIT_RATE => 14, self::SAMPLE_RATE => 15, self::FORMAT => 16, self::LENGTH => 17, self::ALBUM_TITLE => 18, self::GENRE => 19, self::COMMENTS => 20, self::YEAR => 21, self::TRACK_NUMBER => 22, self::CHANNELS => 23, self::URL => 24, self::BPM => 25, self::RATING => 26, self::ENCODED_BY => 27, self::DISC_NUMBER => 28, self::MOOD => 29, self::LABEL => 30, self::COMPOSER => 31, self::ENCODER => 32, self::CHECKSUM => 33, self::LYRICS => 34, self::ORCHESTRA => 35, self::CONDUCTOR => 36, self::LYRICIST => 37, self::ORIGINAL_LYRICIST => 38, self::RADIO_STATION_NAME => 39, self::INFO_URL => 40, self::ARTIST_URL => 41, self::AUDIO_SOURCE_URL => 42, self::RADIO_STATION_URL => 43, self::BUY_THIS_URL => 44, self::ISRC_NUMBER => 45, self::CATALOG_NUMBER => 46, self::ORIGINAL_ARTIST => 47, self::COPYRIGHT => 48, self::REPORT_DATETIME => 49, self::REPORT_LOCATION => 50, self::REPORT_ORGANIZATION => 51, self::SUBJECT => 52, self::CONTRIBUTOR => 53, self::LANGUAGE => 54, self::SOUNDCLOUD_ID => 55, self::SOUNDCLOUD_ERROR_CODE => 56, self::SOUNDCLOUD_ERROR_MSG => 57, self::SOUNDCLOUD_LINK_TO_FILE => 58, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'GUNID' => 1, 'NAME' => 2, 'MIME' => 3, 'FTYPE' => 4, 'DIRECTORY' => 5, 'FILEPATH' => 6, 'STATE' => 7, 'CURRENTLYACCESSING' => 8, 'EDITEDBY' => 9, 'MTIME' => 10, 'MD5' => 11, 'TRACK_TITLE' => 12, 'ARTIST_NAME' => 13, 'BIT_RATE' => 14, 'SAMPLE_RATE' => 15, 'FORMAT' => 16, 'LENGTH' => 17, 'ALBUM_TITLE' => 18, 'GENRE' => 19, 'COMMENTS' => 20, 'YEAR' => 21, 'TRACK_NUMBER' => 22, 'CHANNELS' => 23, 'URL' => 24, 'BPM' => 25, 'RATING' => 26, 'ENCODED_BY' => 27, 'DISC_NUMBER' => 28, 'MOOD' => 29, 'LABEL' => 30, 'COMPOSER' => 31, 'ENCODER' => 32, 'CHECKSUM' => 33, 'LYRICS' => 34, 'ORCHESTRA' => 35, 'CONDUCTOR' => 36, 'LYRICIST' => 37, 'ORIGINAL_LYRICIST' => 38, 'RADIO_STATION_NAME' => 39, 'INFO_URL' => 40, 'ARTIST_URL' => 41, 'AUDIO_SOURCE_URL' => 42, 'RADIO_STATION_URL' => 43, 'BUY_THIS_URL' => 44, 'ISRC_NUMBER' => 45, 'CATALOG_NUMBER' => 46, 'ORIGINAL_ARTIST' => 47, 'COPYRIGHT' => 48, 'REPORT_DATETIME' => 49, 'REPORT_LOCATION' => 50, 'REPORT_ORGANIZATION' => 51, 'SUBJECT' => 52, 'CONTRIBUTOR' => 53, 'LANGUAGE' => 54, 'SOUNDCLOUD_ID' => 55, 'SOUNDCLOUD_ERROR_CODE' => 56, 'SOUNDCLOUD_ERROR_MSG' => 57, 'SOUNDCLOUD_LINK_TO_FILE' => 58, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'gunid' => 1, 'name' => 2, 'mime' => 3, 'ftype' => 4, 'directory' => 5, 'filepath' => 6, 'state' => 7, 'currentlyaccessing' => 8, 'editedby' => 9, 'mtime' => 10, 'md5' => 11, 'track_title' => 12, 'artist_name' => 13, 'bit_rate' => 14, 'sample_rate' => 15, 'format' => 16, 'length' => 17, 'album_title' => 18, 'genre' => 19, 'comments' => 20, 'year' => 21, 'track_number' => 22, 'channels' => 23, 'url' => 24, 'bpm' => 25, 'rating' => 26, 'encoded_by' => 27, 'disc_number' => 28, 'mood' => 29, 'label' => 30, 'composer' => 31, 'encoder' => 32, 'checksum' => 33, 'lyrics' => 34, 'orchestra' => 35, 'conductor' => 36, 'lyricist' => 37, 'original_lyricist' => 38, 'radio_station_name' => 39, 'info_url' => 40, 'artist_url' => 41, 'audio_source_url' => 42, 'radio_station_url' => 43, 'buy_this_url' => 44, 'isrc_number' => 45, 'catalog_number' => 46, 'original_artist' => 47, 'copyright' => 48, 'report_datetime' => 49, 'report_location' => 50, 'report_organization' => 51, 'subject' => 52, 'contributor' => 53, 'language' => 54, 'soundcloud_id' => 55, 'soundcloud_error_code' => 56, 'soundcloud_error_msg' => 57, 'soundcloud_link_to_file' => 58, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcFilesPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcFilesPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcFilesPeer::ID); + $criteria->addSelectColumn(CcFilesPeer::GUNID); + $criteria->addSelectColumn(CcFilesPeer::NAME); + $criteria->addSelectColumn(CcFilesPeer::MIME); + $criteria->addSelectColumn(CcFilesPeer::FTYPE); + $criteria->addSelectColumn(CcFilesPeer::DIRECTORY); + $criteria->addSelectColumn(CcFilesPeer::FILEPATH); + $criteria->addSelectColumn(CcFilesPeer::STATE); + $criteria->addSelectColumn(CcFilesPeer::CURRENTLYACCESSING); + $criteria->addSelectColumn(CcFilesPeer::EDITEDBY); + $criteria->addSelectColumn(CcFilesPeer::MTIME); + $criteria->addSelectColumn(CcFilesPeer::MD5); + $criteria->addSelectColumn(CcFilesPeer::TRACK_TITLE); + $criteria->addSelectColumn(CcFilesPeer::ARTIST_NAME); + $criteria->addSelectColumn(CcFilesPeer::BIT_RATE); + $criteria->addSelectColumn(CcFilesPeer::SAMPLE_RATE); + $criteria->addSelectColumn(CcFilesPeer::FORMAT); + $criteria->addSelectColumn(CcFilesPeer::LENGTH); + $criteria->addSelectColumn(CcFilesPeer::ALBUM_TITLE); + $criteria->addSelectColumn(CcFilesPeer::GENRE); + $criteria->addSelectColumn(CcFilesPeer::COMMENTS); + $criteria->addSelectColumn(CcFilesPeer::YEAR); + $criteria->addSelectColumn(CcFilesPeer::TRACK_NUMBER); + $criteria->addSelectColumn(CcFilesPeer::CHANNELS); + $criteria->addSelectColumn(CcFilesPeer::URL); + $criteria->addSelectColumn(CcFilesPeer::BPM); + $criteria->addSelectColumn(CcFilesPeer::RATING); + $criteria->addSelectColumn(CcFilesPeer::ENCODED_BY); + $criteria->addSelectColumn(CcFilesPeer::DISC_NUMBER); + $criteria->addSelectColumn(CcFilesPeer::MOOD); + $criteria->addSelectColumn(CcFilesPeer::LABEL); + $criteria->addSelectColumn(CcFilesPeer::COMPOSER); + $criteria->addSelectColumn(CcFilesPeer::ENCODER); + $criteria->addSelectColumn(CcFilesPeer::CHECKSUM); + $criteria->addSelectColumn(CcFilesPeer::LYRICS); + $criteria->addSelectColumn(CcFilesPeer::ORCHESTRA); + $criteria->addSelectColumn(CcFilesPeer::CONDUCTOR); + $criteria->addSelectColumn(CcFilesPeer::LYRICIST); + $criteria->addSelectColumn(CcFilesPeer::ORIGINAL_LYRICIST); + $criteria->addSelectColumn(CcFilesPeer::RADIO_STATION_NAME); + $criteria->addSelectColumn(CcFilesPeer::INFO_URL); + $criteria->addSelectColumn(CcFilesPeer::ARTIST_URL); + $criteria->addSelectColumn(CcFilesPeer::AUDIO_SOURCE_URL); + $criteria->addSelectColumn(CcFilesPeer::RADIO_STATION_URL); + $criteria->addSelectColumn(CcFilesPeer::BUY_THIS_URL); + $criteria->addSelectColumn(CcFilesPeer::ISRC_NUMBER); + $criteria->addSelectColumn(CcFilesPeer::CATALOG_NUMBER); + $criteria->addSelectColumn(CcFilesPeer::ORIGINAL_ARTIST); + $criteria->addSelectColumn(CcFilesPeer::COPYRIGHT); + $criteria->addSelectColumn(CcFilesPeer::REPORT_DATETIME); + $criteria->addSelectColumn(CcFilesPeer::REPORT_LOCATION); + $criteria->addSelectColumn(CcFilesPeer::REPORT_ORGANIZATION); + $criteria->addSelectColumn(CcFilesPeer::SUBJECT); + $criteria->addSelectColumn(CcFilesPeer::CONTRIBUTOR); + $criteria->addSelectColumn(CcFilesPeer::LANGUAGE); + $criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_ID); + $criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_ERROR_CODE); + $criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_ERROR_MSG); + $criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.GUNID'); + $criteria->addSelectColumn($alias . '.NAME'); + $criteria->addSelectColumn($alias . '.MIME'); + $criteria->addSelectColumn($alias . '.FTYPE'); + $criteria->addSelectColumn($alias . '.DIRECTORY'); + $criteria->addSelectColumn($alias . '.FILEPATH'); + $criteria->addSelectColumn($alias . '.STATE'); + $criteria->addSelectColumn($alias . '.CURRENTLYACCESSING'); + $criteria->addSelectColumn($alias . '.EDITEDBY'); + $criteria->addSelectColumn($alias . '.MTIME'); + $criteria->addSelectColumn($alias . '.MD5'); + $criteria->addSelectColumn($alias . '.TRACK_TITLE'); + $criteria->addSelectColumn($alias . '.ARTIST_NAME'); + $criteria->addSelectColumn($alias . '.BIT_RATE'); + $criteria->addSelectColumn($alias . '.SAMPLE_RATE'); + $criteria->addSelectColumn($alias . '.FORMAT'); + $criteria->addSelectColumn($alias . '.LENGTH'); + $criteria->addSelectColumn($alias . '.ALBUM_TITLE'); + $criteria->addSelectColumn($alias . '.GENRE'); + $criteria->addSelectColumn($alias . '.COMMENTS'); + $criteria->addSelectColumn($alias . '.YEAR'); + $criteria->addSelectColumn($alias . '.TRACK_NUMBER'); + $criteria->addSelectColumn($alias . '.CHANNELS'); + $criteria->addSelectColumn($alias . '.URL'); + $criteria->addSelectColumn($alias . '.BPM'); + $criteria->addSelectColumn($alias . '.RATING'); + $criteria->addSelectColumn($alias . '.ENCODED_BY'); + $criteria->addSelectColumn($alias . '.DISC_NUMBER'); + $criteria->addSelectColumn($alias . '.MOOD'); + $criteria->addSelectColumn($alias . '.LABEL'); + $criteria->addSelectColumn($alias . '.COMPOSER'); + $criteria->addSelectColumn($alias . '.ENCODER'); + $criteria->addSelectColumn($alias . '.CHECKSUM'); + $criteria->addSelectColumn($alias . '.LYRICS'); + $criteria->addSelectColumn($alias . '.ORCHESTRA'); + $criteria->addSelectColumn($alias . '.CONDUCTOR'); + $criteria->addSelectColumn($alias . '.LYRICIST'); + $criteria->addSelectColumn($alias . '.ORIGINAL_LYRICIST'); + $criteria->addSelectColumn($alias . '.RADIO_STATION_NAME'); + $criteria->addSelectColumn($alias . '.INFO_URL'); + $criteria->addSelectColumn($alias . '.ARTIST_URL'); + $criteria->addSelectColumn($alias . '.AUDIO_SOURCE_URL'); + $criteria->addSelectColumn($alias . '.RADIO_STATION_URL'); + $criteria->addSelectColumn($alias . '.BUY_THIS_URL'); + $criteria->addSelectColumn($alias . '.ISRC_NUMBER'); + $criteria->addSelectColumn($alias . '.CATALOG_NUMBER'); + $criteria->addSelectColumn($alias . '.ORIGINAL_ARTIST'); + $criteria->addSelectColumn($alias . '.COPYRIGHT'); + $criteria->addSelectColumn($alias . '.REPORT_DATETIME'); + $criteria->addSelectColumn($alias . '.REPORT_LOCATION'); + $criteria->addSelectColumn($alias . '.REPORT_ORGANIZATION'); + $criteria->addSelectColumn($alias . '.SUBJECT'); + $criteria->addSelectColumn($alias . '.CONTRIBUTOR'); + $criteria->addSelectColumn($alias . '.LANGUAGE'); + $criteria->addSelectColumn($alias . '.SOUNDCLOUD_ID'); + $criteria->addSelectColumn($alias . '.SOUNDCLOUD_ERROR_CODE'); + $criteria->addSelectColumn($alias . '.SOUNDCLOUD_ERROR_MSG'); + $criteria->addSelectColumn($alias . '.SOUNDCLOUD_LINK_TO_FILE'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcFilesPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcFilesPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcFiles + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcFilesPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcFilesPeer::populateObjects(CcFilesPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcFilesPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcFiles $value A CcFiles object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcFiles $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcFiles object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcFiles) { + $key = (string) $value->getDbId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcFiles object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcFiles Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_files + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + // Invalidate objects in CcShowInstancesPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcShowInstancesPeer::clearInstancePool(); + // Invalidate objects in CcPlaylistcontentsPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcPlaylistcontentsPeer::clearInstancePool(); + // Invalidate objects in CcSchedulePeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcSchedulePeer::clearInstancePool(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcFilesPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcFilesPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcFilesPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcFilesPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcFiles object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcFilesPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcFilesPeer::NUM_COLUMNS; + } else { + $cls = CcFilesPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcFilesPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + + /** + * Returns the number of rows matching criteria, joining the related CcSubjs table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcFilesPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcFilesPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related CcMusicDirs table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinCcMusicDirs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcFilesPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcFilesPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcFiles objects pre-filled with their CcSubjs objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcFiles objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcFilesPeer::addSelectColumns($criteria); + $startcol = (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS); + CcSubjsPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcFilesPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcFilesPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcFilesPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcFilesPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcSubjsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcSubjsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcSubjsPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcFiles) to $obj2 (CcSubjs) + $obj2->addCcFiles($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of CcFiles objects pre-filled with their CcMusicDirs objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcFiles objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcMusicDirs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcFilesPeer::addSelectColumns($criteria); + $startcol = (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS); + CcMusicDirsPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcFilesPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcFilesPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcFilesPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcFilesPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcMusicDirsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcMusicDirsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcMusicDirsPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcFiles) to $obj2 (CcMusicDirs) + $obj2->addCcFiles($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining all related tables + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcFilesPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcFilesPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); + + $criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of CcFiles objects pre-filled with all related objects. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcFiles objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcFilesPeer::addSelectColumns($criteria); + $startcol2 = (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS); + + CcSubjsPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); + + CcMusicDirsPeer::addSelectColumns($criteria); + $startcol4 = $startcol3 + (CcMusicDirsPeer::NUM_COLUMNS - CcMusicDirsPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); + + $criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcFilesPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcFilesPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcFilesPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcFilesPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcSubjs rows + + $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcSubjsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcSubjsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcSubjsPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (CcFiles) to the collection in $obj2 (CcSubjs) + $obj2->addCcFiles($obj1); + } // if joined row not null + + // Add objects for joined CcMusicDirs rows + + $key3 = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = CcMusicDirsPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $cls = CcMusicDirsPeer::getOMClass(false); + + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + CcMusicDirsPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (CcFiles) to the collection in $obj3 (CcMusicDirs) + $obj3->addCcFiles($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related CcSubjs table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcFilesPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcFilesPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related CcMusicDirs table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptCcMusicDirs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcFilesPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcFilesPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcFiles objects pre-filled with all related objects except CcSubjs. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcFiles objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + // $criteria->getDbName() will return the same object if not set to another value + // so == check is okay and faster + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcFilesPeer::addSelectColumns($criteria); + $startcol2 = (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS); + + CcMusicDirsPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcMusicDirsPeer::NUM_COLUMNS - CcMusicDirsPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior); + + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcFilesPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcFilesPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcFilesPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcFilesPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcMusicDirs rows + + $key2 = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcMusicDirsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcMusicDirsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcMusicDirsPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (CcFiles) to the collection in $obj2 (CcMusicDirs) + $obj2->addCcFiles($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of CcFiles objects pre-filled with all related objects except CcMusicDirs. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcFiles objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptCcMusicDirs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + // $criteria->getDbName() will return the same object if not set to another value + // so == check is okay and faster + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcFilesPeer::addSelectColumns($criteria); + $startcol2 = (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS); + + CcSubjsPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); + + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcFilesPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcFilesPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcFilesPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcFilesPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcSubjs rows + + $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcSubjsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcSubjsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcSubjsPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (CcFiles) to the collection in $obj2 (CcSubjs) + $obj2->addCcFiles($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcFilesPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcFilesPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcFilesTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcFilesPeer::CLASS_DEFAULT : CcFilesPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcFiles or Criteria object. + * + * @param mixed $values Criteria or CcFiles object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcFiles object + } + + if ($criteria->containsKey(CcFilesPeer::ID) && $criteria->keyContainsValue(CcFilesPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcFilesPeer::ID.')'); + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcFiles or Criteria object. + * + * @param mixed $values Criteria or CcFiles object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcFilesPeer::ID); + $value = $criteria->remove(CcFilesPeer::ID); + if ($value) { + $selectCriteria->add(CcFilesPeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcFilesPeer::TABLE_NAME); + } + + } else { // $values is CcFiles object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_files table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcFilesPeer::TABLE_NAME, $con, CcFilesPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcFilesPeer::clearInstancePool(); + CcFilesPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcFiles or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcFiles object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcFilesPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcFiles) { // it's a model object + // invalidate the cache for this single object + CcFilesPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcFilesPeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcFilesPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcFilesPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcFiles object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcFiles $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcFiles $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcFilesPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcFilesPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcFilesPeer::DATABASE_NAME, CcFilesPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcFiles + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcFilesPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcFilesPeer::DATABASE_NAME); + $criteria->add(CcFilesPeer::ID, $pk); + + $v = CcFilesPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcFilesPeer::DATABASE_NAME); + $criteria->add(CcFilesPeer::ID, $pks, Criteria::IN); + $objs = CcFilesPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcFilesPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcFilesPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcFilesQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcFilesQuery.php new file mode 100644 index 000000000..36c5f71ed --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcFilesQuery.php @@ -0,0 +1,2094 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcFiles|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcFilesPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcFilesPeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcFilesPeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * @param int|array $dbId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbId($dbId = null, $comparison = null) + { + if (is_array($dbId) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcFilesPeer::ID, $dbId, $comparison); + } + + /** + * Filter the query on the gunid column + * + * @param string $dbGunid The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbGunid($dbGunid = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbGunid)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbGunid)) { + $dbGunid = str_replace('*', '%', $dbGunid); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::GUNID, $dbGunid, $comparison); + } + + /** + * Filter the query on the name column + * + * @param string $dbName The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbName($dbName = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbName)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbName)) { + $dbName = str_replace('*', '%', $dbName); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::NAME, $dbName, $comparison); + } + + /** + * Filter the query on the mime column + * + * @param string $dbMime The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbMime($dbMime = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbMime)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbMime)) { + $dbMime = str_replace('*', '%', $dbMime); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::MIME, $dbMime, $comparison); + } + + /** + * Filter the query on the ftype column + * + * @param string $dbFtype The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbFtype($dbFtype = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbFtype)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbFtype)) { + $dbFtype = str_replace('*', '%', $dbFtype); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::FTYPE, $dbFtype, $comparison); + } + + /** + * Filter the query on the directory column + * + * @param int|array $dbDirectory 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 CcFilesQuery The current query, for fluid interface + */ + public function filterByDbDirectory($dbDirectory = null, $comparison = null) + { + if (is_array($dbDirectory)) { + $useMinMax = false; + if (isset($dbDirectory['min'])) { + $this->addUsingAlias(CcFilesPeer::DIRECTORY, $dbDirectory['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbDirectory['max'])) { + $this->addUsingAlias(CcFilesPeer::DIRECTORY, $dbDirectory['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcFilesPeer::DIRECTORY, $dbDirectory, $comparison); + } + + /** + * Filter the query on the filepath column + * + * @param string $dbFilepath The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbFilepath($dbFilepath = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbFilepath)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbFilepath)) { + $dbFilepath = str_replace('*', '%', $dbFilepath); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::FILEPATH, $dbFilepath, $comparison); + } + + /** + * Filter the query on the state column + * + * @param string $dbState The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbState($dbState = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbState)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbState)) { + $dbState = str_replace('*', '%', $dbState); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::STATE, $dbState, $comparison); + } + + /** + * Filter the query on the currentlyaccessing column + * + * @param int|array $dbCurrentlyaccessing 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 CcFilesQuery The current query, for fluid interface + */ + public function filterByDbCurrentlyaccessing($dbCurrentlyaccessing = null, $comparison = null) + { + if (is_array($dbCurrentlyaccessing)) { + $useMinMax = false; + if (isset($dbCurrentlyaccessing['min'])) { + $this->addUsingAlias(CcFilesPeer::CURRENTLYACCESSING, $dbCurrentlyaccessing['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbCurrentlyaccessing['max'])) { + $this->addUsingAlias(CcFilesPeer::CURRENTLYACCESSING, $dbCurrentlyaccessing['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcFilesPeer::CURRENTLYACCESSING, $dbCurrentlyaccessing, $comparison); + } + + /** + * Filter the query on the editedby column + * + * @param int|array $dbEditedby 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 CcFilesQuery The current query, for fluid interface + */ + public function filterByDbEditedby($dbEditedby = null, $comparison = null) + { + if (is_array($dbEditedby)) { + $useMinMax = false; + if (isset($dbEditedby['min'])) { + $this->addUsingAlias(CcFilesPeer::EDITEDBY, $dbEditedby['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbEditedby['max'])) { + $this->addUsingAlias(CcFilesPeer::EDITEDBY, $dbEditedby['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcFilesPeer::EDITEDBY, $dbEditedby, $comparison); + } + + /** + * Filter the query on the mtime column + * + * @param string|array $dbMtime 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 CcFilesQuery The current query, for fluid interface + */ + public function filterByDbMtime($dbMtime = null, $comparison = null) + { + if (is_array($dbMtime)) { + $useMinMax = false; + if (isset($dbMtime['min'])) { + $this->addUsingAlias(CcFilesPeer::MTIME, $dbMtime['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbMtime['max'])) { + $this->addUsingAlias(CcFilesPeer::MTIME, $dbMtime['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcFilesPeer::MTIME, $dbMtime, $comparison); + } + + /** + * Filter the query on the md5 column + * + * @param string $dbMd5 The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbMd5($dbMd5 = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbMd5)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbMd5)) { + $dbMd5 = str_replace('*', '%', $dbMd5); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::MD5, $dbMd5, $comparison); + } + + /** + * Filter the query on the track_title column + * + * @param string $dbTrackTitle The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbTrackTitle($dbTrackTitle = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbTrackTitle)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbTrackTitle)) { + $dbTrackTitle = str_replace('*', '%', $dbTrackTitle); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::TRACK_TITLE, $dbTrackTitle, $comparison); + } + + /** + * Filter the query on the artist_name column + * + * @param string $dbArtistName The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbArtistName($dbArtistName = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbArtistName)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbArtistName)) { + $dbArtistName = str_replace('*', '%', $dbArtistName); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::ARTIST_NAME, $dbArtistName, $comparison); + } + + /** + * Filter the query on the bit_rate column + * + * @param string $dbBitRate The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbBitRate($dbBitRate = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbBitRate)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbBitRate)) { + $dbBitRate = str_replace('*', '%', $dbBitRate); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::BIT_RATE, $dbBitRate, $comparison); + } + + /** + * Filter the query on the sample_rate column + * + * @param string $dbSampleRate The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbSampleRate($dbSampleRate = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbSampleRate)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbSampleRate)) { + $dbSampleRate = str_replace('*', '%', $dbSampleRate); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::SAMPLE_RATE, $dbSampleRate, $comparison); + } + + /** + * Filter the query on the format column + * + * @param string $dbFormat The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbFormat($dbFormat = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbFormat)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbFormat)) { + $dbFormat = str_replace('*', '%', $dbFormat); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::FORMAT, $dbFormat, $comparison); + } + + /** + * Filter the query on the length column + * + * @param string|array $dbLength 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 CcFilesQuery The current query, for fluid interface + */ + public function filterByDbLength($dbLength = null, $comparison = null) + { + if (is_array($dbLength)) { + $useMinMax = false; + if (isset($dbLength['min'])) { + $this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbLength['max'])) { + $this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength, $comparison); + } + + /** + * Filter the query on the album_title column + * + * @param string $dbAlbumTitle The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbAlbumTitle($dbAlbumTitle = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbAlbumTitle)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbAlbumTitle)) { + $dbAlbumTitle = str_replace('*', '%', $dbAlbumTitle); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::ALBUM_TITLE, $dbAlbumTitle, $comparison); + } + + /** + * Filter the query on the genre column + * + * @param string $dbGenre The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbGenre($dbGenre = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbGenre)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbGenre)) { + $dbGenre = str_replace('*', '%', $dbGenre); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::GENRE, $dbGenre, $comparison); + } + + /** + * Filter the query on the comments column + * + * @param string $dbComments The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbComments($dbComments = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbComments)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbComments)) { + $dbComments = str_replace('*', '%', $dbComments); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::COMMENTS, $dbComments, $comparison); + } + + /** + * Filter the query on the year column + * + * @param string $dbYear The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbYear($dbYear = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbYear)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbYear)) { + $dbYear = str_replace('*', '%', $dbYear); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::YEAR, $dbYear, $comparison); + } + + /** + * Filter the query on the track_number column + * + * @param int|array $dbTrackNumber 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 CcFilesQuery The current query, for fluid interface + */ + public function filterByDbTrackNumber($dbTrackNumber = null, $comparison = null) + { + if (is_array($dbTrackNumber)) { + $useMinMax = false; + if (isset($dbTrackNumber['min'])) { + $this->addUsingAlias(CcFilesPeer::TRACK_NUMBER, $dbTrackNumber['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbTrackNumber['max'])) { + $this->addUsingAlias(CcFilesPeer::TRACK_NUMBER, $dbTrackNumber['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcFilesPeer::TRACK_NUMBER, $dbTrackNumber, $comparison); + } + + /** + * Filter the query on the channels column + * + * @param int|array $dbChannels 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 CcFilesQuery The current query, for fluid interface + */ + public function filterByDbChannels($dbChannels = null, $comparison = null) + { + if (is_array($dbChannels)) { + $useMinMax = false; + if (isset($dbChannels['min'])) { + $this->addUsingAlias(CcFilesPeer::CHANNELS, $dbChannels['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbChannels['max'])) { + $this->addUsingAlias(CcFilesPeer::CHANNELS, $dbChannels['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcFilesPeer::CHANNELS, $dbChannels, $comparison); + } + + /** + * Filter the query on the url column + * + * @param string $dbUrl The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbUrl($dbUrl = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbUrl)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbUrl)) { + $dbUrl = str_replace('*', '%', $dbUrl); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::URL, $dbUrl, $comparison); + } + + /** + * Filter the query on the bpm column + * + * @param string $dbBpm The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbBpm($dbBpm = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbBpm)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbBpm)) { + $dbBpm = str_replace('*', '%', $dbBpm); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::BPM, $dbBpm, $comparison); + } + + /** + * Filter the query on the rating column + * + * @param string $dbRating The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbRating($dbRating = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbRating)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbRating)) { + $dbRating = str_replace('*', '%', $dbRating); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::RATING, $dbRating, $comparison); + } + + /** + * Filter the query on the encoded_by column + * + * @param string $dbEncodedBy The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbEncodedBy($dbEncodedBy = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbEncodedBy)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbEncodedBy)) { + $dbEncodedBy = str_replace('*', '%', $dbEncodedBy); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::ENCODED_BY, $dbEncodedBy, $comparison); + } + + /** + * Filter the query on the disc_number column + * + * @param string $dbDiscNumber The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbDiscNumber($dbDiscNumber = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbDiscNumber)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbDiscNumber)) { + $dbDiscNumber = str_replace('*', '%', $dbDiscNumber); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::DISC_NUMBER, $dbDiscNumber, $comparison); + } + + /** + * Filter the query on the mood column + * + * @param string $dbMood The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbMood($dbMood = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbMood)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbMood)) { + $dbMood = str_replace('*', '%', $dbMood); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::MOOD, $dbMood, $comparison); + } + + /** + * Filter the query on the label column + * + * @param string $dbLabel The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbLabel($dbLabel = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbLabel)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbLabel)) { + $dbLabel = str_replace('*', '%', $dbLabel); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::LABEL, $dbLabel, $comparison); + } + + /** + * Filter the query on the composer column + * + * @param string $dbComposer The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbComposer($dbComposer = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbComposer)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbComposer)) { + $dbComposer = str_replace('*', '%', $dbComposer); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::COMPOSER, $dbComposer, $comparison); + } + + /** + * Filter the query on the encoder column + * + * @param string $dbEncoder The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbEncoder($dbEncoder = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbEncoder)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbEncoder)) { + $dbEncoder = str_replace('*', '%', $dbEncoder); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::ENCODER, $dbEncoder, $comparison); + } + + /** + * Filter the query on the checksum column + * + * @param string $dbChecksum The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbChecksum($dbChecksum = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbChecksum)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbChecksum)) { + $dbChecksum = str_replace('*', '%', $dbChecksum); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::CHECKSUM, $dbChecksum, $comparison); + } + + /** + * Filter the query on the lyrics column + * + * @param string $dbLyrics The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbLyrics($dbLyrics = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbLyrics)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbLyrics)) { + $dbLyrics = str_replace('*', '%', $dbLyrics); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::LYRICS, $dbLyrics, $comparison); + } + + /** + * Filter the query on the orchestra column + * + * @param string $dbOrchestra The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbOrchestra($dbOrchestra = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbOrchestra)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbOrchestra)) { + $dbOrchestra = str_replace('*', '%', $dbOrchestra); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::ORCHESTRA, $dbOrchestra, $comparison); + } + + /** + * Filter the query on the conductor column + * + * @param string $dbConductor The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbConductor($dbConductor = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbConductor)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbConductor)) { + $dbConductor = str_replace('*', '%', $dbConductor); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::CONDUCTOR, $dbConductor, $comparison); + } + + /** + * Filter the query on the lyricist column + * + * @param string $dbLyricist The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbLyricist($dbLyricist = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbLyricist)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbLyricist)) { + $dbLyricist = str_replace('*', '%', $dbLyricist); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::LYRICIST, $dbLyricist, $comparison); + } + + /** + * Filter the query on the original_lyricist column + * + * @param string $dbOriginalLyricist The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbOriginalLyricist($dbOriginalLyricist = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbOriginalLyricist)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbOriginalLyricist)) { + $dbOriginalLyricist = str_replace('*', '%', $dbOriginalLyricist); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::ORIGINAL_LYRICIST, $dbOriginalLyricist, $comparison); + } + + /** + * Filter the query on the radio_station_name column + * + * @param string $dbRadioStationName The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbRadioStationName($dbRadioStationName = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbRadioStationName)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbRadioStationName)) { + $dbRadioStationName = str_replace('*', '%', $dbRadioStationName); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::RADIO_STATION_NAME, $dbRadioStationName, $comparison); + } + + /** + * Filter the query on the info_url column + * + * @param string $dbInfoUrl The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbInfoUrl($dbInfoUrl = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbInfoUrl)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbInfoUrl)) { + $dbInfoUrl = str_replace('*', '%', $dbInfoUrl); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::INFO_URL, $dbInfoUrl, $comparison); + } + + /** + * Filter the query on the artist_url column + * + * @param string $dbArtistUrl The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbArtistUrl($dbArtistUrl = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbArtistUrl)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbArtistUrl)) { + $dbArtistUrl = str_replace('*', '%', $dbArtistUrl); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::ARTIST_URL, $dbArtistUrl, $comparison); + } + + /** + * Filter the query on the audio_source_url column + * + * @param string $dbAudioSourceUrl The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbAudioSourceUrl($dbAudioSourceUrl = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbAudioSourceUrl)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbAudioSourceUrl)) { + $dbAudioSourceUrl = str_replace('*', '%', $dbAudioSourceUrl); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::AUDIO_SOURCE_URL, $dbAudioSourceUrl, $comparison); + } + + /** + * Filter the query on the radio_station_url column + * + * @param string $dbRadioStationUrl The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbRadioStationUrl($dbRadioStationUrl = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbRadioStationUrl)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbRadioStationUrl)) { + $dbRadioStationUrl = str_replace('*', '%', $dbRadioStationUrl); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::RADIO_STATION_URL, $dbRadioStationUrl, $comparison); + } + + /** + * Filter the query on the buy_this_url column + * + * @param string $dbBuyThisUrl The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbBuyThisUrl($dbBuyThisUrl = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbBuyThisUrl)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbBuyThisUrl)) { + $dbBuyThisUrl = str_replace('*', '%', $dbBuyThisUrl); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::BUY_THIS_URL, $dbBuyThisUrl, $comparison); + } + + /** + * Filter the query on the isrc_number column + * + * @param string $dbIsrcNumber The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbIsrcNumber($dbIsrcNumber = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbIsrcNumber)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbIsrcNumber)) { + $dbIsrcNumber = str_replace('*', '%', $dbIsrcNumber); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::ISRC_NUMBER, $dbIsrcNumber, $comparison); + } + + /** + * Filter the query on the catalog_number column + * + * @param string $dbCatalogNumber The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbCatalogNumber($dbCatalogNumber = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbCatalogNumber)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbCatalogNumber)) { + $dbCatalogNumber = str_replace('*', '%', $dbCatalogNumber); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::CATALOG_NUMBER, $dbCatalogNumber, $comparison); + } + + /** + * Filter the query on the original_artist column + * + * @param string $dbOriginalArtist The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbOriginalArtist($dbOriginalArtist = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbOriginalArtist)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbOriginalArtist)) { + $dbOriginalArtist = str_replace('*', '%', $dbOriginalArtist); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::ORIGINAL_ARTIST, $dbOriginalArtist, $comparison); + } + + /** + * Filter the query on the copyright column + * + * @param string $dbCopyright The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbCopyright($dbCopyright = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbCopyright)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbCopyright)) { + $dbCopyright = str_replace('*', '%', $dbCopyright); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::COPYRIGHT, $dbCopyright, $comparison); + } + + /** + * Filter the query on the report_datetime column + * + * @param string $dbReportDatetime The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbReportDatetime($dbReportDatetime = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbReportDatetime)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbReportDatetime)) { + $dbReportDatetime = str_replace('*', '%', $dbReportDatetime); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::REPORT_DATETIME, $dbReportDatetime, $comparison); + } + + /** + * Filter the query on the report_location column + * + * @param string $dbReportLocation The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbReportLocation($dbReportLocation = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbReportLocation)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbReportLocation)) { + $dbReportLocation = str_replace('*', '%', $dbReportLocation); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::REPORT_LOCATION, $dbReportLocation, $comparison); + } + + /** + * Filter the query on the report_organization column + * + * @param string $dbReportOrganization The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbReportOrganization($dbReportOrganization = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbReportOrganization)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbReportOrganization)) { + $dbReportOrganization = str_replace('*', '%', $dbReportOrganization); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::REPORT_ORGANIZATION, $dbReportOrganization, $comparison); + } + + /** + * Filter the query on the subject column + * + * @param string $dbSubject The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbSubject($dbSubject = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbSubject)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbSubject)) { + $dbSubject = str_replace('*', '%', $dbSubject); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::SUBJECT, $dbSubject, $comparison); + } + + /** + * Filter the query on the contributor column + * + * @param string $dbContributor The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbContributor($dbContributor = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbContributor)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbContributor)) { + $dbContributor = str_replace('*', '%', $dbContributor); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::CONTRIBUTOR, $dbContributor, $comparison); + } + + /** + * Filter the query on the language column + * + * @param string $dbLanguage The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbLanguage($dbLanguage = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbLanguage)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbLanguage)) { + $dbLanguage = str_replace('*', '%', $dbLanguage); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::LANGUAGE, $dbLanguage, $comparison); + } + + /** + * Filter the query on the soundcloud_id column + * + * @param int|array $dbSoundcloudId 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 CcFilesQuery The current query, for fluid interface + */ + public function filterByDbSoundcloudId($dbSoundcloudId = null, $comparison = null) + { + if (is_array($dbSoundcloudId)) { + $useMinMax = false; + if (isset($dbSoundcloudId['min'])) { + $this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_ID, $dbSoundcloudId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbSoundcloudId['max'])) { + $this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_ID, $dbSoundcloudId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_ID, $dbSoundcloudId, $comparison); + } + + /** + * Filter the query on the soundcloud_error_code column + * + * @param int|array $dbSoundcloudErrorCode 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 CcFilesQuery The current query, for fluid interface + */ + public function filterByDbSoundcloudErrorCode($dbSoundcloudErrorCode = null, $comparison = null) + { + if (is_array($dbSoundcloudErrorCode)) { + $useMinMax = false; + if (isset($dbSoundcloudErrorCode['min'])) { + $this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_ERROR_CODE, $dbSoundcloudErrorCode['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbSoundcloudErrorCode['max'])) { + $this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_ERROR_CODE, $dbSoundcloudErrorCode['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_ERROR_CODE, $dbSoundcloudErrorCode, $comparison); + } + + /** + * Filter the query on the soundcloud_error_msg column + * + * @param string $dbSoundcloudErrorMsg The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbSoundcloudErrorMsg($dbSoundcloudErrorMsg = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbSoundcloudErrorMsg)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbSoundcloudErrorMsg)) { + $dbSoundcloudErrorMsg = str_replace('*', '%', $dbSoundcloudErrorMsg); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_ERROR_MSG, $dbSoundcloudErrorMsg, $comparison); + } + + /** + * Filter the query on the soundcloud_link_to_file column + * + * @param string $dbSoundcloudLinkToFile The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbSoundcloudLinkToFile($dbSoundcloudLinkToFile = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbSoundcloudLinkToFile)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbSoundcloudLinkToFile)) { + $dbSoundcloudLinkToFile = str_replace('*', '%', $dbSoundcloudLinkToFile); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE, $dbSoundcloudLinkToFile, $comparison); + } + + /** + * Filter the query by a related CcSubjs object + * + * @param CcSubjs $ccSubjs the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByCcSubjs($ccSubjs, $comparison = null) + { + return $this + ->addUsingAlias(CcFilesPeer::EDITEDBY, $ccSubjs->getDbId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcSubjs relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function joinCcSubjs($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcSubjs'); + + // 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, 'CcSubjs'); + } + + return $this; + } + + /** + * Use the CcSubjs relation CcSubjs 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 CcSubjsQuery A secondary query class using the current class as primary query + */ + public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcSubjs($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); + } + + /** + * Filter the query by a related CcMusicDirs object + * + * @param CcMusicDirs $ccMusicDirs the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByCcMusicDirs($ccMusicDirs, $comparison = null) + { + return $this + ->addUsingAlias(CcFilesPeer::DIRECTORY, $ccMusicDirs->getId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcMusicDirs relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function joinCcMusicDirs($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcMusicDirs'); + + // 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, 'CcMusicDirs'); + } + + return $this; + } + + /** + * Use the CcMusicDirs relation CcMusicDirs 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 CcMusicDirsQuery A secondary query class using the current class as primary query + */ + public function useCcMusicDirsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcMusicDirs($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcMusicDirs', 'CcMusicDirsQuery'); + } + + /** + * Filter the query by a related CcShowInstances object + * + * @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 CcFilesQuery The current query, for fluid interface + */ + public function filterByCcShowInstances($ccShowInstances, $comparison = null) + { + return $this + ->addUsingAlias(CcFilesPeer::ID, $ccShowInstances->getDbRecordedFile(), $comparison); + } + + /** + * 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 CcFilesQuery The current query, for fluid interface + */ + public function joinCcShowInstances($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShowInstances'); + + // 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, 'CcShowInstances'); + } + + return $this; + } + + /** + * Use the CcShowInstances relation CcShowInstances 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 CcShowInstancesQuery A secondary query class using the current class as primary query + */ + public function useCcShowInstancesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcShowInstances($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShowInstances', 'CcShowInstancesQuery'); + } + + /** + * Filter the query by a related CcPlaylistcontents object + * + * @param CcPlaylistcontents $ccPlaylistcontents the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByCcPlaylistcontents($ccPlaylistcontents, $comparison = null) + { + return $this + ->addUsingAlias(CcFilesPeer::ID, $ccPlaylistcontents->getDbFileId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcPlaylistcontents relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function joinCcPlaylistcontents($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcPlaylistcontents'); + + // 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, 'CcPlaylistcontents'); + } + + return $this; + } + + /** + * Use the CcPlaylistcontents relation CcPlaylistcontents 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 CcPlaylistcontentsQuery A secondary query class using the current class as primary query + */ + public function useCcPlaylistcontentsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcPlaylistcontents($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcPlaylistcontents', 'CcPlaylistcontentsQuery'); + } + + /** + * Filter the query by a related CcSchedule object + * + * @param CcSchedule $ccSchedule the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByCcSchedule($ccSchedule, $comparison = null) + { + return $this + ->addUsingAlias(CcFilesPeer::ID, $ccSchedule->getDbFileId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcSchedule relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function joinCcSchedule($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcSchedule'); + + // 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, 'CcSchedule'); + } + + return $this; + } + + /** + * Use the CcSchedule relation CcSchedule 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 CcScheduleQuery A secondary query class using the current class as primary query + */ + public function useCcScheduleQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcSchedule($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery'); + } + + /** + * Exclude object from result + * + * @param CcFiles $ccFiles Object to remove from the list of results + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function prune($ccFiles = null) + { + if ($ccFiles) { + $this->addUsingAlias(CcFilesPeer::ID, $ccFiles->getDbId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcFilesQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcLoginAttempts.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcLoginAttempts.php new file mode 100644 index 000000000..b529e12d5 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcLoginAttempts.php @@ -0,0 +1,735 @@ +attempts = 0; + } + + /** + * Initializes internal state of BaseCcLoginAttempts object. + * @see applyDefaults() + */ + public function __construct() + { + parent::__construct(); + $this->applyDefaultValues(); + } + + /** + * Get the [ip] column value. + * + * @return string + */ + public function getDbIP() + { + return $this->ip; + } + + /** + * Get the [attempts] column value. + * + * @return int + */ + public function getDbAttempts() + { + return $this->attempts; + } + + /** + * Set the value of [ip] column. + * + * @param string $v new value + * @return CcLoginAttempts The current object (for fluent API support) + */ + public function setDbIP($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->ip !== $v) { + $this->ip = $v; + $this->modifiedColumns[] = CcLoginAttemptsPeer::IP; + } + + return $this; + } // setDbIP() + + /** + * Set the value of [attempts] column. + * + * @param int $v new value + * @return CcLoginAttempts The current object (for fluent API support) + */ + public function setDbAttempts($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->attempts !== $v || $this->isNew()) { + $this->attempts = $v; + $this->modifiedColumns[] = CcLoginAttemptsPeer::ATTEMPTS; + } + + return $this; + } // setDbAttempts() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + if ($this->attempts !== 0) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->ip = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null; + $this->attempts = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 2; // 2 = CcLoginAttemptsPeer::NUM_COLUMNS - CcLoginAttemptsPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcLoginAttempts object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcLoginAttemptsPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcLoginAttemptsQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcLoginAttemptsPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows = 1; + $this->setNew(false); + } else { + $affectedRows = CcLoginAttemptsPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = CcLoginAttemptsPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcLoginAttemptsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getDbIP(); + break; + case 1: + return $this->getDbAttempts(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = CcLoginAttemptsPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbIP(), + $keys[1] => $this->getDbAttempts(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcLoginAttemptsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setDbIP($value); + break; + case 1: + $this->setDbAttempts($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcLoginAttemptsPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbIP($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbAttempts($arr[$keys[1]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcLoginAttemptsPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcLoginAttemptsPeer::IP)) $criteria->add(CcLoginAttemptsPeer::IP, $this->ip); + if ($this->isColumnModified(CcLoginAttemptsPeer::ATTEMPTS)) $criteria->add(CcLoginAttemptsPeer::ATTEMPTS, $this->attempts); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcLoginAttemptsPeer::DATABASE_NAME); + $criteria->add(CcLoginAttemptsPeer::IP, $this->ip); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return string + */ + public function getPrimaryKey() + { + return $this->getDbIP(); + } + + /** + * Generic method to set the primary key (ip column). + * + * @param string $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbIP($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getDbIP(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcLoginAttempts (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setDbIP($this->ip); + $copyObj->setDbAttempts($this->attempts); + + $copyObj->setNew(true); + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcLoginAttempts Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcLoginAttemptsPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcLoginAttemptsPeer(); + } + return self::$peer; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->ip = null; + $this->attempts = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->applyDefaultValues(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcLoginAttempts diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcLoginAttemptsPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcLoginAttemptsPeer.php new file mode 100644 index 000000000..27b4cd90c --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcLoginAttemptsPeer.php @@ -0,0 +1,735 @@ + array ('DbIP', 'DbAttempts', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbIP', 'dbAttempts', ), + BasePeer::TYPE_COLNAME => array (self::IP, self::ATTEMPTS, ), + BasePeer::TYPE_RAW_COLNAME => array ('IP', 'ATTEMPTS', ), + BasePeer::TYPE_FIELDNAME => array ('ip', 'attempts', ), + BasePeer::TYPE_NUM => array (0, 1, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbIP' => 0, 'DbAttempts' => 1, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbIP' => 0, 'dbAttempts' => 1, ), + BasePeer::TYPE_COLNAME => array (self::IP => 0, self::ATTEMPTS => 1, ), + BasePeer::TYPE_RAW_COLNAME => array ('IP' => 0, 'ATTEMPTS' => 1, ), + BasePeer::TYPE_FIELDNAME => array ('ip' => 0, 'attempts' => 1, ), + BasePeer::TYPE_NUM => array (0, 1, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcLoginAttemptsPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcLoginAttemptsPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcLoginAttemptsPeer::IP); + $criteria->addSelectColumn(CcLoginAttemptsPeer::ATTEMPTS); + } else { + $criteria->addSelectColumn($alias . '.IP'); + $criteria->addSelectColumn($alias . '.ATTEMPTS'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcLoginAttemptsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcLoginAttemptsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcLoginAttempts + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcLoginAttemptsPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcLoginAttemptsPeer::populateObjects(CcLoginAttemptsPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcLoginAttemptsPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcLoginAttempts $value A CcLoginAttempts object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcLoginAttempts $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbIP(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcLoginAttempts object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcLoginAttempts) { + $key = (string) $value->getDbIP(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcLoginAttempts object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcLoginAttempts Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_login_attempts + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (string) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcLoginAttemptsPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcLoginAttemptsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcLoginAttemptsPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcLoginAttemptsPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcLoginAttempts object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcLoginAttemptsPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcLoginAttemptsPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcLoginAttemptsPeer::NUM_COLUMNS; + } else { + $cls = CcLoginAttemptsPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcLoginAttemptsPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcLoginAttemptsPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcLoginAttemptsPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcLoginAttemptsTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcLoginAttemptsPeer::CLASS_DEFAULT : CcLoginAttemptsPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcLoginAttempts or Criteria object. + * + * @param mixed $values Criteria or CcLoginAttempts object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcLoginAttempts object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcLoginAttempts or Criteria object. + * + * @param mixed $values Criteria or CcLoginAttempts object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcLoginAttemptsPeer::IP); + $value = $criteria->remove(CcLoginAttemptsPeer::IP); + if ($value) { + $selectCriteria->add(CcLoginAttemptsPeer::IP, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcLoginAttemptsPeer::TABLE_NAME); + } + + } else { // $values is CcLoginAttempts object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_login_attempts table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcLoginAttemptsPeer::TABLE_NAME, $con, CcLoginAttemptsPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcLoginAttemptsPeer::clearInstancePool(); + CcLoginAttemptsPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcLoginAttempts or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcLoginAttempts object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcLoginAttemptsPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcLoginAttempts) { // it's a model object + // invalidate the cache for this single object + CcLoginAttemptsPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcLoginAttemptsPeer::IP, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcLoginAttemptsPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcLoginAttemptsPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcLoginAttempts object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcLoginAttempts $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcLoginAttempts $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcLoginAttemptsPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcLoginAttemptsPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcLoginAttemptsPeer::DATABASE_NAME, CcLoginAttemptsPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param string $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcLoginAttempts + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcLoginAttemptsPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcLoginAttemptsPeer::DATABASE_NAME); + $criteria->add(CcLoginAttemptsPeer::IP, $pk); + + $v = CcLoginAttemptsPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcLoginAttemptsPeer::DATABASE_NAME); + $criteria->add(CcLoginAttemptsPeer::IP, $pks, Criteria::IN); + $objs = CcLoginAttemptsPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcLoginAttemptsPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcLoginAttemptsPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcLoginAttemptsQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcLoginAttemptsQuery.php new file mode 100644 index 000000000..930f32eda --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcLoginAttemptsQuery.php @@ -0,0 +1,205 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcLoginAttempts|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcLoginAttemptsPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcLoginAttemptsQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcLoginAttemptsPeer::IP, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcLoginAttemptsQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcLoginAttemptsPeer::IP, $keys, Criteria::IN); + } + + /** + * Filter the query on the ip column + * + * @param string $dbIP The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcLoginAttemptsQuery The current query, for fluid interface + */ + public function filterByDbIP($dbIP = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbIP)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbIP)) { + $dbIP = str_replace('*', '%', $dbIP); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcLoginAttemptsPeer::IP, $dbIP, $comparison); + } + + /** + * Filter the query on the attempts column + * + * @param int|array $dbAttempts 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 CcLoginAttemptsQuery The current query, for fluid interface + */ + public function filterByDbAttempts($dbAttempts = null, $comparison = null) + { + if (is_array($dbAttempts)) { + $useMinMax = false; + if (isset($dbAttempts['min'])) { + $this->addUsingAlias(CcLoginAttemptsPeer::ATTEMPTS, $dbAttempts['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbAttempts['max'])) { + $this->addUsingAlias(CcLoginAttemptsPeer::ATTEMPTS, $dbAttempts['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcLoginAttemptsPeer::ATTEMPTS, $dbAttempts, $comparison); + } + + /** + * Exclude object from result + * + * @param CcLoginAttempts $ccLoginAttempts Object to remove from the list of results + * + * @return CcLoginAttemptsQuery The current query, for fluid interface + */ + public function prune($ccLoginAttempts = null) + { + if ($ccLoginAttempts) { + $this->addUsingAlias(CcLoginAttemptsPeer::IP, $ccLoginAttempts->getDbIP(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcLoginAttemptsQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcMusicDirs.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcMusicDirs.php new file mode 100644 index 000000000..8458eed2f --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcMusicDirs.php @@ -0,0 +1,941 @@ +id; + } + + /** + * Get the [directory] column value. + * + * @return string + */ + public function getDirectory() + { + return $this->directory; + } + + /** + * Get the [type] column value. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return CcMusicDirs The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CcMusicDirsPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [directory] column. + * + * @param string $v new value + * @return CcMusicDirs The current object (for fluent API support) + */ + public function setDirectory($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->directory !== $v) { + $this->directory = $v; + $this->modifiedColumns[] = CcMusicDirsPeer::DIRECTORY; + } + + return $this; + } // setDirectory() + + /** + * Set the value of [type] column. + * + * @param string $v new value + * @return CcMusicDirs The current object (for fluent API support) + */ + public function setType($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->type !== $v) { + $this->type = $v; + $this->modifiedColumns[] = CcMusicDirsPeer::TYPE; + } + + return $this; + } // setType() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->directory = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->type = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 3; // 3 = CcMusicDirsPeer::NUM_COLUMNS - CcMusicDirsPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcMusicDirs object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcMusicDirsPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->collCcFiless = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcMusicDirsQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcMusicDirsPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() ) { + $this->modifiedColumns[] = CcMusicDirsPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + if ($criteria->keyContainsValue(CcMusicDirsPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcMusicDirsPeer::ID.')'); + } + + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows = 1; + $this->setId($pk); //[IMV] update autoincrement primary key + $this->setNew(false); + } else { + $affectedRows = CcMusicDirsPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collCcFiless !== null) { + foreach ($this->collCcFiless as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = CcMusicDirsPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collCcFiless !== null) { + foreach ($this->collCcFiless as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcMusicDirsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getDirectory(); + break; + case 2: + return $this->getType(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = CcMusicDirsPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getDirectory(), + $keys[2] => $this->getType(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcMusicDirsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setId($value); + break; + case 1: + $this->setDirectory($value); + break; + case 2: + $this->setType($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcMusicDirsPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDirectory($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcMusicDirsPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcMusicDirsPeer::ID)) $criteria->add(CcMusicDirsPeer::ID, $this->id); + if ($this->isColumnModified(CcMusicDirsPeer::DIRECTORY)) $criteria->add(CcMusicDirsPeer::DIRECTORY, $this->directory); + if ($this->isColumnModified(CcMusicDirsPeer::TYPE)) $criteria->add(CcMusicDirsPeer::TYPE, $this->type); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcMusicDirsPeer::DATABASE_NAME); + $criteria->add(CcMusicDirsPeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcMusicDirs (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setDirectory($this->directory); + $copyObj->setType($this->type); + + 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->getCcFiless() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcFiles($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcMusicDirs Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcMusicDirsPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcMusicDirsPeer(); + } + return self::$peer; + } + + /** + * Clears out the collCcFiless 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 addCcFiless() + */ + public function clearCcFiless() + { + $this->collCcFiless = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcFiless collection. + * + * By default this just sets the collCcFiless collection to an empty array (like clearcollCcFiless()); + * 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 initCcFiless() + { + $this->collCcFiless = new PropelObjectCollection(); + $this->collCcFiless->setModel('CcFiles'); + } + + /** + * Gets an array of CcFiles 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 CcMusicDirs 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 CcFiles[] List of CcFiles objects + * @throws PropelException + */ + public function getCcFiless($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcFiless || null !== $criteria) { + if ($this->isNew() && null === $this->collCcFiless) { + // return empty collection + $this->initCcFiless(); + } else { + $collCcFiless = CcFilesQuery::create(null, $criteria) + ->filterByCcMusicDirs($this) + ->find($con); + if (null !== $criteria) { + return $collCcFiless; + } + $this->collCcFiless = $collCcFiless; + } + } + return $this->collCcFiless; + } + + /** + * Returns the number of related CcFiles objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcFiles objects. + * @throws PropelException + */ + public function countCcFiless(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcFiless || null !== $criteria) { + if ($this->isNew() && null === $this->collCcFiless) { + return 0; + } else { + $query = CcFilesQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcMusicDirs($this) + ->count($con); + } + } else { + return count($this->collCcFiless); + } + } + + /** + * Method called to associate a CcFiles object to this object + * through the CcFiles foreign key attribute. + * + * @param CcFiles $l CcFiles + * @return void + * @throws PropelException + */ + public function addCcFiles(CcFiles $l) + { + if ($this->collCcFiless === null) { + $this->initCcFiless(); + } + if (!$this->collCcFiless->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcFiless[]= $l; + $l->setCcMusicDirs($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcMusicDirs is new, it will return + * an empty collection; or if this CcMusicDirs has previously + * been saved, it will retrieve related CcFiless from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcMusicDirs. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcFiles[] List of CcFiles objects + */ + public function getCcFilessJoinCcSubjs($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcFilesQuery::create(null, $criteria); + $query->joinWith('CcSubjs', $join_behavior); + + return $this->getCcFiless($query, $con); + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->directory = null; + $this->type = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collCcFiless) { + foreach ((array) $this->collCcFiless as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collCcFiless = null; + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcMusicDirs diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcMusicDirsPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcMusicDirsPeer.php new file mode 100644 index 000000000..5d06e270d --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcMusicDirsPeer.php @@ -0,0 +1,747 @@ + array ('Id', 'Directory', 'Type', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'directory', 'type', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::DIRECTORY, self::TYPE, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'DIRECTORY', 'TYPE', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'directory', 'type', ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Directory' => 1, 'Type' => 2, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'directory' => 1, 'type' => 2, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::DIRECTORY => 1, self::TYPE => 2, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'DIRECTORY' => 1, 'TYPE' => 2, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'directory' => 1, 'type' => 2, ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcMusicDirsPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcMusicDirsPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcMusicDirsPeer::ID); + $criteria->addSelectColumn(CcMusicDirsPeer::DIRECTORY); + $criteria->addSelectColumn(CcMusicDirsPeer::TYPE); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.DIRECTORY'); + $criteria->addSelectColumn($alias . '.TYPE'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcMusicDirsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcMusicDirsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcMusicDirs + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcMusicDirsPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcMusicDirsPeer::populateObjects(CcMusicDirsPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcMusicDirsPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcMusicDirs $value A CcMusicDirs object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcMusicDirs $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcMusicDirs object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcMusicDirs) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcMusicDirs object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcMusicDirs Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_music_dirs + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + // Invalidate objects in CcFilesPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcFilesPeer::clearInstancePool(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcMusicDirsPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcMusicDirsPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcMusicDirsPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcMusicDirs object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcMusicDirsPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcMusicDirsPeer::NUM_COLUMNS; + } else { + $cls = CcMusicDirsPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcMusicDirsPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcMusicDirsPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcMusicDirsPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcMusicDirsTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcMusicDirsPeer::CLASS_DEFAULT : CcMusicDirsPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcMusicDirs or Criteria object. + * + * @param mixed $values Criteria or CcMusicDirs object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcMusicDirs object + } + + if ($criteria->containsKey(CcMusicDirsPeer::ID) && $criteria->keyContainsValue(CcMusicDirsPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcMusicDirsPeer::ID.')'); + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcMusicDirs or Criteria object. + * + * @param mixed $values Criteria or CcMusicDirs object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcMusicDirsPeer::ID); + $value = $criteria->remove(CcMusicDirsPeer::ID); + if ($value) { + $selectCriteria->add(CcMusicDirsPeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcMusicDirsPeer::TABLE_NAME); + } + + } else { // $values is CcMusicDirs object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_music_dirs table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcMusicDirsPeer::TABLE_NAME, $con, CcMusicDirsPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcMusicDirsPeer::clearInstancePool(); + CcMusicDirsPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcMusicDirs or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcMusicDirs object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcMusicDirsPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcMusicDirs) { // it's a model object + // invalidate the cache for this single object + CcMusicDirsPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcMusicDirsPeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcMusicDirsPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcMusicDirsPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcMusicDirs object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcMusicDirs $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcMusicDirs $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcMusicDirsPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcMusicDirsPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcMusicDirsPeer::DATABASE_NAME, CcMusicDirsPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcMusicDirs + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcMusicDirsPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcMusicDirsPeer::DATABASE_NAME); + $criteria->add(CcMusicDirsPeer::ID, $pk); + + $v = CcMusicDirsPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcMusicDirsPeer::DATABASE_NAME); + $criteria->add(CcMusicDirsPeer::ID, $pks, Criteria::IN); + $objs = CcMusicDirsPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcMusicDirsPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcMusicDirsPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcMusicDirsQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcMusicDirsQuery.php new file mode 100644 index 000000000..71b5f0f57 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcMusicDirsQuery.php @@ -0,0 +1,285 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcMusicDirs|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcMusicDirsPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcMusicDirsQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcMusicDirsPeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcMusicDirsQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcMusicDirsPeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * @param int|array $id 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 CcMusicDirsQuery The current query, for fluid interface + */ + public function filterById($id = null, $comparison = null) + { + if (is_array($id) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcMusicDirsPeer::ID, $id, $comparison); + } + + /** + * Filter the query on the directory column + * + * @param string $directory The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcMusicDirsQuery The current query, for fluid interface + */ + public function filterByDirectory($directory = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($directory)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $directory)) { + $directory = str_replace('*', '%', $directory); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcMusicDirsPeer::DIRECTORY, $directory, $comparison); + } + + /** + * Filter the query on the type column + * + * @param string $type The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcMusicDirsQuery The current query, for fluid interface + */ + public function filterByType($type = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($type)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $type)) { + $type = str_replace('*', '%', $type); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcMusicDirsPeer::TYPE, $type, $comparison); + } + + /** + * Filter the query by a related CcFiles object + * + * @param CcFiles $ccFiles the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcMusicDirsQuery The current query, for fluid interface + */ + public function filterByCcFiles($ccFiles, $comparison = null) + { + return $this + ->addUsingAlias(CcMusicDirsPeer::ID, $ccFiles->getDbDirectory(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcFiles relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcMusicDirsQuery The current query, for fluid interface + */ + public function joinCcFiles($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcFiles'); + + // 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, 'CcFiles'); + } + + return $this; + } + + /** + * Use the CcFiles relation CcFiles 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 CcFilesQuery A secondary query class using the current class as primary query + */ + public function useCcFilesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcFiles($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery'); + } + + /** + * Exclude object from result + * + * @param CcMusicDirs $ccMusicDirs Object to remove from the list of results + * + * @return CcMusicDirsQuery The current query, for fluid interface + */ + public function prune($ccMusicDirs = null) + { + if ($ccMusicDirs) { + $this->addUsingAlias(CcMusicDirsPeer::ID, $ccMusicDirs->getId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcMusicDirsQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPerms.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPerms.php new file mode 100644 index 000000000..a86413fc1 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPerms.php @@ -0,0 +1,945 @@ +permid; + } + + /** + * Get the [subj] column value. + * + * @return int + */ + public function getSubj() + { + return $this->subj; + } + + /** + * Get the [action] column value. + * + * @return string + */ + public function getAction() + { + return $this->action; + } + + /** + * Get the [obj] column value. + * + * @return int + */ + public function getObj() + { + return $this->obj; + } + + /** + * Get the [type] column value. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Set the value of [permid] column. + * + * @param int $v new value + * @return CcPerms The current object (for fluent API support) + */ + public function setPermid($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->permid !== $v) { + $this->permid = $v; + $this->modifiedColumns[] = CcPermsPeer::PERMID; + } + + return $this; + } // setPermid() + + /** + * Set the value of [subj] column. + * + * @param int $v new value + * @return CcPerms The current object (for fluent API support) + */ + public function setSubj($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->subj !== $v) { + $this->subj = $v; + $this->modifiedColumns[] = CcPermsPeer::SUBJ; + } + + if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) { + $this->aCcSubjs = null; + } + + return $this; + } // setSubj() + + /** + * Set the value of [action] column. + * + * @param string $v new value + * @return CcPerms The current object (for fluent API support) + */ + public function setAction($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->action !== $v) { + $this->action = $v; + $this->modifiedColumns[] = CcPermsPeer::ACTION; + } + + return $this; + } // setAction() + + /** + * Set the value of [obj] column. + * + * @param int $v new value + * @return CcPerms The current object (for fluent API support) + */ + public function setObj($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->obj !== $v) { + $this->obj = $v; + $this->modifiedColumns[] = CcPermsPeer::OBJ; + } + + return $this; + } // setObj() + + /** + * Set the value of [type] column. + * + * @param string $v new value + * @return CcPerms The current object (for fluent API support) + */ + public function setType($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->type !== $v) { + $this->type = $v; + $this->modifiedColumns[] = CcPermsPeer::TYPE; + } + + return $this; + } // setType() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->permid = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->subj = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->action = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->obj = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->type = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 5; // 5 = CcPermsPeer::NUM_COLUMNS - CcPermsPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcPerms object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aCcSubjs !== null && $this->subj !== $this->aCcSubjs->getDbId()) { + $this->aCcSubjs = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcPermsPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aCcSubjs = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcPermsQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcPermsPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcSubjs !== null) { + if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { + $affectedRows += $this->aCcSubjs->save($con); + } + $this->setCcSubjs($this->aCcSubjs); + } + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows += 1; + $this->setNew(false); + } else { + $affectedRows += CcPermsPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + // We call the validate method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcSubjs !== null) { + if (!$this->aCcSubjs->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures()); + } + } + + + if (($retval = CcPermsPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcPermsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getPermid(); + break; + case 1: + return $this->getSubj(); + break; + case 2: + return $this->getAction(); + break; + case 3: + return $this->getObj(); + break; + case 4: + return $this->getType(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) + { + $keys = CcPermsPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getPermid(), + $keys[1] => $this->getSubj(), + $keys[2] => $this->getAction(), + $keys[3] => $this->getObj(), + $keys[4] => $this->getType(), + ); + if ($includeForeignObjects) { + if (null !== $this->aCcSubjs) { + $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, true); + } + } + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcPermsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setPermid($value); + break; + case 1: + $this->setSubj($value); + break; + case 2: + $this->setAction($value); + break; + case 3: + $this->setObj($value); + break; + case 4: + $this->setType($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcPermsPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setPermid($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setSubj($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setAction($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setObj($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setType($arr[$keys[4]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcPermsPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcPermsPeer::PERMID)) $criteria->add(CcPermsPeer::PERMID, $this->permid); + if ($this->isColumnModified(CcPermsPeer::SUBJ)) $criteria->add(CcPermsPeer::SUBJ, $this->subj); + if ($this->isColumnModified(CcPermsPeer::ACTION)) $criteria->add(CcPermsPeer::ACTION, $this->action); + if ($this->isColumnModified(CcPermsPeer::OBJ)) $criteria->add(CcPermsPeer::OBJ, $this->obj); + if ($this->isColumnModified(CcPermsPeer::TYPE)) $criteria->add(CcPermsPeer::TYPE, $this->type); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcPermsPeer::DATABASE_NAME); + $criteria->add(CcPermsPeer::PERMID, $this->permid); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getPermid(); + } + + /** + * Generic method to set the primary key (permid column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setPermid($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getPermid(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcPerms (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setPermid($this->permid); + $copyObj->setSubj($this->subj); + $copyObj->setAction($this->action); + $copyObj->setObj($this->obj); + $copyObj->setType($this->type); + + $copyObj->setNew(true); + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcPerms Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcPermsPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcPermsPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a CcSubjs object. + * + * @param CcSubjs $v + * @return CcPerms The current object (for fluent API support) + * @throws PropelException + */ + public function setCcSubjs(CcSubjs $v = null) + { + if ($v === null) { + $this->setSubj(NULL); + } else { + $this->setSubj($v->getDbId()); + } + + $this->aCcSubjs = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcSubjs object, it will not be re-added. + if ($v !== null) { + $v->addCcPerms($this); + } + + return $this; + } + + + /** + * Get the associated CcSubjs object + * + * @param PropelPDO Optional Connection object. + * @return CcSubjs The associated CcSubjs object. + * @throws PropelException + */ + public function getCcSubjs(PropelPDO $con = null) + { + if ($this->aCcSubjs === null && ($this->subj !== null)) { + $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->subj, $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->aCcSubjs->addCcPermss($this); + */ + } + return $this->aCcSubjs; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->permid = null; + $this->subj = null; + $this->action = null; + $this->obj = null; + $this->type = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aCcSubjs = null; + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcPerms diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPermsPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPermsPeer.php new file mode 100644 index 000000000..4bd4c07ea --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPermsPeer.php @@ -0,0 +1,984 @@ + array ('Permid', 'Subj', 'Action', 'Obj', 'Type', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('permid', 'subj', 'action', 'obj', 'type', ), + BasePeer::TYPE_COLNAME => array (self::PERMID, self::SUBJ, self::ACTION, self::OBJ, self::TYPE, ), + BasePeer::TYPE_RAW_COLNAME => array ('PERMID', 'SUBJ', 'ACTION', 'OBJ', 'TYPE', ), + BasePeer::TYPE_FIELDNAME => array ('permid', 'subj', 'action', 'obj', 'type', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('Permid' => 0, 'Subj' => 1, 'Action' => 2, 'Obj' => 3, 'Type' => 4, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('permid' => 0, 'subj' => 1, 'action' => 2, 'obj' => 3, 'type' => 4, ), + BasePeer::TYPE_COLNAME => array (self::PERMID => 0, self::SUBJ => 1, self::ACTION => 2, self::OBJ => 3, self::TYPE => 4, ), + BasePeer::TYPE_RAW_COLNAME => array ('PERMID' => 0, 'SUBJ' => 1, 'ACTION' => 2, 'OBJ' => 3, 'TYPE' => 4, ), + BasePeer::TYPE_FIELDNAME => array ('permid' => 0, 'subj' => 1, 'action' => 2, 'obj' => 3, 'type' => 4, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcPermsPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcPermsPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcPermsPeer::PERMID); + $criteria->addSelectColumn(CcPermsPeer::SUBJ); + $criteria->addSelectColumn(CcPermsPeer::ACTION); + $criteria->addSelectColumn(CcPermsPeer::OBJ); + $criteria->addSelectColumn(CcPermsPeer::TYPE); + } else { + $criteria->addSelectColumn($alias . '.PERMID'); + $criteria->addSelectColumn($alias . '.SUBJ'); + $criteria->addSelectColumn($alias . '.ACTION'); + $criteria->addSelectColumn($alias . '.OBJ'); + $criteria->addSelectColumn($alias . '.TYPE'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcPermsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcPermsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcPerms + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcPermsPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcPermsPeer::populateObjects(CcPermsPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcPermsPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcPerms $value A CcPerms object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcPerms $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getPermid(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcPerms object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcPerms) { + $key = (string) $value->getPermid(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcPerms object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcPerms Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_perms + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcPermsPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcPermsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcPermsPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcPermsPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcPerms object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcPermsPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcPermsPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcPermsPeer::NUM_COLUMNS; + } else { + $cls = CcPermsPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcPermsPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + + /** + * Returns the number of rows matching criteria, joining the related CcSubjs table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcPermsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcPermsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcPermsPeer::SUBJ, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcPerms objects pre-filled with their CcSubjs objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcPerms objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcPermsPeer::addSelectColumns($criteria); + $startcol = (CcPermsPeer::NUM_COLUMNS - CcPermsPeer::NUM_LAZY_LOAD_COLUMNS); + CcSubjsPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcPermsPeer::SUBJ, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcPermsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcPermsPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcPermsPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcPermsPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcSubjsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcSubjsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcSubjsPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcPerms) to $obj2 (CcSubjs) + $obj2->addCcPerms($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining all related tables + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcPermsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcPermsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcPermsPeer::SUBJ, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of CcPerms objects pre-filled with all related objects. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcPerms objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcPermsPeer::addSelectColumns($criteria); + $startcol2 = (CcPermsPeer::NUM_COLUMNS - CcPermsPeer::NUM_LAZY_LOAD_COLUMNS); + + CcSubjsPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcPermsPeer::SUBJ, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcPermsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcPermsPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcPermsPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcPermsPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcSubjs rows + + $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcSubjsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcSubjsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcSubjsPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (CcPerms) to the collection in $obj2 (CcSubjs) + $obj2->addCcPerms($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcPermsPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcPermsPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcPermsTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcPermsPeer::CLASS_DEFAULT : CcPermsPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcPerms or Criteria object. + * + * @param mixed $values Criteria or CcPerms object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcPerms object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcPerms or Criteria object. + * + * @param mixed $values Criteria or CcPerms object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcPermsPeer::PERMID); + $value = $criteria->remove(CcPermsPeer::PERMID); + if ($value) { + $selectCriteria->add(CcPermsPeer::PERMID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcPermsPeer::TABLE_NAME); + } + + } else { // $values is CcPerms object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_perms table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcPermsPeer::TABLE_NAME, $con, CcPermsPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcPermsPeer::clearInstancePool(); + CcPermsPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcPerms or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcPerms object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcPermsPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcPerms) { // it's a model object + // invalidate the cache for this single object + CcPermsPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcPermsPeer::PERMID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcPermsPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcPermsPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcPerms object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcPerms $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcPerms $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcPermsPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcPermsPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcPermsPeer::DATABASE_NAME, CcPermsPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcPerms + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcPermsPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcPermsPeer::DATABASE_NAME); + $criteria->add(CcPermsPeer::PERMID, $pk); + + $v = CcPermsPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcPermsPeer::DATABASE_NAME); + $criteria->add(CcPermsPeer::PERMID, $pks, Criteria::IN); + $objs = CcPermsPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcPermsPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcPermsPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPermsQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPermsQuery.php new file mode 100644 index 000000000..5866aa488 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPermsQuery.php @@ -0,0 +1,355 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcPerms|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcPermsPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcPermsQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcPermsPeer::PERMID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcPermsQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcPermsPeer::PERMID, $keys, Criteria::IN); + } + + /** + * Filter the query on the permid column + * + * @param int|array $permid 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 CcPermsQuery The current query, for fluid interface + */ + public function filterByPermid($permid = null, $comparison = null) + { + if (is_array($permid) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcPermsPeer::PERMID, $permid, $comparison); + } + + /** + * Filter the query on the subj column + * + * @param int|array $subj 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 CcPermsQuery The current query, for fluid interface + */ + public function filterBySubj($subj = null, $comparison = null) + { + if (is_array($subj)) { + $useMinMax = false; + if (isset($subj['min'])) { + $this->addUsingAlias(CcPermsPeer::SUBJ, $subj['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($subj['max'])) { + $this->addUsingAlias(CcPermsPeer::SUBJ, $subj['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcPermsPeer::SUBJ, $subj, $comparison); + } + + /** + * Filter the query on the action column + * + * @param string $action The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPermsQuery The current query, for fluid interface + */ + public function filterByAction($action = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($action)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $action)) { + $action = str_replace('*', '%', $action); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcPermsPeer::ACTION, $action, $comparison); + } + + /** + * Filter the query on the obj column + * + * @param int|array $obj 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 CcPermsQuery The current query, for fluid interface + */ + public function filterByObj($obj = null, $comparison = null) + { + if (is_array($obj)) { + $useMinMax = false; + if (isset($obj['min'])) { + $this->addUsingAlias(CcPermsPeer::OBJ, $obj['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($obj['max'])) { + $this->addUsingAlias(CcPermsPeer::OBJ, $obj['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcPermsPeer::OBJ, $obj, $comparison); + } + + /** + * Filter the query on the type column + * + * @param string $type The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPermsQuery The current query, for fluid interface + */ + public function filterByType($type = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($type)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $type)) { + $type = str_replace('*', '%', $type); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcPermsPeer::TYPE, $type, $comparison); + } + + /** + * Filter the query by a related CcSubjs object + * + * @param CcSubjs $ccSubjs the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPermsQuery The current query, for fluid interface + */ + public function filterByCcSubjs($ccSubjs, $comparison = null) + { + return $this + ->addUsingAlias(CcPermsPeer::SUBJ, $ccSubjs->getDbId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcSubjs relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcPermsQuery The current query, for fluid interface + */ + public function joinCcSubjs($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcSubjs'); + + // 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, 'CcSubjs'); + } + + return $this; + } + + /** + * Use the CcSubjs relation CcSubjs 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 CcSubjsQuery A secondary query class using the current class as primary query + */ + public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcSubjs($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); + } + + /** + * Exclude object from result + * + * @param CcPerms $ccPerms Object to remove from the list of results + * + * @return CcPermsQuery The current query, for fluid interface + */ + public function prune($ccPerms = null) + { + if ($ccPerms) { + $this->addUsingAlias(CcPermsPeer::PERMID, $ccPerms->getPermid(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcPermsQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylist.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylist.php new file mode 100644 index 000000000..222c1c6f4 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylist.php @@ -0,0 +1,1365 @@ +name = ''; + $this->state = 'empty'; + $this->currentlyaccessing = 0; + } + + /** + * Initializes internal state of BaseCcPlaylist object. + * @see applyDefaults() + */ + public function __construct() + { + parent::__construct(); + $this->applyDefaultValues(); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getDbId() + { + return $this->id; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getDbName() + { + return $this->name; + } + + /** + * Get the [state] column value. + * + * @return string + */ + public function getDbState() + { + return $this->state; + } + + /** + * Get the [currentlyaccessing] column value. + * + * @return int + */ + public function getDbCurrentlyaccessing() + { + return $this->currentlyaccessing; + } + + /** + * Get the [editedby] column value. + * + * @return int + */ + public function getDbEditedby() + { + return $this->editedby; + } + + /** + * Get the [optionally formatted] temporal [mtime] 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 getDbMtime($format = 'Y-m-d H:i:s') + { + if ($this->mtime === null) { + return null; + } + + + + try { + $dt = new DateTime($this->mtime); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->mtime, 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); + } + } + + /** + * Get the [creator] column value. + * + * @return string + */ + public function getDbCreator() + { + return $this->creator; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDbDescription() + { + return $this->description; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return CcPlaylist The current object (for fluent API support) + */ + public function setDbId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CcPlaylistPeer::ID; + } + + return $this; + } // setDbId() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return CcPlaylist The current object (for fluent API support) + */ + public function setDbName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v || $this->isNew()) { + $this->name = $v; + $this->modifiedColumns[] = CcPlaylistPeer::NAME; + } + + return $this; + } // setDbName() + + /** + * Set the value of [state] column. + * + * @param string $v new value + * @return CcPlaylist The current object (for fluent API support) + */ + public function setDbState($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->state !== $v || $this->isNew()) { + $this->state = $v; + $this->modifiedColumns[] = CcPlaylistPeer::STATE; + } + + return $this; + } // setDbState() + + /** + * Set the value of [currentlyaccessing] column. + * + * @param int $v new value + * @return CcPlaylist The current object (for fluent API support) + */ + public function setDbCurrentlyaccessing($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->currentlyaccessing !== $v || $this->isNew()) { + $this->currentlyaccessing = $v; + $this->modifiedColumns[] = CcPlaylistPeer::CURRENTLYACCESSING; + } + + return $this; + } // setDbCurrentlyaccessing() + + /** + * Set the value of [editedby] column. + * + * @param int $v new value + * @return CcPlaylist The current object (for fluent API support) + */ + public function setDbEditedby($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->editedby !== $v) { + $this->editedby = $v; + $this->modifiedColumns[] = CcPlaylistPeer::EDITEDBY; + } + + if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) { + $this->aCcSubjs = null; + } + + return $this; + } // setDbEditedby() + + /** + * Sets the value of [mtime] 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 CcPlaylist The current object (for fluent API support) + */ + public function setDbMtime($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->mtime !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->mtime !== null && $tmpDt = new DateTime($this->mtime)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->mtime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); + $this->modifiedColumns[] = CcPlaylistPeer::MTIME; + } + } // if either are not null + + return $this; + } // setDbMtime() + + /** + * Set the value of [creator] column. + * + * @param string $v new value + * @return CcPlaylist The current object (for fluent API support) + */ + public function setDbCreator($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->creator !== $v) { + $this->creator = $v; + $this->modifiedColumns[] = CcPlaylistPeer::CREATOR; + } + + return $this; + } // setDbCreator() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return CcPlaylist The current object (for fluent API support) + */ + public function setDbDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->description !== $v) { + $this->description = $v; + $this->modifiedColumns[] = CcPlaylistPeer::DESCRIPTION; + } + + return $this; + } // setDbDescription() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + if ($this->name !== '') { + return false; + } + + if ($this->state !== 'empty') { + return false; + } + + if ($this->currentlyaccessing !== 0) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->state = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->currentlyaccessing = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->editedby = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; + $this->mtime = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->creator = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->description = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 8; // 8 = CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcPlaylist object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aCcSubjs !== null && $this->editedby !== $this->aCcSubjs->getDbId()) { + $this->aCcSubjs = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcPlaylistPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aCcSubjs = null; + $this->collCcPlaylistcontentss = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcPlaylistQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcPlaylistPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcSubjs !== null) { + if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { + $affectedRows += $this->aCcSubjs->save($con); + } + $this->setCcSubjs($this->aCcSubjs); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = CcPlaylistPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + if ($criteria->keyContainsValue(CcPlaylistPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlaylistPeer::ID.')'); + } + + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows += 1; + $this->setDbId($pk); //[IMV] update autoincrement primary key + $this->setNew(false); + } else { + $affectedRows += CcPlaylistPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collCcPlaylistcontentss !== null) { + foreach ($this->collCcPlaylistcontentss as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + // We call the validate method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcSubjs !== null) { + if (!$this->aCcSubjs->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures()); + } + } + + + if (($retval = CcPlaylistPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collCcPlaylistcontentss !== null) { + foreach ($this->collCcPlaylistcontentss as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcPlaylistPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getDbId(); + break; + case 1: + return $this->getDbName(); + break; + case 2: + return $this->getDbState(); + break; + case 3: + return $this->getDbCurrentlyaccessing(); + break; + case 4: + return $this->getDbEditedby(); + break; + case 5: + return $this->getDbMtime(); + break; + case 6: + return $this->getDbCreator(); + break; + case 7: + return $this->getDbDescription(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) + { + $keys = CcPlaylistPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbId(), + $keys[1] => $this->getDbName(), + $keys[2] => $this->getDbState(), + $keys[3] => $this->getDbCurrentlyaccessing(), + $keys[4] => $this->getDbEditedby(), + $keys[5] => $this->getDbMtime(), + $keys[6] => $this->getDbCreator(), + $keys[7] => $this->getDbDescription(), + ); + if ($includeForeignObjects) { + if (null !== $this->aCcSubjs) { + $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, true); + } + } + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcPlaylistPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setDbId($value); + break; + case 1: + $this->setDbName($value); + break; + case 2: + $this->setDbState($value); + break; + case 3: + $this->setDbCurrentlyaccessing($value); + break; + case 4: + $this->setDbEditedby($value); + break; + case 5: + $this->setDbMtime($value); + break; + case 6: + $this->setDbCreator($value); + break; + case 7: + $this->setDbDescription($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcPlaylistPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbName($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDbState($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDbCurrentlyaccessing($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setDbEditedby($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setDbMtime($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setDbCreator($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setDbDescription($arr[$keys[7]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcPlaylistPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcPlaylistPeer::ID)) $criteria->add(CcPlaylistPeer::ID, $this->id); + if ($this->isColumnModified(CcPlaylistPeer::NAME)) $criteria->add(CcPlaylistPeer::NAME, $this->name); + if ($this->isColumnModified(CcPlaylistPeer::STATE)) $criteria->add(CcPlaylistPeer::STATE, $this->state); + if ($this->isColumnModified(CcPlaylistPeer::CURRENTLYACCESSING)) $criteria->add(CcPlaylistPeer::CURRENTLYACCESSING, $this->currentlyaccessing); + if ($this->isColumnModified(CcPlaylistPeer::EDITEDBY)) $criteria->add(CcPlaylistPeer::EDITEDBY, $this->editedby); + if ($this->isColumnModified(CcPlaylistPeer::MTIME)) $criteria->add(CcPlaylistPeer::MTIME, $this->mtime); + if ($this->isColumnModified(CcPlaylistPeer::CREATOR)) $criteria->add(CcPlaylistPeer::CREATOR, $this->creator); + if ($this->isColumnModified(CcPlaylistPeer::DESCRIPTION)) $criteria->add(CcPlaylistPeer::DESCRIPTION, $this->description); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcPlaylistPeer::DATABASE_NAME); + $criteria->add(CcPlaylistPeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getDbId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getDbId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcPlaylist (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setDbName($this->name); + $copyObj->setDbState($this->state); + $copyObj->setDbCurrentlyaccessing($this->currentlyaccessing); + $copyObj->setDbEditedby($this->editedby); + $copyObj->setDbMtime($this->mtime); + $copyObj->setDbCreator($this->creator); + $copyObj->setDbDescription($this->description); + + 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->getCcPlaylistcontentss() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcPlaylistcontents($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcPlaylist Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcPlaylistPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcPlaylistPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a CcSubjs object. + * + * @param CcSubjs $v + * @return CcPlaylist The current object (for fluent API support) + * @throws PropelException + */ + public function setCcSubjs(CcSubjs $v = null) + { + if ($v === null) { + $this->setDbEditedby(NULL); + } else { + $this->setDbEditedby($v->getDbId()); + } + + $this->aCcSubjs = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcSubjs object, it will not be re-added. + if ($v !== null) { + $v->addCcPlaylist($this); + } + + return $this; + } + + + /** + * Get the associated CcSubjs object + * + * @param PropelPDO Optional Connection object. + * @return CcSubjs The associated CcSubjs object. + * @throws PropelException + */ + public function getCcSubjs(PropelPDO $con = null) + { + if ($this->aCcSubjs === null && ($this->editedby !== null)) { + $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->editedby, $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->aCcSubjs->addCcPlaylists($this); + */ + } + return $this->aCcSubjs; + } + + /** + * Clears out the collCcPlaylistcontentss 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 addCcPlaylistcontentss() + */ + public function clearCcPlaylistcontentss() + { + $this->collCcPlaylistcontentss = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcPlaylistcontentss collection. + * + * By default this just sets the collCcPlaylistcontentss collection to an empty array (like clearcollCcPlaylistcontentss()); + * 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 initCcPlaylistcontentss() + { + $this->collCcPlaylistcontentss = new PropelObjectCollection(); + $this->collCcPlaylistcontentss->setModel('CcPlaylistcontents'); + } + + /** + * Gets an array of CcPlaylistcontents 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 CcPlaylist 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 CcPlaylistcontents[] List of CcPlaylistcontents objects + * @throws PropelException + */ + public function getCcPlaylistcontentss($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcPlaylistcontentss || null !== $criteria) { + if ($this->isNew() && null === $this->collCcPlaylistcontentss) { + // return empty collection + $this->initCcPlaylistcontentss(); + } else { + $collCcPlaylistcontentss = CcPlaylistcontentsQuery::create(null, $criteria) + ->filterByCcPlaylist($this) + ->find($con); + if (null !== $criteria) { + return $collCcPlaylistcontentss; + } + $this->collCcPlaylistcontentss = $collCcPlaylistcontentss; + } + } + return $this->collCcPlaylistcontentss; + } + + /** + * Returns the number of related CcPlaylistcontents objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcPlaylistcontents objects. + * @throws PropelException + */ + public function countCcPlaylistcontentss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcPlaylistcontentss || null !== $criteria) { + if ($this->isNew() && null === $this->collCcPlaylistcontentss) { + return 0; + } else { + $query = CcPlaylistcontentsQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcPlaylist($this) + ->count($con); + } + } else { + return count($this->collCcPlaylistcontentss); + } + } + + /** + * Method called to associate a CcPlaylistcontents object to this object + * through the CcPlaylistcontents foreign key attribute. + * + * @param CcPlaylistcontents $l CcPlaylistcontents + * @return void + * @throws PropelException + */ + public function addCcPlaylistcontents(CcPlaylistcontents $l) + { + if ($this->collCcPlaylistcontentss === null) { + $this->initCcPlaylistcontentss(); + } + if (!$this->collCcPlaylistcontentss->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcPlaylistcontentss[]= $l; + $l->setCcPlaylist($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcPlaylist is new, it will return + * an empty collection; or if this CcPlaylist has previously + * been saved, it will retrieve related CcPlaylistcontentss from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcPlaylist. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcPlaylistcontents[] List of CcPlaylistcontents objects + */ + public function getCcPlaylistcontentssJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcPlaylistcontentsQuery::create(null, $criteria); + $query->joinWith('CcFiles', $join_behavior); + + return $this->getCcPlaylistcontentss($query, $con); + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->name = null; + $this->state = null; + $this->currentlyaccessing = null; + $this->editedby = null; + $this->mtime = null; + $this->creator = null; + $this->description = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->applyDefaultValues(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collCcPlaylistcontentss) { + foreach ((array) $this->collCcPlaylistcontentss as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collCcPlaylistcontentss = null; + $this->aCcSubjs = null; + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcPlaylist diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistPeer.php new file mode 100644 index 000000000..0e338bc39 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistPeer.php @@ -0,0 +1,1006 @@ + array ('DbId', 'DbName', 'DbState', 'DbCurrentlyaccessing', 'DbEditedby', 'DbMtime', 'DbCreator', 'DbDescription', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbState', 'dbCurrentlyaccessing', 'dbEditedby', 'dbMtime', 'dbCreator', 'dbDescription', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::STATE, self::CURRENTLYACCESSING, self::EDITEDBY, self::MTIME, self::CREATOR, self::DESCRIPTION, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'STATE', 'CURRENTLYACCESSING', 'EDITEDBY', 'MTIME', 'CREATOR', 'DESCRIPTION', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'state', 'currentlyaccessing', 'editedby', 'mtime', 'creator', 'description', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbState' => 2, 'DbCurrentlyaccessing' => 3, 'DbEditedby' => 4, 'DbMtime' => 5, 'DbCreator' => 6, 'DbDescription' => 7, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbState' => 2, 'dbCurrentlyaccessing' => 3, 'dbEditedby' => 4, 'dbMtime' => 5, 'dbCreator' => 6, 'dbDescription' => 7, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::STATE => 2, self::CURRENTLYACCESSING => 3, self::EDITEDBY => 4, self::MTIME => 5, self::CREATOR => 6, self::DESCRIPTION => 7, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'STATE' => 2, 'CURRENTLYACCESSING' => 3, 'EDITEDBY' => 4, 'MTIME' => 5, 'CREATOR' => 6, 'DESCRIPTION' => 7, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'state' => 2, 'currentlyaccessing' => 3, 'editedby' => 4, 'mtime' => 5, 'creator' => 6, 'description' => 7, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcPlaylistPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcPlaylistPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcPlaylistPeer::ID); + $criteria->addSelectColumn(CcPlaylistPeer::NAME); + $criteria->addSelectColumn(CcPlaylistPeer::STATE); + $criteria->addSelectColumn(CcPlaylistPeer::CURRENTLYACCESSING); + $criteria->addSelectColumn(CcPlaylistPeer::EDITEDBY); + $criteria->addSelectColumn(CcPlaylistPeer::MTIME); + $criteria->addSelectColumn(CcPlaylistPeer::CREATOR); + $criteria->addSelectColumn(CcPlaylistPeer::DESCRIPTION); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.NAME'); + $criteria->addSelectColumn($alias . '.STATE'); + $criteria->addSelectColumn($alias . '.CURRENTLYACCESSING'); + $criteria->addSelectColumn($alias . '.EDITEDBY'); + $criteria->addSelectColumn($alias . '.MTIME'); + $criteria->addSelectColumn($alias . '.CREATOR'); + $criteria->addSelectColumn($alias . '.DESCRIPTION'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcPlaylistPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcPlaylistPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcPlaylist + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcPlaylistPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcPlaylistPeer::populateObjects(CcPlaylistPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcPlaylistPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcPlaylist $value A CcPlaylist object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcPlaylist $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcPlaylist object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcPlaylist) { + $key = (string) $value->getDbId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcPlaylist object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcPlaylist Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_playlist + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + // Invalidate objects in CcPlaylistcontentsPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcPlaylistcontentsPeer::clearInstancePool(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcPlaylistPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcPlaylistPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcPlaylistPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcPlaylist object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcPlaylistPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcPlaylistPeer::NUM_COLUMNS; + } else { + $cls = CcPlaylistPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcPlaylistPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + + /** + * Returns the number of rows matching criteria, joining the related CcSubjs table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcPlaylistPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcPlaylistPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcPlaylistPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcPlaylist objects pre-filled with their CcSubjs objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcPlaylist objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcPlaylistPeer::addSelectColumns($criteria); + $startcol = (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS); + CcSubjsPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcPlaylistPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcPlaylistPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcPlaylistPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcPlaylistPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcSubjsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcSubjsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcSubjsPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcPlaylist) to $obj2 (CcSubjs) + $obj2->addCcPlaylist($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining all related tables + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcPlaylistPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcPlaylistPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcPlaylistPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of CcPlaylist objects pre-filled with all related objects. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcPlaylist objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcPlaylistPeer::addSelectColumns($criteria); + $startcol2 = (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS); + + CcSubjsPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcPlaylistPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcPlaylistPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcPlaylistPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcPlaylistPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcSubjs rows + + $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcSubjsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcSubjsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcSubjsPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (CcPlaylist) to the collection in $obj2 (CcSubjs) + $obj2->addCcPlaylist($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcPlaylistPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcPlaylistPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcPlaylistTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcPlaylistPeer::CLASS_DEFAULT : CcPlaylistPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcPlaylist or Criteria object. + * + * @param mixed $values Criteria or CcPlaylist object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcPlaylist object + } + + if ($criteria->containsKey(CcPlaylistPeer::ID) && $criteria->keyContainsValue(CcPlaylistPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlaylistPeer::ID.')'); + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcPlaylist or Criteria object. + * + * @param mixed $values Criteria or CcPlaylist object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcPlaylistPeer::ID); + $value = $criteria->remove(CcPlaylistPeer::ID); + if ($value) { + $selectCriteria->add(CcPlaylistPeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcPlaylistPeer::TABLE_NAME); + } + + } else { // $values is CcPlaylist object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_playlist table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcPlaylistPeer::TABLE_NAME, $con, CcPlaylistPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcPlaylistPeer::clearInstancePool(); + CcPlaylistPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcPlaylist or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcPlaylist object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcPlaylistPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcPlaylist) { // it's a model object + // invalidate the cache for this single object + CcPlaylistPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcPlaylistPeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcPlaylistPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcPlaylistPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcPlaylist object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcPlaylist $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcPlaylist $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcPlaylistPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcPlaylistPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcPlaylistPeer::DATABASE_NAME, CcPlaylistPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcPlaylist + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcPlaylistPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcPlaylistPeer::DATABASE_NAME); + $criteria->add(CcPlaylistPeer::ID, $pk); + + $v = CcPlaylistPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcPlaylistPeer::DATABASE_NAME); + $criteria->add(CcPlaylistPeer::ID, $pks, Criteria::IN); + $objs = CcPlaylistPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcPlaylistPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcPlaylistPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistQuery.php new file mode 100644 index 000000000..0ab594b7a --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistQuery.php @@ -0,0 +1,510 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcPlaylist|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcPlaylistPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcPlaylistQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcPlaylistPeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcPlaylistQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcPlaylistPeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * @param int|array $dbId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPlaylistQuery The current query, for fluid interface + */ + public function filterByDbId($dbId = null, $comparison = null) + { + if (is_array($dbId) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcPlaylistPeer::ID, $dbId, $comparison); + } + + /** + * Filter the query on the name column + * + * @param string $dbName The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPlaylistQuery The current query, for fluid interface + */ + public function filterByDbName($dbName = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbName)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbName)) { + $dbName = str_replace('*', '%', $dbName); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcPlaylistPeer::NAME, $dbName, $comparison); + } + + /** + * Filter the query on the state column + * + * @param string $dbState The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPlaylistQuery The current query, for fluid interface + */ + public function filterByDbState($dbState = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbState)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbState)) { + $dbState = str_replace('*', '%', $dbState); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcPlaylistPeer::STATE, $dbState, $comparison); + } + + /** + * Filter the query on the currentlyaccessing column + * + * @param int|array $dbCurrentlyaccessing 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 CcPlaylistQuery The current query, for fluid interface + */ + public function filterByDbCurrentlyaccessing($dbCurrentlyaccessing = null, $comparison = null) + { + if (is_array($dbCurrentlyaccessing)) { + $useMinMax = false; + if (isset($dbCurrentlyaccessing['min'])) { + $this->addUsingAlias(CcPlaylistPeer::CURRENTLYACCESSING, $dbCurrentlyaccessing['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbCurrentlyaccessing['max'])) { + $this->addUsingAlias(CcPlaylistPeer::CURRENTLYACCESSING, $dbCurrentlyaccessing['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcPlaylistPeer::CURRENTLYACCESSING, $dbCurrentlyaccessing, $comparison); + } + + /** + * Filter the query on the editedby column + * + * @param int|array $dbEditedby 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 CcPlaylistQuery The current query, for fluid interface + */ + public function filterByDbEditedby($dbEditedby = null, $comparison = null) + { + if (is_array($dbEditedby)) { + $useMinMax = false; + if (isset($dbEditedby['min'])) { + $this->addUsingAlias(CcPlaylistPeer::EDITEDBY, $dbEditedby['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbEditedby['max'])) { + $this->addUsingAlias(CcPlaylistPeer::EDITEDBY, $dbEditedby['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcPlaylistPeer::EDITEDBY, $dbEditedby, $comparison); + } + + /** + * Filter the query on the mtime column + * + * @param string|array $dbMtime 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 CcPlaylistQuery The current query, for fluid interface + */ + public function filterByDbMtime($dbMtime = null, $comparison = null) + { + if (is_array($dbMtime)) { + $useMinMax = false; + if (isset($dbMtime['min'])) { + $this->addUsingAlias(CcPlaylistPeer::MTIME, $dbMtime['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbMtime['max'])) { + $this->addUsingAlias(CcPlaylistPeer::MTIME, $dbMtime['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcPlaylistPeer::MTIME, $dbMtime, $comparison); + } + + /** + * Filter the query on the creator column + * + * @param string $dbCreator The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPlaylistQuery The current query, for fluid interface + */ + public function filterByDbCreator($dbCreator = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbCreator)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbCreator)) { + $dbCreator = str_replace('*', '%', $dbCreator); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcPlaylistPeer::CREATOR, $dbCreator, $comparison); + } + + /** + * Filter the query on the description column + * + * @param string $dbDescription The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPlaylistQuery The current query, for fluid interface + */ + public function filterByDbDescription($dbDescription = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbDescription)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbDescription)) { + $dbDescription = str_replace('*', '%', $dbDescription); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcPlaylistPeer::DESCRIPTION, $dbDescription, $comparison); + } + + /** + * Filter the query by a related CcSubjs object + * + * @param CcSubjs $ccSubjs the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPlaylistQuery The current query, for fluid interface + */ + public function filterByCcSubjs($ccSubjs, $comparison = null) + { + return $this + ->addUsingAlias(CcPlaylistPeer::EDITEDBY, $ccSubjs->getDbId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcSubjs relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcPlaylistQuery The current query, for fluid interface + */ + public function joinCcSubjs($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcSubjs'); + + // 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, 'CcSubjs'); + } + + return $this; + } + + /** + * Use the CcSubjs relation CcSubjs 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 CcSubjsQuery A secondary query class using the current class as primary query + */ + public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcSubjs($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); + } + + /** + * Filter the query by a related CcPlaylistcontents object + * + * @param CcPlaylistcontents $ccPlaylistcontents the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPlaylistQuery The current query, for fluid interface + */ + public function filterByCcPlaylistcontents($ccPlaylistcontents, $comparison = null) + { + return $this + ->addUsingAlias(CcPlaylistPeer::ID, $ccPlaylistcontents->getDbPlaylistId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcPlaylistcontents relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcPlaylistQuery The current query, for fluid interface + */ + public function joinCcPlaylistcontents($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcPlaylistcontents'); + + // 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, 'CcPlaylistcontents'); + } + + return $this; + } + + /** + * Use the CcPlaylistcontents relation CcPlaylistcontents 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 CcPlaylistcontentsQuery A secondary query class using the current class as primary query + */ + public function useCcPlaylistcontentsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcPlaylistcontents($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcPlaylistcontents', 'CcPlaylistcontentsQuery'); + } + + /** + * Exclude object from result + * + * @param CcPlaylist $ccPlaylist Object to remove from the list of results + * + * @return CcPlaylistQuery The current query, for fluid interface + */ + public function prune($ccPlaylist = null) + { + if ($ccPlaylist) { + $this->addUsingAlias(CcPlaylistPeer::ID, $ccPlaylist->getDbId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcPlaylistQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistcontents.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistcontents.php new file mode 100644 index 000000000..0118d5038 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistcontents.php @@ -0,0 +1,1540 @@ +cliplength = '00:00:00'; + $this->cuein = '00:00:00'; + $this->cueout = '00:00:00'; + $this->fadein = '00:00:00'; + $this->fadeout = '00:00:00'; + } + + /** + * Initializes internal state of BaseCcPlaylistcontents object. + * @see applyDefaults() + */ + public function __construct() + { + parent::__construct(); + $this->applyDefaultValues(); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getDbId() + { + return $this->id; + } + + /** + * Get the [playlist_id] column value. + * + * @return int + */ + public function getDbPlaylistId() + { + return $this->playlist_id; + } + + /** + * Get the [file_id] column value. + * + * @return int + */ + public function getDbFileId() + { + return $this->file_id; + } + + /** + * Get the [position] column value. + * + * @return int + */ + public function getDbPosition() + { + return $this->position; + } + + /** + * Get the [optionally formatted] temporal [cliplength] 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 getDbCliplength($format = '%X') + { + if ($this->cliplength === null) { + return null; + } + + + + try { + $dt = new DateTime($this->cliplength); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cliplength, 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); + } + } + + /** + * Get the [optionally formatted] temporal [cuein] 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 getDbCuein($format = '%X') + { + if ($this->cuein === null) { + return null; + } + + + + try { + $dt = new DateTime($this->cuein); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cuein, 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); + } + } + + /** + * Get the [optionally formatted] temporal [cueout] 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 getDbCueout($format = '%X') + { + if ($this->cueout === null) { + return null; + } + + + + try { + $dt = new DateTime($this->cueout); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cueout, 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); + } + } + + /** + * Get the [optionally formatted] temporal [fadein] 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 getDbFadein($format = '%X') + { + if ($this->fadein === null) { + return null; + } + + + + try { + $dt = new DateTime($this->fadein); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->fadein, 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); + } + } + + /** + * Get the [optionally formatted] temporal [fadeout] 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 getDbFadeout($format = '%X') + { + if ($this->fadeout === null) { + return null; + } + + + + try { + $dt = new DateTime($this->fadeout); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->fadeout, 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); + } + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return CcPlaylistcontents The current object (for fluent API support) + */ + public function setDbId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CcPlaylistcontentsPeer::ID; + } + + return $this; + } // setDbId() + + /** + * Set the value of [playlist_id] column. + * + * @param int $v new value + * @return CcPlaylistcontents The current object (for fluent API support) + */ + public function setDbPlaylistId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->playlist_id !== $v) { + $this->playlist_id = $v; + $this->modifiedColumns[] = CcPlaylistcontentsPeer::PLAYLIST_ID; + } + + if ($this->aCcPlaylist !== null && $this->aCcPlaylist->getDbId() !== $v) { + $this->aCcPlaylist = null; + } + + return $this; + } // setDbPlaylistId() + + /** + * Set the value of [file_id] column. + * + * @param int $v new value + * @return CcPlaylistcontents The current object (for fluent API support) + */ + public function setDbFileId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->file_id !== $v) { + $this->file_id = $v; + $this->modifiedColumns[] = CcPlaylistcontentsPeer::FILE_ID; + } + + if ($this->aCcFiles !== null && $this->aCcFiles->getDbId() !== $v) { + $this->aCcFiles = null; + } + + return $this; + } // setDbFileId() + + /** + * Set the value of [position] column. + * + * @param int $v new value + * @return CcPlaylistcontents The current object (for fluent API support) + */ + public function setDbPosition($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->position !== $v) { + $this->position = $v; + $this->modifiedColumns[] = CcPlaylistcontentsPeer::POSITION; + } + + return $this; + } // setDbPosition() + + /** + * Sets the value of [cliplength] 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 CcPlaylistcontents The current object (for fluent API support) + */ + public function setDbCliplength($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->cliplength !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->cliplength !== null && $tmpDt = new DateTime($this->cliplength)) ? $tmpDt->format('H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default + ) + { + $this->cliplength = ($dt ? $dt->format('H:i:s') : null); + $this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH; + } + } // if either are not null + + return $this; + } // setDbCliplength() + + /** + * Sets the value of [cuein] 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 CcPlaylistcontents The current object (for fluent API support) + */ + public function setDbCuein($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->cuein !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->cuein !== null && $tmpDt = new DateTime($this->cuein)) ? $tmpDt->format('H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default + ) + { + $this->cuein = ($dt ? $dt->format('H:i:s') : null); + $this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN; + } + } // if either are not null + + return $this; + } // setDbCuein() + + /** + * Sets the value of [cueout] 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 CcPlaylistcontents The current object (for fluent API support) + */ + public function setDbCueout($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->cueout !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->cueout !== null && $tmpDt = new DateTime($this->cueout)) ? $tmpDt->format('H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default + ) + { + $this->cueout = ($dt ? $dt->format('H:i:s') : null); + $this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT; + } + } // if either are not null + + return $this; + } // setDbCueout() + + /** + * Sets the value of [fadein] 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 CcPlaylistcontents The current object (for fluent API support) + */ + public function setDbFadein($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->fadein !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->fadein !== null && $tmpDt = new DateTime($this->fadein)) ? $tmpDt->format('H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default + ) + { + $this->fadein = ($dt ? $dt->format('H:i:s') : null); + $this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN; + } + } // if either are not null + + return $this; + } // setDbFadein() + + /** + * Sets the value of [fadeout] 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 CcPlaylistcontents The current object (for fluent API support) + */ + public function setDbFadeout($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->fadeout !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->fadeout !== null && $tmpDt = new DateTime($this->fadeout)) ? $tmpDt->format('H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default + ) + { + $this->fadeout = ($dt ? $dt->format('H:i:s') : null); + $this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT; + } + } // if either are not null + + return $this; + } // setDbFadeout() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + if ($this->cliplength !== '00:00:00') { + return false; + } + + if ($this->cuein !== '00:00:00') { + return false; + } + + if ($this->cueout !== '00:00:00') { + return false; + } + + if ($this->fadein !== '00:00:00') { + return false; + } + + if ($this->fadeout !== '00:00:00') { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->playlist_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->file_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->position = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->cliplength = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->cuein = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->cueout = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->fadein = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; + $this->fadeout = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 9; // 9 = CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcPlaylistcontents object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aCcPlaylist !== null && $this->playlist_id !== $this->aCcPlaylist->getDbId()) { + $this->aCcPlaylist = null; + } + if ($this->aCcFiles !== null && $this->file_id !== $this->aCcFiles->getDbId()) { + $this->aCcFiles = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcPlaylistcontentsPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aCcFiles = null; + $this->aCcPlaylist = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcPlaylistcontentsQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcPlaylistcontentsPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcFiles !== null) { + if ($this->aCcFiles->isModified() || $this->aCcFiles->isNew()) { + $affectedRows += $this->aCcFiles->save($con); + } + $this->setCcFiles($this->aCcFiles); + } + + if ($this->aCcPlaylist !== null) { + if ($this->aCcPlaylist->isModified() || $this->aCcPlaylist->isNew()) { + $affectedRows += $this->aCcPlaylist->save($con); + } + $this->setCcPlaylist($this->aCcPlaylist); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = CcPlaylistcontentsPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + if ($criteria->keyContainsValue(CcPlaylistcontentsPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlaylistcontentsPeer::ID.')'); + } + + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows += 1; + $this->setDbId($pk); //[IMV] update autoincrement primary key + $this->setNew(false); + } else { + $affectedRows += CcPlaylistcontentsPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + // We call the validate method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcFiles !== null) { + if (!$this->aCcFiles->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcFiles->getValidationFailures()); + } + } + + if ($this->aCcPlaylist !== null) { + if (!$this->aCcPlaylist->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcPlaylist->getValidationFailures()); + } + } + + + if (($retval = CcPlaylistcontentsPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcPlaylistcontentsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getDbId(); + break; + case 1: + return $this->getDbPlaylistId(); + break; + case 2: + return $this->getDbFileId(); + break; + case 3: + return $this->getDbPosition(); + break; + case 4: + return $this->getDbCliplength(); + break; + case 5: + return $this->getDbCuein(); + break; + case 6: + return $this->getDbCueout(); + break; + case 7: + return $this->getDbFadein(); + break; + case 8: + return $this->getDbFadeout(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) + { + $keys = CcPlaylistcontentsPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbId(), + $keys[1] => $this->getDbPlaylistId(), + $keys[2] => $this->getDbFileId(), + $keys[3] => $this->getDbPosition(), + $keys[4] => $this->getDbCliplength(), + $keys[5] => $this->getDbCuein(), + $keys[6] => $this->getDbCueout(), + $keys[7] => $this->getDbFadein(), + $keys[8] => $this->getDbFadeout(), + ); + if ($includeForeignObjects) { + if (null !== $this->aCcFiles) { + $result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, true); + } + if (null !== $this->aCcPlaylist) { + $result['CcPlaylist'] = $this->aCcPlaylist->toArray($keyType, $includeLazyLoadColumns, true); + } + } + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcPlaylistcontentsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setDbId($value); + break; + case 1: + $this->setDbPlaylistId($value); + break; + case 2: + $this->setDbFileId($value); + break; + case 3: + $this->setDbPosition($value); + break; + case 4: + $this->setDbCliplength($value); + break; + case 5: + $this->setDbCuein($value); + break; + case 6: + $this->setDbCueout($value); + break; + case 7: + $this->setDbFadein($value); + break; + case 8: + $this->setDbFadeout($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcPlaylistcontentsPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbPlaylistId($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDbFileId($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDbPosition($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setDbCliplength($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setDbCuein($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setDbCueout($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setDbFadein($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setDbFadeout($arr[$keys[8]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcPlaylistcontentsPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcPlaylistcontentsPeer::ID)) $criteria->add(CcPlaylistcontentsPeer::ID, $this->id); + if ($this->isColumnModified(CcPlaylistcontentsPeer::PLAYLIST_ID)) $criteria->add(CcPlaylistcontentsPeer::PLAYLIST_ID, $this->playlist_id); + if ($this->isColumnModified(CcPlaylistcontentsPeer::FILE_ID)) $criteria->add(CcPlaylistcontentsPeer::FILE_ID, $this->file_id); + if ($this->isColumnModified(CcPlaylistcontentsPeer::POSITION)) $criteria->add(CcPlaylistcontentsPeer::POSITION, $this->position); + if ($this->isColumnModified(CcPlaylistcontentsPeer::CLIPLENGTH)) $criteria->add(CcPlaylistcontentsPeer::CLIPLENGTH, $this->cliplength); + if ($this->isColumnModified(CcPlaylistcontentsPeer::CUEIN)) $criteria->add(CcPlaylistcontentsPeer::CUEIN, $this->cuein); + if ($this->isColumnModified(CcPlaylistcontentsPeer::CUEOUT)) $criteria->add(CcPlaylistcontentsPeer::CUEOUT, $this->cueout); + if ($this->isColumnModified(CcPlaylistcontentsPeer::FADEIN)) $criteria->add(CcPlaylistcontentsPeer::FADEIN, $this->fadein); + if ($this->isColumnModified(CcPlaylistcontentsPeer::FADEOUT)) $criteria->add(CcPlaylistcontentsPeer::FADEOUT, $this->fadeout); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcPlaylistcontentsPeer::DATABASE_NAME); + $criteria->add(CcPlaylistcontentsPeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getDbId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getDbId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcPlaylistcontents (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setDbPlaylistId($this->playlist_id); + $copyObj->setDbFileId($this->file_id); + $copyObj->setDbPosition($this->position); + $copyObj->setDbCliplength($this->cliplength); + $copyObj->setDbCuein($this->cuein); + $copyObj->setDbCueout($this->cueout); + $copyObj->setDbFadein($this->fadein); + $copyObj->setDbFadeout($this->fadeout); + + $copyObj->setNew(true); + $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcPlaylistcontents Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcPlaylistcontentsPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcPlaylistcontentsPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a CcFiles object. + * + * @param CcFiles $v + * @return CcPlaylistcontents The current object (for fluent API support) + * @throws PropelException + */ + public function setCcFiles(CcFiles $v = null) + { + if ($v === null) { + $this->setDbFileId(NULL); + } else { + $this->setDbFileId($v->getDbId()); + } + + $this->aCcFiles = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcFiles object, it will not be re-added. + if ($v !== null) { + $v->addCcPlaylistcontents($this); + } + + return $this; + } + + + /** + * Get the associated CcFiles object + * + * @param PropelPDO Optional Connection object. + * @return CcFiles The associated CcFiles object. + * @throws PropelException + */ + public function getCcFiles(PropelPDO $con = null) + { + if ($this->aCcFiles === null && ($this->file_id !== null)) { + $this->aCcFiles = CcFilesQuery::create()->findPk($this->file_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->aCcFiles->addCcPlaylistcontentss($this); + */ + } + return $this->aCcFiles; + } + + /** + * Declares an association between this object and a CcPlaylist object. + * + * @param CcPlaylist $v + * @return CcPlaylistcontents The current object (for fluent API support) + * @throws PropelException + */ + public function setCcPlaylist(CcPlaylist $v = null) + { + if ($v === null) { + $this->setDbPlaylistId(NULL); + } else { + $this->setDbPlaylistId($v->getDbId()); + } + + $this->aCcPlaylist = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcPlaylist object, it will not be re-added. + if ($v !== null) { + $v->addCcPlaylistcontents($this); + } + + return $this; + } + + + /** + * Get the associated CcPlaylist object + * + * @param PropelPDO Optional Connection object. + * @return CcPlaylist The associated CcPlaylist object. + * @throws PropelException + */ + public function getCcPlaylist(PropelPDO $con = null) + { + if ($this->aCcPlaylist === null && ($this->playlist_id !== null)) { + $this->aCcPlaylist = CcPlaylistQuery::create()->findPk($this->playlist_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->aCcPlaylist->addCcPlaylistcontentss($this); + */ + } + return $this->aCcPlaylist; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->playlist_id = null; + $this->file_id = null; + $this->position = null; + $this->cliplength = null; + $this->cuein = null; + $this->cueout = null; + $this->fadein = null; + $this->fadeout = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->applyDefaultValues(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aCcFiles = null; + $this->aCcPlaylist = null; + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcPlaylistcontents diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistcontentsPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistcontentsPeer.php new file mode 100644 index 000000000..0bb899b67 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistcontentsPeer.php @@ -0,0 +1,1395 @@ + array ('DbId', 'DbPlaylistId', 'DbFileId', 'DbPosition', 'DbCliplength', 'DbCuein', 'DbCueout', 'DbFadein', 'DbFadeout', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbFileId', 'dbPosition', 'dbCliplength', 'dbCuein', 'dbCueout', 'dbFadein', 'dbFadeout', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::PLAYLIST_ID, self::FILE_ID, self::POSITION, self::CLIPLENGTH, self::CUEIN, self::CUEOUT, self::FADEIN, self::FADEOUT, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'FILE_ID', 'POSITION', 'CLIPLENGTH', 'CUEIN', 'CUEOUT', 'FADEIN', 'FADEOUT', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'file_id', 'position', 'cliplength', 'cuein', 'cueout', 'fadein', 'fadeout', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbPlaylistId' => 1, 'DbFileId' => 2, 'DbPosition' => 3, 'DbCliplength' => 4, 'DbCuein' => 5, 'DbCueout' => 6, 'DbFadein' => 7, 'DbFadeout' => 8, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbFileId' => 2, 'dbPosition' => 3, 'dbCliplength' => 4, 'dbCuein' => 5, 'dbCueout' => 6, 'dbFadein' => 7, 'dbFadeout' => 8, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PLAYLIST_ID => 1, self::FILE_ID => 2, self::POSITION => 3, self::CLIPLENGTH => 4, self::CUEIN => 5, self::CUEOUT => 6, self::FADEIN => 7, self::FADEOUT => 8, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'FILE_ID' => 2, 'POSITION' => 3, 'CLIPLENGTH' => 4, 'CUEIN' => 5, 'CUEOUT' => 6, 'FADEIN' => 7, 'FADEOUT' => 8, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'file_id' => 2, 'position' => 3, 'cliplength' => 4, 'cuein' => 5, 'cueout' => 6, 'fadein' => 7, 'fadeout' => 8, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcPlaylistcontentsPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcPlaylistcontentsPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcPlaylistcontentsPeer::ID); + $criteria->addSelectColumn(CcPlaylistcontentsPeer::PLAYLIST_ID); + $criteria->addSelectColumn(CcPlaylistcontentsPeer::FILE_ID); + $criteria->addSelectColumn(CcPlaylistcontentsPeer::POSITION); + $criteria->addSelectColumn(CcPlaylistcontentsPeer::CLIPLENGTH); + $criteria->addSelectColumn(CcPlaylistcontentsPeer::CUEIN); + $criteria->addSelectColumn(CcPlaylistcontentsPeer::CUEOUT); + $criteria->addSelectColumn(CcPlaylistcontentsPeer::FADEIN); + $criteria->addSelectColumn(CcPlaylistcontentsPeer::FADEOUT); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.PLAYLIST_ID'); + $criteria->addSelectColumn($alias . '.FILE_ID'); + $criteria->addSelectColumn($alias . '.POSITION'); + $criteria->addSelectColumn($alias . '.CLIPLENGTH'); + $criteria->addSelectColumn($alias . '.CUEIN'); + $criteria->addSelectColumn($alias . '.CUEOUT'); + $criteria->addSelectColumn($alias . '.FADEIN'); + $criteria->addSelectColumn($alias . '.FADEOUT'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcPlaylistcontentsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcPlaylistcontentsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcPlaylistcontents + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcPlaylistcontentsPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcPlaylistcontentsPeer::populateObjects(CcPlaylistcontentsPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcPlaylistcontentsPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcPlaylistcontents $value A CcPlaylistcontents object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcPlaylistcontents $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcPlaylistcontents object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcPlaylistcontents) { + $key = (string) $value->getDbId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcPlaylistcontents object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcPlaylistcontents Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_playlistcontents + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcPlaylistcontentsPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcPlaylistcontentsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcPlaylistcontentsPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcPlaylistcontentsPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcPlaylistcontents object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcPlaylistcontentsPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcPlaylistcontentsPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcPlaylistcontentsPeer::NUM_COLUMNS; + } else { + $cls = CcPlaylistcontentsPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcPlaylistcontentsPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + + /** + * Returns the number of rows matching criteria, joining the related CcFiles table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcPlaylistcontentsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcPlaylistcontentsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related CcPlaylist table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinCcPlaylist(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcPlaylistcontentsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcPlaylistcontentsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcPlaylistcontents objects pre-filled with their CcFiles objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcPlaylistcontents objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcPlaylistcontentsPeer::addSelectColumns($criteria); + $startcol = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS); + CcFilesPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcPlaylistcontentsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcPlaylistcontentsPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcPlaylistcontentsPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcPlaylistcontentsPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcFilesPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcFilesPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcFilesPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcPlaylistcontents) to $obj2 (CcFiles) + $obj2->addCcPlaylistcontents($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of CcPlaylistcontents objects pre-filled with their CcPlaylist objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcPlaylistcontents objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcPlaylist(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcPlaylistcontentsPeer::addSelectColumns($criteria); + $startcol = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS); + CcPlaylistPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcPlaylistcontentsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcPlaylistcontentsPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcPlaylistcontentsPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcPlaylistcontentsPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcPlaylistPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcPlaylistPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcPlaylistPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcPlaylistcontents) to $obj2 (CcPlaylist) + $obj2->addCcPlaylistcontents($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining all related tables + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcPlaylistcontentsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcPlaylistcontentsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of CcPlaylistcontents objects pre-filled with all related objects. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcPlaylistcontents objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcPlaylistcontentsPeer::addSelectColumns($criteria); + $startcol2 = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS); + + CcFilesPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS); + + CcPlaylistPeer::addSelectColumns($criteria); + $startcol4 = $startcol3 + (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcPlaylistcontentsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcPlaylistcontentsPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcPlaylistcontentsPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcPlaylistcontentsPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcFiles rows + + $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcFilesPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcFilesPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcFilesPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (CcPlaylistcontents) to the collection in $obj2 (CcFiles) + $obj2->addCcPlaylistcontents($obj1); + } // if joined row not null + + // Add objects for joined CcPlaylist rows + + $key3 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = CcPlaylistPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $cls = CcPlaylistPeer::getOMClass(false); + + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + CcPlaylistPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (CcPlaylistcontents) to the collection in $obj3 (CcPlaylist) + $obj3->addCcPlaylistcontents($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related CcFiles table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcPlaylistcontentsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcPlaylistcontentsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related CcPlaylist table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptCcPlaylist(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcPlaylistcontentsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcPlaylistcontentsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcPlaylistcontents objects pre-filled with all related objects except CcFiles. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcPlaylistcontents objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + // $criteria->getDbName() will return the same object if not set to another value + // so == check is okay and faster + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcPlaylistcontentsPeer::addSelectColumns($criteria); + $startcol2 = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS); + + CcPlaylistPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistPeer::ID, $join_behavior); + + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcPlaylistcontentsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcPlaylistcontentsPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcPlaylistcontentsPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcPlaylistcontentsPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcPlaylist rows + + $key2 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcPlaylistPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcPlaylistPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcPlaylistPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (CcPlaylistcontents) to the collection in $obj2 (CcPlaylist) + $obj2->addCcPlaylistcontents($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of CcPlaylistcontents objects pre-filled with all related objects except CcPlaylist. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcPlaylistcontents objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptCcPlaylist(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + // $criteria->getDbName() will return the same object if not set to another value + // so == check is okay and faster + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcPlaylistcontentsPeer::addSelectColumns($criteria); + $startcol2 = (CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS); + + CcFilesPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcPlaylistcontentsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcPlaylistcontentsPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcPlaylistcontentsPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcPlaylistcontentsPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcFiles rows + + $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcFilesPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcFilesPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcFilesPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (CcPlaylistcontents) to the collection in $obj2 (CcFiles) + $obj2->addCcPlaylistcontents($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcPlaylistcontentsPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcPlaylistcontentsPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcPlaylistcontentsTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcPlaylistcontentsPeer::CLASS_DEFAULT : CcPlaylistcontentsPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcPlaylistcontents or Criteria object. + * + * @param mixed $values Criteria or CcPlaylistcontents object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcPlaylistcontents object + } + + if ($criteria->containsKey(CcPlaylistcontentsPeer::ID) && $criteria->keyContainsValue(CcPlaylistcontentsPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlaylistcontentsPeer::ID.')'); + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcPlaylistcontents or Criteria object. + * + * @param mixed $values Criteria or CcPlaylistcontents object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcPlaylistcontentsPeer::ID); + $value = $criteria->remove(CcPlaylistcontentsPeer::ID); + if ($value) { + $selectCriteria->add(CcPlaylistcontentsPeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcPlaylistcontentsPeer::TABLE_NAME); + } + + } else { // $values is CcPlaylistcontents object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_playlistcontents table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcPlaylistcontentsPeer::TABLE_NAME, $con, CcPlaylistcontentsPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcPlaylistcontentsPeer::clearInstancePool(); + CcPlaylistcontentsPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcPlaylistcontents or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcPlaylistcontents object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcPlaylistcontentsPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcPlaylistcontents) { // it's a model object + // invalidate the cache for this single object + CcPlaylistcontentsPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcPlaylistcontentsPeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcPlaylistcontentsPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcPlaylistcontentsPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcPlaylistcontents object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcPlaylistcontents $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcPlaylistcontents $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcPlaylistcontentsPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcPlaylistcontentsPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcPlaylistcontentsPeer::DATABASE_NAME, CcPlaylistcontentsPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcPlaylistcontents + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcPlaylistcontentsPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcPlaylistcontentsPeer::DATABASE_NAME); + $criteria->add(CcPlaylistcontentsPeer::ID, $pk); + + $v = CcPlaylistcontentsPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcPlaylistcontentsPeer::DATABASE_NAME); + $criteria->add(CcPlaylistcontentsPeer::ID, $pks, Criteria::IN); + $objs = CcPlaylistcontentsPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcPlaylistcontentsPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcPlaylistcontentsPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistcontentsQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistcontentsQuery.php new file mode 100644 index 000000000..6c717c6c6 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPlaylistcontentsQuery.php @@ -0,0 +1,581 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcPlaylistcontents|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcPlaylistcontentsPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcPlaylistcontentsQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcPlaylistcontentsPeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcPlaylistcontentsQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcPlaylistcontentsPeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * @param int|array $dbId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPlaylistcontentsQuery The current query, for fluid interface + */ + public function filterByDbId($dbId = null, $comparison = null) + { + if (is_array($dbId) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcPlaylistcontentsPeer::ID, $dbId, $comparison); + } + + /** + * Filter the query on the playlist_id column + * + * @param int|array $dbPlaylistId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPlaylistcontentsQuery The current query, for fluid interface + */ + public function filterByDbPlaylistId($dbPlaylistId = null, $comparison = null) + { + if (is_array($dbPlaylistId)) { + $useMinMax = false; + if (isset($dbPlaylistId['min'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::PLAYLIST_ID, $dbPlaylistId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbPlaylistId['max'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::PLAYLIST_ID, $dbPlaylistId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcPlaylistcontentsPeer::PLAYLIST_ID, $dbPlaylistId, $comparison); + } + + /** + * Filter the query on the file_id column + * + * @param int|array $dbFileId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPlaylistcontentsQuery The current query, for fluid interface + */ + public function filterByDbFileId($dbFileId = null, $comparison = null) + { + if (is_array($dbFileId)) { + $useMinMax = false; + if (isset($dbFileId['min'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::FILE_ID, $dbFileId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbFileId['max'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::FILE_ID, $dbFileId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcPlaylistcontentsPeer::FILE_ID, $dbFileId, $comparison); + } + + /** + * Filter the query on the position column + * + * @param int|array $dbPosition 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 CcPlaylistcontentsQuery The current query, for fluid interface + */ + public function filterByDbPosition($dbPosition = null, $comparison = null) + { + if (is_array($dbPosition)) { + $useMinMax = false; + if (isset($dbPosition['min'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::POSITION, $dbPosition['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbPosition['max'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::POSITION, $dbPosition['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcPlaylistcontentsPeer::POSITION, $dbPosition, $comparison); + } + + /** + * Filter the query on the cliplength column + * + * @param string|array $dbCliplength The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPlaylistcontentsQuery The current query, for fluid interface + */ + public function filterByDbCliplength($dbCliplength = null, $comparison = null) + { + if (is_array($dbCliplength)) { + $useMinMax = false; + if (isset($dbCliplength['min'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::CLIPLENGTH, $dbCliplength['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbCliplength['max'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::CLIPLENGTH, $dbCliplength['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcPlaylistcontentsPeer::CLIPLENGTH, $dbCliplength, $comparison); + } + + /** + * Filter the query on the cuein column + * + * @param string|array $dbCuein The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPlaylistcontentsQuery The current query, for fluid interface + */ + public function filterByDbCuein($dbCuein = null, $comparison = null) + { + if (is_array($dbCuein)) { + $useMinMax = false; + if (isset($dbCuein['min'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::CUEIN, $dbCuein['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbCuein['max'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::CUEIN, $dbCuein['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcPlaylistcontentsPeer::CUEIN, $dbCuein, $comparison); + } + + /** + * Filter the query on the cueout column + * + * @param string|array $dbCueout The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPlaylistcontentsQuery The current query, for fluid interface + */ + public function filterByDbCueout($dbCueout = null, $comparison = null) + { + if (is_array($dbCueout)) { + $useMinMax = false; + if (isset($dbCueout['min'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::CUEOUT, $dbCueout['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbCueout['max'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::CUEOUT, $dbCueout['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcPlaylistcontentsPeer::CUEOUT, $dbCueout, $comparison); + } + + /** + * Filter the query on the fadein column + * + * @param string|array $dbFadein The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPlaylistcontentsQuery The current query, for fluid interface + */ + public function filterByDbFadein($dbFadein = null, $comparison = null) + { + if (is_array($dbFadein)) { + $useMinMax = false; + if (isset($dbFadein['min'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::FADEIN, $dbFadein['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbFadein['max'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::FADEIN, $dbFadein['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcPlaylistcontentsPeer::FADEIN, $dbFadein, $comparison); + } + + /** + * Filter the query on the fadeout column + * + * @param string|array $dbFadeout The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPlaylistcontentsQuery The current query, for fluid interface + */ + public function filterByDbFadeout($dbFadeout = null, $comparison = null) + { + if (is_array($dbFadeout)) { + $useMinMax = false; + if (isset($dbFadeout['min'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::FADEOUT, $dbFadeout['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbFadeout['max'])) { + $this->addUsingAlias(CcPlaylistcontentsPeer::FADEOUT, $dbFadeout['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcPlaylistcontentsPeer::FADEOUT, $dbFadeout, $comparison); + } + + /** + * Filter the query by a related CcFiles object + * + * @param CcFiles $ccFiles the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPlaylistcontentsQuery The current query, for fluid interface + */ + public function filterByCcFiles($ccFiles, $comparison = null) + { + return $this + ->addUsingAlias(CcPlaylistcontentsPeer::FILE_ID, $ccFiles->getDbId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcFiles relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcPlaylistcontentsQuery The current query, for fluid interface + */ + public function joinCcFiles($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcFiles'); + + // 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, 'CcFiles'); + } + + return $this; + } + + /** + * Use the CcFiles relation CcFiles 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 CcFilesQuery A secondary query class using the current class as primary query + */ + public function useCcFilesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcFiles($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery'); + } + + /** + * Filter the query by a related CcPlaylist object + * + * @param CcPlaylist $ccPlaylist the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPlaylistcontentsQuery The current query, for fluid interface + */ + public function filterByCcPlaylist($ccPlaylist, $comparison = null) + { + return $this + ->addUsingAlias(CcPlaylistcontentsPeer::PLAYLIST_ID, $ccPlaylist->getDbId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcPlaylist relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcPlaylistcontentsQuery The current query, for fluid interface + */ + public function joinCcPlaylist($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcPlaylist'); + + // 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, 'CcPlaylist'); + } + + return $this; + } + + /** + * Use the CcPlaylist relation CcPlaylist 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 CcPlaylistQuery A secondary query class using the current class as primary query + */ + public function useCcPlaylistQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcPlaylist($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcPlaylist', 'CcPlaylistQuery'); + } + + /** + * Exclude object from result + * + * @param CcPlaylistcontents $ccPlaylistcontents Object to remove from the list of results + * + * @return CcPlaylistcontentsQuery The current query, for fluid interface + */ + public function prune($ccPlaylistcontents = null) + { + if ($ccPlaylistcontents) { + $this->addUsingAlias(CcPlaylistcontentsPeer::ID, $ccPlaylistcontents->getDbId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcPlaylistcontentsQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPref.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPref.php new file mode 100644 index 000000000..b1d9a307e --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPref.php @@ -0,0 +1,905 @@ +id; + } + + /** + * Get the [subjid] column value. + * + * @return int + */ + public function getSubjid() + { + return $this->subjid; + } + + /** + * Get the [keystr] column value. + * + * @return string + */ + public function getKeystr() + { + return $this->keystr; + } + + /** + * Get the [valstr] column value. + * + * @return string + */ + public function getValstr() + { + return $this->valstr; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return CcPref The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CcPrefPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [subjid] column. + * + * @param int $v new value + * @return CcPref The current object (for fluent API support) + */ + public function setSubjid($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->subjid !== $v) { + $this->subjid = $v; + $this->modifiedColumns[] = CcPrefPeer::SUBJID; + } + + if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) { + $this->aCcSubjs = null; + } + + return $this; + } // setSubjid() + + /** + * Set the value of [keystr] column. + * + * @param string $v new value + * @return CcPref The current object (for fluent API support) + */ + public function setKeystr($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->keystr !== $v) { + $this->keystr = $v; + $this->modifiedColumns[] = CcPrefPeer::KEYSTR; + } + + return $this; + } // setKeystr() + + /** + * Set the value of [valstr] column. + * + * @param string $v new value + * @return CcPref The current object (for fluent API support) + */ + public function setValstr($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->valstr !== $v) { + $this->valstr = $v; + $this->modifiedColumns[] = CcPrefPeer::VALSTR; + } + + return $this; + } // setValstr() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->subjid = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->keystr = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->valstr = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 4; // 4 = CcPrefPeer::NUM_COLUMNS - CcPrefPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcPref object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aCcSubjs !== null && $this->subjid !== $this->aCcSubjs->getDbId()) { + $this->aCcSubjs = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcPrefPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aCcSubjs = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcPrefQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcPrefPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcSubjs !== null) { + if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { + $affectedRows += $this->aCcSubjs->save($con); + } + $this->setCcSubjs($this->aCcSubjs); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = CcPrefPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + if ($criteria->keyContainsValue(CcPrefPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPrefPeer::ID.')'); + } + + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows += 1; + $this->setId($pk); //[IMV] update autoincrement primary key + $this->setNew(false); + } else { + $affectedRows += CcPrefPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + // We call the validate method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcSubjs !== null) { + if (!$this->aCcSubjs->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures()); + } + } + + + if (($retval = CcPrefPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcPrefPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getSubjid(); + break; + case 2: + return $this->getKeystr(); + break; + case 3: + return $this->getValstr(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) + { + $keys = CcPrefPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getSubjid(), + $keys[2] => $this->getKeystr(), + $keys[3] => $this->getValstr(), + ); + if ($includeForeignObjects) { + if (null !== $this->aCcSubjs) { + $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, true); + } + } + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcPrefPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setId($value); + break; + case 1: + $this->setSubjid($value); + break; + case 2: + $this->setKeystr($value); + break; + case 3: + $this->setValstr($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcPrefPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setSubjid($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setKeystr($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setValstr($arr[$keys[3]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcPrefPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcPrefPeer::ID)) $criteria->add(CcPrefPeer::ID, $this->id); + if ($this->isColumnModified(CcPrefPeer::SUBJID)) $criteria->add(CcPrefPeer::SUBJID, $this->subjid); + if ($this->isColumnModified(CcPrefPeer::KEYSTR)) $criteria->add(CcPrefPeer::KEYSTR, $this->keystr); + if ($this->isColumnModified(CcPrefPeer::VALSTR)) $criteria->add(CcPrefPeer::VALSTR, $this->valstr); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcPrefPeer::DATABASE_NAME); + $criteria->add(CcPrefPeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcPref (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setSubjid($this->subjid); + $copyObj->setKeystr($this->keystr); + $copyObj->setValstr($this->valstr); + + $copyObj->setNew(true); + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcPref Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcPrefPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcPrefPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a CcSubjs object. + * + * @param CcSubjs $v + * @return CcPref The current object (for fluent API support) + * @throws PropelException + */ + public function setCcSubjs(CcSubjs $v = null) + { + if ($v === null) { + $this->setSubjid(NULL); + } else { + $this->setSubjid($v->getDbId()); + } + + $this->aCcSubjs = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcSubjs object, it will not be re-added. + if ($v !== null) { + $v->addCcPref($this); + } + + return $this; + } + + + /** + * Get the associated CcSubjs object + * + * @param PropelPDO Optional Connection object. + * @return CcSubjs The associated CcSubjs object. + * @throws PropelException + */ + public function getCcSubjs(PropelPDO $con = null) + { + if ($this->aCcSubjs === null && ($this->subjid !== null)) { + $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->subjid, $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->aCcSubjs->addCcPrefs($this); + */ + } + return $this->aCcSubjs; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->subjid = null; + $this->keystr = null; + $this->valstr = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aCcSubjs = null; + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcPref diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPrefPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPrefPeer.php new file mode 100644 index 000000000..cb6345eac --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPrefPeer.php @@ -0,0 +1,983 @@ + array ('Id', 'Subjid', 'Keystr', 'Valstr', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'subjid', 'keystr', 'valstr', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::SUBJID, self::KEYSTR, self::VALSTR, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'SUBJID', 'KEYSTR', 'VALSTR', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'subjid', 'keystr', 'valstr', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Subjid' => 1, 'Keystr' => 2, 'Valstr' => 3, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'subjid' => 1, 'keystr' => 2, 'valstr' => 3, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::SUBJID => 1, self::KEYSTR => 2, self::VALSTR => 3, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'SUBJID' => 1, 'KEYSTR' => 2, 'VALSTR' => 3, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'subjid' => 1, 'keystr' => 2, 'valstr' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcPrefPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcPrefPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcPrefPeer::ID); + $criteria->addSelectColumn(CcPrefPeer::SUBJID); + $criteria->addSelectColumn(CcPrefPeer::KEYSTR); + $criteria->addSelectColumn(CcPrefPeer::VALSTR); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.SUBJID'); + $criteria->addSelectColumn($alias . '.KEYSTR'); + $criteria->addSelectColumn($alias . '.VALSTR'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcPrefPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcPrefPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcPref + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcPrefPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcPrefPeer::populateObjects(CcPrefPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcPrefPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcPref $value A CcPref object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcPref $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcPref object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcPref) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcPref object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcPref Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_pref + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcPrefPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcPrefPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcPrefPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcPrefPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcPref object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcPrefPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcPrefPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcPrefPeer::NUM_COLUMNS; + } else { + $cls = CcPrefPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcPrefPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + + /** + * Returns the number of rows matching criteria, joining the related CcSubjs table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcPrefPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcPrefPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcPrefPeer::SUBJID, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcPref objects pre-filled with their CcSubjs objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcPref objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcPrefPeer::addSelectColumns($criteria); + $startcol = (CcPrefPeer::NUM_COLUMNS - CcPrefPeer::NUM_LAZY_LOAD_COLUMNS); + CcSubjsPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcPrefPeer::SUBJID, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcPrefPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcPrefPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcPrefPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcPrefPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcSubjsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcSubjsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcSubjsPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcPref) to $obj2 (CcSubjs) + $obj2->addCcPref($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining all related tables + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcPrefPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcPrefPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcPrefPeer::SUBJID, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of CcPref objects pre-filled with all related objects. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcPref objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcPrefPeer::addSelectColumns($criteria); + $startcol2 = (CcPrefPeer::NUM_COLUMNS - CcPrefPeer::NUM_LAZY_LOAD_COLUMNS); + + CcSubjsPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcPrefPeer::SUBJID, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcPrefPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcPrefPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcPrefPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcPrefPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcSubjs rows + + $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcSubjsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcSubjsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcSubjsPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (CcPref) to the collection in $obj2 (CcSubjs) + $obj2->addCcPref($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcPrefPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcPrefPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcPrefTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcPrefPeer::CLASS_DEFAULT : CcPrefPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcPref or Criteria object. + * + * @param mixed $values Criteria or CcPref object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcPref object + } + + if ($criteria->containsKey(CcPrefPeer::ID) && $criteria->keyContainsValue(CcPrefPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPrefPeer::ID.')'); + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcPref or Criteria object. + * + * @param mixed $values Criteria or CcPref object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcPrefPeer::ID); + $value = $criteria->remove(CcPrefPeer::ID); + if ($value) { + $selectCriteria->add(CcPrefPeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcPrefPeer::TABLE_NAME); + } + + } else { // $values is CcPref object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_pref table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcPrefPeer::TABLE_NAME, $con, CcPrefPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcPrefPeer::clearInstancePool(); + CcPrefPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcPref or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcPref object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcPrefPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcPref) { // it's a model object + // invalidate the cache for this single object + CcPrefPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcPrefPeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcPrefPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcPrefPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcPref object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcPref $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcPref $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcPrefPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcPrefPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcPrefPeer::DATABASE_NAME, CcPrefPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcPref + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcPrefPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcPrefPeer::DATABASE_NAME); + $criteria->add(CcPrefPeer::ID, $pk); + + $v = CcPrefPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcPrefPeer::DATABASE_NAME); + $criteria->add(CcPrefPeer::ID, $pks, Criteria::IN); + $objs = CcPrefPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcPrefPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcPrefPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPrefQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPrefQuery.php new file mode 100644 index 000000000..473bafc98 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcPrefQuery.php @@ -0,0 +1,320 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcPref|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcPrefPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcPrefQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcPrefPeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcPrefQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcPrefPeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * @param int|array $id 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 CcPrefQuery The current query, for fluid interface + */ + public function filterById($id = null, $comparison = null) + { + if (is_array($id) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcPrefPeer::ID, $id, $comparison); + } + + /** + * Filter the query on the subjid column + * + * @param int|array $subjid 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 CcPrefQuery The current query, for fluid interface + */ + public function filterBySubjid($subjid = null, $comparison = null) + { + if (is_array($subjid)) { + $useMinMax = false; + if (isset($subjid['min'])) { + $this->addUsingAlias(CcPrefPeer::SUBJID, $subjid['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($subjid['max'])) { + $this->addUsingAlias(CcPrefPeer::SUBJID, $subjid['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcPrefPeer::SUBJID, $subjid, $comparison); + } + + /** + * Filter the query on the keystr column + * + * @param string $keystr The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPrefQuery The current query, for fluid interface + */ + public function filterByKeystr($keystr = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($keystr)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $keystr)) { + $keystr = str_replace('*', '%', $keystr); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcPrefPeer::KEYSTR, $keystr, $comparison); + } + + /** + * Filter the query on the valstr column + * + * @param string $valstr The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPrefQuery The current query, for fluid interface + */ + public function filterByValstr($valstr = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($valstr)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $valstr)) { + $valstr = str_replace('*', '%', $valstr); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcPrefPeer::VALSTR, $valstr, $comparison); + } + + /** + * Filter the query by a related CcSubjs object + * + * @param CcSubjs $ccSubjs the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcPrefQuery The current query, for fluid interface + */ + public function filterByCcSubjs($ccSubjs, $comparison = null) + { + return $this + ->addUsingAlias(CcPrefPeer::SUBJID, $ccSubjs->getDbId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcSubjs relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcPrefQuery The current query, for fluid interface + */ + public function joinCcSubjs($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcSubjs'); + + // 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, 'CcSubjs'); + } + + return $this; + } + + /** + * Use the CcSubjs relation CcSubjs 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 CcSubjsQuery A secondary query class using the current class as primary query + */ + public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcSubjs($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); + } + + /** + * Exclude object from result + * + * @param CcPref $ccPref Object to remove from the list of results + * + * @return CcPrefQuery The current query, for fluid interface + */ + public function prune($ccPref = null) + { + if ($ccPref) { + $this->addUsingAlias(CcPrefPeer::ID, $ccPref->getId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcPrefQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSchedule.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSchedule.php new file mode 100644 index 000000000..26a91778d --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSchedule.php @@ -0,0 +1,1923 @@ +clip_length = '00:00:00'; + $this->fade_in = '00:00:00'; + $this->fade_out = '00:00:00'; + $this->cue_in = '00:00:00'; + $this->cue_out = '00:00:00'; + $this->schedule_group_played = false; + $this->media_item_played = false; + } + + /** + * Initializes internal state of BaseCcSchedule object. + * @see applyDefaults() + */ + public function __construct() + { + parent::__construct(); + $this->applyDefaultValues(); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getDbId() + { + return $this->id; + } + + /** + * Get the [playlist_id] column value. + * + * @return int + */ + public function getDbPlaylistId() + { + return $this->playlist_id; + } + + /** + * Get the [optionally formatted] temporal [starts] 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 getDbStarts($format = 'Y-m-d H:i:s') + { + if ($this->starts === null) { + return null; + } + + + + try { + $dt = new DateTime($this->starts); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->starts, 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); + } + } + + /** + * Get the [optionally formatted] temporal [ends] 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 getDbEnds($format = 'Y-m-d H:i:s') + { + if ($this->ends === null) { + return null; + } + + + + try { + $dt = new DateTime($this->ends); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->ends, 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); + } + } + + /** + * Get the [group_id] column value. + * + * @return int + */ + public function getDbGroupId() + { + return $this->group_id; + } + + /** + * Get the [file_id] column value. + * + * @return int + */ + public function getDbFileId() + { + return $this->file_id; + } + + /** + * Get the [optionally formatted] temporal [clip_length] 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 getDbClipLength($format = '%X') + { + if ($this->clip_length === null) { + return null; + } + + + + try { + $dt = new DateTime($this->clip_length); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->clip_length, 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); + } + } + + /** + * Get the [optionally formatted] temporal [fade_in] 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 getDbFadeIn($format = '%X') + { + if ($this->fade_in === null) { + return null; + } + + + + try { + $dt = new DateTime($this->fade_in); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->fade_in, 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); + } + } + + /** + * Get the [optionally formatted] temporal [fade_out] 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 getDbFadeOut($format = '%X') + { + if ($this->fade_out === null) { + return null; + } + + + + try { + $dt = new DateTime($this->fade_out); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->fade_out, 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); + } + } + + /** + * Get the [optionally formatted] temporal [cue_in] 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 getDbCueIn($format = '%X') + { + if ($this->cue_in === null) { + return null; + } + + + + try { + $dt = new DateTime($this->cue_in); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cue_in, 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); + } + } + + /** + * Get the [optionally formatted] temporal [cue_out] 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 getDbCueOut($format = '%X') + { + if ($this->cue_out === null) { + return null; + } + + + + try { + $dt = new DateTime($this->cue_out); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cue_out, 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); + } + } + + /** + * Get the [schedule_group_played] column value. + * + * @return boolean + */ + public function getDbScheduleGroupPlayed() + { + return $this->schedule_group_played; + } + + /** + * Get the [media_item_played] column value. + * + * @return boolean + */ + public function getDbMediaItemPlayed() + { + return $this->media_item_played; + } + + /** + * Get the [instance_id] column value. + * + * @return int + */ + public function getDbInstanceId() + { + return $this->instance_id; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return CcSchedule The current object (for fluent API support) + */ + public function setDbId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CcSchedulePeer::ID; + } + + return $this; + } // setDbId() + + /** + * Set the value of [playlist_id] column. + * + * @param int $v new value + * @return CcSchedule The current object (for fluent API support) + */ + public function setDbPlaylistId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->playlist_id !== $v) { + $this->playlist_id = $v; + $this->modifiedColumns[] = CcSchedulePeer::PLAYLIST_ID; + } + + return $this; + } // setDbPlaylistId() + + /** + * Sets the value of [starts] 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 CcSchedule The current object (for fluent API support) + */ + public function setDbStarts($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->starts !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->starts !== null && $tmpDt = new DateTime($this->starts)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->starts = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); + $this->modifiedColumns[] = CcSchedulePeer::STARTS; + } + } // if either are not null + + return $this; + } // setDbStarts() + + /** + * Sets the value of [ends] 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 CcSchedule The current object (for fluent API support) + */ + public function setDbEnds($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->ends !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->ends !== null && $tmpDt = new DateTime($this->ends)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->ends = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); + $this->modifiedColumns[] = CcSchedulePeer::ENDS; + } + } // if either are not null + + return $this; + } // setDbEnds() + + /** + * Set the value of [group_id] column. + * + * @param int $v new value + * @return CcSchedule The current object (for fluent API support) + */ + public function setDbGroupId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->group_id !== $v) { + $this->group_id = $v; + $this->modifiedColumns[] = CcSchedulePeer::GROUP_ID; + } + + return $this; + } // setDbGroupId() + + /** + * Set the value of [file_id] column. + * + * @param int $v new value + * @return CcSchedule The current object (for fluent API support) + */ + public function setDbFileId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->file_id !== $v) { + $this->file_id = $v; + $this->modifiedColumns[] = CcSchedulePeer::FILE_ID; + } + + if ($this->aCcFiles !== null && $this->aCcFiles->getDbId() !== $v) { + $this->aCcFiles = null; + } + + return $this; + } // setDbFileId() + + /** + * Sets the value of [clip_length] 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 CcSchedule The current object (for fluent API support) + */ + public function setDbClipLength($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->clip_length !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->clip_length !== null && $tmpDt = new DateTime($this->clip_length)) ? $tmpDt->format('H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default + ) + { + $this->clip_length = ($dt ? $dt->format('H:i:s') : null); + $this->modifiedColumns[] = CcSchedulePeer::CLIP_LENGTH; + } + } // if either are not null + + return $this; + } // setDbClipLength() + + /** + * Sets the value of [fade_in] 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 CcSchedule The current object (for fluent API support) + */ + public function setDbFadeIn($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->fade_in !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->fade_in !== null && $tmpDt = new DateTime($this->fade_in)) ? $tmpDt->format('H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default + ) + { + $this->fade_in = ($dt ? $dt->format('H:i:s') : null); + $this->modifiedColumns[] = CcSchedulePeer::FADE_IN; + } + } // if either are not null + + return $this; + } // setDbFadeIn() + + /** + * Sets the value of [fade_out] 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 CcSchedule The current object (for fluent API support) + */ + public function setDbFadeOut($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->fade_out !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->fade_out !== null && $tmpDt = new DateTime($this->fade_out)) ? $tmpDt->format('H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default + ) + { + $this->fade_out = ($dt ? $dt->format('H:i:s') : null); + $this->modifiedColumns[] = CcSchedulePeer::FADE_OUT; + } + } // if either are not null + + return $this; + } // setDbFadeOut() + + /** + * Sets the value of [cue_in] 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 CcSchedule The current object (for fluent API support) + */ + public function setDbCueIn($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->cue_in !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->cue_in !== null && $tmpDt = new DateTime($this->cue_in)) ? $tmpDt->format('H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default + ) + { + $this->cue_in = ($dt ? $dt->format('H:i:s') : null); + $this->modifiedColumns[] = CcSchedulePeer::CUE_IN; + } + } // if either are not null + + return $this; + } // setDbCueIn() + + /** + * Sets the value of [cue_out] 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 CcSchedule The current object (for fluent API support) + */ + public function setDbCueOut($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->cue_out !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->cue_out !== null && $tmpDt = new DateTime($this->cue_out)) ? $tmpDt->format('H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default + ) + { + $this->cue_out = ($dt ? $dt->format('H:i:s') : null); + $this->modifiedColumns[] = CcSchedulePeer::CUE_OUT; + } + } // if either are not null + + return $this; + } // setDbCueOut() + + /** + * Set the value of [schedule_group_played] column. + * + * @param boolean $v new value + * @return CcSchedule The current object (for fluent API support) + */ + public function setDbScheduleGroupPlayed($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->schedule_group_played !== $v || $this->isNew()) { + $this->schedule_group_played = $v; + $this->modifiedColumns[] = CcSchedulePeer::SCHEDULE_GROUP_PLAYED; + } + + return $this; + } // setDbScheduleGroupPlayed() + + /** + * Set the value of [media_item_played] column. + * + * @param boolean $v new value + * @return CcSchedule The current object (for fluent API support) + */ + public function setDbMediaItemPlayed($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->media_item_played !== $v || $this->isNew()) { + $this->media_item_played = $v; + $this->modifiedColumns[] = CcSchedulePeer::MEDIA_ITEM_PLAYED; + } + + return $this; + } // setDbMediaItemPlayed() + + /** + * Set the value of [instance_id] column. + * + * @param int $v new value + * @return CcSchedule The current object (for fluent API support) + */ + public function setDbInstanceId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->instance_id !== $v) { + $this->instance_id = $v; + $this->modifiedColumns[] = CcSchedulePeer::INSTANCE_ID; + } + + if ($this->aCcShowInstances !== null && $this->aCcShowInstances->getDbId() !== $v) { + $this->aCcShowInstances = null; + } + + return $this; + } // setDbInstanceId() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + if ($this->clip_length !== '00:00:00') { + return false; + } + + if ($this->fade_in !== '00:00:00') { + return false; + } + + if ($this->fade_out !== '00:00:00') { + return false; + } + + if ($this->cue_in !== '00:00:00') { + return false; + } + + if ($this->cue_out !== '00:00:00') { + return false; + } + + if ($this->schedule_group_played !== false) { + return false; + } + + if ($this->media_item_played !== false) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->playlist_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->starts = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->ends = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->group_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; + $this->file_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null; + $this->clip_length = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->fade_in = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; + $this->fade_out = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; + $this->cue_in = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; + $this->cue_out = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; + $this->schedule_group_played = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null; + $this->media_item_played = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null; + $this->instance_id = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 14; // 14 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcSchedule object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aCcFiles !== null && $this->file_id !== $this->aCcFiles->getDbId()) { + $this->aCcFiles = null; + } + if ($this->aCcShowInstances !== null && $this->instance_id !== $this->aCcShowInstances->getDbId()) { + $this->aCcShowInstances = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcSchedulePeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aCcShowInstances = null; + $this->aCcFiles = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcScheduleQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + // aggregate_column_relation behavior + $this->updateRelatedCcShowInstances($con); + CcSchedulePeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcShowInstances !== null) { + if ($this->aCcShowInstances->isModified() || $this->aCcShowInstances->isNew()) { + $affectedRows += $this->aCcShowInstances->save($con); + } + $this->setCcShowInstances($this->aCcShowInstances); + } + + if ($this->aCcFiles !== null) { + if ($this->aCcFiles->isModified() || $this->aCcFiles->isNew()) { + $affectedRows += $this->aCcFiles->save($con); + } + $this->setCcFiles($this->aCcFiles); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = CcSchedulePeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + if ($criteria->keyContainsValue(CcSchedulePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcSchedulePeer::ID.')'); + } + + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows += 1; + $this->setDbId($pk); //[IMV] update autoincrement primary key + $this->setNew(false); + } else { + $affectedRows += CcSchedulePeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + // We call the validate method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcShowInstances !== null) { + if (!$this->aCcShowInstances->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcShowInstances->getValidationFailures()); + } + } + + if ($this->aCcFiles !== null) { + if (!$this->aCcFiles->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcFiles->getValidationFailures()); + } + } + + + if (($retval = CcSchedulePeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcSchedulePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getDbId(); + break; + case 1: + return $this->getDbPlaylistId(); + break; + case 2: + return $this->getDbStarts(); + break; + case 3: + return $this->getDbEnds(); + break; + case 4: + return $this->getDbGroupId(); + break; + case 5: + return $this->getDbFileId(); + break; + case 6: + return $this->getDbClipLength(); + break; + case 7: + return $this->getDbFadeIn(); + break; + case 8: + return $this->getDbFadeOut(); + break; + case 9: + return $this->getDbCueIn(); + break; + case 10: + return $this->getDbCueOut(); + break; + case 11: + return $this->getDbScheduleGroupPlayed(); + break; + case 12: + return $this->getDbMediaItemPlayed(); + break; + case 13: + return $this->getDbInstanceId(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) + { + $keys = CcSchedulePeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbId(), + $keys[1] => $this->getDbPlaylistId(), + $keys[2] => $this->getDbStarts(), + $keys[3] => $this->getDbEnds(), + $keys[4] => $this->getDbGroupId(), + $keys[5] => $this->getDbFileId(), + $keys[6] => $this->getDbClipLength(), + $keys[7] => $this->getDbFadeIn(), + $keys[8] => $this->getDbFadeOut(), + $keys[9] => $this->getDbCueIn(), + $keys[10] => $this->getDbCueOut(), + $keys[11] => $this->getDbScheduleGroupPlayed(), + $keys[12] => $this->getDbMediaItemPlayed(), + $keys[13] => $this->getDbInstanceId(), + ); + if ($includeForeignObjects) { + if (null !== $this->aCcShowInstances) { + $result['CcShowInstances'] = $this->aCcShowInstances->toArray($keyType, $includeLazyLoadColumns, true); + } + if (null !== $this->aCcFiles) { + $result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, true); + } + } + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcSchedulePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setDbId($value); + break; + case 1: + $this->setDbPlaylistId($value); + break; + case 2: + $this->setDbStarts($value); + break; + case 3: + $this->setDbEnds($value); + break; + case 4: + $this->setDbGroupId($value); + break; + case 5: + $this->setDbFileId($value); + break; + case 6: + $this->setDbClipLength($value); + break; + case 7: + $this->setDbFadeIn($value); + break; + case 8: + $this->setDbFadeOut($value); + break; + case 9: + $this->setDbCueIn($value); + break; + case 10: + $this->setDbCueOut($value); + break; + case 11: + $this->setDbScheduleGroupPlayed($value); + break; + case 12: + $this->setDbMediaItemPlayed($value); + break; + case 13: + $this->setDbInstanceId($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcSchedulePeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbPlaylistId($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDbStarts($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDbEnds($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setDbGroupId($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setDbFileId($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setDbClipLength($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setDbFadeIn($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setDbFadeOut($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setDbCueIn($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setDbCueOut($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setDbScheduleGroupPlayed($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setDbMediaItemPlayed($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setDbInstanceId($arr[$keys[13]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcSchedulePeer::DATABASE_NAME); + + if ($this->isColumnModified(CcSchedulePeer::ID)) $criteria->add(CcSchedulePeer::ID, $this->id); + if ($this->isColumnModified(CcSchedulePeer::PLAYLIST_ID)) $criteria->add(CcSchedulePeer::PLAYLIST_ID, $this->playlist_id); + if ($this->isColumnModified(CcSchedulePeer::STARTS)) $criteria->add(CcSchedulePeer::STARTS, $this->starts); + if ($this->isColumnModified(CcSchedulePeer::ENDS)) $criteria->add(CcSchedulePeer::ENDS, $this->ends); + if ($this->isColumnModified(CcSchedulePeer::GROUP_ID)) $criteria->add(CcSchedulePeer::GROUP_ID, $this->group_id); + if ($this->isColumnModified(CcSchedulePeer::FILE_ID)) $criteria->add(CcSchedulePeer::FILE_ID, $this->file_id); + if ($this->isColumnModified(CcSchedulePeer::CLIP_LENGTH)) $criteria->add(CcSchedulePeer::CLIP_LENGTH, $this->clip_length); + if ($this->isColumnModified(CcSchedulePeer::FADE_IN)) $criteria->add(CcSchedulePeer::FADE_IN, $this->fade_in); + if ($this->isColumnModified(CcSchedulePeer::FADE_OUT)) $criteria->add(CcSchedulePeer::FADE_OUT, $this->fade_out); + if ($this->isColumnModified(CcSchedulePeer::CUE_IN)) $criteria->add(CcSchedulePeer::CUE_IN, $this->cue_in); + if ($this->isColumnModified(CcSchedulePeer::CUE_OUT)) $criteria->add(CcSchedulePeer::CUE_OUT, $this->cue_out); + if ($this->isColumnModified(CcSchedulePeer::SCHEDULE_GROUP_PLAYED)) $criteria->add(CcSchedulePeer::SCHEDULE_GROUP_PLAYED, $this->schedule_group_played); + if ($this->isColumnModified(CcSchedulePeer::MEDIA_ITEM_PLAYED)) $criteria->add(CcSchedulePeer::MEDIA_ITEM_PLAYED, $this->media_item_played); + if ($this->isColumnModified(CcSchedulePeer::INSTANCE_ID)) $criteria->add(CcSchedulePeer::INSTANCE_ID, $this->instance_id); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcSchedulePeer::DATABASE_NAME); + $criteria->add(CcSchedulePeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getDbId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getDbId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcSchedule (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setDbPlaylistId($this->playlist_id); + $copyObj->setDbStarts($this->starts); + $copyObj->setDbEnds($this->ends); + $copyObj->setDbGroupId($this->group_id); + $copyObj->setDbFileId($this->file_id); + $copyObj->setDbClipLength($this->clip_length); + $copyObj->setDbFadeIn($this->fade_in); + $copyObj->setDbFadeOut($this->fade_out); + $copyObj->setDbCueIn($this->cue_in); + $copyObj->setDbCueOut($this->cue_out); + $copyObj->setDbScheduleGroupPlayed($this->schedule_group_played); + $copyObj->setDbMediaItemPlayed($this->media_item_played); + $copyObj->setDbInstanceId($this->instance_id); + + $copyObj->setNew(true); + $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcSchedule Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcSchedulePeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcSchedulePeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a CcShowInstances object. + * + * @param CcShowInstances $v + * @return CcSchedule The current object (for fluent API support) + * @throws PropelException + */ + public function setCcShowInstances(CcShowInstances $v = null) + { + // aggregate_column_relation behavior + if (null !== $this->aCcShowInstances && $v !== $this->aCcShowInstances) { + $this->oldCcShowInstances = $this->aCcShowInstances; + } + if ($v === null) { + $this->setDbInstanceId(NULL); + } else { + $this->setDbInstanceId($v->getDbId()); + } + + $this->aCcShowInstances = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcShowInstances object, it will not be re-added. + if ($v !== null) { + $v->addCcSchedule($this); + } + + return $this; + } + + + /** + * Get the associated CcShowInstances object + * + * @param PropelPDO Optional Connection object. + * @return CcShowInstances The associated CcShowInstances object. + * @throws PropelException + */ + public function getCcShowInstances(PropelPDO $con = null) + { + 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->aCcShowInstances->addCcSchedules($this); + */ + } + return $this->aCcShowInstances; + } + + /** + * Declares an association between this object and a CcFiles object. + * + * @param CcFiles $v + * @return CcSchedule The current object (for fluent API support) + * @throws PropelException + */ + public function setCcFiles(CcFiles $v = null) + { + if ($v === null) { + $this->setDbFileId(NULL); + } else { + $this->setDbFileId($v->getDbId()); + } + + $this->aCcFiles = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcFiles object, it will not be re-added. + if ($v !== null) { + $v->addCcSchedule($this); + } + + return $this; + } + + + /** + * Get the associated CcFiles object + * + * @param PropelPDO Optional Connection object. + * @return CcFiles The associated CcFiles object. + * @throws PropelException + */ + public function getCcFiles(PropelPDO $con = null) + { + if ($this->aCcFiles === null && ($this->file_id !== null)) { + $this->aCcFiles = CcFilesQuery::create()->findPk($this->file_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->aCcFiles->addCcSchedules($this); + */ + } + return $this->aCcFiles; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->playlist_id = null; + $this->starts = null; + $this->ends = null; + $this->group_id = null; + $this->file_id = null; + $this->clip_length = null; + $this->fade_in = null; + $this->fade_out = null; + $this->cue_in = null; + $this->cue_out = null; + $this->schedule_group_played = null; + $this->media_item_played = null; + $this->instance_id = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->applyDefaultValues(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aCcShowInstances = null; + $this->aCcFiles = null; + } + + // aggregate_column_relation behavior + + /** + * Update the aggregate column in the related CcShowInstances object + * + * @param PropelPDO $con A connection object + */ + protected function updateRelatedCcShowInstances(PropelPDO $con) + { + if ($ccShowInstances = $this->getCcShowInstances()) { + $ccShowInstances->updateDbTimeFilled($con); + } + if ($this->oldCcShowInstances) { + $this->oldCcShowInstances->updateDbTimeFilled($con); + $this->oldCcShowInstances = null; + } + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcSchedule diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSchedulePeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSchedulePeer.php new file mode 100644 index 000000000..b21b26990 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSchedulePeer.php @@ -0,0 +1,1420 @@ + array ('DbId', 'DbPlaylistId', 'DbStarts', 'DbEnds', 'DbGroupId', 'DbFileId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbScheduleGroupPlayed', 'DbMediaItemPlayed', 'DbInstanceId', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbStarts', 'dbEnds', 'dbGroupId', 'dbFileId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbScheduleGroupPlayed', 'dbMediaItemPlayed', 'dbInstanceId', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::PLAYLIST_ID, self::STARTS, self::ENDS, self::GROUP_ID, self::FILE_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::SCHEDULE_GROUP_PLAYED, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'STARTS', 'ENDS', 'GROUP_ID', 'FILE_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'SCHEDULE_GROUP_PLAYED', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'starts', 'ends', 'group_id', 'file_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'schedule_group_played', 'media_item_played', 'instance_id', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbPlaylistId' => 1, 'DbStarts' => 2, 'DbEnds' => 3, 'DbGroupId' => 4, 'DbFileId' => 5, 'DbClipLength' => 6, 'DbFadeIn' => 7, 'DbFadeOut' => 8, 'DbCueIn' => 9, 'DbCueOut' => 10, 'DbScheduleGroupPlayed' => 11, 'DbMediaItemPlayed' => 12, 'DbInstanceId' => 13, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbStarts' => 2, 'dbEnds' => 3, 'dbGroupId' => 4, 'dbFileId' => 5, 'dbClipLength' => 6, 'dbFadeIn' => 7, 'dbFadeOut' => 8, 'dbCueIn' => 9, 'dbCueOut' => 10, 'dbScheduleGroupPlayed' => 11, 'dbMediaItemPlayed' => 12, 'dbInstanceId' => 13, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PLAYLIST_ID => 1, self::STARTS => 2, self::ENDS => 3, self::GROUP_ID => 4, self::FILE_ID => 5, self::CLIP_LENGTH => 6, self::FADE_IN => 7, self::FADE_OUT => 8, self::CUE_IN => 9, self::CUE_OUT => 10, self::SCHEDULE_GROUP_PLAYED => 11, self::MEDIA_ITEM_PLAYED => 12, self::INSTANCE_ID => 13, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'STARTS' => 2, 'ENDS' => 3, 'GROUP_ID' => 4, 'FILE_ID' => 5, 'CLIP_LENGTH' => 6, 'FADE_IN' => 7, 'FADE_OUT' => 8, 'CUE_IN' => 9, 'CUE_OUT' => 10, 'SCHEDULE_GROUP_PLAYED' => 11, 'MEDIA_ITEM_PLAYED' => 12, 'INSTANCE_ID' => 13, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'starts' => 2, 'ends' => 3, 'group_id' => 4, 'file_id' => 5, 'clip_length' => 6, 'fade_in' => 7, 'fade_out' => 8, 'cue_in' => 9, 'cue_out' => 10, 'schedule_group_played' => 11, 'media_item_played' => 12, 'instance_id' => 13, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcSchedulePeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcSchedulePeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcSchedulePeer::ID); + $criteria->addSelectColumn(CcSchedulePeer::PLAYLIST_ID); + $criteria->addSelectColumn(CcSchedulePeer::STARTS); + $criteria->addSelectColumn(CcSchedulePeer::ENDS); + $criteria->addSelectColumn(CcSchedulePeer::GROUP_ID); + $criteria->addSelectColumn(CcSchedulePeer::FILE_ID); + $criteria->addSelectColumn(CcSchedulePeer::CLIP_LENGTH); + $criteria->addSelectColumn(CcSchedulePeer::FADE_IN); + $criteria->addSelectColumn(CcSchedulePeer::FADE_OUT); + $criteria->addSelectColumn(CcSchedulePeer::CUE_IN); + $criteria->addSelectColumn(CcSchedulePeer::CUE_OUT); + $criteria->addSelectColumn(CcSchedulePeer::SCHEDULE_GROUP_PLAYED); + $criteria->addSelectColumn(CcSchedulePeer::MEDIA_ITEM_PLAYED); + $criteria->addSelectColumn(CcSchedulePeer::INSTANCE_ID); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.PLAYLIST_ID'); + $criteria->addSelectColumn($alias . '.STARTS'); + $criteria->addSelectColumn($alias . '.ENDS'); + $criteria->addSelectColumn($alias . '.GROUP_ID'); + $criteria->addSelectColumn($alias . '.FILE_ID'); + $criteria->addSelectColumn($alias . '.CLIP_LENGTH'); + $criteria->addSelectColumn($alias . '.FADE_IN'); + $criteria->addSelectColumn($alias . '.FADE_OUT'); + $criteria->addSelectColumn($alias . '.CUE_IN'); + $criteria->addSelectColumn($alias . '.CUE_OUT'); + $criteria->addSelectColumn($alias . '.SCHEDULE_GROUP_PLAYED'); + $criteria->addSelectColumn($alias . '.MEDIA_ITEM_PLAYED'); + $criteria->addSelectColumn($alias . '.INSTANCE_ID'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcSchedulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcSchedule + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcSchedulePeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcSchedulePeer::populateObjects(CcSchedulePeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcSchedulePeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcSchedule $value A CcSchedule object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcSchedule $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcSchedule object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcSchedule) { + $key = (string) $value->getDbId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcSchedule object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcSchedule Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_schedule + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcSchedulePeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcSchedulePeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcSchedulePeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcSchedule object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcSchedulePeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcSchedulePeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcSchedulePeer::NUM_COLUMNS; + } else { + $cls = CcSchedulePeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcSchedulePeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + + /** + * 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. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function 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; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcSchedulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related CcFiles table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcSchedulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcSchedule 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 + * @return array Array of CcSchedule objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcShowInstances(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcSchedulePeer::addSelectColumns($criteria); + $startcol = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS); + CcShowInstancesPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcSchedulePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcSchedulePeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcSchedulePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcShowInstancesPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcShowInstancesPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcShowInstancesPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcSchedule) to $obj2 (CcShowInstances) + $obj2->addCcSchedule($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of CcSchedule objects pre-filled with their CcFiles objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcSchedule objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcSchedulePeer::addSelectColumns($criteria); + $startcol = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS); + CcFilesPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcSchedulePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcSchedulePeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcSchedulePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcFilesPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcFilesPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcFilesPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcSchedule) to $obj2 (CcFiles) + $obj2->addCcSchedule($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining all related tables + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcSchedulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior); + + $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of CcSchedule objects pre-filled with all related objects. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcSchedule objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcSchedulePeer::addSelectColumns($criteria); + $startcol2 = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS); + + CcShowInstancesPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS); + + CcFilesPeer::addSelectColumns($criteria); + $startcol4 = $startcol3 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior); + + $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcSchedulePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcSchedulePeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcSchedulePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcShowInstances rows + + $key2 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcShowInstancesPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcShowInstancesPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcShowInstancesPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (CcSchedule) to the collection in $obj2 (CcShowInstances) + $obj2->addCcSchedule($obj1); + } // if joined row not null + + // Add objects for joined CcFiles rows + + $key3 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = CcFilesPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $cls = CcFilesPeer::getOMClass(false); + + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + CcFilesPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (CcSchedule) to the collection in $obj3 (CcFiles) + $obj3->addCcSchedule($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * 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. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptCcShowInstances(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcSchedulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related CcFiles table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcSchedulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcSchedule objects pre-filled with all related objects except CcShowInstances. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcSchedule objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptCcShowInstances(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + // $criteria->getDbName() will return the same object if not set to another value + // so == check is okay and faster + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcSchedulePeer::addSelectColumns($criteria); + $startcol2 = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS); + + CcFilesPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcSchedulePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcSchedulePeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcSchedulePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcFiles rows + + $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcFilesPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcFilesPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcFilesPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (CcSchedule) to the collection in $obj2 (CcFiles) + $obj2->addCcSchedule($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of CcSchedule objects pre-filled with all related objects except CcFiles. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcSchedule objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + // $criteria->getDbName() will return the same object if not set to another value + // so == check is okay and faster + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcSchedulePeer::addSelectColumns($criteria); + $startcol2 = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS); + + CcShowInstancesPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior); + + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcSchedulePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcSchedulePeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcSchedulePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcShowInstances rows + + $key2 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcShowInstancesPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcShowInstancesPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcShowInstancesPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (CcSchedule) to the collection in $obj2 (CcShowInstances) + $obj2->addCcSchedule($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcSchedulePeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcSchedulePeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcScheduleTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcSchedulePeer::CLASS_DEFAULT : CcSchedulePeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcSchedule or Criteria object. + * + * @param mixed $values Criteria or CcSchedule object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcSchedule object + } + + if ($criteria->containsKey(CcSchedulePeer::ID) && $criteria->keyContainsValue(CcSchedulePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcSchedulePeer::ID.')'); + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcSchedule or Criteria object. + * + * @param mixed $values Criteria or CcSchedule object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcSchedulePeer::ID); + $value = $criteria->remove(CcSchedulePeer::ID); + if ($value) { + $selectCriteria->add(CcSchedulePeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME); + } + + } else { // $values is CcSchedule object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_schedule table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcSchedulePeer::TABLE_NAME, $con, CcSchedulePeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcSchedulePeer::clearInstancePool(); + CcSchedulePeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcSchedule or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcSchedule object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcSchedulePeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcSchedule) { // it's a model object + // invalidate the cache for this single object + CcSchedulePeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcSchedulePeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcSchedulePeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcSchedulePeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcSchedule object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcSchedule $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcSchedule $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcSchedulePeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcSchedulePeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcSchedulePeer::DATABASE_NAME, CcSchedulePeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcSchedule + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcSchedulePeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcSchedulePeer::DATABASE_NAME); + $criteria->add(CcSchedulePeer::ID, $pk); + + $v = CcSchedulePeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcSchedulePeer::DATABASE_NAME); + $criteria->add(CcSchedulePeer::ID, $pks, Criteria::IN); + $objs = CcSchedulePeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcSchedulePeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcSchedulePeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcScheduleQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcScheduleQuery.php new file mode 100644 index 000000000..11a030d84 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcScheduleQuery.php @@ -0,0 +1,814 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcSchedule|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcSchedulePeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcSchedulePeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcSchedulePeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * @param int|array $dbId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function filterByDbId($dbId = null, $comparison = null) + { + if (is_array($dbId) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcSchedulePeer::ID, $dbId, $comparison); + } + + /** + * Filter the query on the playlist_id column + * + * @param int|array $dbPlaylistId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function filterByDbPlaylistId($dbPlaylistId = null, $comparison = null) + { + if (is_array($dbPlaylistId)) { + $useMinMax = false; + if (isset($dbPlaylistId['min'])) { + $this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $dbPlaylistId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbPlaylistId['max'])) { + $this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $dbPlaylistId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $dbPlaylistId, $comparison); + } + + /** + * Filter the query on the starts column + * + * @param string|array $dbStarts The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function filterByDbStarts($dbStarts = null, $comparison = null) + { + if (is_array($dbStarts)) { + $useMinMax = false; + if (isset($dbStarts['min'])) { + $this->addUsingAlias(CcSchedulePeer::STARTS, $dbStarts['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbStarts['max'])) { + $this->addUsingAlias(CcSchedulePeer::STARTS, $dbStarts['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSchedulePeer::STARTS, $dbStarts, $comparison); + } + + /** + * Filter the query on the ends column + * + * @param string|array $dbEnds The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function filterByDbEnds($dbEnds = null, $comparison = null) + { + if (is_array($dbEnds)) { + $useMinMax = false; + if (isset($dbEnds['min'])) { + $this->addUsingAlias(CcSchedulePeer::ENDS, $dbEnds['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbEnds['max'])) { + $this->addUsingAlias(CcSchedulePeer::ENDS, $dbEnds['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSchedulePeer::ENDS, $dbEnds, $comparison); + } + + /** + * Filter the query on the group_id column + * + * @param int|array $dbGroupId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function filterByDbGroupId($dbGroupId = null, $comparison = null) + { + if (is_array($dbGroupId)) { + $useMinMax = false; + if (isset($dbGroupId['min'])) { + $this->addUsingAlias(CcSchedulePeer::GROUP_ID, $dbGroupId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbGroupId['max'])) { + $this->addUsingAlias(CcSchedulePeer::GROUP_ID, $dbGroupId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSchedulePeer::GROUP_ID, $dbGroupId, $comparison); + } + + /** + * Filter the query on the file_id column + * + * @param int|array $dbFileId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function filterByDbFileId($dbFileId = null, $comparison = null) + { + if (is_array($dbFileId)) { + $useMinMax = false; + if (isset($dbFileId['min'])) { + $this->addUsingAlias(CcSchedulePeer::FILE_ID, $dbFileId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbFileId['max'])) { + $this->addUsingAlias(CcSchedulePeer::FILE_ID, $dbFileId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSchedulePeer::FILE_ID, $dbFileId, $comparison); + } + + /** + * Filter the query on the clip_length column + * + * @param string|array $dbClipLength The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function filterByDbClipLength($dbClipLength = null, $comparison = null) + { + if (is_array($dbClipLength)) { + $useMinMax = false; + if (isset($dbClipLength['min'])) { + $this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $dbClipLength['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbClipLength['max'])) { + $this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $dbClipLength['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $dbClipLength, $comparison); + } + + /** + * Filter the query on the fade_in column + * + * @param string|array $dbFadeIn The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function filterByDbFadeIn($dbFadeIn = null, $comparison = null) + { + if (is_array($dbFadeIn)) { + $useMinMax = false; + if (isset($dbFadeIn['min'])) { + $this->addUsingAlias(CcSchedulePeer::FADE_IN, $dbFadeIn['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbFadeIn['max'])) { + $this->addUsingAlias(CcSchedulePeer::FADE_IN, $dbFadeIn['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSchedulePeer::FADE_IN, $dbFadeIn, $comparison); + } + + /** + * Filter the query on the fade_out column + * + * @param string|array $dbFadeOut The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function filterByDbFadeOut($dbFadeOut = null, $comparison = null) + { + if (is_array($dbFadeOut)) { + $useMinMax = false; + if (isset($dbFadeOut['min'])) { + $this->addUsingAlias(CcSchedulePeer::FADE_OUT, $dbFadeOut['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbFadeOut['max'])) { + $this->addUsingAlias(CcSchedulePeer::FADE_OUT, $dbFadeOut['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSchedulePeer::FADE_OUT, $dbFadeOut, $comparison); + } + + /** + * Filter the query on the cue_in column + * + * @param string|array $dbCueIn The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function filterByDbCueIn($dbCueIn = null, $comparison = null) + { + if (is_array($dbCueIn)) { + $useMinMax = false; + if (isset($dbCueIn['min'])) { + $this->addUsingAlias(CcSchedulePeer::CUE_IN, $dbCueIn['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbCueIn['max'])) { + $this->addUsingAlias(CcSchedulePeer::CUE_IN, $dbCueIn['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSchedulePeer::CUE_IN, $dbCueIn, $comparison); + } + + /** + * Filter the query on the cue_out column + * + * @param string|array $dbCueOut The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function filterByDbCueOut($dbCueOut = null, $comparison = null) + { + if (is_array($dbCueOut)) { + $useMinMax = false; + if (isset($dbCueOut['min'])) { + $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $dbCueOut['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbCueOut['max'])) { + $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $dbCueOut['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $dbCueOut, $comparison); + } + + /** + * Filter the query on the schedule_group_played column + * + * @param boolean|string $dbScheduleGroupPlayed The value to use as filter. + * Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function filterByDbScheduleGroupPlayed($dbScheduleGroupPlayed = null, $comparison = null) + { + if (is_string($dbScheduleGroupPlayed)) { + $schedule_group_played = in_array(strtolower($dbScheduleGroupPlayed), array('false', 'off', '-', 'no', 'n', '0')) ? false : true; + } + return $this->addUsingAlias(CcSchedulePeer::SCHEDULE_GROUP_PLAYED, $dbScheduleGroupPlayed, $comparison); + } + + /** + * Filter the query on the media_item_played column + * + * @param boolean|string $dbMediaItemPlayed The value to use as filter. + * Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function filterByDbMediaItemPlayed($dbMediaItemPlayed = null, $comparison = null) + { + if (is_string($dbMediaItemPlayed)) { + $media_item_played = in_array(strtolower($dbMediaItemPlayed), array('false', 'off', '-', 'no', 'n', '0')) ? false : true; + } + return $this->addUsingAlias(CcSchedulePeer::MEDIA_ITEM_PLAYED, $dbMediaItemPlayed, $comparison); + } + + /** + * Filter the query on the instance_id column + * + * @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 CcScheduleQuery The current query, for fluid interface + */ + public function filterByDbInstanceId($dbInstanceId = null, $comparison = null) + { + if (is_array($dbInstanceId)) { + $useMinMax = false; + if (isset($dbInstanceId['min'])) { + $this->addUsingAlias(CcSchedulePeer::INSTANCE_ID, $dbInstanceId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbInstanceId['max'])) { + $this->addUsingAlias(CcSchedulePeer::INSTANCE_ID, $dbInstanceId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSchedulePeer::INSTANCE_ID, $dbInstanceId, $comparison); + } + + /** + * Filter the query by a related CcShowInstances object + * + * @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 CcScheduleQuery The current query, for fluid interface + */ + public function filterByCcShowInstances($ccShowInstances, $comparison = null) + { + return $this + ->addUsingAlias(CcSchedulePeer::INSTANCE_ID, $ccShowInstances->getDbId(), $comparison); + } + + /** + * 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 CcScheduleQuery The current query, for fluid interface + */ + public function joinCcShowInstances($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShowInstances'); + + // 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, 'CcShowInstances'); + } + + return $this; + } + + /** + * Use the CcShowInstances relation CcShowInstances 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 CcShowInstancesQuery A secondary query class using the current class as primary query + */ + public function useCcShowInstancesQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCcShowInstances($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShowInstances', 'CcShowInstancesQuery'); + } + + /** + * Filter the query by a related CcFiles object + * + * @param CcFiles $ccFiles the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function filterByCcFiles($ccFiles, $comparison = null) + { + return $this + ->addUsingAlias(CcSchedulePeer::FILE_ID, $ccFiles->getDbId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcFiles relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function joinCcFiles($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcFiles'); + + // 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, 'CcFiles'); + } + + return $this; + } + + /** + * Use the CcFiles relation CcFiles 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 CcFilesQuery A secondary query class using the current class as primary query + */ + public function useCcFilesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcFiles($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery'); + } + + /** + * Exclude object from result + * + * @param CcSchedule $ccSchedule Object to remove from the list of results + * + * @return CcScheduleQuery The current query, for fluid interface + */ + public function prune($ccSchedule = null) + { + if ($ccSchedule) { + $this->addUsingAlias(CcSchedulePeer::ID, $ccSchedule->getDbId(), Criteria::NOT_EQUAL); + } + + return $this; + } + + /** + * Code to execute before every DELETE statement + * + * @param PropelPDO $con The connection object used by the query + */ + protected function basePreDelete(PropelPDO $con) + { + // aggregate_column_relation behavior + $this->findRelatedCcShowInstancess($con); + + return $this->preDelete($con); + } + + /** + * Code to execute after every DELETE statement + * + * @param int $affectedRows the number of deleted rows + * @param PropelPDO $con The connection object used by the query + */ + protected function basePostDelete($affectedRows, PropelPDO $con) + { + // aggregate_column_relation behavior + $this->updateRelatedCcShowInstancess($con); + + return $this->postDelete($affectedRows, $con); + } + + /** + * Code to execute before every UPDATE statement + * + * @param array $values The associatiove array of columns and values for the update + * @param PropelPDO $con The connection object used by the query + * @param boolean $forceIndividualSaves If false (default), the resulting call is a BasePeer::doUpdate(), ortherwise it is a series of save() calls on all the found objects + */ + protected function basePreUpdate(&$values, PropelPDO $con, $forceIndividualSaves = false) + { + // aggregate_column_relation behavior + $this->findRelatedCcShowInstancess($con); + + return $this->preUpdate($values, $con, $forceIndividualSaves); + } + + /** + * Code to execute after every UPDATE statement + * + * @param int $affectedRows the number of udated rows + * @param PropelPDO $con The connection object used by the query + */ + protected function basePostUpdate($affectedRows, PropelPDO $con) + { + // aggregate_column_relation behavior + $this->updateRelatedCcShowInstancess($con); + + return $this->postUpdate($affectedRows, $con); + } + + // aggregate_column_relation behavior + + /** + * Finds the related CcShowInstances objects and keep them for later + * + * @param PropelPDO $con A connection object + */ + protected function findRelatedCcShowInstancess($con) + { + $criteria = clone $this; + if ($this->useAliasInSQL) { + $alias = $this->getModelAlias(); + $criteria->removeAlias($alias); + } else { + $alias = ''; + } + $this->ccShowInstancess = CcShowInstancesQuery::create() + ->joinCcSchedule($alias) + ->mergeWith($criteria) + ->find($con); + } + + protected function updateRelatedCcShowInstancess($con) + { + foreach ($this->ccShowInstancess as $ccShowInstances) { + $ccShowInstances->updateDbTimeFilled($con); + } + $this->ccShowInstancess = array(); + } + +} // BaseCcScheduleQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcServiceRegister.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcServiceRegister.php new file mode 100644 index 000000000..dbb3aa6a2 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcServiceRegister.php @@ -0,0 +1,708 @@ +name; + } + + /** + * Get the [ip] column value. + * + * @return string + */ + public function getDbIp() + { + return $this->ip; + } + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return CcServiceRegister The current object (for fluent API support) + */ + public function setDbName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v) { + $this->name = $v; + $this->modifiedColumns[] = CcServiceRegisterPeer::NAME; + } + + return $this; + } // setDbName() + + /** + * Set the value of [ip] column. + * + * @param string $v new value + * @return CcServiceRegister The current object (for fluent API support) + */ + public function setDbIp($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->ip !== $v) { + $this->ip = $v; + $this->modifiedColumns[] = CcServiceRegisterPeer::IP; + } + + return $this; + } // setDbIp() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->name = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null; + $this->ip = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 2; // 2 = CcServiceRegisterPeer::NUM_COLUMNS - CcServiceRegisterPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcServiceRegister object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcServiceRegisterPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcServiceRegisterQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcServiceRegisterPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows = 1; + $this->setNew(false); + } else { + $affectedRows = CcServiceRegisterPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = CcServiceRegisterPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcServiceRegisterPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getDbName(); + break; + case 1: + return $this->getDbIp(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = CcServiceRegisterPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbName(), + $keys[1] => $this->getDbIp(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcServiceRegisterPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setDbName($value); + break; + case 1: + $this->setDbIp($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcServiceRegisterPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbName($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbIp($arr[$keys[1]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcServiceRegisterPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcServiceRegisterPeer::NAME)) $criteria->add(CcServiceRegisterPeer::NAME, $this->name); + if ($this->isColumnModified(CcServiceRegisterPeer::IP)) $criteria->add(CcServiceRegisterPeer::IP, $this->ip); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcServiceRegisterPeer::DATABASE_NAME); + $criteria->add(CcServiceRegisterPeer::NAME, $this->name); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return string + */ + public function getPrimaryKey() + { + return $this->getDbName(); + } + + /** + * Generic method to set the primary key (name column). + * + * @param string $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbName($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getDbName(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcServiceRegister (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setDbName($this->name); + $copyObj->setDbIp($this->ip); + + $copyObj->setNew(true); + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcServiceRegister Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcServiceRegisterPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcServiceRegisterPeer(); + } + return self::$peer; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->name = null; + $this->ip = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcServiceRegister diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcServiceRegisterPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcServiceRegisterPeer.php new file mode 100644 index 000000000..ab7d35634 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcServiceRegisterPeer.php @@ -0,0 +1,735 @@ + array ('DbName', 'DbIp', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbName', 'dbIp', ), + BasePeer::TYPE_COLNAME => array (self::NAME, self::IP, ), + BasePeer::TYPE_RAW_COLNAME => array ('NAME', 'IP', ), + BasePeer::TYPE_FIELDNAME => array ('name', 'ip', ), + BasePeer::TYPE_NUM => array (0, 1, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbName' => 0, 'DbIp' => 1, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbName' => 0, 'dbIp' => 1, ), + BasePeer::TYPE_COLNAME => array (self::NAME => 0, self::IP => 1, ), + BasePeer::TYPE_RAW_COLNAME => array ('NAME' => 0, 'IP' => 1, ), + BasePeer::TYPE_FIELDNAME => array ('name' => 0, 'ip' => 1, ), + BasePeer::TYPE_NUM => array (0, 1, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcServiceRegisterPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcServiceRegisterPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcServiceRegisterPeer::NAME); + $criteria->addSelectColumn(CcServiceRegisterPeer::IP); + } else { + $criteria->addSelectColumn($alias . '.NAME'); + $criteria->addSelectColumn($alias . '.IP'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcServiceRegisterPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcServiceRegisterPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcServiceRegister + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcServiceRegisterPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcServiceRegisterPeer::populateObjects(CcServiceRegisterPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcServiceRegisterPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcServiceRegister $value A CcServiceRegister object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcServiceRegister $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbName(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcServiceRegister object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcServiceRegister) { + $key = (string) $value->getDbName(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcServiceRegister object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcServiceRegister Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_service_register + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (string) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcServiceRegisterPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcServiceRegisterPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcServiceRegisterPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcServiceRegisterPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcServiceRegister object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcServiceRegisterPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcServiceRegisterPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcServiceRegisterPeer::NUM_COLUMNS; + } else { + $cls = CcServiceRegisterPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcServiceRegisterPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcServiceRegisterPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcServiceRegisterPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcServiceRegisterTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcServiceRegisterPeer::CLASS_DEFAULT : CcServiceRegisterPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcServiceRegister or Criteria object. + * + * @param mixed $values Criteria or CcServiceRegister object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcServiceRegister object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcServiceRegister or Criteria object. + * + * @param mixed $values Criteria or CcServiceRegister object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcServiceRegisterPeer::NAME); + $value = $criteria->remove(CcServiceRegisterPeer::NAME); + if ($value) { + $selectCriteria->add(CcServiceRegisterPeer::NAME, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcServiceRegisterPeer::TABLE_NAME); + } + + } else { // $values is CcServiceRegister object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_service_register table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcServiceRegisterPeer::TABLE_NAME, $con, CcServiceRegisterPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcServiceRegisterPeer::clearInstancePool(); + CcServiceRegisterPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcServiceRegister or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcServiceRegister object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcServiceRegisterPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcServiceRegister) { // it's a model object + // invalidate the cache for this single object + CcServiceRegisterPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcServiceRegisterPeer::NAME, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcServiceRegisterPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcServiceRegisterPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcServiceRegister object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcServiceRegister $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcServiceRegister $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcServiceRegisterPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcServiceRegisterPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcServiceRegisterPeer::DATABASE_NAME, CcServiceRegisterPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param string $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcServiceRegister + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcServiceRegisterPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcServiceRegisterPeer::DATABASE_NAME); + $criteria->add(CcServiceRegisterPeer::NAME, $pk); + + $v = CcServiceRegisterPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcServiceRegisterPeer::DATABASE_NAME); + $criteria->add(CcServiceRegisterPeer::NAME, $pks, Criteria::IN); + $objs = CcServiceRegisterPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcServiceRegisterPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcServiceRegisterPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcServiceRegisterQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcServiceRegisterQuery.php new file mode 100644 index 000000000..a8df529a7 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcServiceRegisterQuery.php @@ -0,0 +1,196 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcServiceRegister|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcServiceRegisterPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcServiceRegisterQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcServiceRegisterPeer::NAME, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcServiceRegisterQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcServiceRegisterPeer::NAME, $keys, Criteria::IN); + } + + /** + * Filter the query on the name column + * + * @param string $dbName The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcServiceRegisterQuery The current query, for fluid interface + */ + public function filterByDbName($dbName = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbName)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbName)) { + $dbName = str_replace('*', '%', $dbName); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcServiceRegisterPeer::NAME, $dbName, $comparison); + } + + /** + * Filter the query on the ip column + * + * @param string $dbIp The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcServiceRegisterQuery The current query, for fluid interface + */ + public function filterByDbIp($dbIp = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbIp)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbIp)) { + $dbIp = str_replace('*', '%', $dbIp); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcServiceRegisterPeer::IP, $dbIp, $comparison); + } + + /** + * Exclude object from result + * + * @param CcServiceRegister $ccServiceRegister Object to remove from the list of results + * + * @return CcServiceRegisterQuery The current query, for fluid interface + */ + public function prune($ccServiceRegister = null) + { + if ($ccServiceRegister) { + $this->addUsingAlias(CcServiceRegisterPeer::NAME, $ccServiceRegister->getDbName(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcServiceRegisterQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSess.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSess.php new file mode 100644 index 000000000..8ae2463af --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSess.php @@ -0,0 +1,949 @@ +sessid; + } + + /** + * Get the [userid] column value. + * + * @return int + */ + public function getUserid() + { + return $this->userid; + } + + /** + * Get the [login] column value. + * + * @return string + */ + public function getLogin() + { + return $this->login; + } + + /** + * Get the [optionally formatted] temporal [ts] 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 getTs($format = 'Y-m-d H:i:s') + { + if ($this->ts === null) { + return null; + } + + + + try { + $dt = new DateTime($this->ts); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->ts, 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); + } + } + + /** + * Set the value of [sessid] column. + * + * @param string $v new value + * @return CcSess The current object (for fluent API support) + */ + public function setSessid($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->sessid !== $v) { + $this->sessid = $v; + $this->modifiedColumns[] = CcSessPeer::SESSID; + } + + return $this; + } // setSessid() + + /** + * Set the value of [userid] column. + * + * @param int $v new value + * @return CcSess The current object (for fluent API support) + */ + public function setUserid($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->userid !== $v) { + $this->userid = $v; + $this->modifiedColumns[] = CcSessPeer::USERID; + } + + if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) { + $this->aCcSubjs = null; + } + + return $this; + } // setUserid() + + /** + * Set the value of [login] column. + * + * @param string $v new value + * @return CcSess The current object (for fluent API support) + */ + public function setLogin($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->login !== $v) { + $this->login = $v; + $this->modifiedColumns[] = CcSessPeer::LOGIN; + } + + return $this; + } // setLogin() + + /** + * Sets the value of [ts] 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 CcSess The current object (for fluent API support) + */ + public function setTs($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->ts !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->ts !== null && $tmpDt = new DateTime($this->ts)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->ts = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); + $this->modifiedColumns[] = CcSessPeer::TS; + } + } // if either are not null + + return $this; + } // setTs() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->sessid = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null; + $this->userid = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->login = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->ts = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 4; // 4 = CcSessPeer::NUM_COLUMNS - CcSessPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcSess object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aCcSubjs !== null && $this->userid !== $this->aCcSubjs->getDbId()) { + $this->aCcSubjs = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcSessPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aCcSubjs = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcSessQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcSessPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcSubjs !== null) { + if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { + $affectedRows += $this->aCcSubjs->save($con); + } + $this->setCcSubjs($this->aCcSubjs); + } + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows += 1; + $this->setNew(false); + } else { + $affectedRows += CcSessPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + // We call the validate method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcSubjs !== null) { + if (!$this->aCcSubjs->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures()); + } + } + + + if (($retval = CcSessPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcSessPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getSessid(); + break; + case 1: + return $this->getUserid(); + break; + case 2: + return $this->getLogin(); + break; + case 3: + return $this->getTs(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) + { + $keys = CcSessPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getSessid(), + $keys[1] => $this->getUserid(), + $keys[2] => $this->getLogin(), + $keys[3] => $this->getTs(), + ); + if ($includeForeignObjects) { + if (null !== $this->aCcSubjs) { + $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, true); + } + } + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcSessPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setSessid($value); + break; + case 1: + $this->setUserid($value); + break; + case 2: + $this->setLogin($value); + break; + case 3: + $this->setTs($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcSessPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setSessid($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setUserid($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setLogin($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setTs($arr[$keys[3]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcSessPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcSessPeer::SESSID)) $criteria->add(CcSessPeer::SESSID, $this->sessid); + if ($this->isColumnModified(CcSessPeer::USERID)) $criteria->add(CcSessPeer::USERID, $this->userid); + if ($this->isColumnModified(CcSessPeer::LOGIN)) $criteria->add(CcSessPeer::LOGIN, $this->login); + if ($this->isColumnModified(CcSessPeer::TS)) $criteria->add(CcSessPeer::TS, $this->ts); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcSessPeer::DATABASE_NAME); + $criteria->add(CcSessPeer::SESSID, $this->sessid); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return string + */ + public function getPrimaryKey() + { + return $this->getSessid(); + } + + /** + * Generic method to set the primary key (sessid column). + * + * @param string $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setSessid($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getSessid(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcSess (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setSessid($this->sessid); + $copyObj->setUserid($this->userid); + $copyObj->setLogin($this->login); + $copyObj->setTs($this->ts); + + $copyObj->setNew(true); + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcSess Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcSessPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcSessPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a CcSubjs object. + * + * @param CcSubjs $v + * @return CcSess The current object (for fluent API support) + * @throws PropelException + */ + public function setCcSubjs(CcSubjs $v = null) + { + if ($v === null) { + $this->setUserid(NULL); + } else { + $this->setUserid($v->getDbId()); + } + + $this->aCcSubjs = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcSubjs object, it will not be re-added. + if ($v !== null) { + $v->addCcSess($this); + } + + return $this; + } + + + /** + * Get the associated CcSubjs object + * + * @param PropelPDO Optional Connection object. + * @return CcSubjs The associated CcSubjs object. + * @throws PropelException + */ + public function getCcSubjs(PropelPDO $con = null) + { + if ($this->aCcSubjs === null && ($this->userid !== null)) { + $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->userid, $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->aCcSubjs->addCcSesss($this); + */ + } + return $this->aCcSubjs; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->sessid = null; + $this->userid = null; + $this->login = null; + $this->ts = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aCcSubjs = null; + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcSess diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSessPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSessPeer.php new file mode 100644 index 000000000..70eab561a --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSessPeer.php @@ -0,0 +1,979 @@ + array ('Sessid', 'Userid', 'Login', 'Ts', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('sessid', 'userid', 'login', 'ts', ), + BasePeer::TYPE_COLNAME => array (self::SESSID, self::USERID, self::LOGIN, self::TS, ), + BasePeer::TYPE_RAW_COLNAME => array ('SESSID', 'USERID', 'LOGIN', 'TS', ), + BasePeer::TYPE_FIELDNAME => array ('sessid', 'userid', 'login', 'ts', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('Sessid' => 0, 'Userid' => 1, 'Login' => 2, 'Ts' => 3, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('sessid' => 0, 'userid' => 1, 'login' => 2, 'ts' => 3, ), + BasePeer::TYPE_COLNAME => array (self::SESSID => 0, self::USERID => 1, self::LOGIN => 2, self::TS => 3, ), + BasePeer::TYPE_RAW_COLNAME => array ('SESSID' => 0, 'USERID' => 1, 'LOGIN' => 2, 'TS' => 3, ), + BasePeer::TYPE_FIELDNAME => array ('sessid' => 0, 'userid' => 1, 'login' => 2, 'ts' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcSessPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcSessPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcSessPeer::SESSID); + $criteria->addSelectColumn(CcSessPeer::USERID); + $criteria->addSelectColumn(CcSessPeer::LOGIN); + $criteria->addSelectColumn(CcSessPeer::TS); + } else { + $criteria->addSelectColumn($alias . '.SESSID'); + $criteria->addSelectColumn($alias . '.USERID'); + $criteria->addSelectColumn($alias . '.LOGIN'); + $criteria->addSelectColumn($alias . '.TS'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcSessPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcSessPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcSess + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcSessPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcSessPeer::populateObjects(CcSessPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcSessPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcSess $value A CcSess object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcSess $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getSessid(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcSess object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcSess) { + $key = (string) $value->getSessid(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcSess object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcSess Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_sess + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (string) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcSessPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcSessPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcSessPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcSessPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcSess object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcSessPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcSessPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcSessPeer::NUM_COLUMNS; + } else { + $cls = CcSessPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcSessPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + + /** + * Returns the number of rows matching criteria, joining the related CcSubjs table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcSessPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcSessPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcSessPeer::USERID, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcSess objects pre-filled with their CcSubjs objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcSess objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcSessPeer::addSelectColumns($criteria); + $startcol = (CcSessPeer::NUM_COLUMNS - CcSessPeer::NUM_LAZY_LOAD_COLUMNS); + CcSubjsPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcSessPeer::USERID, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcSessPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcSessPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcSessPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcSessPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcSubjsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcSubjsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcSubjsPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcSess) to $obj2 (CcSubjs) + $obj2->addCcSess($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining all related tables + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcSessPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcSessPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcSessPeer::USERID, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of CcSess objects pre-filled with all related objects. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcSess objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcSessPeer::addSelectColumns($criteria); + $startcol2 = (CcSessPeer::NUM_COLUMNS - CcSessPeer::NUM_LAZY_LOAD_COLUMNS); + + CcSubjsPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcSessPeer::USERID, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcSessPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcSessPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcSessPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcSessPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcSubjs rows + + $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcSubjsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcSubjsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcSubjsPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (CcSess) to the collection in $obj2 (CcSubjs) + $obj2->addCcSess($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcSessPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcSessPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcSessTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcSessPeer::CLASS_DEFAULT : CcSessPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcSess or Criteria object. + * + * @param mixed $values Criteria or CcSess object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcSess object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcSess or Criteria object. + * + * @param mixed $values Criteria or CcSess object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcSessPeer::SESSID); + $value = $criteria->remove(CcSessPeer::SESSID); + if ($value) { + $selectCriteria->add(CcSessPeer::SESSID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcSessPeer::TABLE_NAME); + } + + } else { // $values is CcSess object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_sess table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcSessPeer::TABLE_NAME, $con, CcSessPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcSessPeer::clearInstancePool(); + CcSessPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcSess or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcSess object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcSessPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcSess) { // it's a model object + // invalidate the cache for this single object + CcSessPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcSessPeer::SESSID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcSessPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcSessPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcSess object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcSess $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcSess $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcSessPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcSessPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcSessPeer::DATABASE_NAME, CcSessPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param string $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcSess + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcSessPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcSessPeer::DATABASE_NAME); + $criteria->add(CcSessPeer::SESSID, $pk); + + $v = CcSessPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcSessPeer::DATABASE_NAME); + $criteria->add(CcSessPeer::SESSID, $pks, Criteria::IN); + $objs = CcSessPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcSessPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcSessPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSessQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSessQuery.php new file mode 100644 index 000000000..f0b500f83 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSessQuery.php @@ -0,0 +1,334 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcSess|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcSessPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcSessQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcSessPeer::SESSID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcSessQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcSessPeer::SESSID, $keys, Criteria::IN); + } + + /** + * Filter the query on the sessid column + * + * @param string $sessid The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSessQuery The current query, for fluid interface + */ + public function filterBySessid($sessid = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($sessid)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $sessid)) { + $sessid = str_replace('*', '%', $sessid); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcSessPeer::SESSID, $sessid, $comparison); + } + + /** + * Filter the query on the userid column + * + * @param int|array $userid 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 CcSessQuery The current query, for fluid interface + */ + public function filterByUserid($userid = null, $comparison = null) + { + if (is_array($userid)) { + $useMinMax = false; + if (isset($userid['min'])) { + $this->addUsingAlias(CcSessPeer::USERID, $userid['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($userid['max'])) { + $this->addUsingAlias(CcSessPeer::USERID, $userid['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSessPeer::USERID, $userid, $comparison); + } + + /** + * Filter the query on the login column + * + * @param string $login The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSessQuery The current query, for fluid interface + */ + public function filterByLogin($login = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($login)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $login)) { + $login = str_replace('*', '%', $login); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcSessPeer::LOGIN, $login, $comparison); + } + + /** + * Filter the query on the ts column + * + * @param string|array $ts 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 CcSessQuery The current query, for fluid interface + */ + public function filterByTs($ts = null, $comparison = null) + { + if (is_array($ts)) { + $useMinMax = false; + if (isset($ts['min'])) { + $this->addUsingAlias(CcSessPeer::TS, $ts['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($ts['max'])) { + $this->addUsingAlias(CcSessPeer::TS, $ts['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSessPeer::TS, $ts, $comparison); + } + + /** + * Filter the query by a related CcSubjs object + * + * @param CcSubjs $ccSubjs the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSessQuery The current query, for fluid interface + */ + public function filterByCcSubjs($ccSubjs, $comparison = null) + { + return $this + ->addUsingAlias(CcSessPeer::USERID, $ccSubjs->getDbId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcSubjs relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcSessQuery The current query, for fluid interface + */ + public function joinCcSubjs($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcSubjs'); + + // 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, 'CcSubjs'); + } + + return $this; + } + + /** + * Use the CcSubjs relation CcSubjs 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 CcSubjsQuery A secondary query class using the current class as primary query + */ + public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcSubjs($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); + } + + /** + * Exclude object from result + * + * @param CcSess $ccSess Object to remove from the list of results + * + * @return CcSessQuery The current query, for fluid interface + */ + public function prune($ccSess = null) + { + if ($ccSess) { + $this->addUsingAlias(CcSessPeer::SESSID, $ccSess->getSessid(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcSessQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShow.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShow.php new file mode 100644 index 000000000..b2ab6b257 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShow.php @@ -0,0 +1,1654 @@ +name = ''; + $this->url = ''; + $this->genre = ''; + } + + /** + * Initializes internal state of BaseCcShow object. + * @see applyDefaults() + */ + public function __construct() + { + parent::__construct(); + $this->applyDefaultValues(); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getDbId() + { + return $this->id; + } + + /** + * Get the [name] column value. + * + * @return string + */ + public function getDbName() + { + return $this->name; + } + + /** + * Get the [url] column value. + * + * @return string + */ + public function getDbUrl() + { + return $this->url; + } + + /** + * Get the [genre] column value. + * + * @return string + */ + public function getDbGenre() + { + return $this->genre; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDbDescription() + { + return $this->description; + } + + /** + * Get the [color] column value. + * + * @return string + */ + public function getDbColor() + { + return $this->color; + } + + /** + * Get the [background_color] column value. + * + * @return string + */ + public function getDbBackgroundColor() + { + return $this->background_color; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return CcShow The current object (for fluent API support) + */ + public function setDbId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CcShowPeer::ID; + } + + return $this; + } // setDbId() + + /** + * Set the value of [name] column. + * + * @param string $v new value + * @return CcShow The current object (for fluent API support) + */ + public function setDbName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->name !== $v || $this->isNew()) { + $this->name = $v; + $this->modifiedColumns[] = CcShowPeer::NAME; + } + + return $this; + } // setDbName() + + /** + * Set the value of [url] column. + * + * @param string $v new value + * @return CcShow The current object (for fluent API support) + */ + public function setDbUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->url !== $v || $this->isNew()) { + $this->url = $v; + $this->modifiedColumns[] = CcShowPeer::URL; + } + + return $this; + } // setDbUrl() + + /** + * Set the value of [genre] column. + * + * @param string $v new value + * @return CcShow The current object (for fluent API support) + */ + public function setDbGenre($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->genre !== $v || $this->isNew()) { + $this->genre = $v; + $this->modifiedColumns[] = CcShowPeer::GENRE; + } + + return $this; + } // setDbGenre() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return CcShow The current object (for fluent API support) + */ + public function setDbDescription($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->description !== $v) { + $this->description = $v; + $this->modifiedColumns[] = CcShowPeer::DESCRIPTION; + } + + return $this; + } // setDbDescription() + + /** + * Set the value of [color] column. + * + * @param string $v new value + * @return CcShow The current object (for fluent API support) + */ + public function setDbColor($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->color !== $v) { + $this->color = $v; + $this->modifiedColumns[] = CcShowPeer::COLOR; + } + + return $this; + } // setDbColor() + + /** + * Set the value of [background_color] column. + * + * @param string $v new value + * @return CcShow The current object (for fluent API support) + */ + public function setDbBackgroundColor($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->background_color !== $v) { + $this->background_color = $v; + $this->modifiedColumns[] = CcShowPeer::BACKGROUND_COLOR; + } + + return $this; + } // setDbBackgroundColor() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + if ($this->name !== '') { + return false; + } + + if ($this->url !== '') { + return false; + } + + if ($this->genre !== '') { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->url = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->genre = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->color = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->background_color = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 7; // 7 = CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcShow object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcShowPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->collCcShowInstancess = null; + + $this->collCcShowDayss = null; + + $this->collCcShowRebroadcasts = null; + + $this->collCcShowHostss = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcShowQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcShowPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() ) { + $this->modifiedColumns[] = CcShowPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + if ($criteria->keyContainsValue(CcShowPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcShowPeer::ID.')'); + } + + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows = 1; + $this->setDbId($pk); //[IMV] update autoincrement primary key + $this->setNew(false); + } else { + $affectedRows = CcShowPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collCcShowInstancess !== null) { + foreach ($this->collCcShowInstancess as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collCcShowDayss !== null) { + foreach ($this->collCcShowDayss as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collCcShowRebroadcasts !== null) { + foreach ($this->collCcShowRebroadcasts as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collCcShowHostss !== null) { + foreach ($this->collCcShowHostss as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = CcShowPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collCcShowInstancess !== null) { + foreach ($this->collCcShowInstancess as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collCcShowDayss !== null) { + foreach ($this->collCcShowDayss as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collCcShowRebroadcasts !== null) { + foreach ($this->collCcShowRebroadcasts as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collCcShowHostss !== null) { + foreach ($this->collCcShowHostss as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcShowPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getDbId(); + break; + case 1: + return $this->getDbName(); + break; + case 2: + return $this->getDbUrl(); + break; + case 3: + return $this->getDbGenre(); + break; + case 4: + return $this->getDbDescription(); + break; + case 5: + return $this->getDbColor(); + break; + case 6: + return $this->getDbBackgroundColor(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = CcShowPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbId(), + $keys[1] => $this->getDbName(), + $keys[2] => $this->getDbUrl(), + $keys[3] => $this->getDbGenre(), + $keys[4] => $this->getDbDescription(), + $keys[5] => $this->getDbColor(), + $keys[6] => $this->getDbBackgroundColor(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcShowPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setDbId($value); + break; + case 1: + $this->setDbName($value); + break; + case 2: + $this->setDbUrl($value); + break; + case 3: + $this->setDbGenre($value); + break; + case 4: + $this->setDbDescription($value); + break; + case 5: + $this->setDbColor($value); + break; + case 6: + $this->setDbBackgroundColor($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcShowPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbName($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDbUrl($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDbGenre($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setDbDescription($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setDbColor($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setDbBackgroundColor($arr[$keys[6]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcShowPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcShowPeer::ID)) $criteria->add(CcShowPeer::ID, $this->id); + if ($this->isColumnModified(CcShowPeer::NAME)) $criteria->add(CcShowPeer::NAME, $this->name); + if ($this->isColumnModified(CcShowPeer::URL)) $criteria->add(CcShowPeer::URL, $this->url); + if ($this->isColumnModified(CcShowPeer::GENRE)) $criteria->add(CcShowPeer::GENRE, $this->genre); + if ($this->isColumnModified(CcShowPeer::DESCRIPTION)) $criteria->add(CcShowPeer::DESCRIPTION, $this->description); + if ($this->isColumnModified(CcShowPeer::COLOR)) $criteria->add(CcShowPeer::COLOR, $this->color); + if ($this->isColumnModified(CcShowPeer::BACKGROUND_COLOR)) $criteria->add(CcShowPeer::BACKGROUND_COLOR, $this->background_color); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcShowPeer::DATABASE_NAME); + $criteria->add(CcShowPeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getDbId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getDbId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcShow (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setDbName($this->name); + $copyObj->setDbUrl($this->url); + $copyObj->setDbGenre($this->genre); + $copyObj->setDbDescription($this->description); + $copyObj->setDbColor($this->color); + $copyObj->setDbBackgroundColor($this->background_color); + + 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->getCcShowInstancess() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcShowInstances($relObj->copy($deepCopy)); + } + } + + foreach ($this->getCcShowDayss() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcShowDays($relObj->copy($deepCopy)); + } + } + + foreach ($this->getCcShowRebroadcasts() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcShowRebroadcast($relObj->copy($deepCopy)); + } + } + + foreach ($this->getCcShowHostss() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcShowHosts($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcShow Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcShowPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcShowPeer(); + } + return self::$peer; + } + + /** + * Clears out the collCcShowInstancess 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 addCcShowInstancess() + */ + public function clearCcShowInstancess() + { + $this->collCcShowInstancess = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcShowInstancess collection. + * + * By default this just sets the collCcShowInstancess collection to an empty array (like clearcollCcShowInstancess()); + * 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 initCcShowInstancess() + { + $this->collCcShowInstancess = new PropelObjectCollection(); + $this->collCcShowInstancess->setModel('CcShowInstances'); + } + + /** + * Gets an array of CcShowInstances 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 CcShowInstances[] List of CcShowInstances objects + * @throws PropelException + */ + public function getCcShowInstancess($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcShowInstancess || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowInstancess) { + // return empty collection + $this->initCcShowInstancess(); + } else { + $collCcShowInstancess = CcShowInstancesQuery::create(null, $criteria) + ->filterByCcShow($this) + ->find($con); + if (null !== $criteria) { + return $collCcShowInstancess; + } + $this->collCcShowInstancess = $collCcShowInstancess; + } + } + return $this->collCcShowInstancess; + } + + /** + * Returns the number of related CcShowInstances objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcShowInstances objects. + * @throws PropelException + */ + public function countCcShowInstancess(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcShowInstancess || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowInstancess) { + return 0; + } else { + $query = CcShowInstancesQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcShow($this) + ->count($con); + } + } else { + return count($this->collCcShowInstancess); + } + } + + /** + * Method called to associate a CcShowInstances object to this object + * through the CcShowInstances foreign key attribute. + * + * @param CcShowInstances $l CcShowInstances + * @return void + * @throws PropelException + */ + public function addCcShowInstances(CcShowInstances $l) + { + if ($this->collCcShowInstancess === null) { + $this->initCcShowInstancess(); + } + if (!$this->collCcShowInstancess->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcShowInstancess[]= $l; + $l->setCcShow($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcShow is new, it will return + * an empty collection; or if this CcShow has previously + * been saved, it will retrieve related CcShowInstancess from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcShow. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowInstances[] List of CcShowInstances objects + */ + public function getCcShowInstancessJoinCcShowInstancesRelatedByDbOriginalShow($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowInstancesQuery::create(null, $criteria); + $query->joinWith('CcShowInstancesRelatedByDbOriginalShow', $join_behavior); + + return $this->getCcShowInstancess($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcShow is new, it will return + * an empty collection; or if this CcShow has previously + * been saved, it will retrieve related CcShowInstancess from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcShow. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowInstances[] List of CcShowInstances objects + */ + public function getCcShowInstancessJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowInstancesQuery::create(null, $criteria); + $query->joinWith('CcFiles', $join_behavior); + + return $this->getCcShowInstancess($query, $con); + } + + /** + * Clears out the collCcShowDayss 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 addCcShowDayss() + */ + public function clearCcShowDayss() + { + $this->collCcShowDayss = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcShowDayss collection. + * + * By default this just sets the collCcShowDayss collection to an empty array (like clearcollCcShowDayss()); + * 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 initCcShowDayss() + { + $this->collCcShowDayss = new PropelObjectCollection(); + $this->collCcShowDayss->setModel('CcShowDays'); + } + + /** + * Gets an array of CcShowDays 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 CcShowDays[] List of CcShowDays objects + * @throws PropelException + */ + public function getCcShowDayss($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcShowDayss || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowDayss) { + // return empty collection + $this->initCcShowDayss(); + } else { + $collCcShowDayss = CcShowDaysQuery::create(null, $criteria) + ->filterByCcShow($this) + ->find($con); + if (null !== $criteria) { + return $collCcShowDayss; + } + $this->collCcShowDayss = $collCcShowDayss; + } + } + return $this->collCcShowDayss; + } + + /** + * Returns the number of related CcShowDays objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcShowDays objects. + * @throws PropelException + */ + public function countCcShowDayss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcShowDayss || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowDayss) { + return 0; + } else { + $query = CcShowDaysQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcShow($this) + ->count($con); + } + } else { + return count($this->collCcShowDayss); + } + } + + /** + * Method called to associate a CcShowDays object to this object + * through the CcShowDays foreign key attribute. + * + * @param CcShowDays $l CcShowDays + * @return void + * @throws PropelException + */ + public function addCcShowDays(CcShowDays $l) + { + if ($this->collCcShowDayss === null) { + $this->initCcShowDayss(); + } + if (!$this->collCcShowDayss->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcShowDayss[]= $l; + $l->setCcShow($this); + } + } + + /** + * Clears out the collCcShowRebroadcasts 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 addCcShowRebroadcasts() + */ + public function clearCcShowRebroadcasts() + { + $this->collCcShowRebroadcasts = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcShowRebroadcasts collection. + * + * By default this just sets the collCcShowRebroadcasts collection to an empty array (like clearcollCcShowRebroadcasts()); + * 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 initCcShowRebroadcasts() + { + $this->collCcShowRebroadcasts = new PropelObjectCollection(); + $this->collCcShowRebroadcasts->setModel('CcShowRebroadcast'); + } + + /** + * Gets an array of CcShowRebroadcast 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 CcShowRebroadcast[] List of CcShowRebroadcast objects + * @throws PropelException + */ + public function getCcShowRebroadcasts($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcShowRebroadcasts || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowRebroadcasts) { + // return empty collection + $this->initCcShowRebroadcasts(); + } else { + $collCcShowRebroadcasts = CcShowRebroadcastQuery::create(null, $criteria) + ->filterByCcShow($this) + ->find($con); + if (null !== $criteria) { + return $collCcShowRebroadcasts; + } + $this->collCcShowRebroadcasts = $collCcShowRebroadcasts; + } + } + return $this->collCcShowRebroadcasts; + } + + /** + * Returns the number of related CcShowRebroadcast objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcShowRebroadcast objects. + * @throws PropelException + */ + public function countCcShowRebroadcasts(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcShowRebroadcasts || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowRebroadcasts) { + return 0; + } else { + $query = CcShowRebroadcastQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcShow($this) + ->count($con); + } + } else { + return count($this->collCcShowRebroadcasts); + } + } + + /** + * Method called to associate a CcShowRebroadcast object to this object + * through the CcShowRebroadcast foreign key attribute. + * + * @param CcShowRebroadcast $l CcShowRebroadcast + * @return void + * @throws PropelException + */ + public function addCcShowRebroadcast(CcShowRebroadcast $l) + { + if ($this->collCcShowRebroadcasts === null) { + $this->initCcShowRebroadcasts(); + } + if (!$this->collCcShowRebroadcasts->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcShowRebroadcasts[]= $l; + $l->setCcShow($this); + } + } + + /** + * Clears out the collCcShowHostss 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 addCcShowHostss() + */ + public function clearCcShowHostss() + { + $this->collCcShowHostss = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcShowHostss collection. + * + * By default this just sets the collCcShowHostss collection to an empty array (like clearcollCcShowHostss()); + * 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 initCcShowHostss() + { + $this->collCcShowHostss = new PropelObjectCollection(); + $this->collCcShowHostss->setModel('CcShowHosts'); + } + + /** + * Gets an array of CcShowHosts 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 CcShowHosts[] List of CcShowHosts objects + * @throws PropelException + */ + public function getCcShowHostss($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcShowHostss || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowHostss) { + // return empty collection + $this->initCcShowHostss(); + } else { + $collCcShowHostss = CcShowHostsQuery::create(null, $criteria) + ->filterByCcShow($this) + ->find($con); + if (null !== $criteria) { + return $collCcShowHostss; + } + $this->collCcShowHostss = $collCcShowHostss; + } + } + return $this->collCcShowHostss; + } + + /** + * Returns the number of related CcShowHosts objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcShowHosts objects. + * @throws PropelException + */ + public function countCcShowHostss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcShowHostss || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowHostss) { + return 0; + } else { + $query = CcShowHostsQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcShow($this) + ->count($con); + } + } else { + return count($this->collCcShowHostss); + } + } + + /** + * Method called to associate a CcShowHosts object to this object + * through the CcShowHosts foreign key attribute. + * + * @param CcShowHosts $l CcShowHosts + * @return void + * @throws PropelException + */ + public function addCcShowHosts(CcShowHosts $l) + { + if ($this->collCcShowHostss === null) { + $this->initCcShowHostss(); + } + if (!$this->collCcShowHostss->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcShowHostss[]= $l; + $l->setCcShow($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcShow is new, it will return + * an empty collection; or if this CcShow has previously + * been saved, it will retrieve related CcShowHostss from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcShow. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowHosts[] List of CcShowHosts objects + */ + public function getCcShowHostssJoinCcSubjs($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowHostsQuery::create(null, $criteria); + $query->joinWith('CcSubjs', $join_behavior); + + return $this->getCcShowHostss($query, $con); + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->name = null; + $this->url = null; + $this->genre = null; + $this->description = null; + $this->color = null; + $this->background_color = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->applyDefaultValues(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collCcShowInstancess) { + foreach ((array) $this->collCcShowInstancess as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collCcShowDayss) { + foreach ((array) $this->collCcShowDayss as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collCcShowRebroadcasts) { + foreach ((array) $this->collCcShowRebroadcasts as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collCcShowHostss) { + foreach ((array) $this->collCcShowHostss as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collCcShowInstancess = null; + $this->collCcShowDayss = null; + $this->collCcShowRebroadcasts = null; + $this->collCcShowHostss = null; + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcShow diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowDays.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowDays.php new file mode 100644 index 000000000..be9f66086 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowDays.php @@ -0,0 +1,1476 @@ +record = 0; + } + + /** + * Initializes internal state of BaseCcShowDays object. + * @see applyDefaults() + */ + public function __construct() + { + parent::__construct(); + $this->applyDefaultValues(); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getDbId() + { + return $this->id; + } + + /** + * Get the [optionally formatted] temporal [first_show] 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 getDbFirstShow($format = '%x') + { + if ($this->first_show === null) { + return null; + } + + + + try { + $dt = new DateTime($this->first_show); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->first_show, 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); + } + } + + /** + * Get the [optionally formatted] temporal [last_show] 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 getDbLastShow($format = '%x') + { + if ($this->last_show === null) { + return null; + } + + + + try { + $dt = new DateTime($this->last_show); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->last_show, 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); + } + } + + /** + * Get the [optionally formatted] temporal [start_time] 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 getDbStartTime($format = '%X') + { + if ($this->start_time === null) { + return null; + } + + + + try { + $dt = new DateTime($this->start_time); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->start_time, 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); + } + } + + /** + * Get the [timezone] column value. + * + * @return string + */ + public function getDbTimezone() + { + return $this->timezone; + } + + /** + * Get the [duration] column value. + * + * @return string + */ + public function getDbDuration() + { + return $this->duration; + } + + /** + * Get the [day] column value. + * + * @return int + */ + public function getDbDay() + { + return $this->day; + } + + /** + * Get the [repeat_type] column value. + * + * @return int + */ + public function getDbRepeatType() + { + return $this->repeat_type; + } + + /** + * Get the [optionally formatted] temporal [next_pop_date] 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 getDbNextPopDate($format = '%x') + { + if ($this->next_pop_date === null) { + return null; + } + + + + try { + $dt = new DateTime($this->next_pop_date); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->next_pop_date, 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); + } + } + + /** + * Get the [show_id] column value. + * + * @return int + */ + public function getDbShowId() + { + return $this->show_id; + } + + /** + * Get the [record] column value. + * + * @return int + */ + public function getDbRecord() + { + return $this->record; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return CcShowDays The current object (for fluent API support) + */ + public function setDbId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CcShowDaysPeer::ID; + } + + return $this; + } // setDbId() + + /** + * Sets the value of [first_show] 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 CcShowDays The current object (for fluent API support) + */ + public function setDbFirstShow($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->first_show !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->first_show !== null && $tmpDt = new DateTime($this->first_show)) ? $tmpDt->format('Y-m-d') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->first_show = ($dt ? $dt->format('Y-m-d') : null); + $this->modifiedColumns[] = CcShowDaysPeer::FIRST_SHOW; + } + } // if either are not null + + return $this; + } // setDbFirstShow() + + /** + * Sets the value of [last_show] 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 CcShowDays The current object (for fluent API support) + */ + public function setDbLastShow($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->last_show !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->last_show !== null && $tmpDt = new DateTime($this->last_show)) ? $tmpDt->format('Y-m-d') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->last_show = ($dt ? $dt->format('Y-m-d') : null); + $this->modifiedColumns[] = CcShowDaysPeer::LAST_SHOW; + } + } // if either are not null + + return $this; + } // setDbLastShow() + + /** + * Sets the value of [start_time] 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 CcShowDays The current object (for fluent API support) + */ + public function setDbStartTime($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->start_time !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->start_time !== null && $tmpDt = new DateTime($this->start_time)) ? $tmpDt->format('H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->start_time = ($dt ? $dt->format('H:i:s') : null); + $this->modifiedColumns[] = CcShowDaysPeer::START_TIME; + } + } // if either are not null + + return $this; + } // setDbStartTime() + + /** + * Set the value of [timezone] column. + * + * @param string $v new value + * @return CcShowDays The current object (for fluent API support) + */ + public function setDbTimezone($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->timezone !== $v) { + $this->timezone = $v; + $this->modifiedColumns[] = CcShowDaysPeer::TIMEZONE; + } + + return $this; + } // setDbTimezone() + + /** + * Set the value of [duration] column. + * + * @param string $v new value + * @return CcShowDays The current object (for fluent API support) + */ + public function setDbDuration($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->duration !== $v) { + $this->duration = $v; + $this->modifiedColumns[] = CcShowDaysPeer::DURATION; + } + + return $this; + } // setDbDuration() + + /** + * Set the value of [day] column. + * + * @param int $v new value + * @return CcShowDays The current object (for fluent API support) + */ + public function setDbDay($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->day !== $v) { + $this->day = $v; + $this->modifiedColumns[] = CcShowDaysPeer::DAY; + } + + return $this; + } // setDbDay() + + /** + * Set the value of [repeat_type] column. + * + * @param int $v new value + * @return CcShowDays The current object (for fluent API support) + */ + public function setDbRepeatType($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->repeat_type !== $v) { + $this->repeat_type = $v; + $this->modifiedColumns[] = CcShowDaysPeer::REPEAT_TYPE; + } + + return $this; + } // setDbRepeatType() + + /** + * Sets the value of [next_pop_date] 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 CcShowDays The current object (for fluent API support) + */ + public function setDbNextPopDate($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->next_pop_date !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->next_pop_date !== null && $tmpDt = new DateTime($this->next_pop_date)) ? $tmpDt->format('Y-m-d') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->next_pop_date = ($dt ? $dt->format('Y-m-d') : null); + $this->modifiedColumns[] = CcShowDaysPeer::NEXT_POP_DATE; + } + } // if either are not null + + return $this; + } // setDbNextPopDate() + + /** + * Set the value of [show_id] column. + * + * @param int $v new value + * @return CcShowDays The current object (for fluent API support) + */ + public function setDbShowId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->show_id !== $v) { + $this->show_id = $v; + $this->modifiedColumns[] = CcShowDaysPeer::SHOW_ID; + } + + if ($this->aCcShow !== null && $this->aCcShow->getDbId() !== $v) { + $this->aCcShow = null; + } + + return $this; + } // setDbShowId() + + /** + * Set the value of [record] column. + * + * @param int $v new value + * @return CcShowDays The current object (for fluent API support) + */ + public function setDbRecord($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->record !== $v || $this->isNew()) { + $this->record = $v; + $this->modifiedColumns[] = CcShowDaysPeer::RECORD; + } + + return $this; + } // setDbRecord() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + if ($this->record !== 0) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->first_show = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->last_show = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->start_time = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->timezone = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->duration = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->day = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null; + $this->repeat_type = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null; + $this->next_pop_date = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; + $this->show_id = ($row[$startcol + 9] !== null) ? (int) $row[$startcol + 9] : null; + $this->record = ($row[$startcol + 10] !== null) ? (int) $row[$startcol + 10] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 11; // 11 = CcShowDaysPeer::NUM_COLUMNS - CcShowDaysPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcShowDays object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aCcShow !== null && $this->show_id !== $this->aCcShow->getDbId()) { + $this->aCcShow = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcShowDaysPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aCcShow = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcShowDaysQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcShowDaysPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcShow !== null) { + if ($this->aCcShow->isModified() || $this->aCcShow->isNew()) { + $affectedRows += $this->aCcShow->save($con); + } + $this->setCcShow($this->aCcShow); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = CcShowDaysPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + if ($criteria->keyContainsValue(CcShowDaysPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcShowDaysPeer::ID.')'); + } + + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows += 1; + $this->setDbId($pk); //[IMV] update autoincrement primary key + $this->setNew(false); + } else { + $affectedRows += CcShowDaysPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + // We call the validate method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcShow !== null) { + if (!$this->aCcShow->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcShow->getValidationFailures()); + } + } + + + if (($retval = CcShowDaysPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcShowDaysPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getDbId(); + break; + case 1: + return $this->getDbFirstShow(); + break; + case 2: + return $this->getDbLastShow(); + break; + case 3: + return $this->getDbStartTime(); + break; + case 4: + return $this->getDbTimezone(); + break; + case 5: + return $this->getDbDuration(); + break; + case 6: + return $this->getDbDay(); + break; + case 7: + return $this->getDbRepeatType(); + break; + case 8: + return $this->getDbNextPopDate(); + break; + case 9: + return $this->getDbShowId(); + break; + case 10: + return $this->getDbRecord(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) + { + $keys = CcShowDaysPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbId(), + $keys[1] => $this->getDbFirstShow(), + $keys[2] => $this->getDbLastShow(), + $keys[3] => $this->getDbStartTime(), + $keys[4] => $this->getDbTimezone(), + $keys[5] => $this->getDbDuration(), + $keys[6] => $this->getDbDay(), + $keys[7] => $this->getDbRepeatType(), + $keys[8] => $this->getDbNextPopDate(), + $keys[9] => $this->getDbShowId(), + $keys[10] => $this->getDbRecord(), + ); + if ($includeForeignObjects) { + if (null !== $this->aCcShow) { + $result['CcShow'] = $this->aCcShow->toArray($keyType, $includeLazyLoadColumns, true); + } + } + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcShowDaysPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setDbId($value); + break; + case 1: + $this->setDbFirstShow($value); + break; + case 2: + $this->setDbLastShow($value); + break; + case 3: + $this->setDbStartTime($value); + break; + case 4: + $this->setDbTimezone($value); + break; + case 5: + $this->setDbDuration($value); + break; + case 6: + $this->setDbDay($value); + break; + case 7: + $this->setDbRepeatType($value); + break; + case 8: + $this->setDbNextPopDate($value); + break; + case 9: + $this->setDbShowId($value); + break; + case 10: + $this->setDbRecord($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcShowDaysPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbFirstShow($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDbLastShow($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDbStartTime($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setDbTimezone($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setDbDuration($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setDbDay($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setDbRepeatType($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setDbNextPopDate($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setDbShowId($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setDbRecord($arr[$keys[10]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcShowDaysPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcShowDaysPeer::ID)) $criteria->add(CcShowDaysPeer::ID, $this->id); + if ($this->isColumnModified(CcShowDaysPeer::FIRST_SHOW)) $criteria->add(CcShowDaysPeer::FIRST_SHOW, $this->first_show); + if ($this->isColumnModified(CcShowDaysPeer::LAST_SHOW)) $criteria->add(CcShowDaysPeer::LAST_SHOW, $this->last_show); + if ($this->isColumnModified(CcShowDaysPeer::START_TIME)) $criteria->add(CcShowDaysPeer::START_TIME, $this->start_time); + if ($this->isColumnModified(CcShowDaysPeer::TIMEZONE)) $criteria->add(CcShowDaysPeer::TIMEZONE, $this->timezone); + if ($this->isColumnModified(CcShowDaysPeer::DURATION)) $criteria->add(CcShowDaysPeer::DURATION, $this->duration); + if ($this->isColumnModified(CcShowDaysPeer::DAY)) $criteria->add(CcShowDaysPeer::DAY, $this->day); + if ($this->isColumnModified(CcShowDaysPeer::REPEAT_TYPE)) $criteria->add(CcShowDaysPeer::REPEAT_TYPE, $this->repeat_type); + if ($this->isColumnModified(CcShowDaysPeer::NEXT_POP_DATE)) $criteria->add(CcShowDaysPeer::NEXT_POP_DATE, $this->next_pop_date); + if ($this->isColumnModified(CcShowDaysPeer::SHOW_ID)) $criteria->add(CcShowDaysPeer::SHOW_ID, $this->show_id); + if ($this->isColumnModified(CcShowDaysPeer::RECORD)) $criteria->add(CcShowDaysPeer::RECORD, $this->record); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcShowDaysPeer::DATABASE_NAME); + $criteria->add(CcShowDaysPeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getDbId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getDbId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcShowDays (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setDbFirstShow($this->first_show); + $copyObj->setDbLastShow($this->last_show); + $copyObj->setDbStartTime($this->start_time); + $copyObj->setDbTimezone($this->timezone); + $copyObj->setDbDuration($this->duration); + $copyObj->setDbDay($this->day); + $copyObj->setDbRepeatType($this->repeat_type); + $copyObj->setDbNextPopDate($this->next_pop_date); + $copyObj->setDbShowId($this->show_id); + $copyObj->setDbRecord($this->record); + + $copyObj->setNew(true); + $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcShowDays Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcShowDaysPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcShowDaysPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a CcShow object. + * + * @param CcShow $v + * @return CcShowDays The current object (for fluent API support) + * @throws PropelException + */ + public function setCcShow(CcShow $v = null) + { + if ($v === null) { + $this->setDbShowId(NULL); + } else { + $this->setDbShowId($v->getDbId()); + } + + $this->aCcShow = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcShow object, it will not be re-added. + if ($v !== null) { + $v->addCcShowDays($this); + } + + return $this; + } + + + /** + * Get the associated CcShow object + * + * @param PropelPDO Optional Connection object. + * @return CcShow The associated CcShow object. + * @throws PropelException + */ + public function getCcShow(PropelPDO $con = null) + { + if ($this->aCcShow === null && ($this->show_id !== null)) { + $this->aCcShow = CcShowQuery::create()->findPk($this->show_id, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aCcShow->addCcShowDayss($this); + */ + } + return $this->aCcShow; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->first_show = null; + $this->last_show = null; + $this->start_time = null; + $this->timezone = null; + $this->duration = null; + $this->day = null; + $this->repeat_type = null; + $this->next_pop_date = null; + $this->show_id = null; + $this->record = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->applyDefaultValues(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aCcShow = null; + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcShowDays diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowDaysPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowDaysPeer.php new file mode 100644 index 000000000..df6b9081d --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowDaysPeer.php @@ -0,0 +1,1018 @@ + array ('DbId', 'DbFirstShow', 'DbLastShow', 'DbStartTime', 'DbTimezone', 'DbDuration', 'DbDay', 'DbRepeatType', 'DbNextPopDate', 'DbShowId', 'DbRecord', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbFirstShow', 'dbLastShow', 'dbStartTime', 'dbTimezone', 'dbDuration', 'dbDay', 'dbRepeatType', 'dbNextPopDate', 'dbShowId', 'dbRecord', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::FIRST_SHOW, self::LAST_SHOW, self::START_TIME, self::TIMEZONE, self::DURATION, self::DAY, self::REPEAT_TYPE, self::NEXT_POP_DATE, self::SHOW_ID, self::RECORD, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FIRST_SHOW', 'LAST_SHOW', 'START_TIME', 'TIMEZONE', 'DURATION', 'DAY', 'REPEAT_TYPE', 'NEXT_POP_DATE', 'SHOW_ID', 'RECORD', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'first_show', 'last_show', 'start_time', 'timezone', 'duration', 'day', 'repeat_type', 'next_pop_date', 'show_id', 'record', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbFirstShow' => 1, 'DbLastShow' => 2, 'DbStartTime' => 3, 'DbTimezone' => 4, 'DbDuration' => 5, 'DbDay' => 6, 'DbRepeatType' => 7, 'DbNextPopDate' => 8, 'DbShowId' => 9, 'DbRecord' => 10, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbFirstShow' => 1, 'dbLastShow' => 2, 'dbStartTime' => 3, 'dbTimezone' => 4, 'dbDuration' => 5, 'dbDay' => 6, 'dbRepeatType' => 7, 'dbNextPopDate' => 8, 'dbShowId' => 9, 'dbRecord' => 10, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::FIRST_SHOW => 1, self::LAST_SHOW => 2, self::START_TIME => 3, self::TIMEZONE => 4, self::DURATION => 5, self::DAY => 6, self::REPEAT_TYPE => 7, self::NEXT_POP_DATE => 8, self::SHOW_ID => 9, self::RECORD => 10, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FIRST_SHOW' => 1, 'LAST_SHOW' => 2, 'START_TIME' => 3, 'TIMEZONE' => 4, 'DURATION' => 5, 'DAY' => 6, 'REPEAT_TYPE' => 7, 'NEXT_POP_DATE' => 8, 'SHOW_ID' => 9, 'RECORD' => 10, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'first_show' => 1, 'last_show' => 2, 'start_time' => 3, 'timezone' => 4, 'duration' => 5, 'day' => 6, 'repeat_type' => 7, 'next_pop_date' => 8, 'show_id' => 9, 'record' => 10, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcShowDaysPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcShowDaysPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcShowDaysPeer::ID); + $criteria->addSelectColumn(CcShowDaysPeer::FIRST_SHOW); + $criteria->addSelectColumn(CcShowDaysPeer::LAST_SHOW); + $criteria->addSelectColumn(CcShowDaysPeer::START_TIME); + $criteria->addSelectColumn(CcShowDaysPeer::TIMEZONE); + $criteria->addSelectColumn(CcShowDaysPeer::DURATION); + $criteria->addSelectColumn(CcShowDaysPeer::DAY); + $criteria->addSelectColumn(CcShowDaysPeer::REPEAT_TYPE); + $criteria->addSelectColumn(CcShowDaysPeer::NEXT_POP_DATE); + $criteria->addSelectColumn(CcShowDaysPeer::SHOW_ID); + $criteria->addSelectColumn(CcShowDaysPeer::RECORD); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.FIRST_SHOW'); + $criteria->addSelectColumn($alias . '.LAST_SHOW'); + $criteria->addSelectColumn($alias . '.START_TIME'); + $criteria->addSelectColumn($alias . '.TIMEZONE'); + $criteria->addSelectColumn($alias . '.DURATION'); + $criteria->addSelectColumn($alias . '.DAY'); + $criteria->addSelectColumn($alias . '.REPEAT_TYPE'); + $criteria->addSelectColumn($alias . '.NEXT_POP_DATE'); + $criteria->addSelectColumn($alias . '.SHOW_ID'); + $criteria->addSelectColumn($alias . '.RECORD'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowDaysPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowDaysPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcShowDays + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcShowDaysPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcShowDaysPeer::populateObjects(CcShowDaysPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcShowDaysPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcShowDays $value A CcShowDays object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcShowDays $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcShowDays object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcShowDays) { + $key = (string) $value->getDbId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcShowDays object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcShowDays Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_show_days + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcShowDaysPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcShowDaysPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcShowDaysPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcShowDaysPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcShowDays object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcShowDaysPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcShowDaysPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcShowDaysPeer::NUM_COLUMNS; + } else { + $cls = CcShowDaysPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcShowDaysPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + + /** + * Returns the number of rows matching criteria, joining the related CcShow table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinCcShow(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowDaysPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowDaysPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowDaysPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcShowDays objects pre-filled with their CcShow objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowDays objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcShow(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowDaysPeer::addSelectColumns($criteria); + $startcol = (CcShowDaysPeer::NUM_COLUMNS - CcShowDaysPeer::NUM_LAZY_LOAD_COLUMNS); + CcShowPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcShowDaysPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowDaysPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowDaysPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcShowDaysPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowDaysPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcShowPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcShowPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcShowPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcShowDays) to $obj2 (CcShow) + $obj2->addCcShowDays($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining all related tables + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowDaysPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowDaysPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowDaysPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of CcShowDays objects pre-filled with all related objects. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowDays objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowDaysPeer::addSelectColumns($criteria); + $startcol2 = (CcShowDaysPeer::NUM_COLUMNS - CcShowDaysPeer::NUM_LAZY_LOAD_COLUMNS); + + CcShowPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcShowDaysPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowDaysPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowDaysPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcShowDaysPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowDaysPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcShow rows + + $key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcShowPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcShowPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcShowPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (CcShowDays) to the collection in $obj2 (CcShow) + $obj2->addCcShowDays($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcShowDaysPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcShowDaysPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcShowDaysTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcShowDaysPeer::CLASS_DEFAULT : CcShowDaysPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcShowDays or Criteria object. + * + * @param mixed $values Criteria or CcShowDays object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcShowDays object + } + + if ($criteria->containsKey(CcShowDaysPeer::ID) && $criteria->keyContainsValue(CcShowDaysPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcShowDaysPeer::ID.')'); + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcShowDays or Criteria object. + * + * @param mixed $values Criteria or CcShowDays object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcShowDaysPeer::ID); + $value = $criteria->remove(CcShowDaysPeer::ID); + if ($value) { + $selectCriteria->add(CcShowDaysPeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcShowDaysPeer::TABLE_NAME); + } + + } else { // $values is CcShowDays object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_show_days table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcShowDaysPeer::TABLE_NAME, $con, CcShowDaysPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcShowDaysPeer::clearInstancePool(); + CcShowDaysPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcShowDays or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcShowDays object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcShowDaysPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcShowDays) { // it's a model object + // invalidate the cache for this single object + CcShowDaysPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcShowDaysPeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcShowDaysPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcShowDaysPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcShowDays object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcShowDays $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcShowDays $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcShowDaysPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcShowDaysPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcShowDaysPeer::DATABASE_NAME, CcShowDaysPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcShowDays + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcShowDaysPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcShowDaysPeer::DATABASE_NAME); + $criteria->add(CcShowDaysPeer::ID, $pk); + + $v = CcShowDaysPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcShowDaysPeer::DATABASE_NAME); + $criteria->add(CcShowDaysPeer::ID, $pks, Criteria::IN); + $objs = CcShowDaysPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcShowDaysPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcShowDaysPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowDaysQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowDaysQuery.php new file mode 100644 index 000000000..18653bd70 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowDaysQuery.php @@ -0,0 +1,565 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcShowDays|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcShowDaysPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcShowDaysQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcShowDaysPeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcShowDaysQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcShowDaysPeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * @param int|array $dbId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowDaysQuery The current query, for fluid interface + */ + public function filterByDbId($dbId = null, $comparison = null) + { + if (is_array($dbId) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcShowDaysPeer::ID, $dbId, $comparison); + } + + /** + * Filter the query on the first_show column + * + * @param string|array $dbFirstShow 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 CcShowDaysQuery The current query, for fluid interface + */ + public function filterByDbFirstShow($dbFirstShow = null, $comparison = null) + { + if (is_array($dbFirstShow)) { + $useMinMax = false; + if (isset($dbFirstShow['min'])) { + $this->addUsingAlias(CcShowDaysPeer::FIRST_SHOW, $dbFirstShow['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbFirstShow['max'])) { + $this->addUsingAlias(CcShowDaysPeer::FIRST_SHOW, $dbFirstShow['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowDaysPeer::FIRST_SHOW, $dbFirstShow, $comparison); + } + + /** + * Filter the query on the last_show column + * + * @param string|array $dbLastShow 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 CcShowDaysQuery The current query, for fluid interface + */ + public function filterByDbLastShow($dbLastShow = null, $comparison = null) + { + if (is_array($dbLastShow)) { + $useMinMax = false; + if (isset($dbLastShow['min'])) { + $this->addUsingAlias(CcShowDaysPeer::LAST_SHOW, $dbLastShow['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbLastShow['max'])) { + $this->addUsingAlias(CcShowDaysPeer::LAST_SHOW, $dbLastShow['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowDaysPeer::LAST_SHOW, $dbLastShow, $comparison); + } + + /** + * Filter the query on the start_time column + * + * @param string|array $dbStartTime 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 CcShowDaysQuery The current query, for fluid interface + */ + public function filterByDbStartTime($dbStartTime = null, $comparison = null) + { + if (is_array($dbStartTime)) { + $useMinMax = false; + if (isset($dbStartTime['min'])) { + $this->addUsingAlias(CcShowDaysPeer::START_TIME, $dbStartTime['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbStartTime['max'])) { + $this->addUsingAlias(CcShowDaysPeer::START_TIME, $dbStartTime['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowDaysPeer::START_TIME, $dbStartTime, $comparison); + } + + /** + * Filter the query on the timezone column + * + * @param string $dbTimezone The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowDaysQuery The current query, for fluid interface + */ + public function filterByDbTimezone($dbTimezone = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbTimezone)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbTimezone)) { + $dbTimezone = str_replace('*', '%', $dbTimezone); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcShowDaysPeer::TIMEZONE, $dbTimezone, $comparison); + } + + /** + * Filter the query on the duration column + * + * @param string $dbDuration The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowDaysQuery The current query, for fluid interface + */ + public function filterByDbDuration($dbDuration = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbDuration)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbDuration)) { + $dbDuration = str_replace('*', '%', $dbDuration); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcShowDaysPeer::DURATION, $dbDuration, $comparison); + } + + /** + * Filter the query on the day column + * + * @param int|array $dbDay 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 CcShowDaysQuery The current query, for fluid interface + */ + public function filterByDbDay($dbDay = null, $comparison = null) + { + if (is_array($dbDay)) { + $useMinMax = false; + if (isset($dbDay['min'])) { + $this->addUsingAlias(CcShowDaysPeer::DAY, $dbDay['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbDay['max'])) { + $this->addUsingAlias(CcShowDaysPeer::DAY, $dbDay['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowDaysPeer::DAY, $dbDay, $comparison); + } + + /** + * Filter the query on the repeat_type column + * + * @param int|array $dbRepeatType 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 CcShowDaysQuery The current query, for fluid interface + */ + public function filterByDbRepeatType($dbRepeatType = null, $comparison = null) + { + if (is_array($dbRepeatType)) { + $useMinMax = false; + if (isset($dbRepeatType['min'])) { + $this->addUsingAlias(CcShowDaysPeer::REPEAT_TYPE, $dbRepeatType['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbRepeatType['max'])) { + $this->addUsingAlias(CcShowDaysPeer::REPEAT_TYPE, $dbRepeatType['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowDaysPeer::REPEAT_TYPE, $dbRepeatType, $comparison); + } + + /** + * Filter the query on the next_pop_date column + * + * @param string|array $dbNextPopDate 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 CcShowDaysQuery The current query, for fluid interface + */ + public function filterByDbNextPopDate($dbNextPopDate = null, $comparison = null) + { + if (is_array($dbNextPopDate)) { + $useMinMax = false; + if (isset($dbNextPopDate['min'])) { + $this->addUsingAlias(CcShowDaysPeer::NEXT_POP_DATE, $dbNextPopDate['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbNextPopDate['max'])) { + $this->addUsingAlias(CcShowDaysPeer::NEXT_POP_DATE, $dbNextPopDate['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowDaysPeer::NEXT_POP_DATE, $dbNextPopDate, $comparison); + } + + /** + * Filter the query on the show_id column + * + * @param int|array $dbShowId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowDaysQuery The current query, for fluid interface + */ + public function filterByDbShowId($dbShowId = null, $comparison = null) + { + if (is_array($dbShowId)) { + $useMinMax = false; + if (isset($dbShowId['min'])) { + $this->addUsingAlias(CcShowDaysPeer::SHOW_ID, $dbShowId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbShowId['max'])) { + $this->addUsingAlias(CcShowDaysPeer::SHOW_ID, $dbShowId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowDaysPeer::SHOW_ID, $dbShowId, $comparison); + } + + /** + * Filter the query on the record column + * + * @param int|array $dbRecord 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 CcShowDaysQuery The current query, for fluid interface + */ + public function filterByDbRecord($dbRecord = null, $comparison = null) + { + if (is_array($dbRecord)) { + $useMinMax = false; + if (isset($dbRecord['min'])) { + $this->addUsingAlias(CcShowDaysPeer::RECORD, $dbRecord['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbRecord['max'])) { + $this->addUsingAlias(CcShowDaysPeer::RECORD, $dbRecord['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowDaysPeer::RECORD, $dbRecord, $comparison); + } + + /** + * Filter the query by a related CcShow object + * + * @param CcShow $ccShow the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowDaysQuery The current query, for fluid interface + */ + public function filterByCcShow($ccShow, $comparison = null) + { + return $this + ->addUsingAlias(CcShowDaysPeer::SHOW_ID, $ccShow->getDbId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcShow relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowDaysQuery The current query, for fluid interface + */ + public function joinCcShow($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShow'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'CcShow'); + } + + return $this; + } + + /** + * Use the CcShow relation CcShow object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowQuery A secondary query class using the current class as primary query + */ + public function useCcShowQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCcShow($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShow', 'CcShowQuery'); + } + + /** + * Exclude object from result + * + * @param CcShowDays $ccShowDays Object to remove from the list of results + * + * @return CcShowDaysQuery The current query, for fluid interface + */ + public function prune($ccShowDays = null) + { + if ($ccShowDays) { + $this->addUsingAlias(CcShowDaysPeer::ID, $ccShowDays->getDbId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcShowDaysQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowHosts.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowHosts.php new file mode 100644 index 000000000..ca4d11449 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowHosts.php @@ -0,0 +1,936 @@ +id; + } + + /** + * Get the [show_id] column value. + * + * @return int + */ + public function getDbShow() + { + return $this->show_id; + } + + /** + * Get the [subjs_id] column value. + * + * @return int + */ + public function getDbHost() + { + return $this->subjs_id; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return CcShowHosts The current object (for fluent API support) + */ + public function setDbId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CcShowHostsPeer::ID; + } + + return $this; + } // setDbId() + + /** + * Set the value of [show_id] column. + * + * @param int $v new value + * @return CcShowHosts The current object (for fluent API support) + */ + public function setDbShow($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->show_id !== $v) { + $this->show_id = $v; + $this->modifiedColumns[] = CcShowHostsPeer::SHOW_ID; + } + + if ($this->aCcShow !== null && $this->aCcShow->getDbId() !== $v) { + $this->aCcShow = null; + } + + return $this; + } // setDbShow() + + /** + * Set the value of [subjs_id] column. + * + * @param int $v new value + * @return CcShowHosts The current object (for fluent API support) + */ + public function setDbHost($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->subjs_id !== $v) { + $this->subjs_id = $v; + $this->modifiedColumns[] = CcShowHostsPeer::SUBJS_ID; + } + + if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) { + $this->aCcSubjs = null; + } + + return $this; + } // setDbHost() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->show_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->subjs_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 3; // 3 = CcShowHostsPeer::NUM_COLUMNS - CcShowHostsPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcShowHosts object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aCcShow !== null && $this->show_id !== $this->aCcShow->getDbId()) { + $this->aCcShow = null; + } + if ($this->aCcSubjs !== null && $this->subjs_id !== $this->aCcSubjs->getDbId()) { + $this->aCcSubjs = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcShowHostsPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aCcShow = null; + $this->aCcSubjs = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcShowHostsQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcShowHostsPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcShow !== null) { + if ($this->aCcShow->isModified() || $this->aCcShow->isNew()) { + $affectedRows += $this->aCcShow->save($con); + } + $this->setCcShow($this->aCcShow); + } + + if ($this->aCcSubjs !== null) { + if ($this->aCcSubjs->isModified() || $this->aCcSubjs->isNew()) { + $affectedRows += $this->aCcSubjs->save($con); + } + $this->setCcSubjs($this->aCcSubjs); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = CcShowHostsPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + if ($criteria->keyContainsValue(CcShowHostsPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcShowHostsPeer::ID.')'); + } + + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows += 1; + $this->setDbId($pk); //[IMV] update autoincrement primary key + $this->setNew(false); + } else { + $affectedRows += CcShowHostsPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + // We call the validate method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcShow !== null) { + if (!$this->aCcShow->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcShow->getValidationFailures()); + } + } + + if ($this->aCcSubjs !== null) { + if (!$this->aCcSubjs->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures()); + } + } + + + if (($retval = CcShowHostsPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcShowHostsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getDbId(); + break; + case 1: + return $this->getDbShow(); + break; + case 2: + return $this->getDbHost(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) + { + $keys = CcShowHostsPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbId(), + $keys[1] => $this->getDbShow(), + $keys[2] => $this->getDbHost(), + ); + if ($includeForeignObjects) { + if (null !== $this->aCcShow) { + $result['CcShow'] = $this->aCcShow->toArray($keyType, $includeLazyLoadColumns, true); + } + if (null !== $this->aCcSubjs) { + $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, true); + } + } + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcShowHostsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setDbId($value); + break; + case 1: + $this->setDbShow($value); + break; + case 2: + $this->setDbHost($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcShowHostsPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbShow($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDbHost($arr[$keys[2]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcShowHostsPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcShowHostsPeer::ID)) $criteria->add(CcShowHostsPeer::ID, $this->id); + if ($this->isColumnModified(CcShowHostsPeer::SHOW_ID)) $criteria->add(CcShowHostsPeer::SHOW_ID, $this->show_id); + if ($this->isColumnModified(CcShowHostsPeer::SUBJS_ID)) $criteria->add(CcShowHostsPeer::SUBJS_ID, $this->subjs_id); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcShowHostsPeer::DATABASE_NAME); + $criteria->add(CcShowHostsPeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getDbId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getDbId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcShowHosts (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setDbShow($this->show_id); + $copyObj->setDbHost($this->subjs_id); + + $copyObj->setNew(true); + $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcShowHosts Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcShowHostsPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcShowHostsPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a CcShow object. + * + * @param CcShow $v + * @return CcShowHosts The current object (for fluent API support) + * @throws PropelException + */ + public function setCcShow(CcShow $v = null) + { + if ($v === null) { + $this->setDbShow(NULL); + } else { + $this->setDbShow($v->getDbId()); + } + + $this->aCcShow = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcShow object, it will not be re-added. + if ($v !== null) { + $v->addCcShowHosts($this); + } + + return $this; + } + + + /** + * Get the associated CcShow object + * + * @param PropelPDO Optional Connection object. + * @return CcShow The associated CcShow object. + * @throws PropelException + */ + public function getCcShow(PropelPDO $con = null) + { + if ($this->aCcShow === null && ($this->show_id !== null)) { + $this->aCcShow = CcShowQuery::create()->findPk($this->show_id, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aCcShow->addCcShowHostss($this); + */ + } + return $this->aCcShow; + } + + /** + * Declares an association between this object and a CcSubjs object. + * + * @param CcSubjs $v + * @return CcShowHosts The current object (for fluent API support) + * @throws PropelException + */ + public function setCcSubjs(CcSubjs $v = null) + { + if ($v === null) { + $this->setDbHost(NULL); + } else { + $this->setDbHost($v->getDbId()); + } + + $this->aCcSubjs = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcSubjs object, it will not be re-added. + if ($v !== null) { + $v->addCcShowHosts($this); + } + + return $this; + } + + + /** + * Get the associated CcSubjs object + * + * @param PropelPDO Optional Connection object. + * @return CcSubjs The associated CcSubjs object. + * @throws PropelException + */ + public function getCcSubjs(PropelPDO $con = null) + { + if ($this->aCcSubjs === null && ($this->subjs_id !== null)) { + $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->subjs_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->aCcSubjs->addCcShowHostss($this); + */ + } + return $this->aCcSubjs; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->show_id = null; + $this->subjs_id = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aCcShow = null; + $this->aCcSubjs = null; + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcShowHosts diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowHostsPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowHostsPeer.php new file mode 100644 index 000000000..33a82f0d9 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowHostsPeer.php @@ -0,0 +1,1365 @@ + array ('DbId', 'DbShow', 'DbHost', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbShow', 'dbHost', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::SHOW_ID, self::SUBJS_ID, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'SHOW_ID', 'SUBJS_ID', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'show_id', 'subjs_id', ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbShow' => 1, 'DbHost' => 2, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbShow' => 1, 'dbHost' => 2, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::SHOW_ID => 1, self::SUBJS_ID => 2, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'SHOW_ID' => 1, 'SUBJS_ID' => 2, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'show_id' => 1, 'subjs_id' => 2, ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcShowHostsPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcShowHostsPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcShowHostsPeer::ID); + $criteria->addSelectColumn(CcShowHostsPeer::SHOW_ID); + $criteria->addSelectColumn(CcShowHostsPeer::SUBJS_ID); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.SHOW_ID'); + $criteria->addSelectColumn($alias . '.SUBJS_ID'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowHostsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowHostsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcShowHosts + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcShowHostsPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcShowHostsPeer::populateObjects(CcShowHostsPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcShowHostsPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcShowHosts $value A CcShowHosts object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcShowHosts $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcShowHosts object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcShowHosts) { + $key = (string) $value->getDbId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcShowHosts object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcShowHosts Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_show_hosts + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcShowHostsPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcShowHostsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcShowHostsPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcShowHostsPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcShowHosts object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcShowHostsPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcShowHostsPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcShowHostsPeer::NUM_COLUMNS; + } else { + $cls = CcShowHostsPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcShowHostsPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + + /** + * Returns the number of rows matching criteria, joining the related CcShow table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinCcShow(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowHostsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowHostsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowHostsPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related CcSubjs table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowHostsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowHostsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowHostsPeer::SUBJS_ID, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcShowHosts objects pre-filled with their CcShow objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowHosts objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcShow(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowHostsPeer::addSelectColumns($criteria); + $startcol = (CcShowHostsPeer::NUM_COLUMNS - CcShowHostsPeer::NUM_LAZY_LOAD_COLUMNS); + CcShowPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcShowHostsPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowHostsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowHostsPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcShowHostsPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowHostsPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcShowPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcShowPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcShowPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcShowHosts) to $obj2 (CcShow) + $obj2->addCcShowHosts($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of CcShowHosts objects pre-filled with their CcSubjs objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowHosts objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowHostsPeer::addSelectColumns($criteria); + $startcol = (CcShowHostsPeer::NUM_COLUMNS - CcShowHostsPeer::NUM_LAZY_LOAD_COLUMNS); + CcSubjsPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcShowHostsPeer::SUBJS_ID, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowHostsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowHostsPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcShowHostsPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowHostsPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcSubjsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcSubjsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcSubjsPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcShowHosts) to $obj2 (CcSubjs) + $obj2->addCcShowHosts($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining all related tables + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowHostsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowHostsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowHostsPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $criteria->addJoin(CcShowHostsPeer::SUBJS_ID, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of CcShowHosts objects pre-filled with all related objects. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowHosts objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowHostsPeer::addSelectColumns($criteria); + $startcol2 = (CcShowHostsPeer::NUM_COLUMNS - CcShowHostsPeer::NUM_LAZY_LOAD_COLUMNS); + + CcShowPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS); + + CcSubjsPeer::addSelectColumns($criteria); + $startcol4 = $startcol3 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcShowHostsPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $criteria->addJoin(CcShowHostsPeer::SUBJS_ID, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowHostsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowHostsPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcShowHostsPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowHostsPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcShow rows + + $key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcShowPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcShowPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcShowPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (CcShowHosts) to the collection in $obj2 (CcShow) + $obj2->addCcShowHosts($obj1); + } // if joined row not null + + // Add objects for joined CcSubjs rows + + $key3 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = CcSubjsPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $cls = CcSubjsPeer::getOMClass(false); + + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + CcSubjsPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (CcShowHosts) to the collection in $obj3 (CcSubjs) + $obj3->addCcShowHosts($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related CcShow table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptCcShow(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowHostsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowHostsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowHostsPeer::SUBJS_ID, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related CcSubjs table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowHostsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowHostsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowHostsPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcShowHosts objects pre-filled with all related objects except CcShow. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowHosts objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptCcShow(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + // $criteria->getDbName() will return the same object if not set to another value + // so == check is okay and faster + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowHostsPeer::addSelectColumns($criteria); + $startcol2 = (CcShowHostsPeer::NUM_COLUMNS - CcShowHostsPeer::NUM_LAZY_LOAD_COLUMNS); + + CcSubjsPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcShowHostsPeer::SUBJS_ID, CcSubjsPeer::ID, $join_behavior); + + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowHostsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowHostsPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcShowHostsPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowHostsPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcSubjs rows + + $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcSubjsPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcSubjsPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcSubjsPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (CcShowHosts) to the collection in $obj2 (CcSubjs) + $obj2->addCcShowHosts($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of CcShowHosts objects pre-filled with all related objects except CcSubjs. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowHosts objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + // $criteria->getDbName() will return the same object if not set to another value + // so == check is okay and faster + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowHostsPeer::addSelectColumns($criteria); + $startcol2 = (CcShowHostsPeer::NUM_COLUMNS - CcShowHostsPeer::NUM_LAZY_LOAD_COLUMNS); + + CcShowPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcShowHostsPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowHostsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowHostsPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcShowHostsPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowHostsPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcShow rows + + $key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcShowPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcShowPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcShowPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (CcShowHosts) to the collection in $obj2 (CcShow) + $obj2->addCcShowHosts($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcShowHostsPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcShowHostsPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcShowHostsTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcShowHostsPeer::CLASS_DEFAULT : CcShowHostsPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcShowHosts or Criteria object. + * + * @param mixed $values Criteria or CcShowHosts object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcShowHosts object + } + + if ($criteria->containsKey(CcShowHostsPeer::ID) && $criteria->keyContainsValue(CcShowHostsPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcShowHostsPeer::ID.')'); + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcShowHosts or Criteria object. + * + * @param mixed $values Criteria or CcShowHosts object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcShowHostsPeer::ID); + $value = $criteria->remove(CcShowHostsPeer::ID); + if ($value) { + $selectCriteria->add(CcShowHostsPeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcShowHostsPeer::TABLE_NAME); + } + + } else { // $values is CcShowHosts object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_show_hosts table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcShowHostsPeer::TABLE_NAME, $con, CcShowHostsPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcShowHostsPeer::clearInstancePool(); + CcShowHostsPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcShowHosts or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcShowHosts object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcShowHostsPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcShowHosts) { // it's a model object + // invalidate the cache for this single object + CcShowHostsPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcShowHostsPeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcShowHostsPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcShowHostsPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcShowHosts object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcShowHosts $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcShowHosts $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcShowHostsPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcShowHostsPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcShowHostsPeer::DATABASE_NAME, CcShowHostsPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcShowHosts + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcShowHostsPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcShowHostsPeer::DATABASE_NAME); + $criteria->add(CcShowHostsPeer::ID, $pk); + + $v = CcShowHostsPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcShowHostsPeer::DATABASE_NAME); + $criteria->add(CcShowHostsPeer::ID, $pks, Criteria::IN); + $objs = CcShowHostsPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcShowHostsPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcShowHostsPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowHostsQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowHostsQuery.php new file mode 100644 index 000000000..2b910a52b --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowHostsQuery.php @@ -0,0 +1,371 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcShowHosts|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcShowHostsPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcShowHostsQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcShowHostsPeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcShowHostsQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcShowHostsPeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * @param int|array $dbId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowHostsQuery The current query, for fluid interface + */ + public function filterByDbId($dbId = null, $comparison = null) + { + if (is_array($dbId) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcShowHostsPeer::ID, $dbId, $comparison); + } + + /** + * Filter the query on the show_id column + * + * @param int|array $dbShow 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 CcShowHostsQuery The current query, for fluid interface + */ + public function filterByDbShow($dbShow = null, $comparison = null) + { + if (is_array($dbShow)) { + $useMinMax = false; + if (isset($dbShow['min'])) { + $this->addUsingAlias(CcShowHostsPeer::SHOW_ID, $dbShow['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbShow['max'])) { + $this->addUsingAlias(CcShowHostsPeer::SHOW_ID, $dbShow['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowHostsPeer::SHOW_ID, $dbShow, $comparison); + } + + /** + * Filter the query on the subjs_id column + * + * @param int|array $dbHost 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 CcShowHostsQuery The current query, for fluid interface + */ + public function filterByDbHost($dbHost = null, $comparison = null) + { + if (is_array($dbHost)) { + $useMinMax = false; + if (isset($dbHost['min'])) { + $this->addUsingAlias(CcShowHostsPeer::SUBJS_ID, $dbHost['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbHost['max'])) { + $this->addUsingAlias(CcShowHostsPeer::SUBJS_ID, $dbHost['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowHostsPeer::SUBJS_ID, $dbHost, $comparison); + } + + /** + * Filter the query by a related CcShow object + * + * @param CcShow $ccShow the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowHostsQuery The current query, for fluid interface + */ + public function filterByCcShow($ccShow, $comparison = null) + { + return $this + ->addUsingAlias(CcShowHostsPeer::SHOW_ID, $ccShow->getDbId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcShow relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowHostsQuery The current query, for fluid interface + */ + public function joinCcShow($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShow'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'CcShow'); + } + + return $this; + } + + /** + * Use the CcShow relation CcShow object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowQuery A secondary query class using the current class as primary query + */ + public function useCcShowQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCcShow($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShow', 'CcShowQuery'); + } + + /** + * Filter the query by a related CcSubjs object + * + * @param CcSubjs $ccSubjs the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowHostsQuery The current query, for fluid interface + */ + public function filterByCcSubjs($ccSubjs, $comparison = null) + { + return $this + ->addUsingAlias(CcShowHostsPeer::SUBJS_ID, $ccSubjs->getDbId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcSubjs relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowHostsQuery The current query, for fluid interface + */ + public function joinCcSubjs($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcSubjs'); + + // 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, 'CcSubjs'); + } + + return $this; + } + + /** + * Use the CcSubjs relation CcSubjs 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 CcSubjsQuery A secondary query class using the current class as primary query + */ + public function useCcSubjsQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCcSubjs($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery'); + } + + /** + * Exclude object from result + * + * @param CcShowHosts $ccShowHosts Object to remove from the list of results + * + * @return CcShowHostsQuery The current query, for fluid interface + */ + public function prune($ccShowHosts = null) + { + if ($ccShowHosts) { + $this->addUsingAlias(CcShowHostsPeer::ID, $ccShowHosts->getDbId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcShowHostsQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowInstances.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowInstances.php new file mode 100644 index 000000000..c78c34142 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowInstances.php @@ -0,0 +1,1945 @@ +record = 0; + $this->rebroadcast = 0; + $this->modified_instance = false; + } + + /** + * Initializes internal state of BaseCcShowInstances object. + * @see applyDefaults() + */ + public function __construct() + { + parent::__construct(); + $this->applyDefaultValues(); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getDbId() + { + return $this->id; + } + + /** + * Get the [optionally formatted] temporal [starts] 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 getDbStarts($format = 'Y-m-d H:i:s') + { + if ($this->starts === null) { + return null; + } + + + + try { + $dt = new DateTime($this->starts); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->starts, 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); + } + } + + /** + * Get the [optionally formatted] temporal [ends] 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 getDbEnds($format = 'Y-m-d H:i:s') + { + if ($this->ends === null) { + return null; + } + + + + try { + $dt = new DateTime($this->ends); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->ends, 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); + } + } + + /** + * Get the [show_id] column value. + * + * @return int + */ + public function getDbShowId() + { + return $this->show_id; + } + + /** + * Get the [record] column value. + * + * @return int + */ + public function getDbRecord() + { + return $this->record; + } + + /** + * Get the [rebroadcast] column value. + * + * @return int + */ + public function getDbRebroadcast() + { + return $this->rebroadcast; + } + + /** + * Get the [instance_id] column value. + * + * @return int + */ + public function getDbOriginalShow() + { + return $this->instance_id; + } + + /** + * Get the [file_id] column value. + * + * @return int + */ + public function getDbRecordedFile() + { + return $this->file_id; + } + + /** + * Get the [optionally formatted] temporal [time_filled] 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 getDbTimeFilled($format = '%X') + { + if ($this->time_filled === null) { + return null; + } + + + + try { + $dt = new DateTime($this->time_filled); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->time_filled, 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); + } + } + + /** + * Get the [modified_instance] column value. + * + * @return boolean + */ + public function getDbModifiedInstance() + { + return $this->modified_instance; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return CcShowInstances The current object (for fluent API support) + */ + public function setDbId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CcShowInstancesPeer::ID; + } + + return $this; + } // setDbId() + + /** + * Sets the value of [starts] 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 CcShowInstances The current object (for fluent API support) + */ + public function setDbStarts($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->starts !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->starts !== null && $tmpDt = new DateTime($this->starts)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->starts = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); + $this->modifiedColumns[] = CcShowInstancesPeer::STARTS; + } + } // if either are not null + + return $this; + } // setDbStarts() + + /** + * Sets the value of [ends] 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 CcShowInstances The current object (for fluent API support) + */ + public function setDbEnds($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->ends !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->ends !== null && $tmpDt = new DateTime($this->ends)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->ends = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); + $this->modifiedColumns[] = CcShowInstancesPeer::ENDS; + } + } // if either are not null + + return $this; + } // setDbEnds() + + /** + * Set the value of [show_id] column. + * + * @param int $v new value + * @return CcShowInstances The current object (for fluent API support) + */ + public function setDbShowId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->show_id !== $v) { + $this->show_id = $v; + $this->modifiedColumns[] = CcShowInstancesPeer::SHOW_ID; + } + + if ($this->aCcShow !== null && $this->aCcShow->getDbId() !== $v) { + $this->aCcShow = null; + } + + return $this; + } // setDbShowId() + + /** + * Set the value of [record] column. + * + * @param int $v new value + * @return CcShowInstances The current object (for fluent API support) + */ + public function setDbRecord($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->record !== $v || $this->isNew()) { + $this->record = $v; + $this->modifiedColumns[] = CcShowInstancesPeer::RECORD; + } + + return $this; + } // setDbRecord() + + /** + * Set the value of [rebroadcast] column. + * + * @param int $v new value + * @return CcShowInstances The current object (for fluent API support) + */ + public function setDbRebroadcast($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->rebroadcast !== $v || $this->isNew()) { + $this->rebroadcast = $v; + $this->modifiedColumns[] = CcShowInstancesPeer::REBROADCAST; + } + + return $this; + } // setDbRebroadcast() + + /** + * Set the value of [instance_id] column. + * + * @param int $v new value + * @return CcShowInstances The current object (for fluent API support) + */ + public function setDbOriginalShow($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->instance_id !== $v) { + $this->instance_id = $v; + $this->modifiedColumns[] = CcShowInstancesPeer::INSTANCE_ID; + } + + if ($this->aCcShowInstancesRelatedByDbOriginalShow !== null && $this->aCcShowInstancesRelatedByDbOriginalShow->getDbId() !== $v) { + $this->aCcShowInstancesRelatedByDbOriginalShow = null; + } + + return $this; + } // setDbOriginalShow() + + /** + * Set the value of [file_id] column. + * + * @param int $v new value + * @return CcShowInstances The current object (for fluent API support) + */ + public function setDbRecordedFile($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->file_id !== $v) { + $this->file_id = $v; + $this->modifiedColumns[] = CcShowInstancesPeer::FILE_ID; + } + + if ($this->aCcFiles !== null && $this->aCcFiles->getDbId() !== $v) { + $this->aCcFiles = null; + } + + return $this; + } // setDbRecordedFile() + + /** + * Sets the value of [time_filled] 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 CcShowInstances The current object (for fluent API support) + */ + public function setDbTimeFilled($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->time_filled !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->time_filled !== null && $tmpDt = new DateTime($this->time_filled)) ? $tmpDt->format('H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->time_filled = ($dt ? $dt->format('H:i:s') : null); + $this->modifiedColumns[] = CcShowInstancesPeer::TIME_FILLED; + } + } // if either are not null + + return $this; + } // setDbTimeFilled() + + /** + * Set the value of [modified_instance] column. + * + * @param boolean $v new value + * @return CcShowInstances The current object (for fluent API support) + */ + public function setDbModifiedInstance($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->modified_instance !== $v || $this->isNew()) { + $this->modified_instance = $v; + $this->modifiedColumns[] = CcShowInstancesPeer::MODIFIED_INSTANCE; + } + + return $this; + } // setDbModifiedInstance() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + if ($this->record !== 0) { + return false; + } + + if ($this->rebroadcast !== 0) { + return false; + } + + if ($this->modified_instance !== false) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->starts = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->ends = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->show_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->record = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; + $this->rebroadcast = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null; + $this->instance_id = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null; + $this->file_id = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null; + $this->time_filled = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; + $this->modified_instance = ($row[$startcol + 9] !== null) ? (boolean) $row[$startcol + 9] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 10; // 10 = CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcShowInstances object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aCcShow !== null && $this->show_id !== $this->aCcShow->getDbId()) { + $this->aCcShow = null; + } + if ($this->aCcShowInstancesRelatedByDbOriginalShow !== null && $this->instance_id !== $this->aCcShowInstancesRelatedByDbOriginalShow->getDbId()) { + $this->aCcShowInstancesRelatedByDbOriginalShow = null; + } + if ($this->aCcFiles !== null && $this->file_id !== $this->aCcFiles->getDbId()) { + $this->aCcFiles = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcShowInstancesPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aCcShow = null; + $this->aCcShowInstancesRelatedByDbOriginalShow = null; + $this->aCcFiles = null; + $this->collCcShowInstancessRelatedByDbId = null; + + $this->collCcSchedules = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcShowInstancesQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcShowInstancesPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcShow !== null) { + if ($this->aCcShow->isModified() || $this->aCcShow->isNew()) { + $affectedRows += $this->aCcShow->save($con); + } + $this->setCcShow($this->aCcShow); + } + + if ($this->aCcShowInstancesRelatedByDbOriginalShow !== null) { + if ($this->aCcShowInstancesRelatedByDbOriginalShow->isModified() || $this->aCcShowInstancesRelatedByDbOriginalShow->isNew()) { + $affectedRows += $this->aCcShowInstancesRelatedByDbOriginalShow->save($con); + } + $this->setCcShowInstancesRelatedByDbOriginalShow($this->aCcShowInstancesRelatedByDbOriginalShow); + } + + if ($this->aCcFiles !== null) { + if ($this->aCcFiles->isModified() || $this->aCcFiles->isNew()) { + $affectedRows += $this->aCcFiles->save($con); + } + $this->setCcFiles($this->aCcFiles); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = CcShowInstancesPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + if ($criteria->keyContainsValue(CcShowInstancesPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcShowInstancesPeer::ID.')'); + } + + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows += 1; + $this->setDbId($pk); //[IMV] update autoincrement primary key + $this->setNew(false); + } else { + $affectedRows += CcShowInstancesPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collCcShowInstancessRelatedByDbId !== null) { + foreach ($this->collCcShowInstancessRelatedByDbId as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collCcSchedules !== null) { + foreach ($this->collCcSchedules as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + // We call the validate method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcShow !== null) { + if (!$this->aCcShow->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcShow->getValidationFailures()); + } + } + + if ($this->aCcShowInstancesRelatedByDbOriginalShow !== null) { + if (!$this->aCcShowInstancesRelatedByDbOriginalShow->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcShowInstancesRelatedByDbOriginalShow->getValidationFailures()); + } + } + + if ($this->aCcFiles !== null) { + if (!$this->aCcFiles->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcFiles->getValidationFailures()); + } + } + + + if (($retval = CcShowInstancesPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collCcShowInstancessRelatedByDbId !== null) { + foreach ($this->collCcShowInstancessRelatedByDbId as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collCcSchedules !== null) { + foreach ($this->collCcSchedules as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcShowInstancesPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getDbId(); + break; + case 1: + return $this->getDbStarts(); + break; + case 2: + return $this->getDbEnds(); + break; + case 3: + return $this->getDbShowId(); + break; + case 4: + return $this->getDbRecord(); + break; + case 5: + return $this->getDbRebroadcast(); + break; + case 6: + return $this->getDbOriginalShow(); + break; + case 7: + return $this->getDbRecordedFile(); + break; + case 8: + return $this->getDbTimeFilled(); + break; + case 9: + return $this->getDbModifiedInstance(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) + { + $keys = CcShowInstancesPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbId(), + $keys[1] => $this->getDbStarts(), + $keys[2] => $this->getDbEnds(), + $keys[3] => $this->getDbShowId(), + $keys[4] => $this->getDbRecord(), + $keys[5] => $this->getDbRebroadcast(), + $keys[6] => $this->getDbOriginalShow(), + $keys[7] => $this->getDbRecordedFile(), + $keys[8] => $this->getDbTimeFilled(), + $keys[9] => $this->getDbModifiedInstance(), + ); + if ($includeForeignObjects) { + if (null !== $this->aCcShow) { + $result['CcShow'] = $this->aCcShow->toArray($keyType, $includeLazyLoadColumns, true); + } + if (null !== $this->aCcShowInstancesRelatedByDbOriginalShow) { + $result['CcShowInstancesRelatedByDbOriginalShow'] = $this->aCcShowInstancesRelatedByDbOriginalShow->toArray($keyType, $includeLazyLoadColumns, true); + } + if (null !== $this->aCcFiles) { + $result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, true); + } + } + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcShowInstancesPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setDbId($value); + break; + case 1: + $this->setDbStarts($value); + break; + case 2: + $this->setDbEnds($value); + break; + case 3: + $this->setDbShowId($value); + break; + case 4: + $this->setDbRecord($value); + break; + case 5: + $this->setDbRebroadcast($value); + break; + case 6: + $this->setDbOriginalShow($value); + break; + case 7: + $this->setDbRecordedFile($value); + break; + case 8: + $this->setDbTimeFilled($value); + break; + case 9: + $this->setDbModifiedInstance($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcShowInstancesPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbStarts($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDbEnds($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDbShowId($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setDbRecord($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setDbRebroadcast($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setDbOriginalShow($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setDbRecordedFile($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setDbTimeFilled($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setDbModifiedInstance($arr[$keys[9]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcShowInstancesPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcShowInstancesPeer::ID)) $criteria->add(CcShowInstancesPeer::ID, $this->id); + if ($this->isColumnModified(CcShowInstancesPeer::STARTS)) $criteria->add(CcShowInstancesPeer::STARTS, $this->starts); + if ($this->isColumnModified(CcShowInstancesPeer::ENDS)) $criteria->add(CcShowInstancesPeer::ENDS, $this->ends); + if ($this->isColumnModified(CcShowInstancesPeer::SHOW_ID)) $criteria->add(CcShowInstancesPeer::SHOW_ID, $this->show_id); + if ($this->isColumnModified(CcShowInstancesPeer::RECORD)) $criteria->add(CcShowInstancesPeer::RECORD, $this->record); + if ($this->isColumnModified(CcShowInstancesPeer::REBROADCAST)) $criteria->add(CcShowInstancesPeer::REBROADCAST, $this->rebroadcast); + if ($this->isColumnModified(CcShowInstancesPeer::INSTANCE_ID)) $criteria->add(CcShowInstancesPeer::INSTANCE_ID, $this->instance_id); + if ($this->isColumnModified(CcShowInstancesPeer::FILE_ID)) $criteria->add(CcShowInstancesPeer::FILE_ID, $this->file_id); + if ($this->isColumnModified(CcShowInstancesPeer::TIME_FILLED)) $criteria->add(CcShowInstancesPeer::TIME_FILLED, $this->time_filled); + if ($this->isColumnModified(CcShowInstancesPeer::MODIFIED_INSTANCE)) $criteria->add(CcShowInstancesPeer::MODIFIED_INSTANCE, $this->modified_instance); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcShowInstancesPeer::DATABASE_NAME); + $criteria->add(CcShowInstancesPeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getDbId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getDbId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcShowInstances (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setDbStarts($this->starts); + $copyObj->setDbEnds($this->ends); + $copyObj->setDbShowId($this->show_id); + $copyObj->setDbRecord($this->record); + $copyObj->setDbRebroadcast($this->rebroadcast); + $copyObj->setDbOriginalShow($this->instance_id); + $copyObj->setDbRecordedFile($this->file_id); + $copyObj->setDbTimeFilled($this->time_filled); + $copyObj->setDbModifiedInstance($this->modified_instance); + + 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->getCcShowInstancessRelatedByDbId() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcShowInstancesRelatedByDbId($relObj->copy($deepCopy)); + } + } + + foreach ($this->getCcSchedules() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcSchedule($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcShowInstances Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcShowInstancesPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcShowInstancesPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a CcShow object. + * + * @param CcShow $v + * @return CcShowInstances The current object (for fluent API support) + * @throws PropelException + */ + public function setCcShow(CcShow $v = null) + { + if ($v === null) { + $this->setDbShowId(NULL); + } else { + $this->setDbShowId($v->getDbId()); + } + + $this->aCcShow = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcShow object, it will not be re-added. + if ($v !== null) { + $v->addCcShowInstances($this); + } + + return $this; + } + + + /** + * Get the associated CcShow object + * + * @param PropelPDO Optional Connection object. + * @return CcShow The associated CcShow object. + * @throws PropelException + */ + public function getCcShow(PropelPDO $con = null) + { + if ($this->aCcShow === null && ($this->show_id !== null)) { + $this->aCcShow = CcShowQuery::create()->findPk($this->show_id, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aCcShow->addCcShowInstancess($this); + */ + } + return $this->aCcShow; + } + + /** + * Declares an association between this object and a CcShowInstances object. + * + * @param CcShowInstances $v + * @return CcShowInstances The current object (for fluent API support) + * @throws PropelException + */ + public function setCcShowInstancesRelatedByDbOriginalShow(CcShowInstances $v = null) + { + if ($v === null) { + $this->setDbOriginalShow(NULL); + } else { + $this->setDbOriginalShow($v->getDbId()); + } + + $this->aCcShowInstancesRelatedByDbOriginalShow = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcShowInstances object, it will not be re-added. + if ($v !== null) { + $v->addCcShowInstancesRelatedByDbId($this); + } + + return $this; + } + + + /** + * Get the associated CcShowInstances object + * + * @param PropelPDO Optional Connection object. + * @return CcShowInstances The associated CcShowInstances object. + * @throws PropelException + */ + public function getCcShowInstancesRelatedByDbOriginalShow(PropelPDO $con = null) + { + if ($this->aCcShowInstancesRelatedByDbOriginalShow === null && ($this->instance_id !== null)) { + $this->aCcShowInstancesRelatedByDbOriginalShow = 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->aCcShowInstancesRelatedByDbOriginalShow->addCcShowInstancessRelatedByDbId($this); + */ + } + return $this->aCcShowInstancesRelatedByDbOriginalShow; + } + + /** + * Declares an association between this object and a CcFiles object. + * + * @param CcFiles $v + * @return CcShowInstances The current object (for fluent API support) + * @throws PropelException + */ + public function setCcFiles(CcFiles $v = null) + { + if ($v === null) { + $this->setDbRecordedFile(NULL); + } else { + $this->setDbRecordedFile($v->getDbId()); + } + + $this->aCcFiles = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcFiles object, it will not be re-added. + if ($v !== null) { + $v->addCcShowInstances($this); + } + + return $this; + } + + + /** + * Get the associated CcFiles object + * + * @param PropelPDO Optional Connection object. + * @return CcFiles The associated CcFiles object. + * @throws PropelException + */ + public function getCcFiles(PropelPDO $con = null) + { + if ($this->aCcFiles === null && ($this->file_id !== null)) { + $this->aCcFiles = CcFilesQuery::create()->findPk($this->file_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->aCcFiles->addCcShowInstancess($this); + */ + } + return $this->aCcFiles; + } + + /** + * Clears out the collCcShowInstancessRelatedByDbId 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 addCcShowInstancessRelatedByDbId() + */ + public function clearCcShowInstancessRelatedByDbId() + { + $this->collCcShowInstancessRelatedByDbId = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcShowInstancessRelatedByDbId collection. + * + * By default this just sets the collCcShowInstancessRelatedByDbId collection to an empty array (like clearcollCcShowInstancessRelatedByDbId()); + * 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 initCcShowInstancessRelatedByDbId() + { + $this->collCcShowInstancessRelatedByDbId = new PropelObjectCollection(); + $this->collCcShowInstancessRelatedByDbId->setModel('CcShowInstances'); + } + + /** + * Gets an array of CcShowInstances 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 CcShowInstances[] List of CcShowInstances objects + * @throws PropelException + */ + public function getCcShowInstancessRelatedByDbId($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcShowInstancessRelatedByDbId || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowInstancessRelatedByDbId) { + // return empty collection + $this->initCcShowInstancessRelatedByDbId(); + } else { + $collCcShowInstancessRelatedByDbId = CcShowInstancesQuery::create(null, $criteria) + ->filterByCcShowInstancesRelatedByDbOriginalShow($this) + ->find($con); + if (null !== $criteria) { + return $collCcShowInstancessRelatedByDbId; + } + $this->collCcShowInstancessRelatedByDbId = $collCcShowInstancessRelatedByDbId; + } + } + return $this->collCcShowInstancessRelatedByDbId; + } + + /** + * Returns the number of related CcShowInstances objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcShowInstances objects. + * @throws PropelException + */ + public function countCcShowInstancessRelatedByDbId(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcShowInstancessRelatedByDbId || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowInstancessRelatedByDbId) { + return 0; + } else { + $query = CcShowInstancesQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcShowInstancesRelatedByDbOriginalShow($this) + ->count($con); + } + } else { + return count($this->collCcShowInstancessRelatedByDbId); + } + } + + /** + * Method called to associate a CcShowInstances object to this object + * through the CcShowInstances foreign key attribute. + * + * @param CcShowInstances $l CcShowInstances + * @return void + * @throws PropelException + */ + public function addCcShowInstancesRelatedByDbId(CcShowInstances $l) + { + if ($this->collCcShowInstancessRelatedByDbId === null) { + $this->initCcShowInstancessRelatedByDbId(); + } + if (!$this->collCcShowInstancessRelatedByDbId->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcShowInstancessRelatedByDbId[]= $l; + $l->setCcShowInstancesRelatedByDbOriginalShow($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcShowInstances is new, it will return + * an empty collection; or if this CcShowInstances has previously + * been saved, it will retrieve related CcShowInstancessRelatedByDbId from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcShowInstances. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowInstances[] List of CcShowInstances objects + */ + public function getCcShowInstancessRelatedByDbIdJoinCcShow($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowInstancesQuery::create(null, $criteria); + $query->joinWith('CcShow', $join_behavior); + + return $this->getCcShowInstancessRelatedByDbId($query, $con); + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcShowInstances is new, it will return + * an empty collection; or if this CcShowInstances has previously + * been saved, it will retrieve related CcShowInstancessRelatedByDbId from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcShowInstances. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowInstances[] List of CcShowInstances objects + */ + public function getCcShowInstancessRelatedByDbIdJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowInstancesQuery::create(null, $criteria); + $query->joinWith('CcFiles', $join_behavior); + + return $this->getCcShowInstancessRelatedByDbId($query, $con); + } + + /** + * Clears out the collCcSchedules 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 addCcSchedules() + */ + public function clearCcSchedules() + { + $this->collCcSchedules = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcSchedules collection. + * + * By default this just sets the collCcSchedules collection to an empty array (like clearcollCcSchedules()); + * 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 initCcSchedules() + { + $this->collCcSchedules = new PropelObjectCollection(); + $this->collCcSchedules->setModel('CcSchedule'); + } + + /** + * Gets an array of CcSchedule 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 CcSchedule[] List of CcSchedule objects + * @throws PropelException + */ + public function getCcSchedules($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcSchedules || null !== $criteria) { + if ($this->isNew() && null === $this->collCcSchedules) { + // return empty collection + $this->initCcSchedules(); + } else { + $collCcSchedules = CcScheduleQuery::create(null, $criteria) + ->filterByCcShowInstances($this) + ->find($con); + if (null !== $criteria) { + return $collCcSchedules; + } + $this->collCcSchedules = $collCcSchedules; + } + } + return $this->collCcSchedules; + } + + /** + * Returns the number of related CcSchedule objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcSchedule objects. + * @throws PropelException + */ + public function countCcSchedules(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcSchedules || null !== $criteria) { + if ($this->isNew() && null === $this->collCcSchedules) { + return 0; + } else { + $query = CcScheduleQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcShowInstances($this) + ->count($con); + } + } else { + return count($this->collCcSchedules); + } + } + + /** + * Method called to associate a CcSchedule object to this object + * through the CcSchedule foreign key attribute. + * + * @param CcSchedule $l CcSchedule + * @return void + * @throws PropelException + */ + public function addCcSchedule(CcSchedule $l) + { + if ($this->collCcSchedules === null) { + $this->initCcSchedules(); + } + if (!$this->collCcSchedules->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcSchedules[]= $l; + $l->setCcShowInstances($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcShowInstances is new, it will return + * an empty collection; or if this CcShowInstances has previously + * been saved, it will retrieve related CcSchedules from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcShowInstances. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcSchedule[] List of CcSchedule objects + */ + public function getCcSchedulesJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcScheduleQuery::create(null, $criteria); + $query->joinWith('CcFiles', $join_behavior); + + return $this->getCcSchedules($query, $con); + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->starts = null; + $this->ends = null; + $this->show_id = null; + $this->record = null; + $this->rebroadcast = null; + $this->instance_id = null; + $this->file_id = null; + $this->time_filled = null; + $this->modified_instance = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->applyDefaultValues(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collCcShowInstancessRelatedByDbId) { + foreach ((array) $this->collCcShowInstancessRelatedByDbId as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collCcSchedules) { + foreach ((array) $this->collCcSchedules as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collCcShowInstancessRelatedByDbId = null; + $this->collCcSchedules = null; + $this->aCcShow = null; + $this->aCcShowInstancesRelatedByDbOriginalShow = null; + $this->aCcFiles = null; + } + + // aggregate_column behavior + + /** + * Computes the value of the aggregate column time_filled + * + * @param PropelPDO $con A connection object + * + * @return mixed The scalar result from the aggregate query + */ + public function computeDbTimeFilled(PropelPDO $con) + { + $stmt = $con->prepare('SELECT SUM(clip_length) FROM "cc_schedule" WHERE cc_schedule.INSTANCE_ID = :p1'); + $stmt->bindValue(':p1', $this->getDbId()); + $stmt->execute(); + return $stmt->fetchColumn(); + } + + /** + * Updates the aggregate column time_filled + * + * @param PropelPDO $con A connection object + */ + public function updateDbTimeFilled(PropelPDO $con) + { + $this->setDbTimeFilled($this->computeDbTimeFilled($con)); + $this->save($con); + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcShowInstances diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowInstancesPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowInstancesPeer.php new file mode 100644 index 000000000..d30a1a8ab --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowInstancesPeer.php @@ -0,0 +1,1555 @@ + array ('DbId', 'DbStarts', 'DbEnds', 'DbShowId', 'DbRecord', 'DbRebroadcast', 'DbOriginalShow', 'DbRecordedFile', 'DbTimeFilled', 'DbModifiedInstance', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbShowId', 'dbRecord', 'dbRebroadcast', 'dbOriginalShow', 'dbRecordedFile', 'dbTimeFilled', 'dbModifiedInstance', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::SHOW_ID, self::RECORD, self::REBROADCAST, self::INSTANCE_ID, self::FILE_ID, self::TIME_FILLED, self::MODIFIED_INSTANCE, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'SHOW_ID', 'RECORD', 'REBROADCAST', 'INSTANCE_ID', 'FILE_ID', 'TIME_FILLED', 'MODIFIED_INSTANCE', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'show_id', 'record', 'rebroadcast', 'instance_id', 'file_id', 'time_filled', 'modified_instance', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbShowId' => 3, 'DbRecord' => 4, 'DbRebroadcast' => 5, 'DbOriginalShow' => 6, 'DbRecordedFile' => 7, 'DbTimeFilled' => 8, 'DbModifiedInstance' => 9, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbShowId' => 3, 'dbRecord' => 4, 'dbRebroadcast' => 5, 'dbOriginalShow' => 6, 'dbRecordedFile' => 7, 'dbTimeFilled' => 8, 'dbModifiedInstance' => 9, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::SHOW_ID => 3, self::RECORD => 4, self::REBROADCAST => 5, self::INSTANCE_ID => 6, self::FILE_ID => 7, self::TIME_FILLED => 8, self::MODIFIED_INSTANCE => 9, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'SHOW_ID' => 3, 'RECORD' => 4, 'REBROADCAST' => 5, 'INSTANCE_ID' => 6, 'FILE_ID' => 7, 'TIME_FILLED' => 8, 'MODIFIED_INSTANCE' => 9, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'show_id' => 3, 'record' => 4, 'rebroadcast' => 5, 'instance_id' => 6, 'file_id' => 7, 'time_filled' => 8, 'modified_instance' => 9, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcShowInstancesPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcShowInstancesPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcShowInstancesPeer::ID); + $criteria->addSelectColumn(CcShowInstancesPeer::STARTS); + $criteria->addSelectColumn(CcShowInstancesPeer::ENDS); + $criteria->addSelectColumn(CcShowInstancesPeer::SHOW_ID); + $criteria->addSelectColumn(CcShowInstancesPeer::RECORD); + $criteria->addSelectColumn(CcShowInstancesPeer::REBROADCAST); + $criteria->addSelectColumn(CcShowInstancesPeer::INSTANCE_ID); + $criteria->addSelectColumn(CcShowInstancesPeer::FILE_ID); + $criteria->addSelectColumn(CcShowInstancesPeer::TIME_FILLED); + $criteria->addSelectColumn(CcShowInstancesPeer::MODIFIED_INSTANCE); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.STARTS'); + $criteria->addSelectColumn($alias . '.ENDS'); + $criteria->addSelectColumn($alias . '.SHOW_ID'); + $criteria->addSelectColumn($alias . '.RECORD'); + $criteria->addSelectColumn($alias . '.REBROADCAST'); + $criteria->addSelectColumn($alias . '.INSTANCE_ID'); + $criteria->addSelectColumn($alias . '.FILE_ID'); + $criteria->addSelectColumn($alias . '.TIME_FILLED'); + $criteria->addSelectColumn($alias . '.MODIFIED_INSTANCE'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowInstancesPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowInstancesPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcShowInstances + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcShowInstancesPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcShowInstancesPeer::populateObjects(CcShowInstancesPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcShowInstancesPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcShowInstances $value A CcShowInstances object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcShowInstances $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcShowInstances object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcShowInstances) { + $key = (string) $value->getDbId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcShowInstances object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcShowInstances Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_show_instances + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + // Invalidate objects in CcShowInstancesPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcShowInstancesPeer::clearInstancePool(); + // Invalidate objects in CcSchedulePeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcSchedulePeer::clearInstancePool(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcShowInstancesPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcShowInstancesPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcShowInstancesPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcShowInstances object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcShowInstancesPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcShowInstancesPeer::NUM_COLUMNS; + } else { + $cls = CcShowInstancesPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcShowInstancesPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + + /** + * Returns the number of rows matching criteria, joining the related CcShow table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinCcShow(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowInstancesPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowInstancesPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowInstancesPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related CcFiles table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowInstancesPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowInstancesPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowInstancesPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcShowInstances objects pre-filled with their CcShow objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowInstances objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcShow(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowInstancesPeer::addSelectColumns($criteria); + $startcol = (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS); + CcShowPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcShowInstancesPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowInstancesPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcShowInstancesPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowInstancesPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcShowPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcShowPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcShowPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcShowInstances) to $obj2 (CcShow) + $obj2->addCcShowInstances($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of CcShowInstances objects pre-filled with their CcFiles objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowInstances objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowInstancesPeer::addSelectColumns($criteria); + $startcol = (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS); + CcFilesPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcShowInstancesPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowInstancesPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcShowInstancesPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowInstancesPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcFilesPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcFilesPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcFilesPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcShowInstances) to $obj2 (CcFiles) + $obj2->addCcShowInstances($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining all related tables + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowInstancesPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowInstancesPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowInstancesPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $criteria->addJoin(CcShowInstancesPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of CcShowInstances objects pre-filled with all related objects. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowInstances objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowInstancesPeer::addSelectColumns($criteria); + $startcol2 = (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS); + + CcShowPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS); + + CcFilesPeer::addSelectColumns($criteria); + $startcol4 = $startcol3 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcShowInstancesPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $criteria->addJoin(CcShowInstancesPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowInstancesPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcShowInstancesPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowInstancesPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcShow rows + + $key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcShowPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcShowPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcShowPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (CcShowInstances) to the collection in $obj2 (CcShow) + $obj2->addCcShowInstances($obj1); + } // if joined row not null + + // Add objects for joined CcFiles rows + + $key3 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = CcFilesPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $cls = CcFilesPeer::getOMClass(false); + + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + CcFilesPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (CcShowInstances) to the collection in $obj3 (CcFiles) + $obj3->addCcShowInstances($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining the related CcShow table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptCcShow(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowInstancesPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowInstancesPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowInstancesPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related CcShowInstancesRelatedByDbOriginalShow table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptCcShowInstancesRelatedByDbOriginalShow(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowInstancesPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowInstancesPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowInstancesPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $criteria->addJoin(CcShowInstancesPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Returns the number of rows matching criteria, joining the related CcFiles table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAllExceptCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowInstancesPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowInstancesPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowInstancesPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcShowInstances objects pre-filled with all related objects except CcShow. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowInstances objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptCcShow(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + // $criteria->getDbName() will return the same object if not set to another value + // so == check is okay and faster + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowInstancesPeer::addSelectColumns($criteria); + $startcol2 = (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS); + + CcFilesPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcShowInstancesPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowInstancesPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcShowInstancesPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowInstancesPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcFiles rows + + $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcFilesPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcFilesPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcFilesPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (CcShowInstances) to the collection in $obj2 (CcFiles) + $obj2->addCcShowInstances($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of CcShowInstances objects pre-filled with all related objects except CcShowInstancesRelatedByDbOriginalShow. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowInstances objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptCcShowInstancesRelatedByDbOriginalShow(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + // $criteria->getDbName() will return the same object if not set to another value + // so == check is okay and faster + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowInstancesPeer::addSelectColumns($criteria); + $startcol2 = (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS); + + CcShowPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS); + + CcFilesPeer::addSelectColumns($criteria); + $startcol4 = $startcol3 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcShowInstancesPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $criteria->addJoin(CcShowInstancesPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowInstancesPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcShowInstancesPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowInstancesPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcShow rows + + $key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcShowPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcShowPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcShowPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (CcShowInstances) to the collection in $obj2 (CcShow) + $obj2->addCcShowInstances($obj1); + + } // if joined row is not null + + // Add objects for joined CcFiles rows + + $key3 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = CcFilesPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $cls = CcFilesPeer::getOMClass(false); + + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + CcFilesPeer::addInstanceToPool($obj3, $key3); + } // if $obj3 already loaded + + // Add the $obj1 (CcShowInstances) to the collection in $obj3 (CcFiles) + $obj3->addCcShowInstances($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Selects a collection of CcShowInstances objects pre-filled with all related objects except CcFiles. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowInstances objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + // $criteria->getDbName() will return the same object if not set to another value + // so == check is okay and faster + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowInstancesPeer::addSelectColumns($criteria); + $startcol2 = (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS); + + CcShowPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcShowInstancesPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowInstancesPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcShowInstancesPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowInstancesPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcShow rows + + $key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcShowPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcShowPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcShowPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (CcShowInstances) to the collection in $obj2 (CcShow) + $obj2->addCcShowInstances($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcShowInstancesPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcShowInstancesPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcShowInstancesTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcShowInstancesPeer::CLASS_DEFAULT : CcShowInstancesPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcShowInstances or Criteria object. + * + * @param mixed $values Criteria or CcShowInstances object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcShowInstances object + } + + if ($criteria->containsKey(CcShowInstancesPeer::ID) && $criteria->keyContainsValue(CcShowInstancesPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcShowInstancesPeer::ID.')'); + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcShowInstances or Criteria object. + * + * @param mixed $values Criteria or CcShowInstances object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcShowInstancesPeer::ID); + $value = $criteria->remove(CcShowInstancesPeer::ID); + if ($value) { + $selectCriteria->add(CcShowInstancesPeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcShowInstancesPeer::TABLE_NAME); + } + + } else { // $values is CcShowInstances object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_show_instances table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcShowInstancesPeer::TABLE_NAME, $con, CcShowInstancesPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcShowInstancesPeer::clearInstancePool(); + CcShowInstancesPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcShowInstances or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcShowInstances object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcShowInstancesPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcShowInstances) { // it's a model object + // invalidate the cache for this single object + CcShowInstancesPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcShowInstancesPeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcShowInstancesPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcShowInstancesPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcShowInstances object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcShowInstances $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcShowInstances $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcShowInstancesPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcShowInstancesPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcShowInstancesPeer::DATABASE_NAME, CcShowInstancesPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcShowInstances + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcShowInstancesPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcShowInstancesPeer::DATABASE_NAME); + $criteria->add(CcShowInstancesPeer::ID, $pk); + + $v = CcShowInstancesPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcShowInstancesPeer::DATABASE_NAME); + $criteria->add(CcShowInstancesPeer::ID, $pks, Criteria::IN); + $objs = CcShowInstancesPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcShowInstancesPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcShowInstancesPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowInstancesQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowInstancesQuery.php new file mode 100644 index 000000000..d127d88ad --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowInstancesQuery.php @@ -0,0 +1,806 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcShowInstances|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcShowInstancesPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcShowInstancesQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcShowInstancesPeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcShowInstancesQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcShowInstancesPeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * @param int|array $dbId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowInstancesQuery The current query, for fluid interface + */ + public function filterByDbId($dbId = null, $comparison = null) + { + if (is_array($dbId) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcShowInstancesPeer::ID, $dbId, $comparison); + } + + /** + * Filter the query on the starts column + * + * @param string|array $dbStarts The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowInstancesQuery The current query, for fluid interface + */ + public function filterByDbStarts($dbStarts = null, $comparison = null) + { + if (is_array($dbStarts)) { + $useMinMax = false; + if (isset($dbStarts['min'])) { + $this->addUsingAlias(CcShowInstancesPeer::STARTS, $dbStarts['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbStarts['max'])) { + $this->addUsingAlias(CcShowInstancesPeer::STARTS, $dbStarts['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowInstancesPeer::STARTS, $dbStarts, $comparison); + } + + /** + * Filter the query on the ends column + * + * @param string|array $dbEnds The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowInstancesQuery The current query, for fluid interface + */ + public function filterByDbEnds($dbEnds = null, $comparison = null) + { + if (is_array($dbEnds)) { + $useMinMax = false; + if (isset($dbEnds['min'])) { + $this->addUsingAlias(CcShowInstancesPeer::ENDS, $dbEnds['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbEnds['max'])) { + $this->addUsingAlias(CcShowInstancesPeer::ENDS, $dbEnds['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowInstancesPeer::ENDS, $dbEnds, $comparison); + } + + /** + * Filter the query on the show_id column + * + * @param int|array $dbShowId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowInstancesQuery The current query, for fluid interface + */ + public function filterByDbShowId($dbShowId = null, $comparison = null) + { + if (is_array($dbShowId)) { + $useMinMax = false; + if (isset($dbShowId['min'])) { + $this->addUsingAlias(CcShowInstancesPeer::SHOW_ID, $dbShowId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbShowId['max'])) { + $this->addUsingAlias(CcShowInstancesPeer::SHOW_ID, $dbShowId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowInstancesPeer::SHOW_ID, $dbShowId, $comparison); + } + + /** + * Filter the query on the record column + * + * @param int|array $dbRecord 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 CcShowInstancesQuery The current query, for fluid interface + */ + public function filterByDbRecord($dbRecord = null, $comparison = null) + { + if (is_array($dbRecord)) { + $useMinMax = false; + if (isset($dbRecord['min'])) { + $this->addUsingAlias(CcShowInstancesPeer::RECORD, $dbRecord['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbRecord['max'])) { + $this->addUsingAlias(CcShowInstancesPeer::RECORD, $dbRecord['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowInstancesPeer::RECORD, $dbRecord, $comparison); + } + + /** + * Filter the query on the rebroadcast column + * + * @param int|array $dbRebroadcast 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 CcShowInstancesQuery The current query, for fluid interface + */ + public function filterByDbRebroadcast($dbRebroadcast = null, $comparison = null) + { + if (is_array($dbRebroadcast)) { + $useMinMax = false; + if (isset($dbRebroadcast['min'])) { + $this->addUsingAlias(CcShowInstancesPeer::REBROADCAST, $dbRebroadcast['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbRebroadcast['max'])) { + $this->addUsingAlias(CcShowInstancesPeer::REBROADCAST, $dbRebroadcast['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowInstancesPeer::REBROADCAST, $dbRebroadcast, $comparison); + } + + /** + * Filter the query on the instance_id column + * + * @param int|array $dbOriginalShow 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 CcShowInstancesQuery The current query, for fluid interface + */ + public function filterByDbOriginalShow($dbOriginalShow = null, $comparison = null) + { + if (is_array($dbOriginalShow)) { + $useMinMax = false; + if (isset($dbOriginalShow['min'])) { + $this->addUsingAlias(CcShowInstancesPeer::INSTANCE_ID, $dbOriginalShow['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbOriginalShow['max'])) { + $this->addUsingAlias(CcShowInstancesPeer::INSTANCE_ID, $dbOriginalShow['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowInstancesPeer::INSTANCE_ID, $dbOriginalShow, $comparison); + } + + /** + * Filter the query on the file_id column + * + * @param int|array $dbRecordedFile 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 CcShowInstancesQuery The current query, for fluid interface + */ + public function filterByDbRecordedFile($dbRecordedFile = null, $comparison = null) + { + if (is_array($dbRecordedFile)) { + $useMinMax = false; + if (isset($dbRecordedFile['min'])) { + $this->addUsingAlias(CcShowInstancesPeer::FILE_ID, $dbRecordedFile['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbRecordedFile['max'])) { + $this->addUsingAlias(CcShowInstancesPeer::FILE_ID, $dbRecordedFile['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowInstancesPeer::FILE_ID, $dbRecordedFile, $comparison); + } + + /** + * Filter the query on the time_filled column + * + * @param string|array $dbTimeFilled 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 CcShowInstancesQuery The current query, for fluid interface + */ + public function filterByDbTimeFilled($dbTimeFilled = null, $comparison = null) + { + if (is_array($dbTimeFilled)) { + $useMinMax = false; + if (isset($dbTimeFilled['min'])) { + $this->addUsingAlias(CcShowInstancesPeer::TIME_FILLED, $dbTimeFilled['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbTimeFilled['max'])) { + $this->addUsingAlias(CcShowInstancesPeer::TIME_FILLED, $dbTimeFilled['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowInstancesPeer::TIME_FILLED, $dbTimeFilled, $comparison); + } + + /** + * Filter the query on the modified_instance column + * + * @param boolean|string $dbModifiedInstance The value to use as filter. + * Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowInstancesQuery The current query, for fluid interface + */ + public function filterByDbModifiedInstance($dbModifiedInstance = null, $comparison = null) + { + if (is_string($dbModifiedInstance)) { + $modified_instance = in_array(strtolower($dbModifiedInstance), array('false', 'off', '-', 'no', 'n', '0')) ? false : true; + } + return $this->addUsingAlias(CcShowInstancesPeer::MODIFIED_INSTANCE, $dbModifiedInstance, $comparison); + } + + /** + * Filter the query by a related CcShow object + * + * @param CcShow $ccShow the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowInstancesQuery The current query, for fluid interface + */ + public function filterByCcShow($ccShow, $comparison = null) + { + return $this + ->addUsingAlias(CcShowInstancesPeer::SHOW_ID, $ccShow->getDbId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcShow relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowInstancesQuery The current query, for fluid interface + */ + public function joinCcShow($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShow'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'CcShow'); + } + + return $this; + } + + /** + * Use the CcShow relation CcShow object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowQuery A secondary query class using the current class as primary query + */ + public function useCcShowQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCcShow($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShow', 'CcShowQuery'); + } + + /** + * Filter the query by a related CcShowInstances object + * + * @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 CcShowInstancesQuery The current query, for fluid interface + */ + public function filterByCcShowInstancesRelatedByDbOriginalShow($ccShowInstances, $comparison = null) + { + return $this + ->addUsingAlias(CcShowInstancesPeer::INSTANCE_ID, $ccShowInstances->getDbId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcShowInstancesRelatedByDbOriginalShow 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 joinCcShowInstancesRelatedByDbOriginalShow($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShowInstancesRelatedByDbOriginalShow'); + + // 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, 'CcShowInstancesRelatedByDbOriginalShow'); + } + + return $this; + } + + /** + * Use the CcShowInstancesRelatedByDbOriginalShow relation CcShowInstances 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 CcShowInstancesQuery A secondary query class using the current class as primary query + */ + public function useCcShowInstancesRelatedByDbOriginalShowQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcShowInstancesRelatedByDbOriginalShow($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShowInstancesRelatedByDbOriginalShow', 'CcShowInstancesQuery'); + } + + /** + * Filter the query by a related CcFiles object + * + * @param CcFiles $ccFiles 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 filterByCcFiles($ccFiles, $comparison = null) + { + return $this + ->addUsingAlias(CcShowInstancesPeer::FILE_ID, $ccFiles->getDbId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcFiles 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 joinCcFiles($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcFiles'); + + // 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, 'CcFiles'); + } + + return $this; + } + + /** + * Use the CcFiles relation CcFiles 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 CcFilesQuery A secondary query class using the current class as primary query + */ + public function useCcFilesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcFiles($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery'); + } + + /** + * Filter the query by a related CcShowInstances object + * + * @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 CcShowInstancesQuery The current query, for fluid interface + */ + public function filterByCcShowInstancesRelatedByDbId($ccShowInstances, $comparison = null) + { + return $this + ->addUsingAlias(CcShowInstancesPeer::ID, $ccShowInstances->getDbOriginalShow(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcShowInstancesRelatedByDbId 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 joinCcShowInstancesRelatedByDbId($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShowInstancesRelatedByDbId'); + + // 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, 'CcShowInstancesRelatedByDbId'); + } + + return $this; + } + + /** + * Use the CcShowInstancesRelatedByDbId relation CcShowInstances 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 CcShowInstancesQuery A secondary query class using the current class as primary query + */ + public function useCcShowInstancesRelatedByDbIdQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcShowInstancesRelatedByDbId($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShowInstancesRelatedByDbId', 'CcShowInstancesQuery'); + } + + /** + * Filter the query by a related CcSchedule object + * + * @param CcSchedule $ccSchedule 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 filterByCcSchedule($ccSchedule, $comparison = null) + { + return $this + ->addUsingAlias(CcShowInstancesPeer::ID, $ccSchedule->getDbInstanceId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcSchedule 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 joinCcSchedule($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcSchedule'); + + // 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, 'CcSchedule'); + } + + return $this; + } + + /** + * Use the CcSchedule relation CcSchedule 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 CcScheduleQuery A secondary query class using the current class as primary query + */ + public function useCcScheduleQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCcSchedule($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery'); + } + + /** + * Exclude object from result + * + * @param CcShowInstances $ccShowInstances Object to remove from the list of results + * + * @return CcShowInstancesQuery The current query, for fluid interface + */ + public function prune($ccShowInstances = null) + { + if ($ccShowInstances) { + $this->addUsingAlias(CcShowInstancesPeer::ID, $ccShowInstances->getDbId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcShowInstancesQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowPeer.php new file mode 100644 index 000000000..110c08101 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowPeer.php @@ -0,0 +1,776 @@ + array ('DbId', 'DbName', 'DbUrl', 'DbGenre', 'DbDescription', 'DbColor', 'DbBackgroundColor', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbUrl', 'dbGenre', 'dbDescription', 'dbColor', 'dbBackgroundColor', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::URL, self::GENRE, self::DESCRIPTION, self::COLOR, self::BACKGROUND_COLOR, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'URL', 'GENRE', 'DESCRIPTION', 'COLOR', 'BACKGROUND_COLOR', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'url', 'genre', 'description', 'color', 'background_color', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbUrl' => 2, 'DbGenre' => 3, 'DbDescription' => 4, 'DbColor' => 5, 'DbBackgroundColor' => 6, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbUrl' => 2, 'dbGenre' => 3, 'dbDescription' => 4, 'dbColor' => 5, 'dbBackgroundColor' => 6, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::URL => 2, self::GENRE => 3, self::DESCRIPTION => 4, self::COLOR => 5, self::BACKGROUND_COLOR => 6, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'URL' => 2, 'GENRE' => 3, 'DESCRIPTION' => 4, 'COLOR' => 5, 'BACKGROUND_COLOR' => 6, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'url' => 2, 'genre' => 3, 'description' => 4, 'color' => 5, 'background_color' => 6, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcShowPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcShowPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcShowPeer::ID); + $criteria->addSelectColumn(CcShowPeer::NAME); + $criteria->addSelectColumn(CcShowPeer::URL); + $criteria->addSelectColumn(CcShowPeer::GENRE); + $criteria->addSelectColumn(CcShowPeer::DESCRIPTION); + $criteria->addSelectColumn(CcShowPeer::COLOR); + $criteria->addSelectColumn(CcShowPeer::BACKGROUND_COLOR); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.NAME'); + $criteria->addSelectColumn($alias . '.URL'); + $criteria->addSelectColumn($alias . '.GENRE'); + $criteria->addSelectColumn($alias . '.DESCRIPTION'); + $criteria->addSelectColumn($alias . '.COLOR'); + $criteria->addSelectColumn($alias . '.BACKGROUND_COLOR'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcShowPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcShow + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcShowPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcShowPeer::populateObjects(CcShowPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcShowPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcShow $value A CcShow object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcShow $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcShow object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcShow) { + $key = (string) $value->getDbId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcShow object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcShow Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_show + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + // Invalidate objects in CcShowInstancesPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcShowInstancesPeer::clearInstancePool(); + // Invalidate objects in CcShowDaysPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcShowDaysPeer::clearInstancePool(); + // Invalidate objects in CcShowRebroadcastPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcShowRebroadcastPeer::clearInstancePool(); + // Invalidate objects in CcShowHostsPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcShowHostsPeer::clearInstancePool(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcShowPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcShowPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcShowPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcShowPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcShow object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcShowPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcShowPeer::NUM_COLUMNS; + } else { + $cls = CcShowPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcShowPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcShowPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcShowPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcShowTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcShowPeer::CLASS_DEFAULT : CcShowPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcShow or Criteria object. + * + * @param mixed $values Criteria or CcShow object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcShow object + } + + if ($criteria->containsKey(CcShowPeer::ID) && $criteria->keyContainsValue(CcShowPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcShowPeer::ID.')'); + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcShow or Criteria object. + * + * @param mixed $values Criteria or CcShow object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcShowPeer::ID); + $value = $criteria->remove(CcShowPeer::ID); + if ($value) { + $selectCriteria->add(CcShowPeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcShowPeer::TABLE_NAME); + } + + } else { // $values is CcShow object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_show table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcShowPeer::TABLE_NAME, $con, CcShowPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcShowPeer::clearInstancePool(); + CcShowPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcShow or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcShow object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcShowPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcShow) { // it's a model object + // invalidate the cache for this single object + CcShowPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcShowPeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcShowPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcShowPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcShow object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcShow $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcShow $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcShowPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcShowPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcShowPeer::DATABASE_NAME, CcShowPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcShow + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcShowPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcShowPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcShowPeer::DATABASE_NAME); + $criteria->add(CcShowPeer::ID, $pk); + + $v = CcShowPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcShowPeer::DATABASE_NAME); + $criteria->add(CcShowPeer::ID, $pks, Criteria::IN); + $objs = CcShowPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcShowPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcShowPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowQuery.php new file mode 100644 index 000000000..10f9dac11 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowQuery.php @@ -0,0 +1,593 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcShow|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcShowPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcShowQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcShowPeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcShowQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcShowPeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * @param int|array $dbId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowQuery The current query, for fluid interface + */ + public function filterByDbId($dbId = null, $comparison = null) + { + if (is_array($dbId) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcShowPeer::ID, $dbId, $comparison); + } + + /** + * Filter the query on the name column + * + * @param string $dbName The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowQuery The current query, for fluid interface + */ + public function filterByDbName($dbName = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbName)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbName)) { + $dbName = str_replace('*', '%', $dbName); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcShowPeer::NAME, $dbName, $comparison); + } + + /** + * Filter the query on the url column + * + * @param string $dbUrl The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowQuery The current query, for fluid interface + */ + public function filterByDbUrl($dbUrl = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbUrl)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbUrl)) { + $dbUrl = str_replace('*', '%', $dbUrl); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcShowPeer::URL, $dbUrl, $comparison); + } + + /** + * Filter the query on the genre column + * + * @param string $dbGenre The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowQuery The current query, for fluid interface + */ + public function filterByDbGenre($dbGenre = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbGenre)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbGenre)) { + $dbGenre = str_replace('*', '%', $dbGenre); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcShowPeer::GENRE, $dbGenre, $comparison); + } + + /** + * Filter the query on the description column + * + * @param string $dbDescription The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowQuery The current query, for fluid interface + */ + public function filterByDbDescription($dbDescription = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbDescription)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbDescription)) { + $dbDescription = str_replace('*', '%', $dbDescription); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcShowPeer::DESCRIPTION, $dbDescription, $comparison); + } + + /** + * Filter the query on the color column + * + * @param string $dbColor The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowQuery The current query, for fluid interface + */ + public function filterByDbColor($dbColor = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbColor)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbColor)) { + $dbColor = str_replace('*', '%', $dbColor); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcShowPeer::COLOR, $dbColor, $comparison); + } + + /** + * Filter the query on the background_color column + * + * @param string $dbBackgroundColor The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowQuery The current query, for fluid interface + */ + public function filterByDbBackgroundColor($dbBackgroundColor = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbBackgroundColor)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbBackgroundColor)) { + $dbBackgroundColor = str_replace('*', '%', $dbBackgroundColor); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcShowPeer::BACKGROUND_COLOR, $dbBackgroundColor, $comparison); + } + + /** + * Filter the query by a related CcShowInstances object + * + * @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 CcShowQuery The current query, for fluid interface + */ + public function filterByCcShowInstances($ccShowInstances, $comparison = null) + { + return $this + ->addUsingAlias(CcShowPeer::ID, $ccShowInstances->getDbShowId(), $comparison); + } + + /** + * 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 CcShowQuery The current query, for fluid interface + */ + public function joinCcShowInstances($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShowInstances'); + + // 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, 'CcShowInstances'); + } + + return $this; + } + + /** + * Use the CcShowInstances relation CcShowInstances 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 CcShowInstancesQuery A secondary query class using the current class as primary query + */ + public function useCcShowInstancesQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCcShowInstances($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShowInstances', 'CcShowInstancesQuery'); + } + + /** + * Filter the query by a related CcShowDays object + * + * @param CcShowDays $ccShowDays 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 filterByCcShowDays($ccShowDays, $comparison = null) + { + return $this + ->addUsingAlias(CcShowPeer::ID, $ccShowDays->getDbShowId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcShowDays 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 joinCcShowDays($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShowDays'); + + // 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, 'CcShowDays'); + } + + return $this; + } + + /** + * Use the CcShowDays relation CcShowDays 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 CcShowDaysQuery A secondary query class using the current class as primary query + */ + public function useCcShowDaysQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCcShowDays($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShowDays', 'CcShowDaysQuery'); + } + + /** + * Filter the query by a related CcShowRebroadcast object + * + * @param CcShowRebroadcast $ccShowRebroadcast 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 filterByCcShowRebroadcast($ccShowRebroadcast, $comparison = null) + { + return $this + ->addUsingAlias(CcShowPeer::ID, $ccShowRebroadcast->getDbShowId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcShowRebroadcast 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 joinCcShowRebroadcast($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShowRebroadcast'); + + // 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, 'CcShowRebroadcast'); + } + + return $this; + } + + /** + * Use the CcShowRebroadcast relation CcShowRebroadcast 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 CcShowRebroadcastQuery A secondary query class using the current class as primary query + */ + public function useCcShowRebroadcastQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCcShowRebroadcast($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShowRebroadcast', 'CcShowRebroadcastQuery'); + } + + /** + * Filter the query by a related CcShowHosts object + * + * @param CcShowHosts $ccShowHosts 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 filterByCcShowHosts($ccShowHosts, $comparison = null) + { + return $this + ->addUsingAlias(CcShowPeer::ID, $ccShowHosts->getDbShow(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcShowHosts 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 joinCcShowHosts($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShowHosts'); + + // 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, 'CcShowHosts'); + } + + return $this; + } + + /** + * Use the CcShowHosts relation CcShowHosts 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 CcShowHostsQuery A secondary query class using the current class as primary query + */ + public function useCcShowHostsQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCcShowHosts($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShowHosts', 'CcShowHostsQuery'); + } + + /** + * Exclude object from result + * + * @param CcShow $ccShow Object to remove from the list of results + * + * @return CcShowQuery The current query, for fluid interface + */ + public function prune($ccShow = null) + { + if ($ccShow) { + $this->addUsingAlias(CcShowPeer::ID, $ccShow->getDbId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcShowQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowRebroadcast.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowRebroadcast.php new file mode 100644 index 000000000..aabd37d79 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowRebroadcast.php @@ -0,0 +1,957 @@ +id; + } + + /** + * Get the [day_offset] column value. + * + * @return string + */ + public function getDbDayOffset() + { + return $this->day_offset; + } + + /** + * Get the [optionally formatted] temporal [start_time] 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 getDbStartTime($format = '%X') + { + if ($this->start_time === null) { + return null; + } + + + + try { + $dt = new DateTime($this->start_time); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->start_time, 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); + } + } + + /** + * Get the [show_id] column value. + * + * @return int + */ + public function getDbShowId() + { + return $this->show_id; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return CcShowRebroadcast The current object (for fluent API support) + */ + public function setDbId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CcShowRebroadcastPeer::ID; + } + + return $this; + } // setDbId() + + /** + * Set the value of [day_offset] column. + * + * @param string $v new value + * @return CcShowRebroadcast The current object (for fluent API support) + */ + public function setDbDayOffset($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->day_offset !== $v) { + $this->day_offset = $v; + $this->modifiedColumns[] = CcShowRebroadcastPeer::DAY_OFFSET; + } + + return $this; + } // setDbDayOffset() + + /** + * Sets the value of [start_time] 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 CcShowRebroadcast The current object (for fluent API support) + */ + public function setDbStartTime($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->start_time !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->start_time !== null && $tmpDt = new DateTime($this->start_time)) ? $tmpDt->format('H:i:s') : null; + $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->start_time = ($dt ? $dt->format('H:i:s') : null); + $this->modifiedColumns[] = CcShowRebroadcastPeer::START_TIME; + } + } // if either are not null + + return $this; + } // setDbStartTime() + + /** + * Set the value of [show_id] column. + * + * @param int $v new value + * @return CcShowRebroadcast The current object (for fluent API support) + */ + public function setDbShowId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->show_id !== $v) { + $this->show_id = $v; + $this->modifiedColumns[] = CcShowRebroadcastPeer::SHOW_ID; + } + + if ($this->aCcShow !== null && $this->aCcShow->getDbId() !== $v) { + $this->aCcShow = null; + } + + return $this; + } // setDbShowId() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->day_offset = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->start_time = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->show_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 4; // 4 = CcShowRebroadcastPeer::NUM_COLUMNS - CcShowRebroadcastPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcShowRebroadcast object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aCcShow !== null && $this->show_id !== $this->aCcShow->getDbId()) { + $this->aCcShow = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowRebroadcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcShowRebroadcastPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aCcShow = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowRebroadcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcShowRebroadcastQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowRebroadcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcShowRebroadcastPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcShow !== null) { + if ($this->aCcShow->isModified() || $this->aCcShow->isNew()) { + $affectedRows += $this->aCcShow->save($con); + } + $this->setCcShow($this->aCcShow); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = CcShowRebroadcastPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + if ($criteria->keyContainsValue(CcShowRebroadcastPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcShowRebroadcastPeer::ID.')'); + } + + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows += 1; + $this->setDbId($pk); //[IMV] update autoincrement primary key + $this->setNew(false); + } else { + $affectedRows += CcShowRebroadcastPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + // We call the validate method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcShow !== null) { + if (!$this->aCcShow->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcShow->getValidationFailures()); + } + } + + + if (($retval = CcShowRebroadcastPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcShowRebroadcastPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getDbId(); + break; + case 1: + return $this->getDbDayOffset(); + break; + case 2: + return $this->getDbStartTime(); + break; + case 3: + return $this->getDbShowId(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) + { + $keys = CcShowRebroadcastPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbId(), + $keys[1] => $this->getDbDayOffset(), + $keys[2] => $this->getDbStartTime(), + $keys[3] => $this->getDbShowId(), + ); + if ($includeForeignObjects) { + if (null !== $this->aCcShow) { + $result['CcShow'] = $this->aCcShow->toArray($keyType, $includeLazyLoadColumns, true); + } + } + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcShowRebroadcastPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setDbId($value); + break; + case 1: + $this->setDbDayOffset($value); + break; + case 2: + $this->setDbStartTime($value); + break; + case 3: + $this->setDbShowId($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcShowRebroadcastPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbDayOffset($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDbStartTime($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDbShowId($arr[$keys[3]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcShowRebroadcastPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcShowRebroadcastPeer::ID)) $criteria->add(CcShowRebroadcastPeer::ID, $this->id); + if ($this->isColumnModified(CcShowRebroadcastPeer::DAY_OFFSET)) $criteria->add(CcShowRebroadcastPeer::DAY_OFFSET, $this->day_offset); + if ($this->isColumnModified(CcShowRebroadcastPeer::START_TIME)) $criteria->add(CcShowRebroadcastPeer::START_TIME, $this->start_time); + if ($this->isColumnModified(CcShowRebroadcastPeer::SHOW_ID)) $criteria->add(CcShowRebroadcastPeer::SHOW_ID, $this->show_id); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcShowRebroadcastPeer::DATABASE_NAME); + $criteria->add(CcShowRebroadcastPeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getDbId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getDbId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcShowRebroadcast (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setDbDayOffset($this->day_offset); + $copyObj->setDbStartTime($this->start_time); + $copyObj->setDbShowId($this->show_id); + + $copyObj->setNew(true); + $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcShowRebroadcast Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcShowRebroadcastPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcShowRebroadcastPeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a CcShow object. + * + * @param CcShow $v + * @return CcShowRebroadcast The current object (for fluent API support) + * @throws PropelException + */ + public function setCcShow(CcShow $v = null) + { + if ($v === null) { + $this->setDbShowId(NULL); + } else { + $this->setDbShowId($v->getDbId()); + } + + $this->aCcShow = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcShow object, it will not be re-added. + if ($v !== null) { + $v->addCcShowRebroadcast($this); + } + + return $this; + } + + + /** + * Get the associated CcShow object + * + * @param PropelPDO Optional Connection object. + * @return CcShow The associated CcShow object. + * @throws PropelException + */ + public function getCcShow(PropelPDO $con = null) + { + if ($this->aCcShow === null && ($this->show_id !== null)) { + $this->aCcShow = CcShowQuery::create()->findPk($this->show_id, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aCcShow->addCcShowRebroadcasts($this); + */ + } + return $this->aCcShow; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->day_offset = null; + $this->start_time = null; + $this->show_id = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aCcShow = null; + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcShowRebroadcast diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowRebroadcastPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowRebroadcastPeer.php new file mode 100644 index 000000000..ef0434c70 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowRebroadcastPeer.php @@ -0,0 +1,983 @@ + array ('DbId', 'DbDayOffset', 'DbStartTime', 'DbShowId', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbDayOffset', 'dbStartTime', 'dbShowId', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::DAY_OFFSET, self::START_TIME, self::SHOW_ID, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'DAY_OFFSET', 'START_TIME', 'SHOW_ID', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'day_offset', 'start_time', 'show_id', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbDayOffset' => 1, 'DbStartTime' => 2, 'DbShowId' => 3, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbDayOffset' => 1, 'dbStartTime' => 2, 'dbShowId' => 3, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::DAY_OFFSET => 1, self::START_TIME => 2, self::SHOW_ID => 3, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'DAY_OFFSET' => 1, 'START_TIME' => 2, 'SHOW_ID' => 3, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'day_offset' => 1, 'start_time' => 2, 'show_id' => 3, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcShowRebroadcastPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcShowRebroadcastPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcShowRebroadcastPeer::ID); + $criteria->addSelectColumn(CcShowRebroadcastPeer::DAY_OFFSET); + $criteria->addSelectColumn(CcShowRebroadcastPeer::START_TIME); + $criteria->addSelectColumn(CcShowRebroadcastPeer::SHOW_ID); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.DAY_OFFSET'); + $criteria->addSelectColumn($alias . '.START_TIME'); + $criteria->addSelectColumn($alias . '.SHOW_ID'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowRebroadcastPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowRebroadcastPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcShowRebroadcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcShowRebroadcast + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcShowRebroadcastPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcShowRebroadcastPeer::populateObjects(CcShowRebroadcastPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowRebroadcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcShowRebroadcastPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcShowRebroadcast $value A CcShowRebroadcast object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcShowRebroadcast $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcShowRebroadcast object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcShowRebroadcast) { + $key = (string) $value->getDbId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcShowRebroadcast object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcShowRebroadcast Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_show_rebroadcast + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcShowRebroadcastPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcShowRebroadcastPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcShowRebroadcastPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcShowRebroadcastPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcShowRebroadcast object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcShowRebroadcastPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcShowRebroadcastPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcShowRebroadcastPeer::NUM_COLUMNS; + } else { + $cls = CcShowRebroadcastPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcShowRebroadcastPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + + /** + * Returns the number of rows matching criteria, joining the related CcShow table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinCcShow(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowRebroadcastPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowRebroadcastPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowRebroadcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowRebroadcastPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcShowRebroadcast objects pre-filled with their CcShow objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowRebroadcast objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcShow(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowRebroadcastPeer::addSelectColumns($criteria); + $startcol = (CcShowRebroadcastPeer::NUM_COLUMNS - CcShowRebroadcastPeer::NUM_LAZY_LOAD_COLUMNS); + CcShowPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcShowRebroadcastPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowRebroadcastPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowRebroadcastPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcShowRebroadcastPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowRebroadcastPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcShowPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcShowPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcShowPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcShowRebroadcast) to $obj2 (CcShow) + $obj2->addCcShowRebroadcast($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining all related tables + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowRebroadcastPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowRebroadcastPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowRebroadcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowRebroadcastPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of CcShowRebroadcast objects pre-filled with all related objects. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowRebroadcast objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowRebroadcastPeer::addSelectColumns($criteria); + $startcol2 = (CcShowRebroadcastPeer::NUM_COLUMNS - CcShowRebroadcastPeer::NUM_LAZY_LOAD_COLUMNS); + + CcShowPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcShowRebroadcastPeer::SHOW_ID, CcShowPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowRebroadcastPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowRebroadcastPeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcShowRebroadcastPeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowRebroadcastPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcShow rows + + $key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcShowPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcShowPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcShowPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (CcShowRebroadcast) to the collection in $obj2 (CcShow) + $obj2->addCcShowRebroadcast($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcShowRebroadcastPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcShowRebroadcastPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcShowRebroadcastTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcShowRebroadcastPeer::CLASS_DEFAULT : CcShowRebroadcastPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcShowRebroadcast or Criteria object. + * + * @param mixed $values Criteria or CcShowRebroadcast object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowRebroadcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcShowRebroadcast object + } + + if ($criteria->containsKey(CcShowRebroadcastPeer::ID) && $criteria->keyContainsValue(CcShowRebroadcastPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcShowRebroadcastPeer::ID.')'); + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcShowRebroadcast or Criteria object. + * + * @param mixed $values Criteria or CcShowRebroadcast object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowRebroadcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcShowRebroadcastPeer::ID); + $value = $criteria->remove(CcShowRebroadcastPeer::ID); + if ($value) { + $selectCriteria->add(CcShowRebroadcastPeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcShowRebroadcastPeer::TABLE_NAME); + } + + } else { // $values is CcShowRebroadcast object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_show_rebroadcast table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowRebroadcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcShowRebroadcastPeer::TABLE_NAME, $con, CcShowRebroadcastPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcShowRebroadcastPeer::clearInstancePool(); + CcShowRebroadcastPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcShowRebroadcast or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcShowRebroadcast object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowRebroadcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcShowRebroadcastPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcShowRebroadcast) { // it's a model object + // invalidate the cache for this single object + CcShowRebroadcastPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcShowRebroadcastPeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcShowRebroadcastPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcShowRebroadcastPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcShowRebroadcast object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcShowRebroadcast $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcShowRebroadcast $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcShowRebroadcastPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcShowRebroadcastPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcShowRebroadcastPeer::DATABASE_NAME, CcShowRebroadcastPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcShowRebroadcast + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcShowRebroadcastPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcShowRebroadcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcShowRebroadcastPeer::DATABASE_NAME); + $criteria->add(CcShowRebroadcastPeer::ID, $pk); + + $v = CcShowRebroadcastPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowRebroadcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcShowRebroadcastPeer::DATABASE_NAME); + $criteria->add(CcShowRebroadcastPeer::ID, $pks, Criteria::IN); + $objs = CcShowRebroadcastPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcShowRebroadcastPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcShowRebroadcastPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowRebroadcastQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowRebroadcastQuery.php new file mode 100644 index 000000000..d7fedf8e9 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowRebroadcastQuery.php @@ -0,0 +1,329 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcShowRebroadcast|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcShowRebroadcastPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcShowRebroadcastQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcShowRebroadcastPeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcShowRebroadcastQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcShowRebroadcastPeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * @param int|array $dbId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowRebroadcastQuery The current query, for fluid interface + */ + public function filterByDbId($dbId = null, $comparison = null) + { + if (is_array($dbId) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcShowRebroadcastPeer::ID, $dbId, $comparison); + } + + /** + * Filter the query on the day_offset column + * + * @param string $dbDayOffset The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowRebroadcastQuery The current query, for fluid interface + */ + public function filterByDbDayOffset($dbDayOffset = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbDayOffset)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbDayOffset)) { + $dbDayOffset = str_replace('*', '%', $dbDayOffset); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcShowRebroadcastPeer::DAY_OFFSET, $dbDayOffset, $comparison); + } + + /** + * Filter the query on the start_time column + * + * @param string|array $dbStartTime 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 CcShowRebroadcastQuery The current query, for fluid interface + */ + public function filterByDbStartTime($dbStartTime = null, $comparison = null) + { + if (is_array($dbStartTime)) { + $useMinMax = false; + if (isset($dbStartTime['min'])) { + $this->addUsingAlias(CcShowRebroadcastPeer::START_TIME, $dbStartTime['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbStartTime['max'])) { + $this->addUsingAlias(CcShowRebroadcastPeer::START_TIME, $dbStartTime['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowRebroadcastPeer::START_TIME, $dbStartTime, $comparison); + } + + /** + * Filter the query on the show_id column + * + * @param int|array $dbShowId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowRebroadcastQuery The current query, for fluid interface + */ + public function filterByDbShowId($dbShowId = null, $comparison = null) + { + if (is_array($dbShowId)) { + $useMinMax = false; + if (isset($dbShowId['min'])) { + $this->addUsingAlias(CcShowRebroadcastPeer::SHOW_ID, $dbShowId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbShowId['max'])) { + $this->addUsingAlias(CcShowRebroadcastPeer::SHOW_ID, $dbShowId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowRebroadcastPeer::SHOW_ID, $dbShowId, $comparison); + } + + /** + * Filter the query by a related CcShow object + * + * @param CcShow $ccShow the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowRebroadcastQuery The current query, for fluid interface + */ + public function filterByCcShow($ccShow, $comparison = null) + { + return $this + ->addUsingAlias(CcShowRebroadcastPeer::SHOW_ID, $ccShow->getDbId(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcShow relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowRebroadcastQuery The current query, for fluid interface + */ + public function joinCcShow($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShow'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'CcShow'); + } + + return $this; + } + + /** + * Use the CcShow relation CcShow object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcShowQuery A secondary query class using the current class as primary query + */ + public function useCcShowQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCcShow($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShow', 'CcShowQuery'); + } + + /** + * Exclude object from result + * + * @param CcShowRebroadcast $ccShowRebroadcast Object to remove from the list of results + * + * @return CcShowRebroadcastQuery The current query, for fluid interface + */ + public function prune($ccShowRebroadcast = null) + { + if ($ccShowRebroadcast) { + $this->addUsingAlias(CcShowRebroadcastPeer::ID, $ccShowRebroadcast->getDbId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcShowRebroadcastQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowSchedule.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowSchedule.php new file mode 100644 index 000000000..bf8b384e6 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowSchedule.php @@ -0,0 +1,905 @@ +id; + } + + /** + * Get the [instance_id] column value. + * + * @return int + */ + public function getDbInstanceId() + { + return $this->instance_id; + } + + /** + * Get the [position] column value. + * + * @return int + */ + public function getDbPosition() + { + return $this->position; + } + + /** + * Get the [group_id] column value. + * + * @return int + */ + public function getDbGroupId() + { + return $this->group_id; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return CcShowSchedule The current object (for fluent API support) + */ + public function setDbId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CcShowSchedulePeer::ID; + } + + return $this; + } // setDbId() + + /** + * Set the value of [instance_id] column. + * + * @param int $v new value + * @return CcShowSchedule The current object (for fluent API support) + */ + public function setDbInstanceId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->instance_id !== $v) { + $this->instance_id = $v; + $this->modifiedColumns[] = CcShowSchedulePeer::INSTANCE_ID; + } + + if ($this->aCcShowInstances !== null && $this->aCcShowInstances->getDbId() !== $v) { + $this->aCcShowInstances = null; + } + + return $this; + } // setDbInstanceId() + + /** + * Set the value of [position] column. + * + * @param int $v new value + * @return CcShowSchedule The current object (for fluent API support) + */ + public function setDbPosition($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->position !== $v) { + $this->position = $v; + $this->modifiedColumns[] = CcShowSchedulePeer::POSITION; + } + + return $this; + } // setDbPosition() + + /** + * Set the value of [group_id] column. + * + * @param int $v new value + * @return CcShowSchedule The current object (for fluent API support) + */ + public function setDbGroupId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->group_id !== $v) { + $this->group_id = $v; + $this->modifiedColumns[] = CcShowSchedulePeer::GROUP_ID; + } + + return $this; + } // setDbGroupId() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->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); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 4; // 4 = CcShowSchedulePeer::NUM_COLUMNS - CcShowSchedulePeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcShowSchedule object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aCcShowInstances !== null && $this->instance_id !== $this->aCcShowInstances->getDbId()) { + $this->aCcShowInstances = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcShowSchedulePeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aCcShowInstances = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcShowScheduleQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcShowSchedulePeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcShowInstances !== null) { + if ($this->aCcShowInstances->isModified() || $this->aCcShowInstances->isNew()) { + $affectedRows += $this->aCcShowInstances->save($con); + } + $this->setCcShowInstances($this->aCcShowInstances); + } + + if ($this->isNew() ) { + $this->modifiedColumns[] = CcShowSchedulePeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + if ($criteria->keyContainsValue(CcShowSchedulePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcShowSchedulePeer::ID.')'); + } + + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows += 1; + $this->setDbId($pk); //[IMV] update autoincrement primary key + $this->setNew(false); + } else { + $affectedRows += CcShowSchedulePeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + // We call the validate method on the following object(s) if they + // were passed to this object by their coresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aCcShowInstances !== null) { + if (!$this->aCcShowInstances->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcShowInstances->getValidationFailures()); + } + } + + + if (($retval = CcShowSchedulePeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcShowSchedulePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getDbId(); + break; + case 1: + return $this->getDbInstanceId(); + break; + case 2: + return $this->getDbPosition(); + break; + case 3: + return $this->getDbGroupId(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false) + { + $keys = CcShowSchedulePeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbId(), + $keys[1] => $this->getDbInstanceId(), + $keys[2] => $this->getDbPosition(), + $keys[3] => $this->getDbGroupId(), + ); + if ($includeForeignObjects) { + if (null !== $this->aCcShowInstances) { + $result['CcShowInstances'] = $this->aCcShowInstances->toArray($keyType, $includeLazyLoadColumns, true); + } + } + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcShowSchedulePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setDbId($value); + break; + case 1: + $this->setDbInstanceId($value); + break; + case 2: + $this->setDbPosition($value); + break; + case 3: + $this->setDbGroupId($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcShowSchedulePeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->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]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcShowSchedulePeer::DATABASE_NAME); + + if ($this->isColumnModified(CcShowSchedulePeer::ID)) $criteria->add(CcShowSchedulePeer::ID, $this->id); + if ($this->isColumnModified(CcShowSchedulePeer::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); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcShowSchedulePeer::DATABASE_NAME); + $criteria->add(CcShowSchedulePeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getDbId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getDbId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcShowSchedule (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setDbInstanceId($this->instance_id); + $copyObj->setDbPosition($this->position); + $copyObj->setDbGroupId($this->group_id); + + $copyObj->setNew(true); + $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcShowSchedule Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcShowSchedulePeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcShowSchedulePeer(); + } + return self::$peer; + } + + /** + * Declares an association between this object and a CcShowInstances object. + * + * @param CcShowInstances $v + * @return CcShowSchedule The current object (for fluent API support) + * @throws PropelException + */ + public function setCcShowInstances(CcShowInstances $v = null) + { + if ($v === null) { + $this->setDbInstanceId(NULL); + } else { + $this->setDbInstanceId($v->getDbId()); + } + + $this->aCcShowInstances = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the CcShowInstances object, it will not be re-added. + if ($v !== null) { + $v->addCcShowSchedule($this); + } + + return $this; + } + + + /** + * Get the associated CcShowInstances object + * + * @param PropelPDO Optional Connection object. + * @return CcShowInstances The associated CcShowInstances object. + * @throws PropelException + */ + public function getCcShowInstances(PropelPDO $con = null) + { + 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->aCcShowInstances->addCcShowSchedules($this); + */ + } + return $this->aCcShowInstances; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->instance_id = null; + $this->position = null; + $this->group_id = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aCcShowInstances = null; + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcShowSchedule diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowSchedulePeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowSchedulePeer.php new file mode 100644 index 000000000..677ff8447 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowSchedulePeer.php @@ -0,0 +1,983 @@ + 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, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, '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, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcShowSchedulePeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcShowSchedulePeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcShowSchedulePeer::ID); + $criteria->addSelectColumn(CcShowSchedulePeer::INSTANCE_ID); + $criteria->addSelectColumn(CcShowSchedulePeer::POSITION); + $criteria->addSelectColumn(CcShowSchedulePeer::GROUP_ID); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.INSTANCE_ID'); + $criteria->addSelectColumn($alias . '.POSITION'); + $criteria->addSelectColumn($alias . '.GROUP_ID'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowSchedulePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowSchedulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcShowSchedule + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcShowSchedulePeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcShowSchedulePeer::populateObjects(CcShowSchedulePeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcShowSchedulePeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcShowSchedule $value A CcShowSchedule object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcShowSchedule $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcShowSchedule object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcShowSchedule) { + $key = (string) $value->getDbId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcShowSchedule object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcShowSchedule Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_show_schedule + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcShowSchedulePeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcShowSchedulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcShowSchedulePeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcShowSchedulePeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcShowSchedule object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcShowSchedulePeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcShowSchedulePeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcShowSchedulePeer::NUM_COLUMNS; + } else { + $cls = CcShowSchedulePeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcShowSchedulePeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + + /** + * Returns the number of rows matching criteria, joining the related CcShowInstances table + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function 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; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowSchedulePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowSchedulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + + /** + * Selects a collection of CcShowSchedule objects pre-filled with their CcShowInstances objects. + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowSchedule objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinCcShowInstances(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowSchedulePeer::addSelectColumns($criteria); + $startcol = (CcShowSchedulePeer::NUM_COLUMNS - CcShowSchedulePeer::NUM_LAZY_LOAD_COLUMNS); + CcShowInstancesPeer::addSelectColumns($criteria); + + $criteria->addJoin(CcShowSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowSchedulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowSchedulePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + + $cls = CcShowSchedulePeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowSchedulePeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = CcShowInstancesPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcShowInstancesPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + CcShowInstancesPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (CcShowSchedule) to $obj2 (CcShowInstances) + $obj2->addCcShowSchedule($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + + /** + * Returns the number of rows matching criteria, joining all related tables + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return int Number of matching rows. + */ + public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + // we're going to modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcShowSchedulePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcShowSchedulePeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(CcShowSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + + /** + * Selects a collection of CcShowSchedule objects pre-filled with all related objects. + * + * @param Criteria $criteria + * @param PropelPDO $con + * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN + * @return array Array of CcShowSchedule objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $criteria = clone $criteria; + + // Set the correct dbName if it has not been overridden + if ($criteria->getDbName() == Propel::getDefaultDB()) { + $criteria->setDbName(self::DATABASE_NAME); + } + + CcShowSchedulePeer::addSelectColumns($criteria); + $startcol2 = (CcShowSchedulePeer::NUM_COLUMNS - CcShowSchedulePeer::NUM_LAZY_LOAD_COLUMNS); + + CcShowInstancesPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS); + + $criteria->addJoin(CcShowSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = CcShowSchedulePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = CcShowSchedulePeer::getInstanceFromPool($key1))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj1->hydrate($row, 0, true); // rehydrate + } else { + $cls = CcShowSchedulePeer::getOMClass(false); + + $obj1 = new $cls(); + $obj1->hydrate($row); + CcShowSchedulePeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined CcShowInstances rows + + $key2 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = CcShowInstancesPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = CcShowInstancesPeer::getOMClass(false); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + CcShowInstancesPeer::addInstanceToPool($obj2, $key2); + } // if obj2 loaded + + // Add the $obj1 (CcShowSchedule) to the collection in $obj2 (CcShowInstances) + $obj2->addCcShowSchedule($obj1); + } // if joined row not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + return $results; + } + + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcShowSchedulePeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcShowSchedulePeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcShowScheduleTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcShowSchedulePeer::CLASS_DEFAULT : CcShowSchedulePeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcShowSchedule or Criteria object. + * + * @param mixed $values Criteria or CcShowSchedule object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcShowSchedule object + } + + if ($criteria->containsKey(CcShowSchedulePeer::ID) && $criteria->keyContainsValue(CcShowSchedulePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcShowSchedulePeer::ID.')'); + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcShowSchedule or Criteria object. + * + * @param mixed $values Criteria or CcShowSchedule object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcShowSchedulePeer::ID); + $value = $criteria->remove(CcShowSchedulePeer::ID); + if ($value) { + $selectCriteria->add(CcShowSchedulePeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcShowSchedulePeer::TABLE_NAME); + } + + } else { // $values is CcShowSchedule object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_show_schedule table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcShowSchedulePeer::TABLE_NAME, $con, CcShowSchedulePeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcShowSchedulePeer::clearInstancePool(); + CcShowSchedulePeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcShowSchedule or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcShowSchedule object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcShowSchedulePeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcShowSchedule) { // it's a model object + // invalidate the cache for this single object + CcShowSchedulePeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcShowSchedulePeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcShowSchedulePeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcShowSchedulePeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcShowSchedule object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcShowSchedule $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcShowSchedule $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcShowSchedulePeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcShowSchedulePeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcShowSchedulePeer::DATABASE_NAME, CcShowSchedulePeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcShowSchedule + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcShowSchedulePeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcShowSchedulePeer::DATABASE_NAME); + $criteria->add(CcShowSchedulePeer::ID, $pk); + + $v = CcShowSchedulePeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcShowSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcShowSchedulePeer::DATABASE_NAME); + $criteria->add(CcShowSchedulePeer::ID, $pks, Criteria::IN); + $objs = CcShowSchedulePeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcShowSchedulePeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcShowSchedulePeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowScheduleQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowScheduleQuery.php new file mode 100644 index 000000000..2cb1b65c8 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcShowScheduleQuery.php @@ -0,0 +1,338 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcShowSchedule|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcShowSchedulePeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcShowScheduleQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcShowSchedulePeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcShowScheduleQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcShowSchedulePeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * @param int|array $dbId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowScheduleQuery The current query, for fluid interface + */ + public function filterByDbId($dbId = null, $comparison = null) + { + if (is_array($dbId) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcShowSchedulePeer::ID, $dbId, $comparison); + } + + /** + * Filter the query on the instance_id column + * + * @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 filterByDbInstanceId($dbInstanceId = null, $comparison = null) + { + if (is_array($dbInstanceId)) { + $useMinMax = false; + if (isset($dbInstanceId['min'])) { + $this->addUsingAlias(CcShowSchedulePeer::INSTANCE_ID, $dbInstanceId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbInstanceId['max'])) { + $this->addUsingAlias(CcShowSchedulePeer::INSTANCE_ID, $dbInstanceId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowSchedulePeer::INSTANCE_ID, $dbInstanceId, $comparison); + } + + /** + * Filter the query on the position column + * + * @param int|array $dbPosition 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 filterByDbPosition($dbPosition = null, $comparison = null) + { + if (is_array($dbPosition)) { + $useMinMax = false; + if (isset($dbPosition['min'])) { + $this->addUsingAlias(CcShowSchedulePeer::POSITION, $dbPosition['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbPosition['max'])) { + $this->addUsingAlias(CcShowSchedulePeer::POSITION, $dbPosition['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowSchedulePeer::POSITION, $dbPosition, $comparison); + } + + /** + * Filter the query on the group_id column + * + * @param int|array $dbGroupId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowScheduleQuery The current query, for fluid interface + */ + public function filterByDbGroupId($dbGroupId = null, $comparison = null) + { + if (is_array($dbGroupId)) { + $useMinMax = false; + if (isset($dbGroupId['min'])) { + $this->addUsingAlias(CcShowSchedulePeer::GROUP_ID, $dbGroupId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbGroupId['max'])) { + $this->addUsingAlias(CcShowSchedulePeer::GROUP_ID, $dbGroupId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcShowSchedulePeer::GROUP_ID, $dbGroupId, $comparison); + } + + /** + * Filter the query by a related CcShowInstances object + * + * @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 filterByCcShowInstances($ccShowInstances, $comparison = null) + { + return $this + ->addUsingAlias(CcShowSchedulePeer::INSTANCE_ID, $ccShowInstances->getDbId(), $comparison); + } + + /** + * 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 joinCcShowInstances($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShowInstances'); + + // 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, 'CcShowInstances'); + } + + return $this; + } + + /** + * Use the CcShowInstances relation CcShowInstances 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 CcShowInstancesQuery A secondary query class using the current class as primary query + */ + public function useCcShowInstancesQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCcShowInstances($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShowInstances', 'CcShowInstancesQuery'); + } + + /** + * Exclude object from result + * + * @param CcShowSchedule $ccShowSchedule Object to remove from the list of results + * + * @return CcShowScheduleQuery The current query, for fluid interface + */ + public function prune($ccShowSchedule = null) + { + if ($ccShowSchedule) { + $this->addUsingAlias(CcShowSchedulePeer::ID, $ccShowSchedule->getDbId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcShowScheduleQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSmemb.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSmemb.php new file mode 100644 index 000000000..7fc4dbc9b --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSmemb.php @@ -0,0 +1,891 @@ +uid = 0; + $this->gid = 0; + $this->level = 0; + } + + /** + * Initializes internal state of BaseCcSmemb object. + * @see applyDefaults() + */ + public function __construct() + { + parent::__construct(); + $this->applyDefaultValues(); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [uid] column value. + * + * @return int + */ + public function getUid() + { + return $this->uid; + } + + /** + * Get the [gid] column value. + * + * @return int + */ + public function getGid() + { + return $this->gid; + } + + /** + * Get the [level] column value. + * + * @return int + */ + public function getLevel() + { + return $this->level; + } + + /** + * Get the [mid] column value. + * + * @return int + */ + public function getMid() + { + return $this->mid; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return CcSmemb The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CcSmembPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [uid] column. + * + * @param int $v new value + * @return CcSmemb The current object (for fluent API support) + */ + public function setUid($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->uid !== $v || $this->isNew()) { + $this->uid = $v; + $this->modifiedColumns[] = CcSmembPeer::UID; + } + + return $this; + } // setUid() + + /** + * Set the value of [gid] column. + * + * @param int $v new value + * @return CcSmemb The current object (for fluent API support) + */ + public function setGid($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->gid !== $v || $this->isNew()) { + $this->gid = $v; + $this->modifiedColumns[] = CcSmembPeer::GID; + } + + return $this; + } // setGid() + + /** + * Set the value of [level] column. + * + * @param int $v new value + * @return CcSmemb The current object (for fluent API support) + */ + public function setLevel($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->level !== $v || $this->isNew()) { + $this->level = $v; + $this->modifiedColumns[] = CcSmembPeer::LEVEL; + } + + return $this; + } // setLevel() + + /** + * Set the value of [mid] column. + * + * @param int $v new value + * @return CcSmemb The current object (for fluent API support) + */ + public function setMid($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->mid !== $v) { + $this->mid = $v; + $this->modifiedColumns[] = CcSmembPeer::MID; + } + + return $this; + } // setMid() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + if ($this->uid !== 0) { + return false; + } + + if ($this->gid !== 0) { + return false; + } + + if ($this->level !== 0) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->uid = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; + $this->gid = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->level = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; + $this->mid = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 5; // 5 = CcSmembPeer::NUM_COLUMNS - CcSmembPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcSmemb object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcSmembPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcSmembQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcSmembPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows = 1; + $this->setNew(false); + } else { + $affectedRows = CcSmembPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = CcSmembPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcSmembPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getUid(); + break; + case 2: + return $this->getGid(); + break; + case 3: + return $this->getLevel(); + break; + case 4: + return $this->getMid(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = CcSmembPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getUid(), + $keys[2] => $this->getGid(), + $keys[3] => $this->getLevel(), + $keys[4] => $this->getMid(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcSmembPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setId($value); + break; + case 1: + $this->setUid($value); + break; + case 2: + $this->setGid($value); + break; + case 3: + $this->setLevel($value); + break; + case 4: + $this->setMid($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcSmembPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setUid($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setGid($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setLevel($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setMid($arr[$keys[4]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcSmembPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcSmembPeer::ID)) $criteria->add(CcSmembPeer::ID, $this->id); + if ($this->isColumnModified(CcSmembPeer::UID)) $criteria->add(CcSmembPeer::UID, $this->uid); + if ($this->isColumnModified(CcSmembPeer::GID)) $criteria->add(CcSmembPeer::GID, $this->gid); + if ($this->isColumnModified(CcSmembPeer::LEVEL)) $criteria->add(CcSmembPeer::LEVEL, $this->level); + if ($this->isColumnModified(CcSmembPeer::MID)) $criteria->add(CcSmembPeer::MID, $this->mid); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcSmembPeer::DATABASE_NAME); + $criteria->add(CcSmembPeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcSmemb (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setId($this->id); + $copyObj->setUid($this->uid); + $copyObj->setGid($this->gid); + $copyObj->setLevel($this->level); + $copyObj->setMid($this->mid); + + $copyObj->setNew(true); + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcSmemb Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcSmembPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcSmembPeer(); + } + return self::$peer; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->uid = null; + $this->gid = null; + $this->level = null; + $this->mid = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->applyDefaultValues(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcSmemb diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSmembPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSmembPeer.php new file mode 100644 index 000000000..849c13423 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSmembPeer.php @@ -0,0 +1,750 @@ + array ('Id', 'Uid', 'Gid', 'Level', 'Mid', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'uid', 'gid', 'level', 'mid', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::UID, self::GID, self::LEVEL, self::MID, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'UID', 'GID', 'LEVEL', 'MID', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'uid', 'gid', 'level', 'mid', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Uid' => 1, 'Gid' => 2, 'Level' => 3, 'Mid' => 4, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'uid' => 1, 'gid' => 2, 'level' => 3, 'mid' => 4, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::UID => 1, self::GID => 2, self::LEVEL => 3, self::MID => 4, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'UID' => 1, 'GID' => 2, 'LEVEL' => 3, 'MID' => 4, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'uid' => 1, 'gid' => 2, 'level' => 3, 'mid' => 4, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcSmembPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcSmembPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcSmembPeer::ID); + $criteria->addSelectColumn(CcSmembPeer::UID); + $criteria->addSelectColumn(CcSmembPeer::GID); + $criteria->addSelectColumn(CcSmembPeer::LEVEL); + $criteria->addSelectColumn(CcSmembPeer::MID); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.UID'); + $criteria->addSelectColumn($alias . '.GID'); + $criteria->addSelectColumn($alias . '.LEVEL'); + $criteria->addSelectColumn($alias . '.MID'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcSmembPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcSmembPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcSmemb + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcSmembPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcSmembPeer::populateObjects(CcSmembPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcSmembPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcSmemb $value A CcSmemb object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcSmemb $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcSmemb object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcSmemb) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcSmemb object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcSmemb Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_smemb + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcSmembPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcSmembPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcSmembPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcSmembPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcSmemb object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcSmembPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcSmembPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcSmembPeer::NUM_COLUMNS; + } else { + $cls = CcSmembPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcSmembPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcSmembPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcSmembPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcSmembTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcSmembPeer::CLASS_DEFAULT : CcSmembPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcSmemb or Criteria object. + * + * @param mixed $values Criteria or CcSmemb object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcSmemb object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcSmemb or Criteria object. + * + * @param mixed $values Criteria or CcSmemb object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcSmembPeer::ID); + $value = $criteria->remove(CcSmembPeer::ID); + if ($value) { + $selectCriteria->add(CcSmembPeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcSmembPeer::TABLE_NAME); + } + + } else { // $values is CcSmemb object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_smemb table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcSmembPeer::TABLE_NAME, $con, CcSmembPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcSmembPeer::clearInstancePool(); + CcSmembPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcSmemb or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcSmemb object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcSmembPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcSmemb) { // it's a model object + // invalidate the cache for this single object + CcSmembPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcSmembPeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcSmembPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcSmembPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcSmemb object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcSmemb $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcSmemb $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcSmembPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcSmembPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcSmembPeer::DATABASE_NAME, CcSmembPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcSmemb + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcSmembPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcSmembPeer::DATABASE_NAME); + $criteria->add(CcSmembPeer::ID, $pk); + + $v = CcSmembPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcSmembPeer::DATABASE_NAME); + $criteria->add(CcSmembPeer::ID, $pks, Criteria::IN); + $objs = CcSmembPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcSmembPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcSmembPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSmembQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSmembQuery.php new file mode 100644 index 000000000..06b24502c --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSmembQuery.php @@ -0,0 +1,305 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcSmemb|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcSmembPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcSmembQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcSmembPeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcSmembQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcSmembPeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * @param int|array $id 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 CcSmembQuery The current query, for fluid interface + */ + public function filterById($id = null, $comparison = null) + { + if (is_array($id) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcSmembPeer::ID, $id, $comparison); + } + + /** + * Filter the query on the uid column + * + * @param int|array $uid 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 CcSmembQuery The current query, for fluid interface + */ + public function filterByUid($uid = null, $comparison = null) + { + if (is_array($uid)) { + $useMinMax = false; + if (isset($uid['min'])) { + $this->addUsingAlias(CcSmembPeer::UID, $uid['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($uid['max'])) { + $this->addUsingAlias(CcSmembPeer::UID, $uid['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSmembPeer::UID, $uid, $comparison); + } + + /** + * Filter the query on the gid column + * + * @param int|array $gid 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 CcSmembQuery The current query, for fluid interface + */ + public function filterByGid($gid = null, $comparison = null) + { + if (is_array($gid)) { + $useMinMax = false; + if (isset($gid['min'])) { + $this->addUsingAlias(CcSmembPeer::GID, $gid['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($gid['max'])) { + $this->addUsingAlias(CcSmembPeer::GID, $gid['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSmembPeer::GID, $gid, $comparison); + } + + /** + * Filter the query on the level column + * + * @param int|array $level 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 CcSmembQuery The current query, for fluid interface + */ + public function filterByLevel($level = null, $comparison = null) + { + if (is_array($level)) { + $useMinMax = false; + if (isset($level['min'])) { + $this->addUsingAlias(CcSmembPeer::LEVEL, $level['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($level['max'])) { + $this->addUsingAlias(CcSmembPeer::LEVEL, $level['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSmembPeer::LEVEL, $level, $comparison); + } + + /** + * Filter the query on the mid column + * + * @param int|array $mid 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 CcSmembQuery The current query, for fluid interface + */ + public function filterByMid($mid = null, $comparison = null) + { + if (is_array($mid)) { + $useMinMax = false; + if (isset($mid['min'])) { + $this->addUsingAlias(CcSmembPeer::MID, $mid['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($mid['max'])) { + $this->addUsingAlias(CcSmembPeer::MID, $mid['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSmembPeer::MID, $mid, $comparison); + } + + /** + * Exclude object from result + * + * @param CcSmemb $ccSmemb Object to remove from the list of results + * + * @return CcSmembQuery The current query, for fluid interface + */ + public function prune($ccSmemb = null) + { + if ($ccSmemb) { + $this->addUsingAlias(CcSmembPeer::ID, $ccSmemb->getId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcSmembQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcStreamSetting.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcStreamSetting.php new file mode 100644 index 000000000..6dadc9b67 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcStreamSetting.php @@ -0,0 +1,756 @@ +keyname; + } + + /** + * Get the [value] column value. + * + * @return string + */ + public function getDbValue() + { + return $this->value; + } + + /** + * Get the [type] column value. + * + * @return string + */ + public function getDbType() + { + return $this->type; + } + + /** + * Set the value of [keyname] column. + * + * @param string $v new value + * @return CcStreamSetting The current object (for fluent API support) + */ + public function setDbKeyName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->keyname !== $v) { + $this->keyname = $v; + $this->modifiedColumns[] = CcStreamSettingPeer::KEYNAME; + } + + return $this; + } // setDbKeyName() + + /** + * Set the value of [value] column. + * + * @param string $v new value + * @return CcStreamSetting The current object (for fluent API support) + */ + public function setDbValue($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->value !== $v) { + $this->value = $v; + $this->modifiedColumns[] = CcStreamSettingPeer::VALUE; + } + + return $this; + } // setDbValue() + + /** + * Set the value of [type] column. + * + * @param string $v new value + * @return CcStreamSetting The current object (for fluent API support) + */ + public function setDbType($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->type !== $v) { + $this->type = $v; + $this->modifiedColumns[] = CcStreamSettingPeer::TYPE; + } + + return $this; + } // setDbType() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->keyname = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null; + $this->value = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->type = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 3; // 3 = CcStreamSettingPeer::NUM_COLUMNS - CcStreamSettingPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcStreamSetting object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcStreamSettingPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcStreamSettingPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcStreamSettingPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcStreamSettingQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcStreamSettingPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcStreamSettingPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows = 1; + $this->setNew(false); + } else { + $affectedRows = CcStreamSettingPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = CcStreamSettingPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcStreamSettingPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getDbKeyName(); + break; + case 1: + return $this->getDbValue(); + break; + case 2: + return $this->getDbType(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = CcStreamSettingPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbKeyName(), + $keys[1] => $this->getDbValue(), + $keys[2] => $this->getDbType(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcStreamSettingPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setDbKeyName($value); + break; + case 1: + $this->setDbValue($value); + break; + case 2: + $this->setDbType($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcStreamSettingPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbKeyName($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbValue($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDbType($arr[$keys[2]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcStreamSettingPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcStreamSettingPeer::KEYNAME)) $criteria->add(CcStreamSettingPeer::KEYNAME, $this->keyname); + if ($this->isColumnModified(CcStreamSettingPeer::VALUE)) $criteria->add(CcStreamSettingPeer::VALUE, $this->value); + if ($this->isColumnModified(CcStreamSettingPeer::TYPE)) $criteria->add(CcStreamSettingPeer::TYPE, $this->type); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcStreamSettingPeer::DATABASE_NAME); + $criteria->add(CcStreamSettingPeer::KEYNAME, $this->keyname); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return string + */ + public function getPrimaryKey() + { + return $this->getDbKeyName(); + } + + /** + * Generic method to set the primary key (keyname column). + * + * @param string $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbKeyName($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getDbKeyName(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcStreamSetting (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setDbKeyName($this->keyname); + $copyObj->setDbValue($this->value); + $copyObj->setDbType($this->type); + + $copyObj->setNew(true); + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcStreamSetting Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcStreamSettingPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcStreamSettingPeer(); + } + return self::$peer; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->keyname = null; + $this->value = null; + $this->type = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcStreamSetting diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcStreamSettingPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcStreamSettingPeer.php new file mode 100644 index 000000000..f5e680b20 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcStreamSettingPeer.php @@ -0,0 +1,740 @@ + array ('DbKeyName', 'DbValue', 'DbType', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbKeyName', 'dbValue', 'dbType', ), + BasePeer::TYPE_COLNAME => array (self::KEYNAME, self::VALUE, self::TYPE, ), + BasePeer::TYPE_RAW_COLNAME => array ('KEYNAME', 'VALUE', 'TYPE', ), + BasePeer::TYPE_FIELDNAME => array ('keyname', 'value', 'type', ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbKeyName' => 0, 'DbValue' => 1, 'DbType' => 2, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbKeyName' => 0, 'dbValue' => 1, 'dbType' => 2, ), + BasePeer::TYPE_COLNAME => array (self::KEYNAME => 0, self::VALUE => 1, self::TYPE => 2, ), + BasePeer::TYPE_RAW_COLNAME => array ('KEYNAME' => 0, 'VALUE' => 1, 'TYPE' => 2, ), + BasePeer::TYPE_FIELDNAME => array ('keyname' => 0, 'value' => 1, 'type' => 2, ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcStreamSettingPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcStreamSettingPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcStreamSettingPeer::KEYNAME); + $criteria->addSelectColumn(CcStreamSettingPeer::VALUE); + $criteria->addSelectColumn(CcStreamSettingPeer::TYPE); + } else { + $criteria->addSelectColumn($alias . '.KEYNAME'); + $criteria->addSelectColumn($alias . '.VALUE'); + $criteria->addSelectColumn($alias . '.TYPE'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcStreamSettingPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcStreamSettingPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcStreamSettingPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcStreamSetting + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcStreamSettingPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcStreamSettingPeer::populateObjects(CcStreamSettingPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcStreamSettingPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcStreamSettingPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcStreamSetting $value A CcStreamSetting object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcStreamSetting $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbKeyName(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcStreamSetting object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcStreamSetting) { + $key = (string) $value->getDbKeyName(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcStreamSetting object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcStreamSetting Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_stream_setting + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (string) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcStreamSettingPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcStreamSettingPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcStreamSettingPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcStreamSettingPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcStreamSetting object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcStreamSettingPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcStreamSettingPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcStreamSettingPeer::NUM_COLUMNS; + } else { + $cls = CcStreamSettingPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcStreamSettingPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcStreamSettingPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcStreamSettingPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcStreamSettingTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcStreamSettingPeer::CLASS_DEFAULT : CcStreamSettingPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcStreamSetting or Criteria object. + * + * @param mixed $values Criteria or CcStreamSetting object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcStreamSettingPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcStreamSetting object + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcStreamSetting or Criteria object. + * + * @param mixed $values Criteria or CcStreamSetting object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcStreamSettingPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcStreamSettingPeer::KEYNAME); + $value = $criteria->remove(CcStreamSettingPeer::KEYNAME); + if ($value) { + $selectCriteria->add(CcStreamSettingPeer::KEYNAME, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcStreamSettingPeer::TABLE_NAME); + } + + } else { // $values is CcStreamSetting object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_stream_setting table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcStreamSettingPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcStreamSettingPeer::TABLE_NAME, $con, CcStreamSettingPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcStreamSettingPeer::clearInstancePool(); + CcStreamSettingPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcStreamSetting or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcStreamSetting object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcStreamSettingPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcStreamSettingPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcStreamSetting) { // it's a model object + // invalidate the cache for this single object + CcStreamSettingPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcStreamSettingPeer::KEYNAME, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcStreamSettingPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcStreamSettingPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcStreamSetting object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcStreamSetting $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcStreamSetting $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcStreamSettingPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcStreamSettingPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcStreamSettingPeer::DATABASE_NAME, CcStreamSettingPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param string $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcStreamSetting + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcStreamSettingPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcStreamSettingPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcStreamSettingPeer::DATABASE_NAME); + $criteria->add(CcStreamSettingPeer::KEYNAME, $pk); + + $v = CcStreamSettingPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcStreamSettingPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcStreamSettingPeer::DATABASE_NAME); + $criteria->add(CcStreamSettingPeer::KEYNAME, $pks, Criteria::IN); + $objs = CcStreamSettingPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcStreamSettingPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcStreamSettingPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcStreamSettingQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcStreamSettingQuery.php new file mode 100644 index 000000000..666106d6f --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcStreamSettingQuery.php @@ -0,0 +1,222 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcStreamSetting|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcStreamSettingPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcStreamSettingQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcStreamSettingPeer::KEYNAME, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcStreamSettingQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcStreamSettingPeer::KEYNAME, $keys, Criteria::IN); + } + + /** + * Filter the query on the keyname column + * + * @param string $dbKeyName The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcStreamSettingQuery The current query, for fluid interface + */ + public function filterByDbKeyName($dbKeyName = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbKeyName)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbKeyName)) { + $dbKeyName = str_replace('*', '%', $dbKeyName); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcStreamSettingPeer::KEYNAME, $dbKeyName, $comparison); + } + + /** + * Filter the query on the value column + * + * @param string $dbValue The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcStreamSettingQuery The current query, for fluid interface + */ + public function filterByDbValue($dbValue = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbValue)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbValue)) { + $dbValue = str_replace('*', '%', $dbValue); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcStreamSettingPeer::VALUE, $dbValue, $comparison); + } + + /** + * Filter the query on the type column + * + * @param string $dbType The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcStreamSettingQuery The current query, for fluid interface + */ + public function filterByDbType($dbType = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbType)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbType)) { + $dbType = str_replace('*', '%', $dbType); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcStreamSettingPeer::TYPE, $dbType, $comparison); + } + + /** + * Exclude object from result + * + * @param CcStreamSetting $ccStreamSetting Object to remove from the list of results + * + * @return CcStreamSettingQuery The current query, for fluid interface + */ + public function prune($ccStreamSetting = null) + { + if ($ccStreamSetting) { + $this->addUsingAlias(CcStreamSettingPeer::KEYNAME, $ccStreamSetting->getDbKeyName(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcStreamSettingQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSubjs.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSubjs.php new file mode 100644 index 000000000..54a0468ce --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSubjs.php @@ -0,0 +1,2423 @@ +login = ''; + $this->pass = ''; + $this->type = 'U'; + $this->first_name = ''; + $this->last_name = ''; + $this->login_attempts = 0; + } + + /** + * Initializes internal state of BaseCcSubjs object. + * @see applyDefaults() + */ + public function __construct() + { + parent::__construct(); + $this->applyDefaultValues(); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getDbId() + { + return $this->id; + } + + /** + * Get the [login] column value. + * + * @return string + */ + public function getDbLogin() + { + return $this->login; + } + + /** + * Get the [pass] column value. + * + * @return string + */ + public function getDbPass() + { + return $this->pass; + } + + /** + * Get the [type] column value. + * + * @return string + */ + public function getDbType() + { + return $this->type; + } + + /** + * Get the [first_name] column value. + * + * @return string + */ + public function getDbFirstName() + { + return $this->first_name; + } + + /** + * Get the [last_name] column value. + * + * @return string + */ + public function getDbLastName() + { + return $this->last_name; + } + + /** + * Get the [optionally formatted] temporal [lastlogin] 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 getDbLastlogin($format = 'Y-m-d H:i:s') + { + if ($this->lastlogin === null) { + return null; + } + + + + try { + $dt = new DateTime($this->lastlogin); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->lastlogin, 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); + } + } + + /** + * Get the [optionally formatted] temporal [lastfail] 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 getDbLastfail($format = 'Y-m-d H:i:s') + { + if ($this->lastfail === null) { + return null; + } + + + + try { + $dt = new DateTime($this->lastfail); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->lastfail, 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); + } + } + + /** + * Get the [skype_contact] column value. + * + * @return string + */ + public function getDbSkypeContact() + { + return $this->skype_contact; + } + + /** + * Get the [jabber_contact] column value. + * + * @return string + */ + public function getDbJabberContact() + { + return $this->jabber_contact; + } + + /** + * Get the [email] column value. + * + * @return string + */ + public function getDbEmail() + { + return $this->email; + } + + /** + * Get the [login_attempts] column value. + * + * @return int + */ + public function getDbLoginAttempts() + { + return $this->login_attempts; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return CcSubjs The current object (for fluent API support) + */ + public function setDbId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CcSubjsPeer::ID; + } + + return $this; + } // setDbId() + + /** + * Set the value of [login] column. + * + * @param string $v new value + * @return CcSubjs The current object (for fluent API support) + */ + public function setDbLogin($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->login !== $v || $this->isNew()) { + $this->login = $v; + $this->modifiedColumns[] = CcSubjsPeer::LOGIN; + } + + return $this; + } // setDbLogin() + + /** + * Set the value of [pass] column. + * + * @param string $v new value + * @return CcSubjs The current object (for fluent API support) + */ + public function setDbPass($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->pass !== $v || $this->isNew()) { + $this->pass = $v; + $this->modifiedColumns[] = CcSubjsPeer::PASS; + } + + return $this; + } // setDbPass() + + /** + * Set the value of [type] column. + * + * @param string $v new value + * @return CcSubjs The current object (for fluent API support) + */ + public function setDbType($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->type !== $v || $this->isNew()) { + $this->type = $v; + $this->modifiedColumns[] = CcSubjsPeer::TYPE; + } + + return $this; + } // setDbType() + + /** + * Set the value of [first_name] column. + * + * @param string $v new value + * @return CcSubjs The current object (for fluent API support) + */ + public function setDbFirstName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->first_name !== $v || $this->isNew()) { + $this->first_name = $v; + $this->modifiedColumns[] = CcSubjsPeer::FIRST_NAME; + } + + return $this; + } // setDbFirstName() + + /** + * Set the value of [last_name] column. + * + * @param string $v new value + * @return CcSubjs The current object (for fluent API support) + */ + public function setDbLastName($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->last_name !== $v || $this->isNew()) { + $this->last_name = $v; + $this->modifiedColumns[] = CcSubjsPeer::LAST_NAME; + } + + return $this; + } // setDbLastName() + + /** + * Sets the value of [lastlogin] 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 CcSubjs The current object (for fluent API support) + */ + public function setDbLastlogin($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->lastlogin !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->lastlogin !== null && $tmpDt = new DateTime($this->lastlogin)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->lastlogin = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); + $this->modifiedColumns[] = CcSubjsPeer::LASTLOGIN; + } + } // if either are not null + + return $this; + } // setDbLastlogin() + + /** + * Sets the value of [lastfail] 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 CcSubjs The current object (for fluent API support) + */ + public function setDbLastfail($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->lastfail !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->lastfail !== null && $tmpDt = new DateTime($this->lastfail)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->lastfail = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); + $this->modifiedColumns[] = CcSubjsPeer::LASTFAIL; + } + } // if either are not null + + return $this; + } // setDbLastfail() + + /** + * Set the value of [skype_contact] column. + * + * @param string $v new value + * @return CcSubjs The current object (for fluent API support) + */ + public function setDbSkypeContact($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->skype_contact !== $v) { + $this->skype_contact = $v; + $this->modifiedColumns[] = CcSubjsPeer::SKYPE_CONTACT; + } + + return $this; + } // setDbSkypeContact() + + /** + * Set the value of [jabber_contact] column. + * + * @param string $v new value + * @return CcSubjs The current object (for fluent API support) + */ + public function setDbJabberContact($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->jabber_contact !== $v) { + $this->jabber_contact = $v; + $this->modifiedColumns[] = CcSubjsPeer::JABBER_CONTACT; + } + + return $this; + } // setDbJabberContact() + + /** + * Set the value of [email] column. + * + * @param string $v new value + * @return CcSubjs The current object (for fluent API support) + */ + public function setDbEmail($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->email !== $v) { + $this->email = $v; + $this->modifiedColumns[] = CcSubjsPeer::EMAIL; + } + + return $this; + } // setDbEmail() + + /** + * Set the value of [login_attempts] column. + * + * @param int $v new value + * @return CcSubjs The current object (for fluent API support) + */ + public function setDbLoginAttempts($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->login_attempts !== $v || $this->isNew()) { + $this->login_attempts = $v; + $this->modifiedColumns[] = CcSubjsPeer::LOGIN_ATTEMPTS; + } + + return $this; + } // setDbLoginAttempts() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + if ($this->login !== '') { + return false; + } + + if ($this->pass !== '') { + return false; + } + + if ($this->type !== 'U') { + return false; + } + + if ($this->first_name !== '') { + return false; + } + + if ($this->last_name !== '') { + return false; + } + + if ($this->login_attempts !== 0) { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->login = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->pass = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->type = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->first_name = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->last_name = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->lastlogin = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->lastfail = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; + $this->skype_contact = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; + $this->jabber_contact = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; + $this->email = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; + $this->login_attempts = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 12; // 12 = CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcSubjs object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcSubjsPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->collCcAccesss = null; + + $this->collCcFiless = null; + + $this->collCcPermss = null; + + $this->collCcShowHostss = null; + + $this->collCcPlaylists = null; + + $this->collCcPrefs = null; + + $this->collCcSesss = null; + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcSubjsQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcSubjsPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() ) { + $this->modifiedColumns[] = CcSubjsPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + if ($criteria->keyContainsValue(CcSubjsPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcSubjsPeer::ID.')'); + } + + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows = 1; + $this->setDbId($pk); //[IMV] update autoincrement primary key + $this->setNew(false); + } else { + $affectedRows = CcSubjsPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + if ($this->collCcAccesss !== null) { + foreach ($this->collCcAccesss as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collCcFiless !== null) { + foreach ($this->collCcFiless as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collCcPermss !== null) { + foreach ($this->collCcPermss as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collCcShowHostss !== null) { + foreach ($this->collCcShowHostss as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collCcPlaylists !== null) { + foreach ($this->collCcPlaylists as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collCcPrefs !== null) { + foreach ($this->collCcPrefs as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + if ($this->collCcSesss !== null) { + foreach ($this->collCcSesss as $referrerFK) { + if (!$referrerFK->isDeleted()) { + $affectedRows += $referrerFK->save($con); + } + } + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = CcSubjsPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collCcAccesss !== null) { + foreach ($this->collCcAccesss as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collCcFiless !== null) { + foreach ($this->collCcFiless as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collCcPermss !== null) { + foreach ($this->collCcPermss as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collCcShowHostss !== null) { + foreach ($this->collCcShowHostss as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collCcPlaylists !== null) { + foreach ($this->collCcPlaylists as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collCcPrefs !== null) { + foreach ($this->collCcPrefs as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + if ($this->collCcSesss !== null) { + foreach ($this->collCcSesss as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcSubjsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getDbId(); + break; + case 1: + return $this->getDbLogin(); + break; + case 2: + return $this->getDbPass(); + break; + case 3: + return $this->getDbType(); + break; + case 4: + return $this->getDbFirstName(); + break; + case 5: + return $this->getDbLastName(); + break; + case 6: + return $this->getDbLastlogin(); + break; + case 7: + return $this->getDbLastfail(); + break; + case 8: + return $this->getDbSkypeContact(); + break; + case 9: + return $this->getDbJabberContact(); + break; + case 10: + return $this->getDbEmail(); + break; + case 11: + return $this->getDbLoginAttempts(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = CcSubjsPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbId(), + $keys[1] => $this->getDbLogin(), + $keys[2] => $this->getDbPass(), + $keys[3] => $this->getDbType(), + $keys[4] => $this->getDbFirstName(), + $keys[5] => $this->getDbLastName(), + $keys[6] => $this->getDbLastlogin(), + $keys[7] => $this->getDbLastfail(), + $keys[8] => $this->getDbSkypeContact(), + $keys[9] => $this->getDbJabberContact(), + $keys[10] => $this->getDbEmail(), + $keys[11] => $this->getDbLoginAttempts(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcSubjsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setDbId($value); + break; + case 1: + $this->setDbLogin($value); + break; + case 2: + $this->setDbPass($value); + break; + case 3: + $this->setDbType($value); + break; + case 4: + $this->setDbFirstName($value); + break; + case 5: + $this->setDbLastName($value); + break; + case 6: + $this->setDbLastlogin($value); + break; + case 7: + $this->setDbLastfail($value); + break; + case 8: + $this->setDbSkypeContact($value); + break; + case 9: + $this->setDbJabberContact($value); + break; + case 10: + $this->setDbEmail($value); + break; + case 11: + $this->setDbLoginAttempts($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcSubjsPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbLogin($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDbPass($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDbType($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setDbFirstName($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setDbLastName($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setDbLastlogin($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setDbLastfail($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setDbSkypeContact($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setDbJabberContact($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setDbEmail($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setDbLoginAttempts($arr[$keys[11]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcSubjsPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcSubjsPeer::ID)) $criteria->add(CcSubjsPeer::ID, $this->id); + if ($this->isColumnModified(CcSubjsPeer::LOGIN)) $criteria->add(CcSubjsPeer::LOGIN, $this->login); + if ($this->isColumnModified(CcSubjsPeer::PASS)) $criteria->add(CcSubjsPeer::PASS, $this->pass); + if ($this->isColumnModified(CcSubjsPeer::TYPE)) $criteria->add(CcSubjsPeer::TYPE, $this->type); + if ($this->isColumnModified(CcSubjsPeer::FIRST_NAME)) $criteria->add(CcSubjsPeer::FIRST_NAME, $this->first_name); + if ($this->isColumnModified(CcSubjsPeer::LAST_NAME)) $criteria->add(CcSubjsPeer::LAST_NAME, $this->last_name); + if ($this->isColumnModified(CcSubjsPeer::LASTLOGIN)) $criteria->add(CcSubjsPeer::LASTLOGIN, $this->lastlogin); + if ($this->isColumnModified(CcSubjsPeer::LASTFAIL)) $criteria->add(CcSubjsPeer::LASTFAIL, $this->lastfail); + if ($this->isColumnModified(CcSubjsPeer::SKYPE_CONTACT)) $criteria->add(CcSubjsPeer::SKYPE_CONTACT, $this->skype_contact); + if ($this->isColumnModified(CcSubjsPeer::JABBER_CONTACT)) $criteria->add(CcSubjsPeer::JABBER_CONTACT, $this->jabber_contact); + if ($this->isColumnModified(CcSubjsPeer::EMAIL)) $criteria->add(CcSubjsPeer::EMAIL, $this->email); + if ($this->isColumnModified(CcSubjsPeer::LOGIN_ATTEMPTS)) $criteria->add(CcSubjsPeer::LOGIN_ATTEMPTS, $this->login_attempts); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcSubjsPeer::DATABASE_NAME); + $criteria->add(CcSubjsPeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getDbId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getDbId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcSubjs (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setDbLogin($this->login); + $copyObj->setDbPass($this->pass); + $copyObj->setDbType($this->type); + $copyObj->setDbFirstName($this->first_name); + $copyObj->setDbLastName($this->last_name); + $copyObj->setDbLastlogin($this->lastlogin); + $copyObj->setDbLastfail($this->lastfail); + $copyObj->setDbSkypeContact($this->skype_contact); + $copyObj->setDbJabberContact($this->jabber_contact); + $copyObj->setDbEmail($this->email); + $copyObj->setDbLoginAttempts($this->login_attempts); + + 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->getCcAccesss() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcAccess($relObj->copy($deepCopy)); + } + } + + foreach ($this->getCcFiless() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcFiles($relObj->copy($deepCopy)); + } + } + + foreach ($this->getCcPermss() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcPerms($relObj->copy($deepCopy)); + } + } + + foreach ($this->getCcShowHostss() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcShowHosts($relObj->copy($deepCopy)); + } + } + + foreach ($this->getCcPlaylists() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcPlaylist($relObj->copy($deepCopy)); + } + } + + foreach ($this->getCcPrefs() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcPref($relObj->copy($deepCopy)); + } + } + + foreach ($this->getCcSesss() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addCcSess($relObj->copy($deepCopy)); + } + } + + } // if ($deepCopy) + + + $copyObj->setNew(true); + $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcSubjs Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcSubjsPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcSubjsPeer(); + } + return self::$peer; + } + + /** + * Clears out the collCcAccesss 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 addCcAccesss() + */ + public function clearCcAccesss() + { + $this->collCcAccesss = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcAccesss collection. + * + * By default this just sets the collCcAccesss collection to an empty array (like clearcollCcAccesss()); + * 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 initCcAccesss() + { + $this->collCcAccesss = new PropelObjectCollection(); + $this->collCcAccesss->setModel('CcAccess'); + } + + /** + * Gets an array of CcAccess 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 CcSubjs 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 CcAccess[] List of CcAccess objects + * @throws PropelException + */ + public function getCcAccesss($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcAccesss || null !== $criteria) { + if ($this->isNew() && null === $this->collCcAccesss) { + // return empty collection + $this->initCcAccesss(); + } else { + $collCcAccesss = CcAccessQuery::create(null, $criteria) + ->filterByCcSubjs($this) + ->find($con); + if (null !== $criteria) { + return $collCcAccesss; + } + $this->collCcAccesss = $collCcAccesss; + } + } + return $this->collCcAccesss; + } + + /** + * Returns the number of related CcAccess objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcAccess objects. + * @throws PropelException + */ + public function countCcAccesss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcAccesss || null !== $criteria) { + if ($this->isNew() && null === $this->collCcAccesss) { + return 0; + } else { + $query = CcAccessQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcSubjs($this) + ->count($con); + } + } else { + return count($this->collCcAccesss); + } + } + + /** + * Method called to associate a CcAccess object to this object + * through the CcAccess foreign key attribute. + * + * @param CcAccess $l CcAccess + * @return void + * @throws PropelException + */ + public function addCcAccess(CcAccess $l) + { + if ($this->collCcAccesss === null) { + $this->initCcAccesss(); + } + if (!$this->collCcAccesss->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcAccesss[]= $l; + $l->setCcSubjs($this); + } + } + + /** + * Clears out the collCcFiless 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 addCcFiless() + */ + public function clearCcFiless() + { + $this->collCcFiless = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcFiless collection. + * + * By default this just sets the collCcFiless collection to an empty array (like clearcollCcFiless()); + * 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 initCcFiless() + { + $this->collCcFiless = new PropelObjectCollection(); + $this->collCcFiless->setModel('CcFiles'); + } + + /** + * Gets an array of CcFiles 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 CcSubjs 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 CcFiles[] List of CcFiles objects + * @throws PropelException + */ + public function getCcFiless($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcFiless || null !== $criteria) { + if ($this->isNew() && null === $this->collCcFiless) { + // return empty collection + $this->initCcFiless(); + } else { + $collCcFiless = CcFilesQuery::create(null, $criteria) + ->filterByCcSubjs($this) + ->find($con); + if (null !== $criteria) { + return $collCcFiless; + } + $this->collCcFiless = $collCcFiless; + } + } + return $this->collCcFiless; + } + + /** + * Returns the number of related CcFiles objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcFiles objects. + * @throws PropelException + */ + public function countCcFiless(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcFiless || null !== $criteria) { + if ($this->isNew() && null === $this->collCcFiless) { + return 0; + } else { + $query = CcFilesQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcSubjs($this) + ->count($con); + } + } else { + return count($this->collCcFiless); + } + } + + /** + * Method called to associate a CcFiles object to this object + * through the CcFiles foreign key attribute. + * + * @param CcFiles $l CcFiles + * @return void + * @throws PropelException + */ + public function addCcFiles(CcFiles $l) + { + if ($this->collCcFiless === null) { + $this->initCcFiless(); + } + if (!$this->collCcFiless->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcFiless[]= $l; + $l->setCcSubjs($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcSubjs is new, it will return + * an empty collection; or if this CcSubjs has previously + * been saved, it will retrieve related CcFiless from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcSubjs. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcFiles[] List of CcFiles objects + */ + public function getCcFilessJoinCcMusicDirs($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcFilesQuery::create(null, $criteria); + $query->joinWith('CcMusicDirs', $join_behavior); + + return $this->getCcFiless($query, $con); + } + + /** + * Clears out the collCcPermss 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 addCcPermss() + */ + public function clearCcPermss() + { + $this->collCcPermss = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcPermss collection. + * + * By default this just sets the collCcPermss collection to an empty array (like clearcollCcPermss()); + * 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 initCcPermss() + { + $this->collCcPermss = new PropelObjectCollection(); + $this->collCcPermss->setModel('CcPerms'); + } + + /** + * Gets an array of CcPerms 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 CcSubjs 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 CcPerms[] List of CcPerms objects + * @throws PropelException + */ + public function getCcPermss($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcPermss || null !== $criteria) { + if ($this->isNew() && null === $this->collCcPermss) { + // return empty collection + $this->initCcPermss(); + } else { + $collCcPermss = CcPermsQuery::create(null, $criteria) + ->filterByCcSubjs($this) + ->find($con); + if (null !== $criteria) { + return $collCcPermss; + } + $this->collCcPermss = $collCcPermss; + } + } + return $this->collCcPermss; + } + + /** + * Returns the number of related CcPerms objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcPerms objects. + * @throws PropelException + */ + public function countCcPermss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcPermss || null !== $criteria) { + if ($this->isNew() && null === $this->collCcPermss) { + return 0; + } else { + $query = CcPermsQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcSubjs($this) + ->count($con); + } + } else { + return count($this->collCcPermss); + } + } + + /** + * Method called to associate a CcPerms object to this object + * through the CcPerms foreign key attribute. + * + * @param CcPerms $l CcPerms + * @return void + * @throws PropelException + */ + public function addCcPerms(CcPerms $l) + { + if ($this->collCcPermss === null) { + $this->initCcPermss(); + } + if (!$this->collCcPermss->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcPermss[]= $l; + $l->setCcSubjs($this); + } + } + + /** + * Clears out the collCcShowHostss 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 addCcShowHostss() + */ + public function clearCcShowHostss() + { + $this->collCcShowHostss = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcShowHostss collection. + * + * By default this just sets the collCcShowHostss collection to an empty array (like clearcollCcShowHostss()); + * 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 initCcShowHostss() + { + $this->collCcShowHostss = new PropelObjectCollection(); + $this->collCcShowHostss->setModel('CcShowHosts'); + } + + /** + * Gets an array of CcShowHosts 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 CcSubjs 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 CcShowHosts[] List of CcShowHosts objects + * @throws PropelException + */ + public function getCcShowHostss($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcShowHostss || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowHostss) { + // return empty collection + $this->initCcShowHostss(); + } else { + $collCcShowHostss = CcShowHostsQuery::create(null, $criteria) + ->filterByCcSubjs($this) + ->find($con); + if (null !== $criteria) { + return $collCcShowHostss; + } + $this->collCcShowHostss = $collCcShowHostss; + } + } + return $this->collCcShowHostss; + } + + /** + * Returns the number of related CcShowHosts objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcShowHosts objects. + * @throws PropelException + */ + public function countCcShowHostss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcShowHostss || null !== $criteria) { + if ($this->isNew() && null === $this->collCcShowHostss) { + return 0; + } else { + $query = CcShowHostsQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcSubjs($this) + ->count($con); + } + } else { + return count($this->collCcShowHostss); + } + } + + /** + * Method called to associate a CcShowHosts object to this object + * through the CcShowHosts foreign key attribute. + * + * @param CcShowHosts $l CcShowHosts + * @return void + * @throws PropelException + */ + public function addCcShowHosts(CcShowHosts $l) + { + if ($this->collCcShowHostss === null) { + $this->initCcShowHostss(); + } + if (!$this->collCcShowHostss->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcShowHostss[]= $l; + $l->setCcSubjs($this); + } + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this CcSubjs is new, it will return + * an empty collection; or if this CcSubjs has previously + * been saved, it will retrieve related CcShowHostss from storage. + * + * This method is protected by default in order to keep the public + * api reasonable. You can provide public methods for those you + * actually need in CcSubjs. + * + * @param Criteria $criteria optional Criteria object to narrow the query + * @param PropelPDO $con optional connection object + * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN) + * @return PropelCollection|array CcShowHosts[] List of CcShowHosts objects + */ + public function getCcShowHostssJoinCcShow($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = CcShowHostsQuery::create(null, $criteria); + $query->joinWith('CcShow', $join_behavior); + + return $this->getCcShowHostss($query, $con); + } + + /** + * Clears out the collCcPlaylists 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 addCcPlaylists() + */ + public function clearCcPlaylists() + { + $this->collCcPlaylists = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcPlaylists collection. + * + * By default this just sets the collCcPlaylists collection to an empty array (like clearcollCcPlaylists()); + * 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 initCcPlaylists() + { + $this->collCcPlaylists = new PropelObjectCollection(); + $this->collCcPlaylists->setModel('CcPlaylist'); + } + + /** + * Gets an array of CcPlaylist 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 CcSubjs 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 CcPlaylist[] List of CcPlaylist objects + * @throws PropelException + */ + public function getCcPlaylists($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcPlaylists || null !== $criteria) { + if ($this->isNew() && null === $this->collCcPlaylists) { + // return empty collection + $this->initCcPlaylists(); + } else { + $collCcPlaylists = CcPlaylistQuery::create(null, $criteria) + ->filterByCcSubjs($this) + ->find($con); + if (null !== $criteria) { + return $collCcPlaylists; + } + $this->collCcPlaylists = $collCcPlaylists; + } + } + return $this->collCcPlaylists; + } + + /** + * Returns the number of related CcPlaylist objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcPlaylist objects. + * @throws PropelException + */ + public function countCcPlaylists(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcPlaylists || null !== $criteria) { + if ($this->isNew() && null === $this->collCcPlaylists) { + return 0; + } else { + $query = CcPlaylistQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcSubjs($this) + ->count($con); + } + } else { + return count($this->collCcPlaylists); + } + } + + /** + * Method called to associate a CcPlaylist object to this object + * through the CcPlaylist foreign key attribute. + * + * @param CcPlaylist $l CcPlaylist + * @return void + * @throws PropelException + */ + public function addCcPlaylist(CcPlaylist $l) + { + if ($this->collCcPlaylists === null) { + $this->initCcPlaylists(); + } + if (!$this->collCcPlaylists->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcPlaylists[]= $l; + $l->setCcSubjs($this); + } + } + + /** + * Clears out the collCcPrefs 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 addCcPrefs() + */ + public function clearCcPrefs() + { + $this->collCcPrefs = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcPrefs collection. + * + * By default this just sets the collCcPrefs collection to an empty array (like clearcollCcPrefs()); + * 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 initCcPrefs() + { + $this->collCcPrefs = new PropelObjectCollection(); + $this->collCcPrefs->setModel('CcPref'); + } + + /** + * Gets an array of CcPref 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 CcSubjs 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 CcPref[] List of CcPref objects + * @throws PropelException + */ + public function getCcPrefs($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcPrefs || null !== $criteria) { + if ($this->isNew() && null === $this->collCcPrefs) { + // return empty collection + $this->initCcPrefs(); + } else { + $collCcPrefs = CcPrefQuery::create(null, $criteria) + ->filterByCcSubjs($this) + ->find($con); + if (null !== $criteria) { + return $collCcPrefs; + } + $this->collCcPrefs = $collCcPrefs; + } + } + return $this->collCcPrefs; + } + + /** + * Returns the number of related CcPref objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcPref objects. + * @throws PropelException + */ + public function countCcPrefs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcPrefs || null !== $criteria) { + if ($this->isNew() && null === $this->collCcPrefs) { + return 0; + } else { + $query = CcPrefQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcSubjs($this) + ->count($con); + } + } else { + return count($this->collCcPrefs); + } + } + + /** + * Method called to associate a CcPref object to this object + * through the CcPref foreign key attribute. + * + * @param CcPref $l CcPref + * @return void + * @throws PropelException + */ + public function addCcPref(CcPref $l) + { + if ($this->collCcPrefs === null) { + $this->initCcPrefs(); + } + if (!$this->collCcPrefs->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcPrefs[]= $l; + $l->setCcSubjs($this); + } + } + + /** + * Clears out the collCcSesss 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 addCcSesss() + */ + public function clearCcSesss() + { + $this->collCcSesss = null; // important to set this to NULL since that means it is uninitialized + } + + /** + * Initializes the collCcSesss collection. + * + * By default this just sets the collCcSesss collection to an empty array (like clearcollCcSesss()); + * 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 initCcSesss() + { + $this->collCcSesss = new PropelObjectCollection(); + $this->collCcSesss->setModel('CcSess'); + } + + /** + * Gets an array of CcSess 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 CcSubjs 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 CcSess[] List of CcSess objects + * @throws PropelException + */ + public function getCcSesss($criteria = null, PropelPDO $con = null) + { + if(null === $this->collCcSesss || null !== $criteria) { + if ($this->isNew() && null === $this->collCcSesss) { + // return empty collection + $this->initCcSesss(); + } else { + $collCcSesss = CcSessQuery::create(null, $criteria) + ->filterByCcSubjs($this) + ->find($con); + if (null !== $criteria) { + return $collCcSesss; + } + $this->collCcSesss = $collCcSesss; + } + } + return $this->collCcSesss; + } + + /** + * Returns the number of related CcSess objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related CcSess objects. + * @throws PropelException + */ + public function countCcSesss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + if(null === $this->collCcSesss || null !== $criteria) { + if ($this->isNew() && null === $this->collCcSesss) { + return 0; + } else { + $query = CcSessQuery::create(null, $criteria); + if($distinct) { + $query->distinct(); + } + return $query + ->filterByCcSubjs($this) + ->count($con); + } + } else { + return count($this->collCcSesss); + } + } + + /** + * Method called to associate a CcSess object to this object + * through the CcSess foreign key attribute. + * + * @param CcSess $l CcSess + * @return void + * @throws PropelException + */ + public function addCcSess(CcSess $l) + { + if ($this->collCcSesss === null) { + $this->initCcSesss(); + } + if (!$this->collCcSesss->contains($l)) { // only add it if the **same** object is not already associated + $this->collCcSesss[]= $l; + $l->setCcSubjs($this); + } + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->login = null; + $this->pass = null; + $this->type = null; + $this->first_name = null; + $this->last_name = null; + $this->lastlogin = null; + $this->lastfail = null; + $this->skype_contact = null; + $this->jabber_contact = null; + $this->email = null; + $this->login_attempts = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->applyDefaultValues(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + if ($this->collCcAccesss) { + foreach ((array) $this->collCcAccesss as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collCcFiless) { + foreach ((array) $this->collCcFiless as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collCcPermss) { + foreach ((array) $this->collCcPermss as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collCcShowHostss) { + foreach ((array) $this->collCcShowHostss as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collCcPlaylists) { + foreach ((array) $this->collCcPlaylists as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collCcPrefs) { + foreach ((array) $this->collCcPrefs as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->collCcSesss) { + foreach ((array) $this->collCcSesss as $o) { + $o->clearAllReferences($deep); + } + } + } // if ($deep) + + $this->collCcAccesss = null; + $this->collCcFiless = null; + $this->collCcPermss = null; + $this->collCcShowHostss = null; + $this->collCcPlaylists = null; + $this->collCcPrefs = null; + $this->collCcSesss = null; + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcSubjs diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSubjsPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSubjsPeer.php new file mode 100644 index 000000000..79a9a7efa --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSubjsPeer.php @@ -0,0 +1,801 @@ + array ('DbId', 'DbLogin', 'DbPass', 'DbType', 'DbFirstName', 'DbLastName', 'DbLastlogin', 'DbLastfail', 'DbSkypeContact', 'DbJabberContact', 'DbEmail', 'DbLoginAttempts', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbLogin', 'dbPass', 'dbType', 'dbFirstName', 'dbLastName', 'dbLastlogin', 'dbLastfail', 'dbSkypeContact', 'dbJabberContact', 'dbEmail', 'dbLoginAttempts', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::LOGIN, self::PASS, self::TYPE, self::FIRST_NAME, self::LAST_NAME, self::LASTLOGIN, self::LASTFAIL, self::SKYPE_CONTACT, self::JABBER_CONTACT, self::EMAIL, self::LOGIN_ATTEMPTS, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOGIN', 'PASS', 'TYPE', 'FIRST_NAME', 'LAST_NAME', 'LASTLOGIN', 'LASTFAIL', 'SKYPE_CONTACT', 'JABBER_CONTACT', 'EMAIL', 'LOGIN_ATTEMPTS', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'login', 'pass', 'type', 'first_name', 'last_name', 'lastlogin', 'lastfail', 'skype_contact', 'jabber_contact', 'email', 'login_attempts', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbLogin' => 1, 'DbPass' => 2, 'DbType' => 3, 'DbFirstName' => 4, 'DbLastName' => 5, 'DbLastlogin' => 6, 'DbLastfail' => 7, 'DbSkypeContact' => 8, 'DbJabberContact' => 9, 'DbEmail' => 10, 'DbLoginAttempts' => 11, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbLogin' => 1, 'dbPass' => 2, 'dbType' => 3, 'dbFirstName' => 4, 'dbLastName' => 5, 'dbLastlogin' => 6, 'dbLastfail' => 7, 'dbSkypeContact' => 8, 'dbJabberContact' => 9, 'dbEmail' => 10, 'dbLoginAttempts' => 11, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::LOGIN => 1, self::PASS => 2, self::TYPE => 3, self::FIRST_NAME => 4, self::LAST_NAME => 5, self::LASTLOGIN => 6, self::LASTFAIL => 7, self::SKYPE_CONTACT => 8, self::JABBER_CONTACT => 9, self::EMAIL => 10, self::LOGIN_ATTEMPTS => 11, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOGIN' => 1, 'PASS' => 2, 'TYPE' => 3, 'FIRST_NAME' => 4, 'LAST_NAME' => 5, 'LASTLOGIN' => 6, 'LASTFAIL' => 7, 'SKYPE_CONTACT' => 8, 'JABBER_CONTACT' => 9, 'EMAIL' => 10, 'LOGIN_ATTEMPTS' => 11, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'login' => 1, 'pass' => 2, 'type' => 3, 'first_name' => 4, 'last_name' => 5, 'lastlogin' => 6, 'lastfail' => 7, 'skype_contact' => 8, 'jabber_contact' => 9, 'email' => 10, 'login_attempts' => 11, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcSubjsPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcSubjsPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcSubjsPeer::ID); + $criteria->addSelectColumn(CcSubjsPeer::LOGIN); + $criteria->addSelectColumn(CcSubjsPeer::PASS); + $criteria->addSelectColumn(CcSubjsPeer::TYPE); + $criteria->addSelectColumn(CcSubjsPeer::FIRST_NAME); + $criteria->addSelectColumn(CcSubjsPeer::LAST_NAME); + $criteria->addSelectColumn(CcSubjsPeer::LASTLOGIN); + $criteria->addSelectColumn(CcSubjsPeer::LASTFAIL); + $criteria->addSelectColumn(CcSubjsPeer::SKYPE_CONTACT); + $criteria->addSelectColumn(CcSubjsPeer::JABBER_CONTACT); + $criteria->addSelectColumn(CcSubjsPeer::EMAIL); + $criteria->addSelectColumn(CcSubjsPeer::LOGIN_ATTEMPTS); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.LOGIN'); + $criteria->addSelectColumn($alias . '.PASS'); + $criteria->addSelectColumn($alias . '.TYPE'); + $criteria->addSelectColumn($alias . '.FIRST_NAME'); + $criteria->addSelectColumn($alias . '.LAST_NAME'); + $criteria->addSelectColumn($alias . '.LASTLOGIN'); + $criteria->addSelectColumn($alias . '.LASTFAIL'); + $criteria->addSelectColumn($alias . '.SKYPE_CONTACT'); + $criteria->addSelectColumn($alias . '.JABBER_CONTACT'); + $criteria->addSelectColumn($alias . '.EMAIL'); + $criteria->addSelectColumn($alias . '.LOGIN_ATTEMPTS'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcSubjsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcSubjsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcSubjs + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcSubjsPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcSubjsPeer::populateObjects(CcSubjsPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcSubjsPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcSubjs $value A CcSubjs object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcSubjs $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcSubjs object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcSubjs) { + $key = (string) $value->getDbId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcSubjs object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcSubjs Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_subjs + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + // Invalidate objects in CcPermsPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcPermsPeer::clearInstancePool(); + // 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 CcPrefPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcPrefPeer::clearInstancePool(); + // Invalidate objects in CcSessPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + CcSessPeer::clearInstancePool(); + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcSubjsPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcSubjsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcSubjsPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcSubjsPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcSubjs object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcSubjsPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcSubjsPeer::NUM_COLUMNS; + } else { + $cls = CcSubjsPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcSubjsPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcSubjsPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcSubjsPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcSubjsTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcSubjsPeer::CLASS_DEFAULT : CcSubjsPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcSubjs or Criteria object. + * + * @param mixed $values Criteria or CcSubjs object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcSubjs object + } + + if ($criteria->containsKey(CcSubjsPeer::ID) && $criteria->keyContainsValue(CcSubjsPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcSubjsPeer::ID.')'); + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcSubjs or Criteria object. + * + * @param mixed $values Criteria or CcSubjs object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcSubjsPeer::ID); + $value = $criteria->remove(CcSubjsPeer::ID); + if ($value) { + $selectCriteria->add(CcSubjsPeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcSubjsPeer::TABLE_NAME); + } + + } else { // $values is CcSubjs object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_subjs table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcSubjsPeer::TABLE_NAME, $con, CcSubjsPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcSubjsPeer::clearInstancePool(); + CcSubjsPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcSubjs or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcSubjs object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcSubjsPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcSubjs) { // it's a model object + // invalidate the cache for this single object + CcSubjsPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcSubjsPeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcSubjsPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcSubjsPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcSubjs object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcSubjs $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcSubjs $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcSubjsPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcSubjsPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcSubjsPeer::DATABASE_NAME, CcSubjsPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcSubjs + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcSubjsPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcSubjsPeer::DATABASE_NAME); + $criteria->add(CcSubjsPeer::ID, $pk); + + $v = CcSubjsPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcSubjsPeer::DATABASE_NAME); + $criteria->add(CcSubjsPeer::ID, $pks, Criteria::IN); + $objs = CcSubjsPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcSubjsPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcSubjsPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSubjsQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSubjsQuery.php new file mode 100644 index 000000000..9a0cffdd0 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcSubjsQuery.php @@ -0,0 +1,954 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcSubjs|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcSubjsPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcSubjsPeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcSubjsPeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * @param int|array $dbId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByDbId($dbId = null, $comparison = null) + { + if (is_array($dbId) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcSubjsPeer::ID, $dbId, $comparison); + } + + /** + * Filter the query on the login column + * + * @param string $dbLogin The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByDbLogin($dbLogin = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbLogin)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbLogin)) { + $dbLogin = str_replace('*', '%', $dbLogin); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcSubjsPeer::LOGIN, $dbLogin, $comparison); + } + + /** + * Filter the query on the pass column + * + * @param string $dbPass The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByDbPass($dbPass = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbPass)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbPass)) { + $dbPass = str_replace('*', '%', $dbPass); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcSubjsPeer::PASS, $dbPass, $comparison); + } + + /** + * Filter the query on the type column + * + * @param string $dbType The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByDbType($dbType = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbType)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbType)) { + $dbType = str_replace('*', '%', $dbType); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcSubjsPeer::TYPE, $dbType, $comparison); + } + + /** + * Filter the query on the first_name column + * + * @param string $dbFirstName The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByDbFirstName($dbFirstName = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbFirstName)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbFirstName)) { + $dbFirstName = str_replace('*', '%', $dbFirstName); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcSubjsPeer::FIRST_NAME, $dbFirstName, $comparison); + } + + /** + * Filter the query on the last_name column + * + * @param string $dbLastName The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByDbLastName($dbLastName = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbLastName)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbLastName)) { + $dbLastName = str_replace('*', '%', $dbLastName); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcSubjsPeer::LAST_NAME, $dbLastName, $comparison); + } + + /** + * Filter the query on the lastlogin column + * + * @param string|array $dbLastlogin 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 CcSubjsQuery The current query, for fluid interface + */ + public function filterByDbLastlogin($dbLastlogin = null, $comparison = null) + { + if (is_array($dbLastlogin)) { + $useMinMax = false; + if (isset($dbLastlogin['min'])) { + $this->addUsingAlias(CcSubjsPeer::LASTLOGIN, $dbLastlogin['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbLastlogin['max'])) { + $this->addUsingAlias(CcSubjsPeer::LASTLOGIN, $dbLastlogin['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSubjsPeer::LASTLOGIN, $dbLastlogin, $comparison); + } + + /** + * Filter the query on the lastfail column + * + * @param string|array $dbLastfail 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 CcSubjsQuery The current query, for fluid interface + */ + public function filterByDbLastfail($dbLastfail = null, $comparison = null) + { + if (is_array($dbLastfail)) { + $useMinMax = false; + if (isset($dbLastfail['min'])) { + $this->addUsingAlias(CcSubjsPeer::LASTFAIL, $dbLastfail['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbLastfail['max'])) { + $this->addUsingAlias(CcSubjsPeer::LASTFAIL, $dbLastfail['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSubjsPeer::LASTFAIL, $dbLastfail, $comparison); + } + + /** + * Filter the query on the skype_contact column + * + * @param string $dbSkypeContact The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByDbSkypeContact($dbSkypeContact = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbSkypeContact)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbSkypeContact)) { + $dbSkypeContact = str_replace('*', '%', $dbSkypeContact); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcSubjsPeer::SKYPE_CONTACT, $dbSkypeContact, $comparison); + } + + /** + * Filter the query on the jabber_contact column + * + * @param string $dbJabberContact The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByDbJabberContact($dbJabberContact = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbJabberContact)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbJabberContact)) { + $dbJabberContact = str_replace('*', '%', $dbJabberContact); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcSubjsPeer::JABBER_CONTACT, $dbJabberContact, $comparison); + } + + /** + * Filter the query on the email column + * + * @param string $dbEmail The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByDbEmail($dbEmail = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbEmail)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbEmail)) { + $dbEmail = str_replace('*', '%', $dbEmail); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcSubjsPeer::EMAIL, $dbEmail, $comparison); + } + + /** + * Filter the query on the login_attempts column + * + * @param int|array $dbLoginAttempts 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 CcSubjsQuery The current query, for fluid interface + */ + public function filterByDbLoginAttempts($dbLoginAttempts = null, $comparison = null) + { + if (is_array($dbLoginAttempts)) { + $useMinMax = false; + if (isset($dbLoginAttempts['min'])) { + $this->addUsingAlias(CcSubjsPeer::LOGIN_ATTEMPTS, $dbLoginAttempts['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbLoginAttempts['max'])) { + $this->addUsingAlias(CcSubjsPeer::LOGIN_ATTEMPTS, $dbLoginAttempts['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcSubjsPeer::LOGIN_ATTEMPTS, $dbLoginAttempts, $comparison); + } + + /** + * Filter the query by a related CcAccess object + * + * @param CcAccess $ccAccess the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByCcAccess($ccAccess, $comparison = null) + { + return $this + ->addUsingAlias(CcSubjsPeer::ID, $ccAccess->getOwner(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcAccess relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function joinCcAccess($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcAccess'); + + // 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, 'CcAccess'); + } + + return $this; + } + + /** + * Use the CcAccess relation CcAccess 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 CcAccessQuery A secondary query class using the current class as primary query + */ + public function useCcAccessQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcAccess($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcAccess', 'CcAccessQuery'); + } + + /** + * Filter the query by a related CcFiles object + * + * @param CcFiles $ccFiles the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByCcFiles($ccFiles, $comparison = null) + { + return $this + ->addUsingAlias(CcSubjsPeer::ID, $ccFiles->getDbEditedby(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcFiles relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function joinCcFiles($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcFiles'); + + // 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, 'CcFiles'); + } + + return $this; + } + + /** + * Use the CcFiles relation CcFiles 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 CcFilesQuery A secondary query class using the current class as primary query + */ + public function useCcFilesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcFiles($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery'); + } + + /** + * Filter the query by a related CcPerms object + * + * @param CcPerms $ccPerms the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByCcPerms($ccPerms, $comparison = null) + { + return $this + ->addUsingAlias(CcSubjsPeer::ID, $ccPerms->getSubj(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcPerms relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function joinCcPerms($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcPerms'); + + // 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, 'CcPerms'); + } + + return $this; + } + + /** + * Use the CcPerms relation CcPerms 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 CcPermsQuery A secondary query class using the current class as primary query + */ + public function useCcPermsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcPerms($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcPerms', 'CcPermsQuery'); + } + + /** + * Filter the query by a related CcShowHosts object + * + * @param CcShowHosts $ccShowHosts the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByCcShowHosts($ccShowHosts, $comparison = null) + { + return $this + ->addUsingAlias(CcSubjsPeer::ID, $ccShowHosts->getDbHost(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcShowHosts relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function joinCcShowHosts($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcShowHosts'); + + // 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, 'CcShowHosts'); + } + + return $this; + } + + /** + * Use the CcShowHosts relation CcShowHosts 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 CcShowHostsQuery A secondary query class using the current class as primary query + */ + public function useCcShowHostsQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinCcShowHosts($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcShowHosts', 'CcShowHostsQuery'); + } + + /** + * Filter the query by a related CcPlaylist object + * + * @param CcPlaylist $ccPlaylist the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByCcPlaylist($ccPlaylist, $comparison = null) + { + return $this + ->addUsingAlias(CcSubjsPeer::ID, $ccPlaylist->getDbEditedby(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcPlaylist relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function joinCcPlaylist($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcPlaylist'); + + // 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, 'CcPlaylist'); + } + + return $this; + } + + /** + * Use the CcPlaylist relation CcPlaylist 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 CcPlaylistQuery A secondary query class using the current class as primary query + */ + public function useCcPlaylistQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcPlaylist($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcPlaylist', 'CcPlaylistQuery'); + } + + /** + * Filter the query by a related CcPref object + * + * @param CcPref $ccPref the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByCcPref($ccPref, $comparison = null) + { + return $this + ->addUsingAlias(CcSubjsPeer::ID, $ccPref->getSubjid(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcPref relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function joinCcPref($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcPref'); + + // 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, 'CcPref'); + } + + return $this; + } + + /** + * Use the CcPref relation CcPref 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 CcPrefQuery A secondary query class using the current class as primary query + */ + public function useCcPrefQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcPref($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcPref', 'CcPrefQuery'); + } + + /** + * Filter the query by a related CcSess object + * + * @param CcSess $ccSess the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByCcSess($ccSess, $comparison = null) + { + return $this + ->addUsingAlias(CcSubjsPeer::ID, $ccSess->getUserid(), $comparison); + } + + /** + * Adds a JOIN clause to the query using the CcSess relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function joinCcSess($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('CcSess'); + + // 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, 'CcSess'); + } + + return $this; + } + + /** + * Use the CcSess relation CcSess 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 CcSessQuery A secondary query class using the current class as primary query + */ + public function useCcSessQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinCcSess($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcSess', 'CcSessQuery'); + } + + /** + * Exclude object from result + * + * @param CcSubjs $ccSubjs Object to remove from the list of results + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function prune($ccSubjs = null) + { + if ($ccSubjs) { + $this->addUsingAlias(CcSubjsPeer::ID, $ccSubjs->getDbId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcSubjsQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcTrans.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcTrans.php new file mode 100644 index 000000000..2ea4f7c20 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcTrans.php @@ -0,0 +1,1903 @@ +lock = 'N'; + } + + /** + * Initializes internal state of BaseCcTrans object. + * @see applyDefaults() + */ + public function __construct() + { + parent::__construct(); + $this->applyDefaultValues(); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Get the [trtok] column value. + * + * @return string + */ + public function getTrtok() + { + return $this->trtok; + } + + /** + * Get the [direction] column value. + * + * @return string + */ + public function getDirection() + { + return $this->direction; + } + + /** + * Get the [state] column value. + * + * @return string + */ + public function getState() + { + return $this->state; + } + + /** + * Get the [trtype] column value. + * + * @return string + */ + public function getTrtype() + { + return $this->trtype; + } + + /** + * Get the [lock] column value. + * + * @return string + */ + public function getLock() + { + return $this->lock; + } + + /** + * Get the [target] column value. + * + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Get the [rtrtok] column value. + * + * @return string + */ + public function getRtrtok() + { + return $this->rtrtok; + } + + /** + * Get the [mdtrtok] column value. + * + * @return string + */ + public function getMdtrtok() + { + return $this->mdtrtok; + } + + /** + * Get the [gunid] column value. + * + * @return string + */ + public function getGunid() + { + return $this->gunid; + } + + /** + * Get the [pdtoken] column value. + * + * @return string + */ + public function getPdtoken() + { + return $this->pdtoken; + } + + /** + * Get the [url] column value. + * + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Get the [localfile] column value. + * + * @return string + */ + public function getLocalfile() + { + return $this->localfile; + } + + /** + * Get the [fname] column value. + * + * @return string + */ + public function getFname() + { + return $this->fname; + } + + /** + * Get the [title] column value. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Get the [expectedsum] column value. + * + * @return string + */ + public function getExpectedsum() + { + return $this->expectedsum; + } + + /** + * Get the [realsum] column value. + * + * @return string + */ + public function getRealsum() + { + return $this->realsum; + } + + /** + * Get the [expectedsize] column value. + * + * @return int + */ + public function getExpectedsize() + { + return $this->expectedsize; + } + + /** + * Get the [realsize] column value. + * + * @return int + */ + public function getRealsize() + { + return $this->realsize; + } + + /** + * Get the [uid] column value. + * + * @return int + */ + public function getUid() + { + return $this->uid; + } + + /** + * Get the [errmsg] column value. + * + * @return string + */ + public function getErrmsg() + { + return $this->errmsg; + } + + /** + * Get the [jobpid] column value. + * + * @return int + */ + public function getJobpid() + { + return $this->jobpid; + } + + /** + * Get the [optionally formatted] temporal [start] 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 getStart($format = 'Y-m-d H:i:s') + { + if ($this->start === null) { + return null; + } + + + + try { + $dt = new DateTime($this->start); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->start, 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); + } + } + + /** + * Get the [optionally formatted] temporal [ts] 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 getTs($format = 'Y-m-d H:i:s') + { + if ($this->ts === null) { + return null; + } + + + + try { + $dt = new DateTime($this->ts); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->ts, 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); + } + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CcTransPeer::ID; + } + + return $this; + } // setId() + + /** + * Set the value of [trtok] column. + * + * @param string $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setTrtok($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->trtok !== $v) { + $this->trtok = $v; + $this->modifiedColumns[] = CcTransPeer::TRTOK; + } + + return $this; + } // setTrtok() + + /** + * Set the value of [direction] column. + * + * @param string $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setDirection($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->direction !== $v) { + $this->direction = $v; + $this->modifiedColumns[] = CcTransPeer::DIRECTION; + } + + return $this; + } // setDirection() + + /** + * Set the value of [state] column. + * + * @param string $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setState($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->state !== $v) { + $this->state = $v; + $this->modifiedColumns[] = CcTransPeer::STATE; + } + + return $this; + } // setState() + + /** + * Set the value of [trtype] column. + * + * @param string $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setTrtype($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->trtype !== $v) { + $this->trtype = $v; + $this->modifiedColumns[] = CcTransPeer::TRTYPE; + } + + return $this; + } // setTrtype() + + /** + * Set the value of [lock] column. + * + * @param string $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setLock($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->lock !== $v || $this->isNew()) { + $this->lock = $v; + $this->modifiedColumns[] = CcTransPeer::LOCK; + } + + return $this; + } // setLock() + + /** + * Set the value of [target] column. + * + * @param string $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setTarget($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->target !== $v) { + $this->target = $v; + $this->modifiedColumns[] = CcTransPeer::TARGET; + } + + return $this; + } // setTarget() + + /** + * Set the value of [rtrtok] column. + * + * @param string $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setRtrtok($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->rtrtok !== $v) { + $this->rtrtok = $v; + $this->modifiedColumns[] = CcTransPeer::RTRTOK; + } + + return $this; + } // setRtrtok() + + /** + * Set the value of [mdtrtok] column. + * + * @param string $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setMdtrtok($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->mdtrtok !== $v) { + $this->mdtrtok = $v; + $this->modifiedColumns[] = CcTransPeer::MDTRTOK; + } + + return $this; + } // setMdtrtok() + + /** + * Set the value of [gunid] column. + * + * @param string $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setGunid($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->gunid !== $v) { + $this->gunid = $v; + $this->modifiedColumns[] = CcTransPeer::GUNID; + } + + return $this; + } // setGunid() + + /** + * Set the value of [pdtoken] column. + * + * @param string $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setPdtoken($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->pdtoken !== $v) { + $this->pdtoken = $v; + $this->modifiedColumns[] = CcTransPeer::PDTOKEN; + } + + return $this; + } // setPdtoken() + + /** + * Set the value of [url] column. + * + * @param string $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setUrl($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->url !== $v) { + $this->url = $v; + $this->modifiedColumns[] = CcTransPeer::URL; + } + + return $this; + } // setUrl() + + /** + * Set the value of [localfile] column. + * + * @param string $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setLocalfile($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->localfile !== $v) { + $this->localfile = $v; + $this->modifiedColumns[] = CcTransPeer::LOCALFILE; + } + + return $this; + } // setLocalfile() + + /** + * Set the value of [fname] column. + * + * @param string $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setFname($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->fname !== $v) { + $this->fname = $v; + $this->modifiedColumns[] = CcTransPeer::FNAME; + } + + return $this; + } // setFname() + + /** + * Set the value of [title] column. + * + * @param string $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setTitle($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->title !== $v) { + $this->title = $v; + $this->modifiedColumns[] = CcTransPeer::TITLE; + } + + return $this; + } // setTitle() + + /** + * Set the value of [expectedsum] column. + * + * @param string $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setExpectedsum($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->expectedsum !== $v) { + $this->expectedsum = $v; + $this->modifiedColumns[] = CcTransPeer::EXPECTEDSUM; + } + + return $this; + } // setExpectedsum() + + /** + * Set the value of [realsum] column. + * + * @param string $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setRealsum($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->realsum !== $v) { + $this->realsum = $v; + $this->modifiedColumns[] = CcTransPeer::REALSUM; + } + + return $this; + } // setRealsum() + + /** + * Set the value of [expectedsize] column. + * + * @param int $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setExpectedsize($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->expectedsize !== $v) { + $this->expectedsize = $v; + $this->modifiedColumns[] = CcTransPeer::EXPECTEDSIZE; + } + + return $this; + } // setExpectedsize() + + /** + * Set the value of [realsize] column. + * + * @param int $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setRealsize($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->realsize !== $v) { + $this->realsize = $v; + $this->modifiedColumns[] = CcTransPeer::REALSIZE; + } + + return $this; + } // setRealsize() + + /** + * Set the value of [uid] column. + * + * @param int $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setUid($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->uid !== $v) { + $this->uid = $v; + $this->modifiedColumns[] = CcTransPeer::UID; + } + + return $this; + } // setUid() + + /** + * Set the value of [errmsg] column. + * + * @param string $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setErrmsg($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->errmsg !== $v) { + $this->errmsg = $v; + $this->modifiedColumns[] = CcTransPeer::ERRMSG; + } + + return $this; + } // setErrmsg() + + /** + * Set the value of [jobpid] column. + * + * @param int $v new value + * @return CcTrans The current object (for fluent API support) + */ + public function setJobpid($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->jobpid !== $v) { + $this->jobpid = $v; + $this->modifiedColumns[] = CcTransPeer::JOBPID; + } + + return $this; + } // setJobpid() + + /** + * Sets the value of [start] 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 CcTrans The current object (for fluent API support) + */ + public function setStart($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->start !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->start !== null && $tmpDt = new DateTime($this->start)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->start = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); + $this->modifiedColumns[] = CcTransPeer::START; + } + } // if either are not null + + return $this; + } // setStart() + + /** + * Sets the value of [ts] 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 CcTrans The current object (for fluent API support) + */ + public function setTs($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->ts !== null || $dt !== null ) { + // (nested ifs are a little easier to read in this case) + + $currNorm = ($this->ts !== null && $tmpDt = new DateTime($this->ts)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null; + $newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null; + + if ( ($currNorm !== $newNorm) // normalized values don't match + ) + { + $this->ts = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null); + $this->modifiedColumns[] = CcTransPeer::TS; + } + } // if either are not null + + return $this; + } // setTs() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + if ($this->lock !== 'N') { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->trtok = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->direction = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->state = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->trtype = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->lock = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; + $this->target = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->rtrtok = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; + $this->mdtrtok = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; + $this->gunid = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; + $this->pdtoken = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; + $this->url = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; + $this->localfile = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null; + $this->fname = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null; + $this->title = ($row[$startcol + 14] !== null) ? (string) $row[$startcol + 14] : null; + $this->expectedsum = ($row[$startcol + 15] !== null) ? (string) $row[$startcol + 15] : null; + $this->realsum = ($row[$startcol + 16] !== null) ? (string) $row[$startcol + 16] : null; + $this->expectedsize = ($row[$startcol + 17] !== null) ? (int) $row[$startcol + 17] : null; + $this->realsize = ($row[$startcol + 18] !== null) ? (int) $row[$startcol + 18] : null; + $this->uid = ($row[$startcol + 19] !== null) ? (int) $row[$startcol + 19] : null; + $this->errmsg = ($row[$startcol + 20] !== null) ? (string) $row[$startcol + 20] : null; + $this->jobpid = ($row[$startcol + 21] !== null) ? (int) $row[$startcol + 21] : null; + $this->start = ($row[$startcol + 22] !== null) ? (string) $row[$startcol + 22] : null; + $this->ts = ($row[$startcol + 23] !== null) ? (string) $row[$startcol + 23] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 24; // 24 = CcTransPeer::NUM_COLUMNS - CcTransPeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcTrans object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $stmt = CcTransPeer::doSelectStmt($this->buildPkeyCriteria(), $con); + $row = $stmt->fetch(PDO::FETCH_NUM); + $stmt->closeCursor(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true); // rehydrate + + if ($deep) { // also de-associate any related objects? + + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param PropelPDO $con + * @return void + * @throws PropelException + * @see BaseObject::setDeleted() + * @see BaseObject::isDeleted() + */ + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcTransQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()) + ->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + CcTransPeer::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param PropelPDO $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(PropelPDO $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + if ($this->isNew() ) { + $this->modifiedColumns[] = CcTransPeer::ID; + } + + // If this object has been modified, then save it to the database. + if ($this->isModified()) { + if ($this->isNew()) { + $criteria = $this->buildCriteria(); + if ($criteria->keyContainsValue(CcTransPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcTransPeer::ID.')'); + } + + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows = 1; + $this->setId($pk); //[IMV] update autoincrement primary key + $this->setNew(false); + } else { + $affectedRows = CcTransPeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = CcTransPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return mixed Value of field. + */ + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcTransPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getTrtok(); + break; + case 2: + return $this->getDirection(); + break; + case 3: + return $this->getState(); + break; + case 4: + return $this->getTrtype(); + break; + case 5: + return $this->getLock(); + break; + case 6: + return $this->getTarget(); + break; + case 7: + return $this->getRtrtok(); + break; + case 8: + return $this->getMdtrtok(); + break; + case 9: + return $this->getGunid(); + break; + case 10: + return $this->getPdtoken(); + break; + case 11: + return $this->getUrl(); + break; + case 12: + return $this->getLocalfile(); + break; + case 13: + return $this->getFname(); + break; + case 14: + return $this->getTitle(); + break; + case 15: + return $this->getExpectedsum(); + break; + case 16: + return $this->getRealsum(); + break; + case 17: + return $this->getExpectedsize(); + break; + case 18: + return $this->getRealsize(); + break; + case 19: + return $this->getUid(); + break; + case 20: + return $this->getErrmsg(); + break; + case 21: + return $this->getJobpid(); + break; + case 22: + return $this->getStart(); + break; + case 23: + return $this->getTs(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * Defaults to BasePeer::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = CcTransPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getTrtok(), + $keys[2] => $this->getDirection(), + $keys[3] => $this->getState(), + $keys[4] => $this->getTrtype(), + $keys[5] => $this->getLock(), + $keys[6] => $this->getTarget(), + $keys[7] => $this->getRtrtok(), + $keys[8] => $this->getMdtrtok(), + $keys[9] => $this->getGunid(), + $keys[10] => $this->getPdtoken(), + $keys[11] => $this->getUrl(), + $keys[12] => $this->getLocalfile(), + $keys[13] => $this->getFname(), + $keys[14] => $this->getTitle(), + $keys[15] => $this->getExpectedsum(), + $keys[16] => $this->getRealsum(), + $keys[17] => $this->getExpectedsize(), + $keys[18] => $this->getRealsize(), + $keys[19] => $this->getUid(), + $keys[20] => $this->getErrmsg(), + $keys[21] => $this->getJobpid(), + $keys[22] => $this->getStart(), + $keys[23] => $this->getTs(), + ); + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name peer name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return void + */ + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = CcTransPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setId($value); + break; + case 1: + $this->setTrtok($value); + break; + case 2: + $this->setDirection($value); + break; + case 3: + $this->setState($value); + break; + case 4: + $this->setTrtype($value); + break; + case 5: + $this->setLock($value); + break; + case 6: + $this->setTarget($value); + break; + case 7: + $this->setRtrtok($value); + break; + case 8: + $this->setMdtrtok($value); + break; + case 9: + $this->setGunid($value); + break; + case 10: + $this->setPdtoken($value); + break; + case 11: + $this->setUrl($value); + break; + case 12: + $this->setLocalfile($value); + break; + case 13: + $this->setFname($value); + break; + case 14: + $this->setTitle($value); + break; + case 15: + $this->setExpectedsum($value); + break; + case 16: + $this->setRealsum($value); + break; + case 17: + $this->setExpectedsize($value); + break; + case 18: + $this->setRealsize($value); + break; + case 19: + $this->setUid($value); + break; + case 20: + $this->setErrmsg($value); + break; + case 21: + $this->setJobpid($value); + break; + case 22: + $this->setStart($value); + break; + case 23: + $this->setTs($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. + * The default key type is the column's phpname (e.g. 'AuthorId') + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = CcTransPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setTrtok($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDirection($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setState($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setTrtype($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setLock($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setTarget($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setRtrtok($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setMdtrtok($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setGunid($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setPdtoken($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setUrl($arr[$keys[11]]); + if (array_key_exists($keys[12], $arr)) $this->setLocalfile($arr[$keys[12]]); + if (array_key_exists($keys[13], $arr)) $this->setFname($arr[$keys[13]]); + if (array_key_exists($keys[14], $arr)) $this->setTitle($arr[$keys[14]]); + if (array_key_exists($keys[15], $arr)) $this->setExpectedsum($arr[$keys[15]]); + if (array_key_exists($keys[16], $arr)) $this->setRealsum($arr[$keys[16]]); + if (array_key_exists($keys[17], $arr)) $this->setExpectedsize($arr[$keys[17]]); + if (array_key_exists($keys[18], $arr)) $this->setRealsize($arr[$keys[18]]); + if (array_key_exists($keys[19], $arr)) $this->setUid($arr[$keys[19]]); + if (array_key_exists($keys[20], $arr)) $this->setErrmsg($arr[$keys[20]]); + if (array_key_exists($keys[21], $arr)) $this->setJobpid($arr[$keys[21]]); + if (array_key_exists($keys[22], $arr)) $this->setStart($arr[$keys[22]]); + if (array_key_exists($keys[23], $arr)) $this->setTs($arr[$keys[23]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(CcTransPeer::DATABASE_NAME); + + if ($this->isColumnModified(CcTransPeer::ID)) $criteria->add(CcTransPeer::ID, $this->id); + if ($this->isColumnModified(CcTransPeer::TRTOK)) $criteria->add(CcTransPeer::TRTOK, $this->trtok); + if ($this->isColumnModified(CcTransPeer::DIRECTION)) $criteria->add(CcTransPeer::DIRECTION, $this->direction); + if ($this->isColumnModified(CcTransPeer::STATE)) $criteria->add(CcTransPeer::STATE, $this->state); + if ($this->isColumnModified(CcTransPeer::TRTYPE)) $criteria->add(CcTransPeer::TRTYPE, $this->trtype); + if ($this->isColumnModified(CcTransPeer::LOCK)) $criteria->add(CcTransPeer::LOCK, $this->lock); + if ($this->isColumnModified(CcTransPeer::TARGET)) $criteria->add(CcTransPeer::TARGET, $this->target); + if ($this->isColumnModified(CcTransPeer::RTRTOK)) $criteria->add(CcTransPeer::RTRTOK, $this->rtrtok); + if ($this->isColumnModified(CcTransPeer::MDTRTOK)) $criteria->add(CcTransPeer::MDTRTOK, $this->mdtrtok); + if ($this->isColumnModified(CcTransPeer::GUNID)) $criteria->add(CcTransPeer::GUNID, $this->gunid); + if ($this->isColumnModified(CcTransPeer::PDTOKEN)) $criteria->add(CcTransPeer::PDTOKEN, $this->pdtoken); + if ($this->isColumnModified(CcTransPeer::URL)) $criteria->add(CcTransPeer::URL, $this->url); + if ($this->isColumnModified(CcTransPeer::LOCALFILE)) $criteria->add(CcTransPeer::LOCALFILE, $this->localfile); + if ($this->isColumnModified(CcTransPeer::FNAME)) $criteria->add(CcTransPeer::FNAME, $this->fname); + if ($this->isColumnModified(CcTransPeer::TITLE)) $criteria->add(CcTransPeer::TITLE, $this->title); + if ($this->isColumnModified(CcTransPeer::EXPECTEDSUM)) $criteria->add(CcTransPeer::EXPECTEDSUM, $this->expectedsum); + if ($this->isColumnModified(CcTransPeer::REALSUM)) $criteria->add(CcTransPeer::REALSUM, $this->realsum); + if ($this->isColumnModified(CcTransPeer::EXPECTEDSIZE)) $criteria->add(CcTransPeer::EXPECTEDSIZE, $this->expectedsize); + if ($this->isColumnModified(CcTransPeer::REALSIZE)) $criteria->add(CcTransPeer::REALSIZE, $this->realsize); + if ($this->isColumnModified(CcTransPeer::UID)) $criteria->add(CcTransPeer::UID, $this->uid); + if ($this->isColumnModified(CcTransPeer::ERRMSG)) $criteria->add(CcTransPeer::ERRMSG, $this->errmsg); + if ($this->isColumnModified(CcTransPeer::JOBPID)) $criteria->add(CcTransPeer::JOBPID, $this->jobpid); + if ($this->isColumnModified(CcTransPeer::START)) $criteria->add(CcTransPeer::START, $this->start); + if ($this->isColumnModified(CcTransPeer::TS)) $criteria->add(CcTransPeer::TS, $this->ts); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(CcTransPeer::DATABASE_NAME); + $criteria->add(CcTransPeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcTrans (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false) + { + $copyObj->setTrtok($this->trtok); + $copyObj->setDirection($this->direction); + $copyObj->setState($this->state); + $copyObj->setTrtype($this->trtype); + $copyObj->setLock($this->lock); + $copyObj->setTarget($this->target); + $copyObj->setRtrtok($this->rtrtok); + $copyObj->setMdtrtok($this->mdtrtok); + $copyObj->setGunid($this->gunid); + $copyObj->setPdtoken($this->pdtoken); + $copyObj->setUrl($this->url); + $copyObj->setLocalfile($this->localfile); + $copyObj->setFname($this->fname); + $copyObj->setTitle($this->title); + $copyObj->setExpectedsum($this->expectedsum); + $copyObj->setRealsum($this->realsum); + $copyObj->setExpectedsize($this->expectedsize); + $copyObj->setRealsize($this->realsize); + $copyObj->setUid($this->uid); + $copyObj->setErrmsg($this->errmsg); + $copyObj->setJobpid($this->jobpid); + $copyObj->setStart($this->start); + $copyObj->setTs($this->ts); + + $copyObj->setNew(true); + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcTrans Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + return $copyObj; + } + + /** + * Returns a peer instance associated with this om. + * + * Since Peer classes are not to have any instance attributes, this method returns the + * same instance for all member of this class. The method could therefore + * be static, but this would prevent one from overriding the behavior. + * + * @return CcTransPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcTransPeer(); + } + return self::$peer; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->trtok = null; + $this->direction = null; + $this->state = null; + $this->trtype = null; + $this->lock = null; + $this->target = null; + $this->rtrtok = null; + $this->mdtrtok = null; + $this->gunid = null; + $this->pdtoken = null; + $this->url = null; + $this->localfile = null; + $this->fname = null; + $this->title = null; + $this->expectedsum = null; + $this->realsum = null; + $this->expectedsize = null; + $this->realsize = null; + $this->uid = null; + $this->errmsg = null; + $this->jobpid = null; + $this->start = null; + $this->ts = null; + $this->alreadyInSave = false; + $this->alreadyInValidation = false; + $this->clearAllReferences(); + $this->applyDefaultValues(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all collections of referencing foreign keys. + * + * This method is a user-space workaround for PHP's inability to garbage collect objects + * with circular references. This is currently necessary when using Propel in certain + * daemon or large-volumne/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all associated objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + } + + /** + * Catches calls to virtual methods + */ + public function __call($name, $params) + { + if (preg_match('/get(\w+)/', $name, $matches)) { + $virtualColumn = $matches[1]; + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + // no lcfirst in php<5.3... + $virtualColumn[0] = strtolower($virtualColumn[0]); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + throw new PropelException('Call to undefined method: ' . $name); + } + +} // BaseCcTrans diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcTransPeer.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcTransPeer.php new file mode 100644 index 000000000..bac6b9ed8 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcTransPeer.php @@ -0,0 +1,849 @@ + array ('Id', 'Trtok', 'Direction', 'State', 'Trtype', 'Lock', 'Target', 'Rtrtok', 'Mdtrtok', 'Gunid', 'Pdtoken', 'Url', 'Localfile', 'Fname', 'Title', 'Expectedsum', 'Realsum', 'Expectedsize', 'Realsize', 'Uid', 'Errmsg', 'Jobpid', 'Start', 'Ts', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'trtok', 'direction', 'state', 'trtype', 'lock', 'target', 'rtrtok', 'mdtrtok', 'gunid', 'pdtoken', 'url', 'localfile', 'fname', 'title', 'expectedsum', 'realsum', 'expectedsize', 'realsize', 'uid', 'errmsg', 'jobpid', 'start', 'ts', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::TRTOK, self::DIRECTION, self::STATE, self::TRTYPE, self::LOCK, self::TARGET, self::RTRTOK, self::MDTRTOK, self::GUNID, self::PDTOKEN, self::URL, self::LOCALFILE, self::FNAME, self::TITLE, self::EXPECTEDSUM, self::REALSUM, self::EXPECTEDSIZE, self::REALSIZE, self::UID, self::ERRMSG, self::JOBPID, self::START, self::TS, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TRTOK', 'DIRECTION', 'STATE', 'TRTYPE', 'LOCK', 'TARGET', 'RTRTOK', 'MDTRTOK', 'GUNID', 'PDTOKEN', 'URL', 'LOCALFILE', 'FNAME', 'TITLE', 'EXPECTEDSUM', 'REALSUM', 'EXPECTEDSIZE', 'REALSIZE', 'UID', 'ERRMSG', 'JOBPID', 'START', 'TS', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'trtok', 'direction', 'state', 'trtype', 'lock', 'target', 'rtrtok', 'mdtrtok', 'gunid', 'pdtoken', 'url', 'localfile', 'fname', 'title', 'expectedsum', 'realsum', 'expectedsize', 'realsize', 'uid', 'errmsg', 'jobpid', 'start', 'ts', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Trtok' => 1, 'Direction' => 2, 'State' => 3, 'Trtype' => 4, 'Lock' => 5, 'Target' => 6, 'Rtrtok' => 7, 'Mdtrtok' => 8, 'Gunid' => 9, 'Pdtoken' => 10, 'Url' => 11, 'Localfile' => 12, 'Fname' => 13, 'Title' => 14, 'Expectedsum' => 15, 'Realsum' => 16, 'Expectedsize' => 17, 'Realsize' => 18, 'Uid' => 19, 'Errmsg' => 20, 'Jobpid' => 21, 'Start' => 22, 'Ts' => 23, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'trtok' => 1, 'direction' => 2, 'state' => 3, 'trtype' => 4, 'lock' => 5, 'target' => 6, 'rtrtok' => 7, 'mdtrtok' => 8, 'gunid' => 9, 'pdtoken' => 10, 'url' => 11, 'localfile' => 12, 'fname' => 13, 'title' => 14, 'expectedsum' => 15, 'realsum' => 16, 'expectedsize' => 17, 'realsize' => 18, 'uid' => 19, 'errmsg' => 20, 'jobpid' => 21, 'start' => 22, 'ts' => 23, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TRTOK => 1, self::DIRECTION => 2, self::STATE => 3, self::TRTYPE => 4, self::LOCK => 5, self::TARGET => 6, self::RTRTOK => 7, self::MDTRTOK => 8, self::GUNID => 9, self::PDTOKEN => 10, self::URL => 11, self::LOCALFILE => 12, self::FNAME => 13, self::TITLE => 14, self::EXPECTEDSUM => 15, self::REALSUM => 16, self::EXPECTEDSIZE => 17, self::REALSIZE => 18, self::UID => 19, self::ERRMSG => 20, self::JOBPID => 21, self::START => 22, self::TS => 23, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TRTOK' => 1, 'DIRECTION' => 2, 'STATE' => 3, 'TRTYPE' => 4, 'LOCK' => 5, 'TARGET' => 6, 'RTRTOK' => 7, 'MDTRTOK' => 8, 'GUNID' => 9, 'PDTOKEN' => 10, 'URL' => 11, 'LOCALFILE' => 12, 'FNAME' => 13, 'TITLE' => 14, 'EXPECTEDSUM' => 15, 'REALSUM' => 16, 'EXPECTEDSIZE' => 17, 'REALSIZE' => 18, 'UID' => 19, 'ERRMSG' => 20, 'JOBPID' => 21, 'START' => 22, 'TS' => 23, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'trtok' => 1, 'direction' => 2, 'state' => 3, 'trtype' => 4, 'lock' => 5, 'target' => 6, 'rtrtok' => 7, 'mdtrtok' => 8, 'gunid' => 9, 'pdtoken' => 10, 'url' => 11, 'localfile' => 12, 'fname' => 13, 'title' => 14, 'expectedsum' => 15, 'realsum' => 16, 'expectedsize' => 17, 'realsize' => 18, 'uid' => 19, 'errmsg' => 20, 'jobpid' => 21, 'start' => 22, 'ts' => 23, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcTransPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcTransPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(CcTransPeer::ID); + $criteria->addSelectColumn(CcTransPeer::TRTOK); + $criteria->addSelectColumn(CcTransPeer::DIRECTION); + $criteria->addSelectColumn(CcTransPeer::STATE); + $criteria->addSelectColumn(CcTransPeer::TRTYPE); + $criteria->addSelectColumn(CcTransPeer::LOCK); + $criteria->addSelectColumn(CcTransPeer::TARGET); + $criteria->addSelectColumn(CcTransPeer::RTRTOK); + $criteria->addSelectColumn(CcTransPeer::MDTRTOK); + $criteria->addSelectColumn(CcTransPeer::GUNID); + $criteria->addSelectColumn(CcTransPeer::PDTOKEN); + $criteria->addSelectColumn(CcTransPeer::URL); + $criteria->addSelectColumn(CcTransPeer::LOCALFILE); + $criteria->addSelectColumn(CcTransPeer::FNAME); + $criteria->addSelectColumn(CcTransPeer::TITLE); + $criteria->addSelectColumn(CcTransPeer::EXPECTEDSUM); + $criteria->addSelectColumn(CcTransPeer::REALSUM); + $criteria->addSelectColumn(CcTransPeer::EXPECTEDSIZE); + $criteria->addSelectColumn(CcTransPeer::REALSIZE); + $criteria->addSelectColumn(CcTransPeer::UID); + $criteria->addSelectColumn(CcTransPeer::ERRMSG); + $criteria->addSelectColumn(CcTransPeer::JOBPID); + $criteria->addSelectColumn(CcTransPeer::START); + $criteria->addSelectColumn(CcTransPeer::TS); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.TRTOK'); + $criteria->addSelectColumn($alias . '.DIRECTION'); + $criteria->addSelectColumn($alias . '.STATE'); + $criteria->addSelectColumn($alias . '.TRTYPE'); + $criteria->addSelectColumn($alias . '.LOCK'); + $criteria->addSelectColumn($alias . '.TARGET'); + $criteria->addSelectColumn($alias . '.RTRTOK'); + $criteria->addSelectColumn($alias . '.MDTRTOK'); + $criteria->addSelectColumn($alias . '.GUNID'); + $criteria->addSelectColumn($alias . '.PDTOKEN'); + $criteria->addSelectColumn($alias . '.URL'); + $criteria->addSelectColumn($alias . '.LOCALFILE'); + $criteria->addSelectColumn($alias . '.FNAME'); + $criteria->addSelectColumn($alias . '.TITLE'); + $criteria->addSelectColumn($alias . '.EXPECTEDSUM'); + $criteria->addSelectColumn($alias . '.REALSUM'); + $criteria->addSelectColumn($alias . '.EXPECTEDSIZE'); + $criteria->addSelectColumn($alias . '.REALSIZE'); + $criteria->addSelectColumn($alias . '.UID'); + $criteria->addSelectColumn($alias . '.ERRMSG'); + $criteria->addSelectColumn($alias . '.JOBPID'); + $criteria->addSelectColumn($alias . '.START'); + $criteria->addSelectColumn($alias . '.TS'); + } + } + + /** + * Returns the number of rows matching criteria. + * + * @param Criteria $criteria + * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead. + * @param PropelPDO $con + * @return int Number of matching rows. + */ + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + // we may modify criteria, so copy it first + $criteria = clone $criteria; + + // We need to set the primary table name, since in the case that there are no WHERE columns + // it will be impossible for the BasePeer::createSelectSql() method to determine which + // tables go into the FROM clause. + $criteria->setPrimaryTableName(CcTransPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcTransPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + // BasePeer returns a PDOStatement + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + return $count; + } + /** + * Method to select one object from the DB. + * + * @param Criteria $criteria object used to create the SELECT statement. + * @param PropelPDO $con + * @return CcTrans + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectOne(Criteria $criteria, PropelPDO $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = CcTransPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + /** + * Method to do selects. + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con + * @return array Array of selected Objects + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return CcTransPeer::populateObjects(CcTransPeer::doSelectStmt($criteria, $con)); + } + /** + * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement. + * + * Use this method directly if you want to work with an executed statement durirectly (for example + * to perform your own object hydration). + * + * @param Criteria $criteria The Criteria object used to build the SELECT statement. + * @param PropelPDO $con The connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return PDOStatement The executed PDOStatement object. + * @see BasePeer::doSelect() + */ + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcTransPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + // BasePeer returns a PDOStatement + return BasePeer::doSelect($criteria, $con); + } + /** + * Adds an object to the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doSelect*() + * methods in your stub classes -- you may need to explicitly add objects + * to the cache in order to ensure that the same objects are always returned by doSelect*() + * and retrieveByPK*() calls. + * + * @param CcTrans $value A CcTrans object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcTrans $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcTrans object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcTrans) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcTrans object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(self::$instances[$key]); + } + } // removeInstanceFromPool() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param string $key The key (@see getPrimaryKeyHash()) for this instance. + * @return CcTrans Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled. + * @see getPrimaryKeyHash() + */ + public static function getInstanceFromPool($key) + { + if (Propel::isInstancePoolingEnabled()) { + if (isset(self::$instances[$key])) { + return self::$instances[$key]; + } + } + return null; // just to be explicit + } + + /** + * Clear the instance pool. + * + * @return void + */ + public static function clearInstancePool() + { + self::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to cc_trans + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcTransPeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcTransPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcTransPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + CcTransPeer::addInstanceToPool($obj, $key); + } // if key exists + } + $stmt->closeCursor(); + return $results; + } + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (CcTrans object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcTransPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcTransPeer::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $startcol, true); // rehydrate + $col = $startcol + CcTransPeer::NUM_COLUMNS; + } else { + $cls = CcTransPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcTransPeer::addInstanceToPool($obj, $key); + } + return array($obj, $col); + } + /** + * Returns the TableMap related to this peer. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BaseCcTransPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcTransPeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcTransTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is tranalted into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? CcTransPeer::CLASS_DEFAULT : CcTransPeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcTrans or Criteria object. + * + * @param mixed $values Criteria or CcTrans object containing data that is used to create the INSERT statement. + * @param PropelPDO $con the PropelPDO connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcTrans object + } + + if ($criteria->containsKey(CcTransPeer::ID) && $criteria->keyContainsValue(CcTransPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcTransPeer::ID.')'); + } + + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + + /** + * Method perform an UPDATE on the database, given a CcTrans or Criteria object. + * + * @param mixed $values Criteria or CcTrans object containing data that is used to create the UPDATE statement. + * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions). + * @return int The number of affected rows (if supported by underlying database driver). + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doUpdate($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcTransPeer::ID); + $value = $criteria->remove(CcTransPeer::ID); + if ($value) { + $selectCriteria->add(CcTransPeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcTransPeer::TABLE_NAME); + } + + } else { // $values is CcTrans object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Method to DELETE all rows from the cc_trans table. + * + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll($con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(CcTransPeer::TABLE_NAME, $con, CcTransPeer::DATABASE_NAME); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + CcTransPeer::clearInstancePool(); + CcTransPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcTrans or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcTrans object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param PropelPDO $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + // invalidate the cache for all objects of this type, since we have no + // way of knowing (without running a query) what objects should be invalidated + // from the cache based on this Criteria. + CcTransPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcTrans) { // it's a model object + // invalidate the cache for this single object + CcTransPeer::removeInstanceFromPool($values); + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(CcTransPeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcTransPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + CcTransPeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcTrans object. + * If parameter $columns is either a single column name or an array of column names + * than only those columns are validated. + * + * NOTICE: This does not apply to primary or foreign keys for now. + * + * @param CcTrans $obj The object to validate. + * @param mixed $cols Column name or array of column names. + * + * @return mixed TRUE if all columns are valid or the error message of the first invalid column. + */ + public static function doValidate(CcTrans $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcTransPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcTransPeer::TABLE_NAME); + + if (! is_array($cols)) { + $cols = array($cols); + } + + foreach ($cols as $colName) { + if ($tableMap->containsColumn($colName)) { + $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); + $columns[$colName] = $obj->$get(); + } + } + } else { + + } + + return BasePeer::doValidate(CcTransPeer::DATABASE_NAME, CcTransPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcTrans + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcTransPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcTransPeer::DATABASE_NAME); + $criteria->add(CcTransPeer::ID, $pk); + + $v = CcTransPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + /** + * Retrieve multiple objects by pkey. + * + * @param array $pks List of primary keys + * @param PropelPDO $con the connection to use + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(CcTransPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcTransPeer::DATABASE_NAME); + $criteria->add(CcTransPeer::ID, $pks, Criteria::IN); + $objs = CcTransPeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcTransPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcTransPeer::buildTableMap(); + diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcTransQuery.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcTransQuery.php new file mode 100644 index 000000000..0bbccae2f --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/BaseCcTransQuery.php @@ -0,0 +1,826 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcTrans|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcTransPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcTransQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcTransPeer::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return CcTransQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcTransPeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * @param int|array $id 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 CcTransQuery The current query, for fluid interface + */ + public function filterById($id = null, $comparison = null) + { + if (is_array($id) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcTransPeer::ID, $id, $comparison); + } + + /** + * Filter the query on the trtok column + * + * @param string $trtok The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcTransQuery The current query, for fluid interface + */ + public function filterByTrtok($trtok = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($trtok)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $trtok)) { + $trtok = str_replace('*', '%', $trtok); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcTransPeer::TRTOK, $trtok, $comparison); + } + + /** + * Filter the query on the direction column + * + * @param string $direction The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcTransQuery The current query, for fluid interface + */ + public function filterByDirection($direction = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($direction)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $direction)) { + $direction = str_replace('*', '%', $direction); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcTransPeer::DIRECTION, $direction, $comparison); + } + + /** + * Filter the query on the state column + * + * @param string $state The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcTransQuery The current query, for fluid interface + */ + public function filterByState($state = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($state)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $state)) { + $state = str_replace('*', '%', $state); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcTransPeer::STATE, $state, $comparison); + } + + /** + * Filter the query on the trtype column + * + * @param string $trtype The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcTransQuery The current query, for fluid interface + */ + public function filterByTrtype($trtype = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($trtype)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $trtype)) { + $trtype = str_replace('*', '%', $trtype); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcTransPeer::TRTYPE, $trtype, $comparison); + } + + /** + * Filter the query on the lock column + * + * @param string $lock The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcTransQuery The current query, for fluid interface + */ + public function filterByLock($lock = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($lock)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $lock)) { + $lock = str_replace('*', '%', $lock); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcTransPeer::LOCK, $lock, $comparison); + } + + /** + * Filter the query on the target column + * + * @param string $target The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcTransQuery The current query, for fluid interface + */ + public function filterByTarget($target = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($target)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $target)) { + $target = str_replace('*', '%', $target); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcTransPeer::TARGET, $target, $comparison); + } + + /** + * Filter the query on the rtrtok column + * + * @param string $rtrtok The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcTransQuery The current query, for fluid interface + */ + public function filterByRtrtok($rtrtok = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($rtrtok)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $rtrtok)) { + $rtrtok = str_replace('*', '%', $rtrtok); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcTransPeer::RTRTOK, $rtrtok, $comparison); + } + + /** + * Filter the query on the mdtrtok column + * + * @param string $mdtrtok The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcTransQuery The current query, for fluid interface + */ + public function filterByMdtrtok($mdtrtok = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($mdtrtok)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $mdtrtok)) { + $mdtrtok = str_replace('*', '%', $mdtrtok); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcTransPeer::MDTRTOK, $mdtrtok, $comparison); + } + + /** + * Filter the query on the gunid column + * + * @param string $gunid The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcTransQuery The current query, for fluid interface + */ + public function filterByGunid($gunid = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($gunid)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $gunid)) { + $gunid = str_replace('*', '%', $gunid); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcTransPeer::GUNID, $gunid, $comparison); + } + + /** + * Filter the query on the pdtoken column + * + * @param string|array $pdtoken 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 CcTransQuery The current query, for fluid interface + */ + public function filterByPdtoken($pdtoken = null, $comparison = null) + { + if (is_array($pdtoken)) { + $useMinMax = false; + if (isset($pdtoken['min'])) { + $this->addUsingAlias(CcTransPeer::PDTOKEN, $pdtoken['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($pdtoken['max'])) { + $this->addUsingAlias(CcTransPeer::PDTOKEN, $pdtoken['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcTransPeer::PDTOKEN, $pdtoken, $comparison); + } + + /** + * Filter the query on the url column + * + * @param string $url The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcTransQuery The current query, for fluid interface + */ + public function filterByUrl($url = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($url)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $url)) { + $url = str_replace('*', '%', $url); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcTransPeer::URL, $url, $comparison); + } + + /** + * Filter the query on the localfile column + * + * @param string $localfile The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcTransQuery The current query, for fluid interface + */ + public function filterByLocalfile($localfile = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($localfile)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $localfile)) { + $localfile = str_replace('*', '%', $localfile); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcTransPeer::LOCALFILE, $localfile, $comparison); + } + + /** + * Filter the query on the fname column + * + * @param string $fname The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcTransQuery The current query, for fluid interface + */ + public function filterByFname($fname = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($fname)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $fname)) { + $fname = str_replace('*', '%', $fname); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcTransPeer::FNAME, $fname, $comparison); + } + + /** + * Filter the query on the title column + * + * @param string $title The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcTransQuery The current query, for fluid interface + */ + public function filterByTitle($title = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($title)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $title)) { + $title = str_replace('*', '%', $title); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcTransPeer::TITLE, $title, $comparison); + } + + /** + * Filter the query on the expectedsum column + * + * @param string $expectedsum The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcTransQuery The current query, for fluid interface + */ + public function filterByExpectedsum($expectedsum = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($expectedsum)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $expectedsum)) { + $expectedsum = str_replace('*', '%', $expectedsum); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcTransPeer::EXPECTEDSUM, $expectedsum, $comparison); + } + + /** + * Filter the query on the realsum column + * + * @param string $realsum The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcTransQuery The current query, for fluid interface + */ + public function filterByRealsum($realsum = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($realsum)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $realsum)) { + $realsum = str_replace('*', '%', $realsum); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcTransPeer::REALSUM, $realsum, $comparison); + } + + /** + * Filter the query on the expectedsize column + * + * @param int|array $expectedsize 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 CcTransQuery The current query, for fluid interface + */ + public function filterByExpectedsize($expectedsize = null, $comparison = null) + { + if (is_array($expectedsize)) { + $useMinMax = false; + if (isset($expectedsize['min'])) { + $this->addUsingAlias(CcTransPeer::EXPECTEDSIZE, $expectedsize['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($expectedsize['max'])) { + $this->addUsingAlias(CcTransPeer::EXPECTEDSIZE, $expectedsize['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcTransPeer::EXPECTEDSIZE, $expectedsize, $comparison); + } + + /** + * Filter the query on the realsize column + * + * @param int|array $realsize 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 CcTransQuery The current query, for fluid interface + */ + public function filterByRealsize($realsize = null, $comparison = null) + { + if (is_array($realsize)) { + $useMinMax = false; + if (isset($realsize['min'])) { + $this->addUsingAlias(CcTransPeer::REALSIZE, $realsize['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($realsize['max'])) { + $this->addUsingAlias(CcTransPeer::REALSIZE, $realsize['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcTransPeer::REALSIZE, $realsize, $comparison); + } + + /** + * Filter the query on the uid column + * + * @param int|array $uid 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 CcTransQuery The current query, for fluid interface + */ + public function filterByUid($uid = null, $comparison = null) + { + if (is_array($uid)) { + $useMinMax = false; + if (isset($uid['min'])) { + $this->addUsingAlias(CcTransPeer::UID, $uid['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($uid['max'])) { + $this->addUsingAlias(CcTransPeer::UID, $uid['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcTransPeer::UID, $uid, $comparison); + } + + /** + * Filter the query on the errmsg column + * + * @param string $errmsg The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcTransQuery The current query, for fluid interface + */ + public function filterByErrmsg($errmsg = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($errmsg)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $errmsg)) { + $errmsg = str_replace('*', '%', $errmsg); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcTransPeer::ERRMSG, $errmsg, $comparison); + } + + /** + * Filter the query on the jobpid column + * + * @param int|array $jobpid 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 CcTransQuery The current query, for fluid interface + */ + public function filterByJobpid($jobpid = null, $comparison = null) + { + if (is_array($jobpid)) { + $useMinMax = false; + if (isset($jobpid['min'])) { + $this->addUsingAlias(CcTransPeer::JOBPID, $jobpid['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($jobpid['max'])) { + $this->addUsingAlias(CcTransPeer::JOBPID, $jobpid['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcTransPeer::JOBPID, $jobpid, $comparison); + } + + /** + * Filter the query on the start column + * + * @param string|array $start 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 CcTransQuery The current query, for fluid interface + */ + public function filterByStart($start = null, $comparison = null) + { + if (is_array($start)) { + $useMinMax = false; + if (isset($start['min'])) { + $this->addUsingAlias(CcTransPeer::START, $start['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($start['max'])) { + $this->addUsingAlias(CcTransPeer::START, $start['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcTransPeer::START, $start, $comparison); + } + + /** + * Filter the query on the ts column + * + * @param string|array $ts 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 CcTransQuery The current query, for fluid interface + */ + public function filterByTs($ts = null, $comparison = null) + { + if (is_array($ts)) { + $useMinMax = false; + if (isset($ts['min'])) { + $this->addUsingAlias(CcTransPeer::TS, $ts['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($ts['max'])) { + $this->addUsingAlias(CcTransPeer::TS, $ts['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + return $this->addUsingAlias(CcTransPeer::TS, $ts, $comparison); + } + + /** + * Exclude object from result + * + * @param CcTrans $ccTrans Object to remove from the list of results + * + * @return CcTransQuery The current query, for fluid interface + */ + public function prune($ccTrans = null) + { + if ($ccTrans) { + $this->addUsingAlias(CcTransPeer::ID, $ccTrans->getId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcTransQuery diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/CcFiles.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/CcFiles.php new file mode 100644 index 000000000..edc51a659 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/CcFiles.php @@ -0,0 +1,31 @@ +length; + } + + public function setDbLength($time) + { + $this->length = $time; + //$this->modifiedColumns[] = CcPlaylistcontentsPeer::LENGTH; + return Common::setTimeInSub($this, 'LENGTH', $time); + } + + +} // CcFiles diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/CcPlaylist.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/CcPlaylist.php new file mode 100644 index 000000000..0d3cff401 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/CcPlaylist.php @@ -0,0 +1,48 @@ +prepare($sql); + $stmt->bindValue(':p1', $this->getDbId()); + $stmt->execute(); + return $stmt->fetchColumn(); + } + + public function computeLength() + { + $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME); + + $sql = 'SELECT SUM('.CcPlaylistcontentsPeer::CLIPLENGTH.') AS length' + . ' FROM ' .CcPlaylistcontentsPeer::TABLE_NAME + . ' WHERE ' .CcPlaylistcontentsPeer::PLAYLIST_ID. ' = :p1'; + + $stmt = $con->prepare($sql); + $stmt->bindValue(':p1', $this->getDbId()); + $stmt->execute(); + return $stmt->fetchColumn(); + } + + +} // CcPlaylist diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/CcPlaylistcontents.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/CcPlaylistcontents.php new file mode 100644 index 000000000..1b6417a66 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/CcPlaylistcontents.php @@ -0,0 +1,81 @@ +fadein; + } + + public function setDbFadein($time) + { + $this->fadein = $time; + //$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN; + Common::setTimeInSub($this, 'FADEIN', $time); + } + + public function getDbFadeout() + { + return $this->fadeout; + } + + public function setDbFadeout($time) + { + $this->fadeout = $time; + //$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT; + Common::setTimeInSub($this, 'FADEOUT', $time); + } + + public function getDbCuein() + { + return $this->cuein; + } + + public function setDbCuein($time) + { + $this->cuein = $time; + //$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN; + Common::setTimeInSub($this, 'CUEIN', $time); + } + + public function getDbCueout() + { + return $this->cueout; + } + + public function setDbCueout($time) + { + $this->cueout = $time; + //$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT; + Common::setTimeInSub($this, 'CUEOUT', $time); + } + + public function getDbCliplength() + { + return $this->cliplength; + } + + public function setDbCliplength($time) + { + $this->cliplength = $time; + //$this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH; + Common::setTimeInSub($this, 'CLIPLENGTH', $time); + } + + + + +} // CcPlaylistcontents diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/Common.php b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/Common.php new file mode 100644 index 000000000..3e13c7fa3 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/airtime/om/Common.php @@ -0,0 +1,19 @@ +prepare($sql); + $stmt->bindValue(':f1', $time); + $stmt->bindValue(':p1', $row->getDbId()); + $stmt->execute(); + } +} diff --git a/install_minimal/upgrades/airtime-2.0.2/propel/classmap-airtime-conf.php b/install_minimal/upgrades/airtime-2.0.2/propel/classmap-airtime-conf.php new file mode 100644 index 000000000..ef3b99a4b --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/propel/classmap-airtime-conf.php @@ -0,0 +1,144 @@ + 'airtime/map/CcAccessTableMap.php', + 'CcAccessPeer' => 'airtime/CcAccessPeer.php', + 'CcAccess' => 'airtime/CcAccess.php', + 'CcAccessQuery' => 'airtime/CcAccessQuery.php', + 'BaseCcAccessPeer' => 'airtime/om/BaseCcAccessPeer.php', + 'BaseCcAccess' => 'airtime/om/BaseCcAccess.php', + 'BaseCcAccessQuery' => 'airtime/om/BaseCcAccessQuery.php', + 'CcMusicDirsTableMap' => 'airtime/map/CcMusicDirsTableMap.php', + 'CcMusicDirsPeer' => 'airtime/CcMusicDirsPeer.php', + 'CcMusicDirs' => 'airtime/CcMusicDirs.php', + 'CcMusicDirsQuery' => 'airtime/CcMusicDirsQuery.php', + 'BaseCcMusicDirsPeer' => 'airtime/om/BaseCcMusicDirsPeer.php', + 'BaseCcMusicDirs' => 'airtime/om/BaseCcMusicDirs.php', + 'BaseCcMusicDirsQuery' => 'airtime/om/BaseCcMusicDirsQuery.php', + 'CcFilesTableMap' => 'airtime/map/CcFilesTableMap.php', + 'CcFilesPeer' => 'airtime/CcFilesPeer.php', + 'CcFiles' => 'airtime/CcFiles.php', + 'CcFilesQuery' => 'airtime/CcFilesQuery.php', + 'BaseCcFilesPeer' => 'airtime/om/BaseCcFilesPeer.php', + 'BaseCcFiles' => 'airtime/om/BaseCcFiles.php', + 'BaseCcFilesQuery' => 'airtime/om/BaseCcFilesQuery.php', + 'CcPermsTableMap' => 'airtime/map/CcPermsTableMap.php', + 'CcPermsPeer' => 'airtime/CcPermsPeer.php', + 'CcPerms' => 'airtime/CcPerms.php', + 'CcPermsQuery' => 'airtime/CcPermsQuery.php', + 'BaseCcPermsPeer' => 'airtime/om/BaseCcPermsPeer.php', + 'BaseCcPerms' => 'airtime/om/BaseCcPerms.php', + 'BaseCcPermsQuery' => 'airtime/om/BaseCcPermsQuery.php', + 'CcShowTableMap' => 'airtime/map/CcShowTableMap.php', + 'CcShowPeer' => 'airtime/CcShowPeer.php', + 'CcShow' => 'airtime/CcShow.php', + 'CcShowQuery' => 'airtime/CcShowQuery.php', + 'BaseCcShowPeer' => 'airtime/om/BaseCcShowPeer.php', + 'BaseCcShow' => 'airtime/om/BaseCcShow.php', + 'BaseCcShowQuery' => 'airtime/om/BaseCcShowQuery.php', + 'CcShowInstancesTableMap' => 'airtime/map/CcShowInstancesTableMap.php', + 'CcShowInstancesPeer' => 'airtime/CcShowInstancesPeer.php', + 'CcShowInstances' => 'airtime/CcShowInstances.php', + 'CcShowInstancesQuery' => 'airtime/CcShowInstancesQuery.php', + 'BaseCcShowInstancesPeer' => 'airtime/om/BaseCcShowInstancesPeer.php', + 'BaseCcShowInstances' => 'airtime/om/BaseCcShowInstances.php', + 'BaseCcShowInstancesQuery' => 'airtime/om/BaseCcShowInstancesQuery.php', + 'CcShowDaysTableMap' => 'airtime/map/CcShowDaysTableMap.php', + 'CcShowDaysPeer' => 'airtime/CcShowDaysPeer.php', + 'CcShowDays' => 'airtime/CcShowDays.php', + 'CcShowDaysQuery' => 'airtime/CcShowDaysQuery.php', + 'BaseCcShowDaysPeer' => 'airtime/om/BaseCcShowDaysPeer.php', + 'BaseCcShowDays' => 'airtime/om/BaseCcShowDays.php', + 'BaseCcShowDaysQuery' => 'airtime/om/BaseCcShowDaysQuery.php', + 'CcShowRebroadcastTableMap' => 'airtime/map/CcShowRebroadcastTableMap.php', + 'CcShowRebroadcastPeer' => 'airtime/CcShowRebroadcastPeer.php', + 'CcShowRebroadcast' => 'airtime/CcShowRebroadcast.php', + 'CcShowRebroadcastQuery' => 'airtime/CcShowRebroadcastQuery.php', + 'BaseCcShowRebroadcastPeer' => 'airtime/om/BaseCcShowRebroadcastPeer.php', + 'BaseCcShowRebroadcast' => 'airtime/om/BaseCcShowRebroadcast.php', + 'BaseCcShowRebroadcastQuery' => 'airtime/om/BaseCcShowRebroadcastQuery.php', + 'CcShowHostsTableMap' => 'airtime/map/CcShowHostsTableMap.php', + 'CcShowHostsPeer' => 'airtime/CcShowHostsPeer.php', + 'CcShowHosts' => 'airtime/CcShowHosts.php', + 'CcShowHostsQuery' => 'airtime/CcShowHostsQuery.php', + 'BaseCcShowHostsPeer' => 'airtime/om/BaseCcShowHostsPeer.php', + 'BaseCcShowHosts' => 'airtime/om/BaseCcShowHosts.php', + 'BaseCcShowHostsQuery' => 'airtime/om/BaseCcShowHostsQuery.php', + 'CcPlaylistTableMap' => 'airtime/map/CcPlaylistTableMap.php', + 'CcPlaylistPeer' => 'airtime/CcPlaylistPeer.php', + 'CcPlaylist' => 'airtime/CcPlaylist.php', + 'CcPlaylistQuery' => 'airtime/CcPlaylistQuery.php', + 'BaseCcPlaylistPeer' => 'airtime/om/BaseCcPlaylistPeer.php', + 'BaseCcPlaylist' => 'airtime/om/BaseCcPlaylist.php', + 'BaseCcPlaylistQuery' => 'airtime/om/BaseCcPlaylistQuery.php', + 'CcPlaylistcontentsTableMap' => 'airtime/map/CcPlaylistcontentsTableMap.php', + 'CcPlaylistcontentsPeer' => 'airtime/CcPlaylistcontentsPeer.php', + 'CcPlaylistcontents' => 'airtime/CcPlaylistcontents.php', + 'CcPlaylistcontentsQuery' => 'airtime/CcPlaylistcontentsQuery.php', + 'BaseCcPlaylistcontentsPeer' => 'airtime/om/BaseCcPlaylistcontentsPeer.php', + 'BaseCcPlaylistcontents' => 'airtime/om/BaseCcPlaylistcontents.php', + 'BaseCcPlaylistcontentsQuery' => 'airtime/om/BaseCcPlaylistcontentsQuery.php', + 'CcPrefTableMap' => 'airtime/map/CcPrefTableMap.php', + 'CcPrefPeer' => 'airtime/CcPrefPeer.php', + 'CcPref' => 'airtime/CcPref.php', + 'CcPrefQuery' => 'airtime/CcPrefQuery.php', + 'BaseCcPrefPeer' => 'airtime/om/BaseCcPrefPeer.php', + 'BaseCcPref' => 'airtime/om/BaseCcPref.php', + 'BaseCcPrefQuery' => 'airtime/om/BaseCcPrefQuery.php', + 'CcScheduleTableMap' => 'airtime/map/CcScheduleTableMap.php', + 'CcSchedulePeer' => 'airtime/CcSchedulePeer.php', + 'CcSchedule' => 'airtime/CcSchedule.php', + 'CcScheduleQuery' => 'airtime/CcScheduleQuery.php', + 'BaseCcSchedulePeer' => 'airtime/om/BaseCcSchedulePeer.php', + 'BaseCcSchedule' => 'airtime/om/BaseCcSchedule.php', + 'BaseCcScheduleQuery' => 'airtime/om/BaseCcScheduleQuery.php', + 'CcSessTableMap' => 'airtime/map/CcSessTableMap.php', + 'CcSessPeer' => 'airtime/CcSessPeer.php', + 'CcSess' => 'airtime/CcSess.php', + 'CcSessQuery' => 'airtime/CcSessQuery.php', + 'BaseCcSessPeer' => 'airtime/om/BaseCcSessPeer.php', + 'BaseCcSess' => 'airtime/om/BaseCcSess.php', + 'BaseCcSessQuery' => 'airtime/om/BaseCcSessQuery.php', + 'CcSmembTableMap' => 'airtime/map/CcSmembTableMap.php', + 'CcSmembPeer' => 'airtime/CcSmembPeer.php', + 'CcSmemb' => 'airtime/CcSmemb.php', + 'CcSmembQuery' => 'airtime/CcSmembQuery.php', + 'BaseCcSmembPeer' => 'airtime/om/BaseCcSmembPeer.php', + 'BaseCcSmemb' => 'airtime/om/BaseCcSmemb.php', + 'BaseCcSmembQuery' => 'airtime/om/BaseCcSmembQuery.php', + 'CcSubjsTableMap' => 'airtime/map/CcSubjsTableMap.php', + 'CcSubjsPeer' => 'airtime/CcSubjsPeer.php', + 'CcSubjs' => 'airtime/CcSubjs.php', + 'CcSubjsQuery' => 'airtime/CcSubjsQuery.php', + 'BaseCcSubjsPeer' => 'airtime/om/BaseCcSubjsPeer.php', + 'BaseCcSubjs' => 'airtime/om/BaseCcSubjs.php', + 'BaseCcSubjsQuery' => 'airtime/om/BaseCcSubjsQuery.php', + 'CcCountryTableMap' => 'airtime/map/CcCountryTableMap.php', + 'CcCountryPeer' => 'airtime/CcCountryPeer.php', + 'CcCountry' => 'airtime/CcCountry.php', + 'CcCountryQuery' => 'airtime/CcCountryQuery.php', + 'BaseCcCountryPeer' => 'airtime/om/BaseCcCountryPeer.php', + 'BaseCcCountry' => 'airtime/om/BaseCcCountry.php', + 'BaseCcCountryQuery' => 'airtime/om/BaseCcCountryQuery.php', + 'CcStreamSettingTableMap' => 'airtime/map/CcStreamSettingTableMap.php', + 'CcStreamSettingPeer' => 'airtime/CcStreamSettingPeer.php', + 'CcStreamSetting' => 'airtime/CcStreamSetting.php', + 'CcStreamSettingQuery' => 'airtime/CcStreamSettingQuery.php', + 'BaseCcStreamSettingPeer' => 'airtime/om/BaseCcStreamSettingPeer.php', + 'BaseCcStreamSetting' => 'airtime/om/BaseCcStreamSetting.php', + 'BaseCcStreamSettingQuery' => 'airtime/om/BaseCcStreamSettingQuery.php', + 'CcLoginAttemptsTableMap' => 'airtime/map/CcLoginAttemptsTableMap.php', + 'CcLoginAttemptsPeer' => 'airtime/CcLoginAttemptsPeer.php', + 'CcLoginAttempts' => 'airtime/CcLoginAttempts.php', + 'CcLoginAttemptsQuery' => 'airtime/CcLoginAttemptsQuery.php', + 'BaseCcLoginAttemptsPeer' => 'airtime/om/BaseCcLoginAttemptsPeer.php', + 'BaseCcLoginAttempts' => 'airtime/om/BaseCcLoginAttempts.php', + 'BaseCcLoginAttemptsQuery' => 'airtime/om/BaseCcLoginAttemptsQuery.php', + 'CcServiceRegisterTableMap' => 'airtime/map/CcServiceRegisterTableMap.php', + 'CcServiceRegisterPeer' => 'airtime/CcServiceRegisterPeer.php', + 'CcServiceRegister' => 'airtime/CcServiceRegister.php', + 'CcServiceRegisterQuery' => 'airtime/CcServiceRegisterQuery.php', + 'BaseCcServiceRegisterPeer' => 'airtime/om/BaseCcServiceRegisterPeer.php', + 'BaseCcServiceRegister' => 'airtime/om/BaseCcServiceRegister.php', + 'BaseCcServiceRegisterQuery' => 'airtime/om/BaseCcServiceRegisterQuery.php', +); \ No newline at end of file diff --git a/install_minimal/upgrades/airtime-2.0.2/pypo.cfg.202 b/install_minimal/upgrades/airtime-2.0.2/pypo.cfg.202 new file mode 100644 index 000000000..09ccdb197 --- /dev/null +++ b/install_minimal/upgrades/airtime-2.0.2/pypo.cfg.202 @@ -0,0 +1,87 @@ +############################################ +# pypo - configuration # +############################################ + +# Set the type of client you are using. +# Currently supported types: +# 1) "obp" = Open Broadcast Platform +# 2) "airtime" +# +api_client = "airtime" + +############################################ +# Cache Directories # +# *include* trailing slash !! # +############################################ +cache_dir = '/var/tmp/airtime/pypo/cache/' +file_dir = '/var/tmp/airtime/pypo/files/' +tmp_dir = '/var/tmp/airtime/pypo/tmp/' + +############################################ +# Setup Directories # +# Do *not* include trailing slash !! # +############################################ +cache_base_dir = '/var/tmp/airtime/pypo' +bin_dir = '/usr/lib/airtime/pypo' +log_base_dir = '/var/log/airtime' +pypo_log_dir = '/var/log/airtime/pypo' +liquidsoap_log_dir = '/var/log/airtime/pypo-liquidsoap' + +############################################ +# Liquidsoap settings # +############################################ +ls_host = '127.0.0.1' +ls_port = '1234' + +############################################ +# RabbitMQ settings # +############################################ +rabbitmq_host = 'localhost' +rabbitmq_user = 'guest' +rabbitmq_password = 'guest' +rabbitmq_vhost = '/' + +############################################ +# pypo preferences # +############################################ +prepare_ahead = 24 #in hours +cache_for = 24 #how long to hold the cache, in hours + +# Poll interval in seconds. +# +# This will rarely need to be changed because any schedule changes are +# automatically sent to pypo immediately. +# +# This is how often the poll script downloads new schedules and files from the +# server in the event that no changes are made to the schedule. +# +poll_interval = 3600 # in seconds. + + +# Push interval in seconds. +# +# This is how often the push script checks whether it has something new to +# push to liquidsoap. +# +# It's hard to imagine a situation where this should be more than 1 second. +# +push_interval = 1 # in seconds + +# 'pre' or 'otf'. 'pre' cues while playlist preparation +# while 'otf' (on the fly) cues while loading into ls +# (needs the post_processor patch) +cue_style = 'pre' + +############################################ +# Recorded Audio settings # +############################################ +record_bitrate = 256 +record_samplerate = 44100 +record_channels = 2 +record_sample_size = 16 + +#can be either ogg|mp3, mp3 recording requires installation of the package "lame" +record_file_type = 'ogg' + +# base path to store recordered shows at +base_recorded_files = '/var/tmp/airtime/show-recorder/' diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index cea8062d4..5a054a060 100755 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -21,7 +21,7 @@ from urlparse import urlparse import base64 from configobj import ConfigObj -AIRTIME_VERSION = "2.0.1" +AIRTIME_VERSION = "2.0.2" def api_client_factory(config, logger=None): if logger != None: From 793c72b09c6f511c6caf3d1f42e77d05fa996fcf Mon Sep 17 00:00:00 2001 From: james Date: Fri, 24 Feb 2012 21:00:59 -0500 Subject: [PATCH 14/35] CC-3357: Upgrade script to 2.0.2 doesn't work - It was deleting /user/lib/airtime after it installs virtualenv. rm comand is ran before anything. --- install_minimal/airtime-install | 3 +-- install_minimal/include/airtime-copy-files.sh | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/install_minimal/airtime-install b/install_minimal/airtime-install index 1ad62c5bb..57f912c1c 100755 --- a/install_minimal/airtime-install +++ b/install_minimal/airtime-install @@ -155,9 +155,8 @@ export python_service=$? set -e echo -e "\n******************************** Install Begin *********************************" - +rm -rf "/usr/lib/airtime" if [ "$python_service" -eq "0" ]; then - rm -rf "/usr/lib/airtime" $AIRTIMEROOT/python_apps/python-virtualenv/virtualenv-install.sh virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/" diff --git a/install_minimal/include/airtime-copy-files.sh b/install_minimal/include/airtime-copy-files.sh index 1c4c28bf2..ad4f571d4 100755 --- a/install_minimal/include/airtime-copy-files.sh +++ b/install_minimal/include/airtime-copy-files.sh @@ -53,7 +53,6 @@ MIN=$(($RANDOM%60)) echo "$MIN $HOUR * * * root /usr/lib/airtime/utils/phone_home_stat" > /etc/cron.d/airtime-crons echo "* Creating /usr/lib/airtime" -rm -rf "/usr/lib/airtime" if [ "$python_service" -eq "0" ]; then python $AIRTIMEROOT/python_apps/api_clients/install/api_client_install.py From 38c16df138834af8426575233825f1a2e54628cc Mon Sep 17 00:00:00 2001 From: james Date: Sat, 25 Feb 2012 09:44:33 -0500 Subject: [PATCH 15/35] CC-3346: Recorder: Merge recorder with pypo - function parse_show was renamed to process_recorder_schedule - using thread on self.process_schedule call --- python_apps/pypo/pypofetch.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py index 10e3891f4..f211f0e20 100644 --- a/python_apps/pypo/pypofetch.py +++ b/python_apps/pypo/pypofetch.py @@ -16,6 +16,7 @@ from datetime import datetime from datetime import timedelta from Queue import Empty import filecmp +import thread # For RabbitMQ from kombu.connection import BrokerConnection @@ -83,7 +84,7 @@ class PypoFetch(Thread): if command == 'update_schedule': self.schedule_data = m['schedule'] - self.process_schedule(self.schedule_data, "scheduler", False) + thread.start_new_thread(self.process_schedule, (self.schedule_data, "scheduler", False)) elif command == 'update_stream_setting': logger.info("Updating stream setting...") self.regenerateLiquidsoapConf(m['setting']) @@ -99,7 +100,7 @@ class PypoFetch(Thread): elif command == 'update_recorder_schedule': temp = m if temp is not None: - self.parse_shows(temp) + self.process_recorder_schedule(temp) elif command == 'cancel_recording': self.recorder_queue.put('cancel_recording') except Exception, e: @@ -331,7 +332,7 @@ class PypoFetch(Thread): return datetime(date[0], date[1], date[2], time[0], time[1], time[2], 0, None) - def parse_shows(self, m): + def process_recorder_schedule(self, m): logger = logging.getLogger('fetch') logger.info("Parsing recording show schedules...") shows_to_record = {} @@ -518,14 +519,14 @@ class PypoFetch(Thread): status, self.schedule_data = self.api_client.get_schedule() if status == 1: logger.info("Bootstrap schedule received: %s", self.schedule_data) - self.process_schedule(self.schedule_data, "scheduler", True) + thread.start_new_thread(self.process_schedule, (self.schedule_data, "scheduler", True)) # Bootstrap: since we are just starting up, we need to grab the # most recent schedule. After that we can just wait for updates. try: temp = self.api_client.get_shows_to_record() if temp is not None: - self.parse_shows(temp) + self.process_recorder_schedule(temp) logger.info("Bootstrap recorder schedule received: %s", temp) except Exception, e: logger.error(e) @@ -583,14 +584,14 @@ class PypoFetch(Thread): """ status, self.schedule_data = self.api_client.get_schedule() if status == 1: - self.process_schedule(self.schedule_data, "scheduler", False) + thread.start_new_thread(self.process_schedule, (self.schedule_data, "scheduler", False)) """ Fetch recorder schedule """ try: temp = self.api_client.get_shows_to_record() if temp is not None: - self.parse_shows(temp) + self.process_recorder_schedule(temp) logger.info("updated recorder schedule received: %s", temp) except Exception, e: logger.error(e) From f030cf4f672a34f5891346fec0fbd866644cd41f Mon Sep 17 00:00:00 2001 From: James Date: Mon, 27 Feb 2012 16:18:10 -0500 Subject: [PATCH 16/35] CC-3346: Recorder: Merge recorder with pypo - separated rabitMQ listener part out from pypoFetch and created pypomessagehandler.py --- python_apps/pypo/logging.cfg | 16 +++- python_apps/pypo/pypo-cli.py | 21 +++-- python_apps/pypo/pypofetch.py | 104 +++------------------ python_apps/pypo/pypomessagehandler.py | 120 +++++++++++++++++++++++++ python_apps/pypo/recorder.py | 56 ++++++++++-- 5 files changed, 207 insertions(+), 110 deletions(-) create mode 100644 python_apps/pypo/pypomessagehandler.py diff --git a/python_apps/pypo/logging.cfg b/python_apps/pypo/logging.cfg index acff7007d..6dae7d9c5 100644 --- a/python_apps/pypo/logging.cfg +++ b/python_apps/pypo/logging.cfg @@ -1,8 +1,8 @@ [loggers] -keys=root,fetch,push,recorder +keys=root,fetch,push,recorder,message_h [handlers] -keys=pypo,recorder +keys=pypo,recorder,message_h [formatters] keys=simpleFormatter @@ -29,6 +29,12 @@ handlers=recorder qualname=recorder propagate=0 +[logger_message_h] +level=DEBUG +handlers=message_h +qualname=message_h +propagate=0 + [handler_pypo] class=logging.handlers.RotatingFileHandler level=DEBUG @@ -41,6 +47,12 @@ level=DEBUG formatter=simpleFormatter args=("/var/log/airtime/pypo/show-recorder.log", 'a', 1000000, 5,) +[handler_message_h] +class=logging.handlers.RotatingFileHandler +level=DEBUG +formatter=simpleFormatter +args=("/var/log/airtime/pypo/message-handler.log", 'a', 1000000, 5,) + [formatter_simpleFormatter] format=%(asctime)s %(levelname)s - [%(filename)s : %(funcName)s() : line %(lineno)d] - %(message)s datefmt= diff --git a/python_apps/pypo/pypo-cli.py b/python_apps/pypo/pypo-cli.py index d82d0b782..1fcf6e59c 100644 --- a/python_apps/pypo/pypo-cli.py +++ b/python_apps/pypo/pypo-cli.py @@ -16,6 +16,7 @@ from Queue import Queue from pypopush import PypoPush from pypofetch import PypoFetch from recorder import Recorder +from pypomessagehandler import PypoMessageHandler from configobj import ConfigObj @@ -127,11 +128,19 @@ if __name__ == '__main__': api_client = api_client.api_client_factory(config) api_client.register_component("pypo") - q = Queue() - + pypoFetch_q = Queue() recorder_q = Queue() - - pp = PypoPush(q) + pypoPush_q = Queue() + + pmh = PypoMessageHandler(pypoFetch_q, recorder_q) + pmh.daemon = True + pmh.start() + + pf = PypoFetch(pypoFetch_q, pypoPush_q) + pf.daemon = True + pf.start() + + pp = PypoPush(pypoPush_q) pp.daemon = True pp.start() @@ -139,10 +148,6 @@ if __name__ == '__main__': recorder.daemon = True recorder.start() - pf = PypoFetch(q, recorder_q) - pf.daemon = True - pf.start() - #pp.join() pf.join() logger.info("pypo fetch exit") diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py index f211f0e20..4a4bc59ca 100644 --- a/python_apps/pypo/pypofetch.py +++ b/python_apps/pypo/pypofetch.py @@ -16,13 +16,6 @@ from datetime import datetime from datetime import timedelta from Queue import Empty import filecmp -import thread - -# For RabbitMQ -from kombu.connection import BrokerConnection -from kombu.messaging import Exchange, Queue, Consumer, Producer -from kombu.exceptions import MessageStateError -from kombu.simple import SimpleQueue from api_clients import api_client @@ -44,30 +37,15 @@ except Exception, e: sys.exit() class PypoFetch(Thread): - def __init__(self, q, recorder_q): + def __init__(self, pypoFetch_q, pypoPush_q): Thread.__init__(self) self.api_client = api_client.api_client_factory(config) self.set_export_source('scheduler') - self.queue = q - self.recorder_queue = recorder_q + self.fetch_queue = pypoFetch_q + self.push_queue = pypoPush_q self.schedule_data = [] logger = logging.getLogger('fetch') logger.info("PypoFetch: init complete") - - def init_rabbit_mq(self): - logger = logging.getLogger('fetch') - logger.info("Initializing RabbitMQ stuff") - try: - schedule_exchange = Exchange("airtime-pypo", "direct", durable=True, auto_delete=True) - schedule_queue = Queue("pypo-fetch", exchange=schedule_exchange, key="foo") - connection = BrokerConnection(config["rabbitmq_host"], config["rabbitmq_user"], config["rabbitmq_password"], config["rabbitmq_vhost"]) - channel = connection.channel() - self.simple_queue = SimpleQueue(channel, schedule_queue) - except Exception, e: - logger.error(e) - return False - - return True """ Handle a message from RabbitMQ, put it into our yucky global var. @@ -84,7 +62,7 @@ class PypoFetch(Thread): if command == 'update_schedule': self.schedule_data = m['schedule'] - thread.start_new_thread(self.process_schedule, (self.schedule_data, "scheduler", False)) + self.process_schedule(self.schedule_data, "scheduler", False) elif command == 'update_stream_setting': logger.info("Updating stream setting...") self.regenerateLiquidsoapConf(m['setting']) @@ -97,13 +75,11 @@ class PypoFetch(Thread): elif command == 'cancel_current_show': logger.info("Cancel current show command received...") self.stop_current_show() - elif command == 'update_recorder_schedule': - temp = m - if temp is not None: - self.process_recorder_schedule(temp) - elif command == 'cancel_recording': - self.recorder_queue.put('cancel_recording') except Exception, e: + import traceback + top = traceback.format_exc() + logger.error('Exception: %s', e) + logger.error("traceback: %s", top) logger.error("Exception in handling RabbitMQ message: %s", e) def stop_current_show(self): @@ -316,36 +292,11 @@ class PypoFetch(Thread): scheduled_data = dict() scheduled_data['liquidsoap_playlists'] = liquidsoap_playlists scheduled_data['schedule'] = playlists - self.queue.put(scheduled_data) + self.push_queue.put(scheduled_data) # cleanup try: self.cleanup(self.export_source) except Exception, e: logger.error("%s", e) - - def getDateTimeObj(self,time): - timeinfo = time.split(" ") - date = timeinfo[0].split("-") - time = timeinfo[1].split(":") - - date = map(int, date) - time = map(int, time) - - return datetime(date[0], date[1], date[2], time[0], time[1], time[2], 0, None) - - def process_recorder_schedule(self, m): - logger = logging.getLogger('fetch') - logger.info("Parsing recording show schedules...") - shows_to_record = {} - shows = m['shows'] - for show in shows: - show_starts = self.getDateTimeObj(show[u'starts']) - show_end = self.getDateTimeObj(show[u'ends']) - time_delta = show_end - show_starts - - shows_to_record[show[u'starts']] = [time_delta, show[u'instance_id'], show[u'name'], m['server_timezone']] - self.recorder_queue.put(shows_to_record) - logger.info(shows_to_record) - """ In this function every audio file is cut as necessary (cue_in/cue_out != 0) @@ -519,24 +470,7 @@ class PypoFetch(Thread): status, self.schedule_data = self.api_client.get_schedule() if status == 1: logger.info("Bootstrap schedule received: %s", self.schedule_data) - thread.start_new_thread(self.process_schedule, (self.schedule_data, "scheduler", True)) - - # Bootstrap: since we are just starting up, we need to grab the - # most recent schedule. After that we can just wait for updates. - try: - temp = self.api_client.get_shows_to_record() - if temp is not None: - self.process_recorder_schedule(temp) - logger.info("Bootstrap recorder schedule received: %s", temp) - except Exception, e: - logger.error(e) - - logger.info("Bootstrap complete: got initial copy of the schedule") - - - while not self.init_rabbit_mq(): - logger.error("Error connecting to RabbitMQ Server. Trying again in few seconds") - time.sleep(5) + self.process_schedule(self.schedule_data, "scheduler", True) loops = 1 while True: @@ -556,10 +490,8 @@ class PypoFetch(Thread): Currently we are checking every 3600 seconds (1 hour) """ - message = self.simple_queue.get(block=True, timeout=3600) - self.handle_message(message.payload) - # ACK the message to take it off the queue - message.ack() + message = self.fetch_queue.get(block=True, timeout=3600) + self.handle_message(message) except Empty, e: """ Queue timeout. Fetching data manually @@ -584,17 +516,7 @@ class PypoFetch(Thread): """ status, self.schedule_data = self.api_client.get_schedule() if status == 1: - thread.start_new_thread(self.process_schedule, (self.schedule_data, "scheduler", False)) - """ - Fetch recorder schedule - """ - try: - temp = self.api_client.get_shows_to_record() - if temp is not None: - self.process_recorder_schedule(temp) - logger.info("updated recorder schedule received: %s", temp) - except Exception, e: - logger.error(e) + self.process_schedule(self.schedule_data, "scheduler", False) loops += 1 diff --git a/python_apps/pypo/pypomessagehandler.py b/python_apps/pypo/pypomessagehandler.py new file mode 100644 index 000000000..75b0407ea --- /dev/null +++ b/python_apps/pypo/pypomessagehandler.py @@ -0,0 +1,120 @@ +import logging +import logging.config +import sys +from configobj import ConfigObj +from threading import Thread +import time +# For RabbitMQ +from kombu.connection import BrokerConnection +from kombu.messaging import Exchange, Queue, Consumer, Producer +from kombu.exceptions import MessageStateError +from kombu.simple import SimpleQueue +import json + +# configure logging +logging.config.fileConfig("logging.cfg") + +# loading config file +try: + config = ConfigObj('/etc/airtime/pypo.cfg') + LS_HOST = config['ls_host'] + LS_PORT = config['ls_port'] + POLL_INTERVAL = int(config['poll_interval']) + +except Exception, e: + logger = logging.getLogger('message_h') + logger.error('Error loading config file: %s', e) + sys.exit() + +class PypoMessageHandler(Thread): + def __init__(self, pq, rq): + Thread.__init__(self) + self.logger = logging.getLogger('message_h') + self.pypo_queue = pq + self.recorder_queue = rq + + def init_rabbit_mq(self): + self.logger.info("Initializing RabbitMQ stuff") + try: + schedule_exchange = Exchange("airtime-pypo", "direct", durable=True, auto_delete=True) + schedule_queue = Queue("pypo-fetch", exchange=schedule_exchange, key="foo") + connection = BrokerConnection(config["rabbitmq_host"], config["rabbitmq_user"], config["rabbitmq_password"], config["rabbitmq_vhost"]) + channel = connection.channel() + self.simple_queue = SimpleQueue(channel, schedule_queue) + except Exception, e: + self.logger.error(e) + return False + + return True + + """ + Handle a message from RabbitMQ, put it into our yucky global var. + Hopefully there is a better way to do this. + """ + def handle_message(self, message): + try: + self.logger.info("Received event from RabbitMQ: %s" % message) + + m = json.loads(message) + command = m['event_type'] + self.logger.info("Handling command: " + command) + + if command == 'update_schedule': + self.logger.info("Updating schdule...") + self.pypo_queue.put(message) + elif command == 'update_stream_setting': + self.logger.info("Updating stream setting...") + self.pypo_queue.put(message) + elif command == 'update_stream_format': + self.logger.info("Updating stream format...") + self.pypo_queue.put(message) + elif command == 'update_station_name': + self.logger.info("Updating station name...") + self.pypo_queue.put(message) + elif command == 'cancel_current_show': + self.logger.info("Cancel current show command received...") + self.pypo_queue.put(message) + elif command == 'update_recorder_schedule': + self.recorder_queue.put(message) + elif command == 'cancel_recording': + self.recorder_queue.put(message) + except Exception, e: + self.logger.error("Exception in handling RabbitMQ message: %s", e) + + def main(self): + while not self.init_rabbit_mq(): + self.logger.error("Error connecting to RabbitMQ Server. Trying again in few seconds") + time.sleep(5) + + loops = 1 + while True: + self.logger.info("Loop #%s", loops) + try: + message = self.simple_queue.get(block=True) + self.handle_message(message.payload) + # ACK the message to take it off the queue + message.ack() + except Exception, e: + """ + sleep 5 seconds so that we don't spin inside this + while loop and eat all the CPU + """ + time.sleep(5) + + """ + There is a problem with the RabbitMq messenger service. Let's + log the error and get the schedule via HTTP polling + """ + self.logger.error("Exception, %s", e) + + loops += 1 + + """ + Main loop of the thread: + Wait for schedule updates from RabbitMQ, but in case there arent any, + poll the server to get the upcoming schedule. + """ + def run(self): + while True: + self.main() + diff --git a/python_apps/pypo/recorder.py b/python_apps/pypo/recorder.py index 6347c4f76..a4052c485 100644 --- a/python_apps/pypo/recorder.py +++ b/python_apps/pypo/recorder.py @@ -176,19 +176,35 @@ class Recorder(Thread): self.server_timezone = '' self.queue = q self.logger.info("RecorderFetch: init complete") + self.loops = 0 def handle_message(self): if not self.queue.empty(): - msg = self.queue.get() - self.logger.info("Receivied msg from Pypo Fetch: %s", msg) - if msg == 'cancel_recording': + message = self.queue.get() + msg = json.loads(message) + command = msg["event_type"] + self.logger.info("Received msg from Pypo Fetch: %s", msg) + if command == 'cancel_recording': if self.sr is not None and self.sr.is_recording(): self.sr.cancel_recording() else: - self.shows_to_record = msg + self.process_recorder_schedule(msg) + self.loops = 0 if self.shows_to_record: self.start_record() + + def process_recorder_schedule(self, m): + self.logger.info("Parsing recording show schedules...") + temp_shows_to_record = {} + shows = m['shows'] + for show in shows: + show_starts = getDateTimeObj(show[u'starts']) + show_end = getDateTimeObj(show[u'ends']) + time_delta = show_end - show_starts + + temp_shows_to_record[show[u'starts']] = [time_delta, show[u'instance_id'], show[u'name'], m['server_timezone']] + self.shows_to_record = temp_shows_to_record def get_time_till_next_show(self): if len(self.shows_to_record) != 0: @@ -247,21 +263,43 @@ class Recorder(Thread): def run(self): try: self.logger.info("Started...") - + # Bootstrap: since we are just starting up, we need to grab the + # most recent schedule. After that we can just wait for updates. + try: + temp = self.api_client.get_shows_to_record() + if temp is not None: + self.process_recorder_schedule(temp) + self.logger.info("Bootstrap recorder schedule received: %s", temp) + except Exception, e: + self.logger.error(e) + + self.logger.info("Bootstrap complete: got initial copy of the schedule") + recording = False - loops = 0 + self.loops = 0 heartbeat_period = math.floor(30/PUSH_INTERVAL) while True: - if loops % heartbeat_period == 0: + if self.loops % heartbeat_period == 0: self.logger.info("heartbeat") - loops = 0 + if self.loops * PUSH_INTERVAL > 3600: + self.loops = 0 + """ + Fetch recorder schedule + """ + try: + temp = self.api_client.get_shows_to_record() + if temp is not None: + self.process_recorder_schedule(temp) + self.logger.info("updated recorder schedule received: %s", temp) + except Exception, e: + self.logger.error(e) try: self.handle_message() except Exception, e: self.logger.error('Pypo Recorder Exception: %s', e) time.sleep(PUSH_INTERVAL) - loops += 1 + self.loops += 1 except Exception,e : import traceback top = traceback.format_exc() From 9736fd7debb47ea5a4d855d75d002cc5b94a972a Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 27 Feb 2012 17:28:06 -0500 Subject: [PATCH 17/35] CC-3334: Upgrade notification reports there is an upgrade when user has a later version than the official released version - I've updated the comment to read the difference between 1.9.5 and version 3.0.0 is calculated as 105 - I've also updated the checking logic to make the first outdated anything below 20 and the second outdated between 20 and 29. --- airtime_mvc/application/views/helpers/VersionNotify.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/application/views/helpers/VersionNotify.php b/airtime_mvc/application/views/helpers/VersionNotify.php index a488c6e9b..b356d843c 100644 --- a/airtime_mvc/application/views/helpers/VersionNotify.php +++ b/airtime_mvc/application/views/helpers/VersionNotify.php @@ -27,7 +27,7 @@ class Airtime_View_Helper_VersionNotify extends Zend_View_Helper_Abstract{ } // Calculate the version difference; - // Example: if current = 1.9.5 and latest = 3.0.0, diff = 115 + // Example: if current = 1.9.5 and latest = 3.0.0, diff = 105 // Note: algorithm assumes the number after 1st dot never goes above 9 $versionDifference = (intval($latestExploded[0]) * 100 + intval($latestExploded[1]) *10 + intval($latestExploded[2])) - (intval($currentExploded[0]) * 100 + intval($currentExploded[1] *10 + intval($currentExploded[2]))); @@ -36,10 +36,10 @@ class Airtime_View_Helper_VersionNotify extends Zend_View_Helper_Abstract{ if($versionDifference <= 0) { // current version is up to date or newer $class = "uptodate"; - } else if($versionDifference <= 20) { + } else if($versionDifference < 20) { // 2 or less major versions back $class = "update"; - } else if($versionDifference == 30) { + } else if($versionDifference < 30) { // 3 major versions back $class = "update2"; } else { From 33b6c2a3900b922641951f8be44ab76b2ff20500 Mon Sep 17 00:00:00 2001 From: James Date: Mon, 27 Feb 2012 18:09:07 -0500 Subject: [PATCH 18/35] CC-3346: Recorder: Merge recorder with pypo - fixed log message --- python_apps/pypo/pypofetch.py | 4 ++-- python_apps/pypo/recorder.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py index 4a4bc59ca..6e58cc287 100644 --- a/python_apps/pypo/pypofetch.py +++ b/python_apps/pypo/pypofetch.py @@ -54,7 +54,7 @@ class PypoFetch(Thread): def handle_message(self, message): try: logger = logging.getLogger('fetch') - logger.info("Received event from RabbitMQ: %s" % message) + logger.info("Received event from Pypo Message Handler: %s" % message) m = json.loads(message) command = m['event_type'] @@ -80,7 +80,7 @@ class PypoFetch(Thread): top = traceback.format_exc() logger.error('Exception: %s', e) logger.error("traceback: %s", top) - logger.error("Exception in handling RabbitMQ message: %s", e) + logger.error("Exception in handling Message Handler message: %s", e) def stop_current_show(self): logger = logging.getLogger('fetch') diff --git a/python_apps/pypo/recorder.py b/python_apps/pypo/recorder.py index a4052c485..cd57617d9 100644 --- a/python_apps/pypo/recorder.py +++ b/python_apps/pypo/recorder.py @@ -183,7 +183,7 @@ class Recorder(Thread): message = self.queue.get() msg = json.loads(message) command = msg["event_type"] - self.logger.info("Received msg from Pypo Fetch: %s", msg) + self.logger.info("Received msg from Pypo Message Handler: %s", msg) if command == 'cancel_recording': if self.sr is not None and self.sr.is_recording(): self.sr.cancel_recording() From fc2b18923e2eeac9d8c436954274d3d377a3c256 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 27 Feb 2012 18:09:30 -0500 Subject: [PATCH 19/35] CC-3337: Optimize Schedule/get-current-playlist/format/json - I've updated the time interval used to search for the next, current and previously secheduled shows to 24 hours before and after from 1 hour. --- airtime_mvc/application/models/Schedule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 2e3ea8402..29fb8654d 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -177,7 +177,7 @@ class Application_Model_Schedule { $sql = "Select ft.artist_name, ft.track_title, st.starts as starts, st.ends as ends, st.media_item_played as media_item_played FROM cc_schedule st LEFT JOIN cc_files ft ON st.file_id = ft.id LEFT JOIN cc_show_instances sit ON st.instance_id = sit.id - WHERE st.starts > (TIMESTAMP '$p_timeNow'-INTERVAL '1 hours') AND st.starts < (TIMESTAMP '$p_timeNow'+INTERVAL '1 hours') AND st.starts < sit.ends + WHERE st.starts > (TIMESTAMP '$p_timeNow'-INTERVAL '24 hours') AND st.starts < (TIMESTAMP '$p_timeNow'+INTERVAL '24 hours') AND st.starts < sit.ends ORDER BY st.starts"; $row = $CC_DBC->GetAll($sql); From 428d836d4e5d462aa4f1429a44557b65535f7218 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 27 Feb 2012 19:34:57 -0500 Subject: [PATCH 20/35] CC-3350: Upgrade 1.8.2 to 2.0.1 doesnt preserve recorded files names when the Airtime stor directory is a symlink -fixed? --- .../upgrades/airtime-1.9.0/airtime-upgrade.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/install_minimal/upgrades/airtime-1.9.0/airtime-upgrade.php b/install_minimal/upgrades/airtime-1.9.0/airtime-upgrade.php index eeca6f9f8..ce4beb954 100644 --- a/install_minimal/upgrades/airtime-1.9.0/airtime-upgrade.php +++ b/install_minimal/upgrades/airtime-1.9.0/airtime-upgrade.php @@ -617,7 +617,18 @@ class Airtime190Upgrade{ echo "Save DbMd to File".PHP_EOL; - $stor_dir = realpath($values['general']['base_files_dir']."/stor"); + + /* Do not use realpath. It expands a symlinked path into its real path + * which then causes us problems for string comparisons later on. */ + //$stor_dir = realpath($values['general']['base_files_dir']."/stor"); + + $baseDir = $values['general']['base_files_dir']; + if ($baseDir[strlen($baseDir)-1] != '/'){ + $baseDir.='/'; + } + + $stor_dir = $baseDir.'stor'; + $files = CcFilesQuery::create() ->setFormatter(ModelCriteria::FORMAT_ON_DEMAND) From 4514967ccda4656512cc52928f6135ad798e6beb Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 27 Feb 2012 21:37:23 -0500 Subject: [PATCH 21/35] CC-3359: Now Playing -> Day view has a bug with supporting UTC time -fixed --- airtime_mvc/application/models/Nowplaying.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/Nowplaying.php b/airtime_mvc/application/models/Nowplaying.php index ec80a91c7..b3a45c539 100644 --- a/airtime_mvc/application/models/Nowplaying.php +++ b/airtime_mvc/application/models/Nowplaying.php @@ -76,9 +76,12 @@ class Application_Model_Nowplaying $startCutoff = 60; $endCutoff = 86400; //60*60*24 - seconds in a day } else { + $time = date("H:i:s"); + $utcDate = Application_Model_DateHelper::ConvertToUtcDateTimeString($dateString." ".$time); + $date = new Application_Model_DateHelper; - $time = $date->getTime(); - $date->setDate($dateString." ".$time); + $date->setDate($utcDate); + $timeNow = $date->getUtcTimestamp(); $startCutoff = $date->getNowDayStartDiff(); @@ -88,6 +91,7 @@ class Application_Model_Nowplaying $data = array(); $showIds = Application_Model_ShowInstance::GetShowsInstancesIdsInRange($timeNow, $startCutoff, $endCutoff); + //get all the pieces to be played between the start cut off and the end cut off. $scheduledItems = Application_Model_Schedule::getScheduleItemsInRange($timeNow, $startCutoff, $endCutoff); From ba828a28bca3ba56d68b58ae4c6b1a22751f308a Mon Sep 17 00:00:00 2001 From: James Date: Tue, 28 Feb 2012 10:00:43 -0500 Subject: [PATCH 22/35] CC-3346: Recorder will not record shows if calendar is not touched 2 hours before the recorder starts - apiclient should log to correct log file. --- python_apps/pypo/recorder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_apps/pypo/recorder.py b/python_apps/pypo/recorder.py index cd57617d9..89a95b001 100644 --- a/python_apps/pypo/recorder.py +++ b/python_apps/pypo/recorder.py @@ -169,7 +169,7 @@ class Recorder(Thread): def __init__(self, q): Thread.__init__(self) self.logger = logging.getLogger('recorder') - self.api_client = api_client.api_client_factory(config) + self.api_client = api_client.api_client_factory(config, self.logger) self.api_client.register_component("show-recorder") self.sr = None self.shows_to_record = {} From 9e06b909896f34258ad8cd56d3be0f307ed00c4f Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Tue, 28 Feb 2012 22:48:16 -0500 Subject: [PATCH 23/35] -changelog for 2.0.2 --- CREDITS | 7 +++++++ changelog | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/CREDITS b/CREDITS index 52b8b9b18..1e590de8d 100644 --- a/CREDITS +++ b/CREDITS @@ -1,3 +1,10 @@ +======= +CREDITS +======= +Version 2.0.2 +------------- +Same as previous version. + ======= CREDITS ======= diff --git a/changelog b/changelog index efa3e48b2..66a9dadff 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,13 @@ +2.0.2 - February 28, 2012 + * Bug Fixes: + * Fixed Airtime could stop automatically playing after 24 hours if the web interface isn't used (regression in 2.0.1). + * Fixed Airtime could stop automatically recording after 2 hours if the web interface isn't used. + * Fixed upgrading from 1.8.2 when the stor directory was a symlink would cause filenames to not be preserved. + * Fixed Day View in the Now Playing tab showed some items on incorrect days. + * Fixed problems with having an equal '=' sign as an icecast password + * Other + * Various optimizations to make Airtime feel snappier in the browser. Various views should + load much quicker. 2.0.1 - February 14, 2012 * Changes: * Widgets should have a version string so users can make sure widgets are up to date From 1deee3cb659174875553ff813f961d21e2cc10cd Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 29 Feb 2012 14:54:54 -0500 Subject: [PATCH 24/35] CC-3365: Airtime API returns a non-null value for next item when there is no next item. - Improved check for determining if there is another element in the result set which is used to compute the next value. --- airtime_mvc/application/models/Schedule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 29fb8654d..8321627a6 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -197,7 +197,7 @@ class Application_Model_Schedule { "ends"=>$row[$i]["ends"], "media_item_played"=>$row[0]["media_item_played"], "record"=>0); - if ( $i +1 <= $numberOfRows){ + if ( isset($row[$i+1])){ $results['next'] = array("name"=>$row[$i+1]["artist_name"]." - ".$row[$i+1]["track_title"], "starts"=>$row[$i+1]["starts"], "ends"=>$row[$i+1]["ends"]); From 82812e15a560bbaafbd3b29a2c9e8faa856564ea Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Fri, 2 Mar 2012 11:42:35 -0500 Subject: [PATCH 25/35] CC-3377: Airtime 2.0.2 install fails for ubuntu 11.10 -should be fixed --- python_apps/pypo/install/pypo-initialize.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/python_apps/pypo/install/pypo-initialize.py b/python_apps/pypo/install/pypo-initialize.py index 029068b99..869578de2 100644 --- a/python_apps/pypo/install/pypo-initialize.py +++ b/python_apps/pypo/install/pypo-initialize.py @@ -81,12 +81,25 @@ try: print " Found %s (%s) on %s architecture" % (fullname, codename, arch) print " * Installing Liquidsoap binary" - if (os.path.exists("%s/liquidsoap_%s_%s"%(PATH_LIQUIDSOAP_BIN, codename, arch))): + + binary_path = os.path.join(PATH_LIQUIDSOAP_BIN, "liquidsoap_%s_%s" % (codename, arch)) + + try: shutil.copy("%s/liquidsoap_%s_%s"%(PATH_LIQUIDSOAP_BIN, codename, arch), "%s/liquidsoap"%PATH_LIQUIDSOAP_BIN) - else: - print "Unsupported system architecture." - sys.exit(1) + except IOError, e: + """ + shutil.copy can throw this exception for two reasons. First reason is that it cannot open the source file. + This is when the liquidsoap file we requested does not exist, and therefore tells the user we don't support + their OS/System architecture. The second reason for this exception is the shutil.copy cannot open the target file. + Since this script is being run as root (and we cannot install to a read-only device), this should never happen. So + it is safe to assume this exception is a result of the first case. + Note: We cannot simply use os.path.exists before this, since it sometimes gives us "false" incorrectly + """ + print "Unsupported OS/system architecture." + sys.exit(1) + + #generate liquidsoap config file #access the DB and generate liquidsoap.cfg under /etc/airtime/ ac = api_client.api_client_factory(config) From df22ab21a6d2ce81c2993f8874f968ebf0e3b619 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Fri, 2 Mar 2012 16:32:16 -0500 Subject: [PATCH 26/35] CC-3359: Now Playing -> Day view has a bug with supporting UTC time -fixed --- airtime_mvc/application/models/Nowplaying.php | 51 +++++++++++-------- airtime_mvc/application/models/Schedule.php | 10 ++-- .../application/models/ShowInstance.php | 16 +++--- 3 files changed, 45 insertions(+), 32 deletions(-) diff --git a/airtime_mvc/application/models/Nowplaying.php b/airtime_mvc/application/models/Nowplaying.php index b3a45c539..cff2598ef 100644 --- a/airtime_mvc/application/models/Nowplaying.php +++ b/airtime_mvc/application/models/Nowplaying.php @@ -67,40 +67,51 @@ class Application_Model_Nowplaying return array("r", "", "", "", $p_showInstance->getName(), "", "", "", "", "", ""); } - public static function GetDataGridData($viewType, $dateString){ - if ($viewType == "now"){ - $dateTime = new DateTime("now", new DateTimeZone("UTC")); - $timeNow = $dateTime->format("Y-m-d H:i:s"); + /* + * The purpose of this function is to return an array of scheduled + * items. There are two parameters. $p_viewType can be either "now" + * or "day". If "now", we show all scheduled items in the near future. + * + * If "day" we need to find what day was requested by the user, and return + * scheduled items for that day. + * + * $p_dateString is only used when $p_viewType is "day" it is in the format + * "2012-12-31". In this case it tells us which day to use. + */ + public static function GetDataGridData($p_viewType, $p_dateString){ + + if ($p_viewType == "now"){ + $start_dt = new DateTime("now", new DateTimeZone("UTC")); + $end_dt = clone $start_dt; - $startCutoff = 60; - $endCutoff = 86400; //60*60*24 - seconds in a day + $start_dt->sub(new DateInterval("PT60S")); + $end_dt->add(new DateInterval("PT24H")); } else { - $time = date("H:i:s"); - $utcDate = Application_Model_DateHelper::ConvertToUtcDateTimeString($dateString." ".$time); + Logging::log("HIII"); - $date = new Application_Model_DateHelper; - $date->setDate($utcDate); + //convert to UTC + $utc_dt = Application_Model_DateHelper::ConvertToUtcDateTime($p_dateString); + $start_dt = $utc_dt; - $timeNow = $date->getUtcTimestamp(); - - $startCutoff = $date->getNowDayStartDiff(); - $endCutoff = $date->getNowDayEndDiff(); + $end_dt = clone $utc_dt; + $end_dt->add(new DateInterval("PT24H")); } - - $data = array(); - - $showIds = Application_Model_ShowInstance::GetShowsInstancesIdsInRange($timeNow, $startCutoff, $endCutoff); - + $starts = $start_dt->format("Y-m-d H:i:s"); + $ends = $end_dt->format("Y-m-d H:i:s"); + + $showIds = Application_Model_ShowInstance::GetShowsInstancesIdsInRange($starts, $ends); + //get all the pieces to be played between the start cut off and the end cut off. - $scheduledItems = Application_Model_Schedule::getScheduleItemsInRange($timeNow, $startCutoff, $endCutoff); + $scheduledItems = Application_Model_Schedule::getScheduleItemsInRange($starts, $ends); $orderedScheduledItems; foreach ($scheduledItems as $scheduledItem){ $orderedScheduledItems[$scheduledItem['instance_id']][] = $scheduledItem; } + $data = array(); foreach ($showIds as $showId){ $instanceId = $showId['id']; diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 8321627a6..cc12a5a47 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -354,7 +354,7 @@ class Application_Model_Schedule { } - public static function getScheduleItemsInRange($timeNow, $start, $end) + public static function getScheduleItemsInRange($starts, $ends) { global $CC_DBC, $CC_CONFIG; @@ -380,9 +380,9 @@ class Application_Model_Schedule { ." ON st.file_id = ft.id" ." LEFT JOIN ".$CC_CONFIG["showTable"]." s" ." ON si.show_id = s.id" - ." WHERE ((si.starts < TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends > TIMESTAMP '$timeNow' - INTERVAL '$start seconds')" - ." OR (si.starts > TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends < TIMESTAMP '$timeNow' + INTERVAL '$end seconds')" - ." OR (si.starts < TIMESTAMP '$timeNow' + INTERVAL '$end seconds' AND si.ends > TIMESTAMP '$timeNow' + INTERVAL '$end seconds'))" + ." WHERE ((si.starts < TIMESTAMP '$starts' AND si.ends > TIMESTAMP '$starts')" + ." OR (si.starts > TIMESTAMP '$starts' AND si.ends < TIMESTAMP '$ends')" + ." OR (si.starts < TIMESTAMP '$ends' AND si.ends > TIMESTAMP '$ends'))" ." AND (st.starts < si.ends)" ." ORDER BY si.id, si.starts, st.starts"; @@ -670,4 +670,4 @@ class Application_Model_Schedule { } $p_view->addNewShow = true; } -} \ No newline at end of file +} diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php index 0fbaa4666..bd7cc7b27 100644 --- a/airtime_mvc/application/models/ShowInstance.php +++ b/airtime_mvc/application/models/ShowInstance.php @@ -700,20 +700,22 @@ class Application_Model_ShowInstance { return $items; } - public static function GetShowsInstancesIdsInRange($p_timeNow, $p_start, $p_end) + public static function GetShowsInstancesIdsInRange($p_start, $p_end) { global $CC_DBC; $sql = "SELECT id FROM cc_show_instances AS si " ."WHERE modified_instance != TRUE AND (" - ."(si.starts < TIMESTAMP '$p_timeNow' - INTERVAL '$p_start seconds' " - ."AND si.ends > TIMESTAMP '$p_timeNow' - INTERVAL '$p_start seconds') " - ."OR (si.starts > TIMESTAMP '$p_timeNow' - INTERVAL '$p_start seconds' " - ."AND si.ends < TIMESTAMP '$p_timeNow' + INTERVAL '$p_end seconds') " - ."OR (si.starts < TIMESTAMP '$p_timeNow' + INTERVAL '$p_end seconds' " - ."AND si.ends > TIMESTAMP '$p_timeNow' + INTERVAL '$p_end seconds') " + ."(si.starts < TIMESTAMP '$p_start'" + ."AND si.ends > TIMESTAMP '$p_start') " + ."OR (si.starts > TIMESTAMP '$p_start' " + ."AND si.ends < TIMESTAMP '$p_end') " + ."OR (si.starts < TIMESTAMP '$p_end' " + ."AND si.ends > TIMESTAMP '$p_end') " .") " ." ORDER BY si.starts"; + + Logging::debug($sql); $rows = $CC_DBC->GetAll($sql); return $rows; From c353009d39561d3317bace961127d42fe37526bb Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Fri, 2 Mar 2012 18:41:03 -0500 Subject: [PATCH 27/35] CC-3377: Airtime 2.0.2 install fails for ubuntu 11.10 -user binary_path var --- python_apps/pypo/install/pypo-initialize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_apps/pypo/install/pypo-initialize.py b/python_apps/pypo/install/pypo-initialize.py index 869578de2..acf3cf50d 100644 --- a/python_apps/pypo/install/pypo-initialize.py +++ b/python_apps/pypo/install/pypo-initialize.py @@ -85,7 +85,7 @@ try: binary_path = os.path.join(PATH_LIQUIDSOAP_BIN, "liquidsoap_%s_%s" % (codename, arch)) try: - shutil.copy("%s/liquidsoap_%s_%s"%(PATH_LIQUIDSOAP_BIN, codename, arch), "%s/liquidsoap"%PATH_LIQUIDSOAP_BIN) + shutil.copy(binary_path, "%s/liquidsoap"%PATH_LIQUIDSOAP_BIN) except IOError, e: """ shutil.copy can throw this exception for two reasons. First reason is that it cannot open the source file. From 463fc1ff0893795a01483542ee9ab18080f80bd0 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 5 Mar 2012 16:17:00 -0500 Subject: [PATCH 28/35] CC-3382: Include jPlayer sources in release tarball for GPL compliance -Done --- airtime_mvc/public/js/jplayer/Jplayer.as | 415 ++++++++++++++++++ airtime_mvc/public/js/jplayer/Jplayer.fla | Bin 0 -> 61952 bytes .../jplayer/happyworm/jPlayer/JplayerEvent.as | 69 +++ .../jplayer/happyworm/jPlayer/JplayerMp3.as | 328 ++++++++++++++ .../jplayer/happyworm/jPlayer/JplayerMp4.as | 413 +++++++++++++++++ .../happyworm/jPlayer/JplayerStatus.as | 101 +++++ 6 files changed, 1326 insertions(+) create mode 100644 airtime_mvc/public/js/jplayer/Jplayer.as create mode 100644 airtime_mvc/public/js/jplayer/Jplayer.fla create mode 100644 airtime_mvc/public/js/jplayer/happyworm/jPlayer/JplayerEvent.as create mode 100644 airtime_mvc/public/js/jplayer/happyworm/jPlayer/JplayerMp3.as create mode 100644 airtime_mvc/public/js/jplayer/happyworm/jPlayer/JplayerMp4.as create mode 100644 airtime_mvc/public/js/jplayer/happyworm/jPlayer/JplayerStatus.as diff --git a/airtime_mvc/public/js/jplayer/Jplayer.as b/airtime_mvc/public/js/jplayer/Jplayer.as new file mode 100644 index 000000000..1178dacc3 --- /dev/null +++ b/airtime_mvc/public/js/jplayer/Jplayer.as @@ -0,0 +1,415 @@ +/* + * jPlayer Plugin for jQuery JavaScript Library + * http://www.happyworm.com/jquery/jplayer + * + * Copyright (c) 2009 - 2011 Happyworm Ltd + * Dual licensed under the MIT and GPL licenses. + * - http://www.opensource.org/licenses/mit-license.php + * - http://www.gnu.org/copyleft/gpl.html + * + * Author: Mark J Panaghiston + * Version: 2.1.0 + * Date: 1st September 2011 + * + * FlashVars expected: (AS3 property of: loaderInfo.parameters) + * id: (URL Encoded: String) Id of jPlayer instance + * vol: (Number) Sets the initial volume + * muted: (Boolean in a String) Sets the initial muted state + * jQuery: (URL Encoded: String) Sets the jQuery var name. Used with: someVar = jQuery.noConflict(true); + * + * Compiled using: Adobe Flex Compiler (mxmlc) Version 4.5.1 build 21328 + */ + +package { + import flash.system.Security; + import flash.external.ExternalInterface; + + import flash.utils.Timer; + import flash.events.TimerEvent; + + import flash.text.TextField; + import flash.text.TextFormat; + + import flash.events.KeyboardEvent; + + import flash.display.Sprite; + import happyworm.jPlayer.*; + + import flash.display.StageAlign; + import flash.display.StageScaleMode; + import flash.events.Event; + import flash.events.MouseEvent; + + import flash.ui.ContextMenu; + import flash.ui.ContextMenuItem; + import flash.events.ContextMenuEvent; + import flash.net.URLRequest; + import flash.net.navigateToURL; + + public class Jplayer extends Sprite { + private var jQuery:String; + private var sentNumberFractionDigits:uint = 2; + + public var commonStatus:JplayerStatus = new JplayerStatus(); // Used for inital ready event so volume is correct. + + private var myInitTimer:Timer = new Timer(100, 0); + + private var myMp3Player:JplayerMp3; + private var myMp4Player:JplayerMp4; + + private var isMp3:Boolean = false; + private var isVideo:Boolean = false; + + private var txLog:TextField; + private var debug:Boolean = false; // Set debug to false for release compile! + + public function Jplayer() { + flash.system.Security.allowDomain("*"); + + jQuery = loaderInfo.parameters.jQuery + "('#" + loaderInfo.parameters.id + "').jPlayer"; + commonStatus.volume = Number(loaderInfo.parameters.vol); + commonStatus.muted = loaderInfo.parameters.muted == "true"; + + stage.scaleMode = StageScaleMode.NO_SCALE; + stage.align = StageAlign.TOP_LEFT; + stage.addEventListener(Event.RESIZE, resizeHandler); + stage.addEventListener(MouseEvent.CLICK, clickHandler); + + var initialVolume:Number = commonStatus.volume; + if(commonStatus.muted) { + initialVolume = 0; + } + myMp3Player = new JplayerMp3(initialVolume); + addChild(myMp3Player); + + myMp4Player = new JplayerMp4(initialVolume); + addChild(myMp4Player); + + setupListeners(!isMp3, isMp3); // Set up the listeners to the default isMp3 state. + + // The ContextMenu only partially works. The menu select events never occur. + // Investigated and it is something to do with the way jPlayer inserts the Flash on the page. + // A simple test inserting the Jplayer.swf on a page using: 1) SWFObject 2.2 works. 2) AC_FL_RunContent() works. + // jPlayer Flash insertion is based on SWFObject 2.2 and the resaon behind this failure is not clear. The Flash insertion HTML on the page looks similar. + var myContextMenu:ContextMenu = new ContextMenu(); + myContextMenu.hideBuiltInItems(); + var menuItem_jPlayer:ContextMenuItem = new ContextMenuItem("jPlayer " + JplayerStatus.VERSION); + var menuItem_happyworm:ContextMenuItem = new ContextMenuItem("© 2009-2011 Happyworm Ltd", true); + menuItem_jPlayer.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuSelectHandler_jPlayer); + menuItem_happyworm.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuSelectHandler_happyworm); + myContextMenu.customItems.push(menuItem_jPlayer, menuItem_happyworm); + contextMenu = myContextMenu; + + // Log console for dev compile option: debug + if(debug) { + txLog = new TextField(); + txLog.x = 5; + txLog.y = 5; + txLog.width = 540; + txLog.height = 390; + txLog.border = true; + txLog.background = true; + txLog.backgroundColor = 0xEEEEFF; + txLog.multiline = true; + txLog.text = "jPlayer " + JplayerStatus.VERSION; + txLog.visible = false; + this.addChild(txLog); + this.stage.addEventListener(KeyboardEvent.KEY_UP, keyboardHandler); + + myMp3Player.addEventListener(JplayerEvent.DEBUG_MSG, debugMsgHandler); + myMp4Player.addEventListener(JplayerEvent.DEBUG_MSG, debugMsgHandler); + } + + // Delay init() because Firefox 3.5.7+ developed a bug with local testing in Firebug. + myInitTimer.addEventListener(TimerEvent.TIMER, init); + myInitTimer.start(); + } + + private function init(e:TimerEvent):void { + myInitTimer.stop(); + if(ExternalInterface.available) { + ExternalInterface.addCallback("fl_setAudio_mp3", fl_setAudio_mp3); + ExternalInterface.addCallback("fl_setAudio_m4a", fl_setAudio_m4a); + ExternalInterface.addCallback("fl_setVideo_m4v", fl_setVideo_m4v); + ExternalInterface.addCallback("fl_clearMedia", fl_clearMedia); + ExternalInterface.addCallback("fl_load", fl_load); + ExternalInterface.addCallback("fl_play", fl_play); + ExternalInterface.addCallback("fl_pause", fl_pause); + ExternalInterface.addCallback("fl_play_head", fl_play_head); + ExternalInterface.addCallback("fl_volume", fl_volume); + ExternalInterface.addCallback("fl_mute", fl_mute); + + ExternalInterface.call(jQuery, "jPlayerFlashEvent", JplayerEvent.JPLAYER_READY, extractStatusData(commonStatus)); // See JplayerStatus() class for version number. + } + } + private function setupListeners(oldMP3:Boolean, newMP3:Boolean):void { + if(oldMP3 != newMP3) { + if(newMP3) { + listenToMp3(true); + listenToMp4(false); + } else { + listenToMp3(false); + listenToMp4(true); + } + } + } + private function listenToMp3(active:Boolean):void { + if(active) { + myMp3Player.addEventListener(JplayerEvent.JPLAYER_ERROR, jPlayerFlashEvent); + myMp3Player.addEventListener(JplayerEvent.JPLAYER_PROGRESS, jPlayerFlashEvent); + myMp3Player.addEventListener(JplayerEvent.JPLAYER_TIMEUPDATE, jPlayerFlashEvent); + myMp3Player.addEventListener(JplayerEvent.JPLAYER_ENDED, jPlayerFlashEvent); + + myMp3Player.addEventListener(JplayerEvent.JPLAYER_PLAY, jPlayerFlashEvent); + myMp3Player.addEventListener(JplayerEvent.JPLAYER_PAUSE, jPlayerFlashEvent); + myMp3Player.addEventListener(JplayerEvent.JPLAYER_LOADSTART, jPlayerFlashEvent); + + myMp3Player.addEventListener(JplayerEvent.JPLAYER_SEEKING, jPlayerFlashEvent); + myMp3Player.addEventListener(JplayerEvent.JPLAYER_SEEKED, jPlayerFlashEvent); + } else { + myMp3Player.removeEventListener(JplayerEvent.JPLAYER_ERROR, jPlayerFlashEvent); + myMp3Player.removeEventListener(JplayerEvent.JPLAYER_PROGRESS, jPlayerFlashEvent); + myMp3Player.removeEventListener(JplayerEvent.JPLAYER_TIMEUPDATE, jPlayerFlashEvent); + myMp3Player.removeEventListener(JplayerEvent.JPLAYER_ENDED, jPlayerFlashEvent); + + myMp3Player.removeEventListener(JplayerEvent.JPLAYER_PLAY, jPlayerFlashEvent); + myMp3Player.removeEventListener(JplayerEvent.JPLAYER_PAUSE, jPlayerFlashEvent); + myMp3Player.removeEventListener(JplayerEvent.JPLAYER_LOADSTART, jPlayerFlashEvent); + + myMp3Player.removeEventListener(JplayerEvent.JPLAYER_SEEKING, jPlayerFlashEvent); + myMp3Player.removeEventListener(JplayerEvent.JPLAYER_SEEKED, jPlayerFlashEvent); + } + } + private function listenToMp4(active:Boolean):void { + if(active) { + myMp4Player.addEventListener(JplayerEvent.JPLAYER_ERROR, jPlayerFlashEvent); + myMp4Player.addEventListener(JplayerEvent.JPLAYER_PROGRESS, jPlayerFlashEvent); + myMp4Player.addEventListener(JplayerEvent.JPLAYER_TIMEUPDATE, jPlayerFlashEvent); + myMp4Player.addEventListener(JplayerEvent.JPLAYER_ENDED, jPlayerFlashEvent); + + myMp4Player.addEventListener(JplayerEvent.JPLAYER_PLAY, jPlayerFlashEvent); + myMp4Player.addEventListener(JplayerEvent.JPLAYER_PAUSE, jPlayerFlashEvent); + myMp4Player.addEventListener(JplayerEvent.JPLAYER_LOADSTART, jPlayerFlashEvent); + + myMp4Player.addEventListener(JplayerEvent.JPLAYER_SEEKING, jPlayerFlashEvent); + myMp4Player.addEventListener(JplayerEvent.JPLAYER_SEEKED, jPlayerFlashEvent); + + myMp4Player.addEventListener(JplayerEvent.JPLAYER_LOADEDMETADATA, jPlayerMetaDataHandler); // Note the unique handler + } else { + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_ERROR, jPlayerFlashEvent); + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_PROGRESS, jPlayerFlashEvent); + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_TIMEUPDATE, jPlayerFlashEvent); + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_ENDED, jPlayerFlashEvent); + + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_PLAY, jPlayerFlashEvent); + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_PAUSE, jPlayerFlashEvent); + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_LOADSTART, jPlayerFlashEvent); + + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_SEEKING, jPlayerFlashEvent); + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_SEEKED, jPlayerFlashEvent); + + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_LOADEDMETADATA, jPlayerMetaDataHandler); // Note the unique handler + } + } + private function fl_setAudio_mp3(src:String):Boolean { + if (src != null) { + log("fl_setAudio_mp3: "+src); + setupListeners(isMp3, true); + isMp3 = true; + isVideo = false; + myMp4Player.clearFile(); + myMp3Player.setFile(src); + return true; + } else { + log("fl_setAudio_mp3: null"); + return false; + } + } + private function fl_setAudio_m4a(src:String):Boolean { + if (src != null) { + log("fl_setAudio_m4a: "+src); + setupListeners(isMp3, false); + isMp3 = false; + isVideo = false; + myMp3Player.clearFile(); + myMp4Player.setFile(src); + return true; + } else { + log("fl_setAudio_m4a: null"); + return false; + } + } + private function fl_setVideo_m4v(src:String):Boolean { + if (src != null) { + log("fl_setVideo_m4v: "+src); + setupListeners(isMp3, false); + isMp3 = false; + isVideo = true; + myMp3Player.clearFile(); + myMp4Player.setFile(src); + return true; + } else { + log("fl_setVideo_m4v: null"); + return false; + } + } + private function fl_clearMedia():void { + log("clearMedia."); + myMp3Player.clearFile(); + myMp4Player.clearFile(); + } + private function fl_load():Boolean { + log("load."); + if(isMp3) { + return myMp3Player.load(); + } else { + return myMp4Player.load(); + } + } + private function fl_play(time:Number = NaN):Boolean { + log("play: time = " + time); + if(isMp3) { + return myMp3Player.play(time * 1000); // Flash uses milliseconds + } else { + return myMp4Player.play(time * 1000); // Flash uses milliseconds + } + } + private function fl_pause(time:Number = NaN):Boolean { + log("pause: time = " + time); + if(isMp3) { + return myMp3Player.pause(time * 1000); // Flash uses milliseconds + } else { + return myMp4Player.pause(time * 1000); // Flash uses milliseconds + } + } + private function fl_play_head(percent:Number):Boolean { + log("play_head: "+percent+"%"); + if(isMp3) { + return myMp3Player.playHead(percent); + } else { + return myMp4Player.playHead(percent); + } + } + private function fl_volume(v:Number):void { + log("volume: "+v); + commonStatus.volume = v; + if(!commonStatus.muted) { + myMp3Player.setVolume(v); + myMp4Player.setVolume(v); + } + } + private function fl_mute(mute:Boolean):void { + log("mute: "+mute); + commonStatus.muted = mute; + if(mute) { + myMp3Player.setVolume(0); + myMp4Player.setVolume(0); + } else { + myMp3Player.setVolume(commonStatus.volume); + myMp4Player.setVolume(commonStatus.volume); + } + } + private function jPlayerFlashEvent(e:JplayerEvent):void { + log("jPlayer Flash Event: " + e.type + ": " + e.target); + if(ExternalInterface.available) { + ExternalInterface.call(jQuery, "jPlayerFlashEvent", e.type, extractStatusData(e.data)); + } + } + private function extractStatusData(data:JplayerStatus):Object { + var myStatus:Object = { + version: JplayerStatus.VERSION, + src: data.src, + paused: !data.isPlaying, // Changing this name requires inverting all assignments and conditional statements. + srcSet: data.srcSet, + seekPercent: data.seekPercent, + currentPercentRelative: data.currentPercentRelative, + currentPercentAbsolute: data.currentPercentAbsolute, + currentTime: data.currentTime / 1000, // JavaScript uses seconds + duration: data.duration / 1000, // JavaScript uses seconds + volume: commonStatus.volume, + muted: commonStatus.muted + }; + log("extractStatusData: sp="+myStatus.seekPercent+" cpr="+myStatus.currentPercentRelative+" cpa="+myStatus.currentPercentAbsolute+" ct="+myStatus.currentTime+" d="+myStatus.duration); + return myStatus; + } + private function jPlayerMetaDataHandler(e:JplayerEvent):void { + log("jPlayerMetaDataHandler:" + e.target); + if(ExternalInterface.available) { + resizeHandler(new Event(Event.RESIZE)); + ExternalInterface.call(jQuery, "jPlayerFlashEvent", e.type, extractStatusData(e.data)); + } + } + private function resizeHandler(e:Event):void { + log("resizeHandler: stageWidth = " + stage.stageWidth + " | stageHeight = " + stage.stageHeight); + + var mediaX:Number = 0; + var mediaY:Number = 0; + var mediaWidth:Number = 0; + var mediaHeight:Number = 0; + + if(stage.stageWidth > 0 && stage.stageHeight > 0 && myMp4Player.myVideo.width > 0 && myMp4Player.myVideo.height > 0) { + var aspectRatioStage:Number = stage.stageWidth / stage.stageHeight; + var aspectRatioVideo:Number = myMp4Player.myVideo.width / myMp4Player.myVideo.height; + if(aspectRatioStage < aspectRatioVideo) { + mediaWidth = stage.stageWidth; + mediaHeight = stage.stageWidth / aspectRatioVideo; + mediaX = 0; + mediaY = (stage.stageHeight - mediaHeight) / 2; + } else { + mediaWidth = stage.stageHeight * aspectRatioVideo; + mediaHeight = stage.stageHeight; + mediaX = (stage.stageWidth - mediaWidth) / 2; + mediaY = 0; + } + resizeEntity(myMp4Player, mediaX, mediaY, mediaWidth, mediaHeight); + } + if(debug && stage.stageWidth > 20 && stage.stageHeight > 20) { + txLog.width = stage.stageWidth - 10; + txLog.height = stage.stageHeight - 10; + } + } + private function resizeEntity(entity:Sprite, mediaX:Number, mediaY:Number, mediaWidth:Number, mediaHeight:Number):void { + entity.x = mediaX; + entity.y = mediaY; + entity.width = mediaWidth; + entity.height = mediaHeight; + } + private function clickHandler(e:MouseEvent):void { + if(isMp3) { + jPlayerFlashEvent(new JplayerEvent(JplayerEvent.JPLAYER_CLICK, myMp3Player.myStatus, "click")) + } else { + jPlayerFlashEvent(new JplayerEvent(JplayerEvent.JPLAYER_CLICK, myMp4Player.myStatus, "click")) + } + } + // This event is never called. See comments in class constructor. + private function menuSelectHandler_jPlayer(e:ContextMenuEvent):void { + navigateToURL(new URLRequest("http://jplayer.org/"), "_blank"); + } + // This event is never called. See comments in class constructor. + private function menuSelectHandler_happyworm(e:ContextMenuEvent):void { + navigateToURL(new URLRequest("http://happyworm.com/"), "_blank"); + } + private function log(t:String):void { + if(debug) { + txLog.text = t + "\n" + txLog.text; + } + } + private function debugMsgHandler(e:JplayerEvent):void { + log(e.msg); + } + private function keyboardHandler(e:KeyboardEvent):void { + log("keyboardHandler: e.keyCode = " + e.keyCode); + switch(e.keyCode) { + case 68 : // d + txLog.visible = !txLog.visible; + log("Toggled log display: " + txLog.visible); + break; + case 76 : // l + if(e.ctrlKey && e.shiftKey) { + txLog.text = "Cleared log."; + } + break; + } + } + } +} diff --git a/airtime_mvc/public/js/jplayer/Jplayer.fla b/airtime_mvc/public/js/jplayer/Jplayer.fla new file mode 100644 index 0000000000000000000000000000000000000000..61ae40d3ac2811ebcfd63b1ff3bb590f67984445 GIT binary patch literal 61952 zcmeHQU2Gl4b-omB%T6r+#c}-aYuRyRJEHg_$`Y%{qDje=Em^cETdpfNqR4wmS|TZv zm!cR1sE{B)A5tJdjH35VeQ019FyIyj64XFp^hrQ(&@^a@Joq6+fTBQw#3)dp1sb#8 zch1i2?(FZSX^~3jl5_8#-PtoU=bSm`%KJFa(@!$OY>xcG#_goawnV)~>+aLbVKXg2clLv3qD?=!q<<{hTF`B*9@m-ZI z9VGV_aFapbXRs)_Eh@u%fB+8hbvob`^%P3yq!V&%al=+ zhvk}2QC{~t`|j_|&Hs;n+3tfN#vl@phwwX$bO`A%((_0oNJo%fKzb4BDAF;cmynJl zjUv5_bOLD%=_JxCNUtKDLV6A950PF+`Xi*%NN*thG151Y&LE8=okf~JnnbE0)sd!< zrjcfl-bA9fo=2KRnnRjLx`6Z+(gG5DP6KHP=_1lH65Cbuxt9I^{U7)I?R)6|BKm>+ zZ$$sU8MN8x{{LS$pc3o!iSoEzl;&Qe2lz{yzZHqcx8U~+NMA&{6=@sNZAiBx!3C(? ziF6mzmyqs8`ZCfzNMAv^7wJBv`;i_%dJyR$q=%6nL8>A>inJZ+F{H(-#{wUFAQCN z-+wzm58BR7B#I=vrQtvONjv=abiMwh1t!J=*-0E_*9L~TnCs=_~`gbZ6SK% z@WS|PkVEe{S-aE-^!R1S3es)2$S44Sd^##Wg>v`=$B+MJb@dr45`2CFrO_eU0Y2NO zaM>0+Zojt!M>h__md(H>p6B^nLuhB^Ias{&u#m^Z%2o~n4Q_<=;-7j#KY|U1{M|y) zmJgvfVXe;t^9n5NLZvFu60GbDtZ5Y%cV5oE346XIIaYA?1?0boGzRO;dR-7d`6!Og z0v<5KxGd-o#RunlKfkMtI@6LEa@WpG{1uWA@ z`DIO^u1ly9xike_69Em+qXu7kU7%HzW48Qjr8 zzB%0Ys+6{fatZUkF`OZH(#shJ4vvwEat8e=BKM|8@YH2ZQ12ZCgHL!IbmiduL%2Xo zj8BjS+U;2+^d{!y$$z0q4nEP6%sKw@d{~A>rdclI2WcBJJ($)p*dcn5s&K}$x&V+< z?;gh=k+Li#{_t~I)7CBa49^zjC@xb*o$Zw=1#hyi=MA0G>qTn-l{Gv+u{2woYtTg8 zcU#_=8I0UYeX0G8V{7>sA)sp!Es@95ubnvhAHhkwogy*3fk~Vb3-BsF1_Rlyxqf=$ zua22qbY~(u%U!L|}9NS^3(X5o3 zg^?DQB_0OdNUI2yZgnk$$%~Sz@seJKozE)aD9Tq~=s0Ld{?HNu2U8n(22np+@NvwD zB=9(N%&QOWW&?bgh6SC6*F||5#`mnyv4`Jxxg32(DE$(0HsEuS&*vn!Q2hZn_b~FE zg`7^|Po~(?>y1dU&|AL#Y2y z{QfdhOdptu~UP!l>B z=S5DmuS>h0h+{0TamIj^x{w?>0{u9Qy4aSsjWxt|LV7|C^0EX9P+lz7FDGSs9#XX= zT<0wM5NbouRNA*St|@@!EAIV=Dwl8<`v7H!V~FS|33qHe9AKP|U7>q~tBz(Xk}2AT zdGyqiC~FFOojP+4{e3Zz5#h(z;`}JWslA$9rA}8Ws@BwYS=v3=9^O|_GmckOQlz!J z+r>cto)Qx8i`1AQ&3R{`Wk5m_8WSF@h^_=btN^bF==m?gx{pBj_PsGmL6yc{NCf< z%YM&M-U4#7Z*Y`mYz*=%r4oHB*H2(MP9HC$5yRFSo<}VE7vuf43pHJa4o68&pD0rj zZCu@vyhvH8(oqI4sW^|>jnKEE<(^mOGALQKVft8%Dc8F0BYHck_EkoR&pc*dKKaFd^8e0qGUZS-WMq zx#I`I#BXB<|n`Chgd4@j7v%xesWZ%b9EdM zus5@W(3eeUF~>^gd6nwT=*Uw>JKCF^UXjmBwOgzc$2($c@9c$!*ol6}eo}?jR;|W) zMl(7BMVxx(my&AD9hobyTghkkxk*Ti<;^2;-sEGWeo?Q5_LjW1cpR^uR*YVMmRCNE zD@SO^h7TQLDZxwyg#ZM8=ahahAgTfiI4gFS1jawkI(UN!vJqT5!ImhE-q3VBt_+ zhgd47)G`tmjuMF_O>XmLs$DtA$JV|a6j8PW#s^*NS7DC zXHYMKe+x2(3cPcrzN6cV?0#tDtrV=m4^ED>skP@y=^~CfMRz(Qi!#!uqoe|B*B#gF zj$TemU!sT4@e93a^(P}E2WR|T)E`EG z%dB-l*`2#ZE90omewE?1ICGq3WYPF^W$Zfh$}@~7+n4!JlNU(2aqbr8u`SiIX$N9`-`fU}Z5gG@kL3k+h&=EBp>s$z*$#5Oi z7-ld|F$`zs(6-=-sapDVvD4(&ge}9!J6e>O;nyWixUz;TJDRby<$_%p_vt+v~ylpW>ct_ z9W3QXYT>FH(Y3d^8kBT4&nc|DJRP@`Mg9Lc`u&{DjIn>}vuGZr^isCP=_^Ip>5Z4d z>pagZ!ds|OSXakCEYow6^WT=P&geK_!i+5Cu6}UpS0oo)Pr`mQ58iODXBM&>nQcvs z+PG+wGeXOOjMJZ_XUUnJs9muwywjC0wdH)`t7~_)G?B&a>3R7kqr0l%DC!)p*>=|K zbjX^o#N0En$HszqzAPh%yWMhiyuseak!T8C68@03hjSNP$xTU$KA$Evo}u(OS~H4U zM-rTAkFT!dY?Y;^qqp-lW~SbCYLSnnoR6L_xg~Y?nxE+Q zKa>phfcIjCdQ7;^dG=a#wo2{fL#}K^C8Z>e#L74JI^zvS*HI)SyrYk@lXxN>wjxJX z9a$^Vo~#G`*vP11UFHl>*0q z&hK&Y*}jPXM_#stDcvWrZFcNqejiT9MO&<^MS-=Gy>KsU>CBPlV;+RBz;&UtJh2s< zZQ8Q%DY}j?^&Jk>hBb10j3T=jK5rmr7Xpt+Yshy{KFi8LT{EXooz-S?Wh^~VU0JEN zFz#^`)tB>w#%l}5foON?d}on9%+UFX6;)APmSHIq>%Q2N`Q);2eV@bqBK;HBeVkFL zql|$2j-OS=?oL4_>(*n9^uolLPjjLqr$3b`h1R`5w>fmk(@fMHOBjK$7Yzb4`9ps# z;z2lLt~_kUALcCYdHm5cF+Ql7O&9;k8H?m=w}LTOLSEEgR6AwnFbuS)Eqi1L^?C`s zI)afQ-$>B+#KthU@lDX-6=>=anD%gBZqwVP2>LAc(~2*;;_r*^-^t1!G5t1cDn7O-i+5dm8U zJR=|shGxD*5HF%jH3C$9f_aC*+$Wg#0~E}Cf_Vs_VD1ylhXD%aKEXT!P%zgmX1TX6 znC~{I>VlaC=~cnp4^S}I1vASP%yq$h5TIaoNY~eglI5e#cL~d@S8%V=N-|%vV4YVd z0qVU?f^Pr}NJsE>fC1?Uz6LNL9l@&r1+!C)KEXT+E-9@9^C<3ATD5rZXype1s#OJl zixXfM;4Gd7#1@jJrxh|OZ8_adVJY+D}1v7ahm>ts9>maRsw1F<^c$K76 z;`9;xz6Ir8Qc|xrdG#E?fOG^&*no5d&j1WaNALr4Z=YbkVp`M}V78=FRF-rE-!KjA zTO~*yNdxN@f@F%+sxFwX8q7|6>r&@YWR+UgTfCP%QdEMOz3d(7IC0`Mn@wcqM>69# z04tiAS4ldhMjyc+TCh&=dlnQ_q+~!kUY!FNkdELqz<_iF-!qx}1oIVKlgxdB`TG_O zFq^9_-g_=29YOLaARWOE4d%LF{=lHB3+5}9Rsm*9Iz?qkN09v}jdZP63s?F1D21?< z3a^rM+WbC(e{R7#K?Z4&&B1qCxHsaIEd^#Z_vbOhfuSNjC>6-y1l{6h;0=I>cB zz-&7#QISUh=?GGurQEt;e$U)n7tG|5W){rkk%9qc14^CQkJ3m-!=j}7B$af$O43Pt zp+x}xg$3&be_+8T!9TTNi{NDoN68 zSwPqU-1|PRN1;twJu%KA0UVy@Vh(0R07ofDLWiiXumSFyZ$=njmG>dvwFh6WT!OVj6 zs$lL0D40{|-q@Z9Xj}#QlB%Oe0d5m---W1?8!ZyWP z{Q_45($N5YY>5+C=Rn6c#ait!8n`LeigsVhZHl#`Z}tvZ))LHgAp+77^RJOrs?iEC z2luuFGkGMaT7sE8Qcy6{HxtaOg85ef1JV&Qc_f)v1I#9~U}itkdj&K5k%EGmq!Z8~ z9lAO&XUSxZU?x+3Nv5m{=AQu!NJoQ99tBcIko_ni z9YG4epjr(u8&rasq!Y{zaUgWKmram@oU2fxxcU=w6^a2M?Y`1VtQCDTrIlDK_I;@a znv2Xdiwat6rR^2WAK|K$3mt>ZZJ6QX&S@#&Dg)bu$1O}-f3xWBxD8ICq)@AQcR_jhtv3~|$z zJ1RpjpB!A8oS7f1H5xN>Q`{gDWxR%}cGz0TglC6r3ZfOdDrY#=Qs$$GD6zboRN$R* z9KnEdtIK!ouRMz$q)WceVX}u0OSuq<)1h-R$+r6GcAVo&N}O^#g+&#|V49ENo+0F$ z#+4B)GviW;G5o%SX}Ssgp2PP(+_N3{4`8c8+V24*K2YTpKc_US0-r}Y+=Aqi;OBx6 zT?#c2oHx050T=HuSQ;pUH3}C`Rf9#|ID&c+?5 zVs?%A$VVS19RPQ9Ppq9HJv&8uPU5&933aNvXql zZe4mnIWCl7$*fTyBs{Aw*?5cU!$pF8;IgugbxFe+uLn75`dzx5U+aD`33*TUiVNsp z3y{EY!#w8O1upWj4D}p)G&kjA@94pAcJJVw1E4hfgg$gV04d-GH||2yU0BRca}@87 zx&)e(OT)C;>8rZo7_3l|%H?&>tZ1aNx{i;jxa2}LWL$%nFLM$7a0Ohdf%05Xvj`5F zZ5qP`9n|G<9%N}?){1!QpNSHAwNmV9)+MeN$&CR#oFgr$mH6@%x8NCuu2z0^K{wEk z7=X=v2KxIj=(!L2dN2NZ<%l+uTWjtGv>WG!p{Jh1Q4hWcp|^%`Uq8-U?8y%@UGZ{_ASGHL7q zwPEPx=%QXeS~tCr`oryqSz0$*CsR(S6$ZeQa6#7r950|8^$sS5irIP7s8v)NrJ%T{ ztq1p`^-eE!E%jf97fg#+qzzMzNhdMnXdg}ByI6Y5}YR~s&e)y2LI)Ga!?XxGb( z)-bP(qB=+Y8_Kim&7?`n#>@XAWd9;Kym7L>9#$sG!)qh^Wjyt0t$x2{KTXf_N`u2KQv;AU2)W;h@ zS=Z90Swvv{33$58CUt(P4%bxtp}Y@O-zY>X#I&0*S5t`=!+a%G#N?xdu;b}HI) zipJ^DygHXgY+A0F0W>p%ZaGPNc>SD7qxSVv`)EylOQO`+9LJs~n}ZM0T6msBsj)eZ zJx?|VAELGJJc&|ca~yk~Yz{s|YvFkkrN-ts_B`1fe2CV<^CU`*&2hX|o^WO$xsHiX z7j)IqGM@5q9a3}!6_-WXFk1|PxCcw|uy|zrVr{Z|cBMKvIe)fRJ$!zAak_eHW^QtR zd9m8l-PK(^yEJotvf96APqi^KTbr0)nrl?QQSIsL?%lJuyLT@`o#J!(#e?5Q)YU79 z$l9T2+WF=!Tp8Gj#D!cpB5?&B*S)nH|C8}weGE{t`}+C#_@6%hr;q=sakUs1*2n*Z z5|_`lj{o@>HxP)295O3q+X;w^HObVzZA9k0jOHT6B7|}UV}8uhc1sbOZoV(;n50+j zdWrw}n;9Sf)5rge?&*~ozmdD1`1qekK?NWGb5tHD>(1BCZc>@@le?GTb|3#UjP%Q$ zvwi$e?yy|6AD7u5D7q&gcO}!kHZhr?y8(yKK>{A@}hY~@`?B^U}g5`(wAYV5mI*PO6(Np*>p0`J(zF6Vof2Qrj`8*a1*MpatlUzO`d?oMMqxiy|^{kw@g+;r?`uLw2v5(t~ zbQ0gemVJaCZ}?)EkN?@gCJ|127iVARGMe9vV%yU~WiZ>FfK^vI{V2abntjQw7Ib#$ z&%Zlk$7W~W<05~H%i=jg9ml+zkN@f8e-_D0xJ$Z^|H;>NvtoFJqeR=gAB&HK^7qW< z3^!+z)X#DD;HKSf3mbRfZosZg<5hM>xaIubFurHS0}v0)(Hlh`KnaYANE+^}eLOOv zkN+7T>2M@09-0%As*F|g@jt^EY|429l25;v(L4B3bP(TKZT9wfzbuk`?eRYTCpRU6 z9&$!*MRT$lUdtMGus1$knOQjI_3=OX94E_OjiFcg_@4vV>VumrsV3%FEJeC}{Lhpb zB#qg`7oC0lPi|GirvrRtTDRNE>UCyDvS3`ghPh4?Nrc{Knw~CGJ3H5^7@W~*-W*+K zbTvoM=lj5X_1wq*lt@0bv`);O@*_1L|1+!qnRrLKnV!-0+%SvtBA_{w;~$pkIm!8N z+Yg;_R{k818Ta}4pL`PL<9|-We`7qWEP2kS8$5PHm&zIbiy1N=5d$ps}eEiP~ z7}v(1AW+L7;DwL>3Ce^s0A`+@8y0E2Me&Gy{7-0-yyt~J{-=r6>EnNLEW7#rta3Be+fz6f>;D3QJhjtD4`z6hQX5Cc68c65oLkN*j3`1qfJY}lwU zc*CBded-_%!wRWf`S_oaKIr3rLN+czGDMBkB|6z800}Bpm*`|Z{%1fOAOBNhw2EvX z{Fq2i5PuA|3*h@uGAc+Coy^Do3>IZ(EkN*j3`1qeb{-^eca2v8P<|z6L-4fGnf+2XBXr&TZGI6Jm z|H(BJV|Xgz<9{Nml#l<(Xj~>*rpE0^Myy-L0;^@j=kxJD!(Av%B$VtJou4H#lg3EP z#+|kgWm=7*u{wSHPriu27ms}WPapr(K1sW>K2b?ET9A+b zxqi_~-R*%i>S&(L(P*W|@tA&NqDDnyrk1Nkacj!NLsNgi$Nw~Rh{pZ9wz1kY@^My# zxHN8uzMMJIxNQbg7`HIrbMo;&qp{F@{Lcm!+?11jAOF+zyy$Pd7v{yK{VXG_sHVy* zV=bD)jqd5=f37{6bv%}4xqh|Yu{6_5&6bRKozo+6ejZWKLtlFUtj`Do`�DN>v0;j*NSUn@AEC$So)`x?s<|%m5n{;d9tze zPb=N?B#kN?d(QJ@W9gq(y5~t6RW|mV=gG#>Kdp4nlQgPq>^aYqjirBD>1*Z5riuT# Lr)S@~#Q*$1&)N_z literal 0 HcmV?d00001 diff --git a/airtime_mvc/public/js/jplayer/happyworm/jPlayer/JplayerEvent.as b/airtime_mvc/public/js/jplayer/happyworm/jPlayer/JplayerEvent.as new file mode 100644 index 000000000..addb97a7a --- /dev/null +++ b/airtime_mvc/public/js/jplayer/happyworm/jPlayer/JplayerEvent.as @@ -0,0 +1,69 @@ +/* + * jPlayer Plugin for jQuery JavaScript Library + * http://www.happyworm.com/jquery/jplayer + * + * Copyright (c) 2009 - 2011 Happyworm Ltd + * Dual licensed under the MIT and GPL licenses. + * - http://www.opensource.org/licenses/mit-license.php + * - http://www.gnu.org/copyleft/gpl.html + * + * Author: Mark J Panaghiston + * Date: 8th August 2011 + */ + +package happyworm.jPlayer { + import flash.events.Event; + + public class JplayerEvent extends Event { + + // The event strings must match those in the JavaScript's $.jPlayer.event object + + public static const JPLAYER_READY:String = "jPlayer_ready"; + public static const JPLAYER_FLASHRESET:String = "jPlayer_flashreset"; // Handled in JavaScript + public static const JPLAYER_RESIZE:String = "jPlayer_resize"; // Handled in JavaScript + public static const JPLAYER_REPEAT:String = "jPlayer_repeat"; // Handled in JavaScript + public static const JPLAYER_CLICK:String = "jPlayer_click"; + public static const JPLAYER_ERROR:String = "jPlayer_error"; + public static const JPLAYER_WARNING:String = "jPlayer_warning"; // Currently not used by the flash solution + + public static const JPLAYER_LOADSTART:String = "jPlayer_loadstart"; + public static const JPLAYER_PROGRESS:String = "jPlayer_progress"; + public static const JPLAYER_SUSPEND:String = "jPlayer_suspend"; // Not implemented + public static const JPLAYER_ABORT:String = "jPlayer_abort"; // Not implemented + public static const JPLAYER_EMPTIED:String = "jPlayer_emptied"; // Not implemented + public static const JPLAYER_STALLED:String = "jPlayer_stalled"; // Not implemented + public static const JPLAYER_PLAY:String = "jPlayer_play"; + public static const JPLAYER_PAUSE:String = "jPlayer_pause"; + public static const JPLAYER_LOADEDMETADATA:String = "jPlayer_loadedmetadata"; // MP3 has no equivilent + public static const JPLAYER_LOADEDDATA:String = "jPlayer_loadeddata"; // Not implemented + public static const JPLAYER_WAITING:String = "jPlayer_waiting"; // Not implemented + public static const JPLAYER_PLAYING:String = "jPlayer_playing"; // Not implemented + public static const JPLAYER_CANPLAY:String = "jPlayer_canplay"; // Not implemented + public static const JPLAYER_CANPLAYTHROUGH:String = "jPlayer_canplaythrough"; // Not implemented + public static const JPLAYER_SEEKING:String = "jPlayer_seeking"; + public static const JPLAYER_SEEKED:String = "jPlayer_seeked"; + public static const JPLAYER_TIMEUPDATE:String = "jPlayer_timeupdate"; + public static const JPLAYER_ENDED:String = "jPlayer_ended"; + public static const JPLAYER_RATECHANGE:String = "jPlayer_ratechange"; // Not implemented + public static const JPLAYER_DURATIONCHANGE:String = "jPlayer_durationchange"; // Not implemented + public static const JPLAYER_VOLUMECHANGE:String = "jPlayer_volumechange"; // See JavaScript + + // Events used internal to jPlayer's Flash. + public static const DEBUG_MSG:String = "debug_msg"; + + public var data:JplayerStatus; + public var msg:String = "" + + public function JplayerEvent(type:String, data:JplayerStatus, msg:String = "", bubbles:Boolean = false, cancelable:Boolean = false) { + super(type, bubbles, cancelable); + this.data = data; + this.msg = msg; + } + public override function clone():Event { + return new JplayerEvent(type, data, msg, bubbles, cancelable); + } + public override function toString():String { + return formatToString("JplayerEvent", "type", "bubbles", "cancelable", "eventPhase", "data", "msg"); + } + } +} \ No newline at end of file diff --git a/airtime_mvc/public/js/jplayer/happyworm/jPlayer/JplayerMp3.as b/airtime_mvc/public/js/jplayer/happyworm/jPlayer/JplayerMp3.as new file mode 100644 index 000000000..8c51d5b76 --- /dev/null +++ b/airtime_mvc/public/js/jplayer/happyworm/jPlayer/JplayerMp3.as @@ -0,0 +1,328 @@ +/* + * jPlayer Plugin for jQuery JavaScript Library + * http://www.happyworm.com/jquery/jplayer + * + * Copyright (c) 2009 - 2011 Happyworm Ltd + * Dual licensed under the MIT and GPL licenses. + * - http://www.opensource.org/licenses/mit-license.php + * - http://www.gnu.org/copyleft/gpl.html + * + * Author: Mark J Panaghiston + * Date: 1st September 2011 + */ + +package happyworm.jPlayer { + import flash.display.Sprite; + + import flash.media.Sound; + import flash.media.SoundChannel; + import flash.media.SoundLoaderContext; + import flash.media.SoundTransform; + import flash.net.URLRequest; + import flash.utils.Timer; + import flash.errors.IOError; + import flash.events.*; + + public class JplayerMp3 extends Sprite { + private var mySound:Sound = new Sound(); + private var myChannel:SoundChannel = new SoundChannel(); + private var myContext:SoundLoaderContext = new SoundLoaderContext(3000, false); + private var myTransform:SoundTransform = new SoundTransform(); + private var myRequest:URLRequest = new URLRequest(); + + private var timeUpdateTimer:Timer = new Timer(250, 0); // Matched to HTML event freq + private var progressTimer:Timer = new Timer(250, 0); // Matched to HTML event freq + private var seekingTimer:Timer = new Timer(100, 0); // Internal: How often seeking is checked to see if it is over. + + public var myStatus:JplayerStatus = new JplayerStatus(); + + public function JplayerMp3(volume:Number) { + timeUpdateTimer.addEventListener(TimerEvent.TIMER, timeUpdateHandler); + progressTimer.addEventListener(TimerEvent.TIMER, progressHandler); + seekingTimer.addEventListener(TimerEvent.TIMER, seekingHandler); + setVolume(volume); + } + public function setFile(src:String):void { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "setFile: " + src)); + if(myStatus.isPlaying) { + myChannel.stop(); + progressUpdates(false); + timeUpdates(false); + } + try { + mySound.close(); + } catch (err:IOError) { + // Occurs if the file is either yet to be opened or has finished downloading. + } + mySound = null; + mySound = new Sound(); + mySound.addEventListener(IOErrorEvent.IO_ERROR, errorHandler); + mySound.addEventListener(Event.OPEN, loadOpen); + mySound.addEventListener(Event.COMPLETE, loadComplete); + myRequest = new URLRequest(src); + myStatus.reset(); + myStatus.src = src; + myStatus.srcSet = true; + timeUpdateEvent(); + } + public function clearFile():void { + setFile(""); + myStatus.srcSet = false; + } + private function errorHandler(err:IOErrorEvent):void { + // MP3 player needs to stop progress and timeupdate events as they are started before the error occurs. + // NB: The MP4 player works differently and the error occurs before they are started. + progressUpdates(false); + timeUpdates(false); + myStatus.error(); // Resets status except the src, and it sets srcError property. + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ERROR, myStatus)); + } + private function loadOpen(e:Event):void { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "loadOpen:")); + myStatus.loading(); + if(myStatus.playOnLoad) { + myStatus.playOnLoad = false; // Capture the flag + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADSTART, myStatus)); // So loadstart event happens before play event occurs. + play(); + } else { + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADSTART, myStatus)); + pause(); + } + progressUpdates(true); + } + private function loadComplete(e:Event):void { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "loadComplete:")); + myStatus.loaded(); + progressUpdates(false); + progressEvent(); + } + private function soundCompleteHandler(e:Event):void { + myStatus.pausePosition = 0; + myStatus.isPlaying = false; + timeUpdates(false); + timeUpdateEvent(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ENDED, myStatus)); + } + private function progressUpdates(active:Boolean):void { + // Using a timer rather than Flash's load progress event, because that event gave data at about 200Hz. The 10Hz timer is closer to HTML5 norm. + if(active) { + progressTimer.start(); + } else { + progressTimer.stop(); + } + } + private function progressHandler(e:TimerEvent):void { + progressEvent(); + } + private function progressEvent():void { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "progressEvent:")); + updateStatusValues(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PROGRESS, myStatus)); + } + private function timeUpdates(active:Boolean):void { + if(active) { + timeUpdateTimer.start(); + } else { + timeUpdateTimer.stop(); + } + } + private function timeUpdateHandler(e:TimerEvent):void { + timeUpdateEvent(); + } + private function timeUpdateEvent():void { + updateStatusValues(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_TIMEUPDATE, myStatus)); + } + private function seeking(active:Boolean):void { + if(active) { + if(!myStatus.isSeeking) { + seekingEvent(); + seekingTimer.start(); + } + } else { + seekingTimer.stop(); + } + } + private function seekingHandler(e:TimerEvent):void { + if(myStatus.pausePosition <= getDuration()) { + seekedEvent(); + seeking(false); + if(myStatus.playOnSeek) { + myStatus.playOnSeek = false; // Capture the flag. + play(); + } + } else if(myStatus.isLoaded && (myStatus.pausePosition > getDuration())) { + // Illegal seek time + seeking(false); + seekedEvent(); + pause(0); + } + } + private function seekingEvent():void { + myStatus.isSeeking = true; + updateStatusValues(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_SEEKING, myStatus)); + } + private function seekedEvent():void { + myStatus.isSeeking = false; + updateStatusValues(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_SEEKED, myStatus)); + } + public function load():Boolean { + if(myStatus.loadRequired()) { + myStatus.startingDownload(); + mySound.load(myRequest, myContext); + return true; + } else { + return false; + } + } + public function play(time:Number = NaN):Boolean { + var wasPlaying:Boolean = myStatus.isPlaying; + + if(!isNaN(time) && myStatus.srcSet) { + if(myStatus.isPlaying) { + myChannel.stop(); + myStatus.isPlaying = false; + } + myStatus.pausePosition = time; + } + + if(myStatus.isStartingDownload) { + myStatus.playOnLoad = true; // Raise flag, captured in loadOpen() + return true; + } else if(myStatus.loadRequired()) { + myStatus.playOnLoad = true; // Raise flag, captured in loadOpen() + return load(); + } else if((myStatus.isLoading || myStatus.isLoaded) && !myStatus.isPlaying) { + if(myStatus.isLoaded && myStatus.pausePosition > getDuration()) { // The time is invalid, ie., past the end. + myStatus.pausePosition = 0; + timeUpdates(false); + timeUpdateEvent(); + if(wasPlaying) { // For when playing and then get a play(huge) + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PAUSE, myStatus)); + } + } else if(myStatus.pausePosition > getDuration()) { + myStatus.playOnSeek = true; + seeking(true); + } else { + myStatus.isPlaying = true; // Set immediately before playing. Could affects events. + myChannel = mySound.play(myStatus.pausePosition); + myChannel.soundTransform = myTransform; + myChannel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler); + timeUpdates(true); + if(!wasPlaying) { + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PLAY, myStatus)); + } + } + return true; + } else { + return false; + } + } + public function pause(time:Number = NaN):Boolean { + myStatus.playOnLoad = false; // Reset flag in case load/play issued immediately before this command, ie., before loadOpen() event. + myStatus.playOnSeek = false; // Reset flag in case play(time) issued before the command and is still seeking to time set. + + var wasPlaying:Boolean = myStatus.isPlaying; + + // To avoid possible loops with timeupdate and pause(time). A pause() does not have the problem. + var alreadyPausedAtTime:Boolean = false; + if(!isNaN(time) && myStatus.pausePosition == time) { + alreadyPausedAtTime = true; + } + + if(myStatus.isPlaying) { + myStatus.isPlaying = false; + myChannel.stop(); + if(myChannel.position > 0) { // Required otherwise a fast play then pause causes myChannel.position to equal zero and not the correct value. ie., When it happens leave pausePosition alone. + myStatus.pausePosition = myChannel.position; + } + } + + if(!isNaN(time) && myStatus.srcSet) { + myStatus.pausePosition = time; + } + + if(wasPlaying) { + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PAUSE, myStatus)); + } + + if(myStatus.isStartingDownload) { + return true; + } else if(myStatus.loadRequired()) { + if(time > 0) { // We do not want the stop() command, which does pause(0), causing a load operation. + return load(); + } else { + return true; // Technically the pause(0) succeeded. ie., It did nothing, since nothing was required. + } + } else if(myStatus.isLoading || myStatus.isLoaded) { + if(myStatus.isLoaded && myStatus.pausePosition > getDuration()) { // The time is invalid, ie., past the end. + myStatus.pausePosition = 0; + } else if(myStatus.pausePosition > getDuration()) { + seeking(true); + } + timeUpdates(false); + // Need to be careful with timeupdate event, otherwise a pause in a timeupdate event can cause a loop. + // Neither pause() nor pause(time) will cause a timeupdate loop. + if(wasPlaying || !isNaN(time) && !alreadyPausedAtTime) { + timeUpdateEvent(); + } + return true; + } else { + return false; + } + } + public function playHead(percent:Number):Boolean { + var time:Number = percent * getDuration() / 100; + if(myStatus.isPlaying || myStatus.playOnLoad || myStatus.playOnSeek) { + return play(time); + } else { + return pause(time); + } + } + public function setVolume(v:Number):void { + myStatus.volume = v; + myTransform.volume = v; + myChannel.soundTransform = myTransform; + } + private function updateStatusValues():void { + myStatus.seekPercent = 100 * getLoadRatio(); + myStatus.currentTime = getCurrentTime(); + myStatus.currentPercentRelative = 100 * getCurrentRatioRel(); + myStatus.currentPercentAbsolute = 100 * getCurrentRatioAbs(); + myStatus.duration = getDuration(); + } + public function getLoadRatio():Number { + if((myStatus.isLoading || myStatus.isLoaded) && mySound.bytesTotal > 0) { + return mySound.bytesLoaded / mySound.bytesTotal; + } else { + return 0; + } + } + public function getDuration():Number { + if(mySound.length > 0) { + return mySound.length; + } else { + return 0; + } + } + public function getCurrentTime():Number { + if(myStatus.isPlaying) { + return myChannel.position; + } else { + return myStatus.pausePosition; + } + } + public function getCurrentRatioRel():Number { + if((getDuration() > 0) && (getCurrentTime() <= getDuration())) { + return getCurrentTime() / getDuration(); + } else { + return 0; + } + } + public function getCurrentRatioAbs():Number { + return getCurrentRatioRel() * getLoadRatio(); + } + } +} diff --git a/airtime_mvc/public/js/jplayer/happyworm/jPlayer/JplayerMp4.as b/airtime_mvc/public/js/jplayer/happyworm/jPlayer/JplayerMp4.as new file mode 100644 index 000000000..dcdc0655d --- /dev/null +++ b/airtime_mvc/public/js/jplayer/happyworm/jPlayer/JplayerMp4.as @@ -0,0 +1,413 @@ +/* + * jPlayer Plugin for jQuery JavaScript Library + * http://www.happyworm.com/jquery/jplayer + * + * Copyright (c) 2009 - 2011 Happyworm Ltd + * Dual licensed under the MIT and GPL licenses. + * - http://www.opensource.org/licenses/mit-license.php + * - http://www.gnu.org/copyleft/gpl.html + * + * Author: Mark J Panaghiston + * Date: 7th August 2011 + */ + +package happyworm.jPlayer { + import flash.display.Sprite; + + import flash.media.Video; + import flash.media.SoundTransform; + + import flash.net.NetConnection; + import flash.net.NetStream; + + import flash.utils.Timer; + + import flash.events.NetStatusEvent; + import flash.events.SecurityErrorEvent; + import flash.events.TimerEvent; + + public class JplayerMp4 extends Sprite { + + public var myVideo:Video = new Video(); + private var myConnection:NetConnection; + private var myStream:NetStream; + + private var myTransform:SoundTransform = new SoundTransform(); + + public var myStatus:JplayerStatus = new JplayerStatus(); + + private var timeUpdateTimer:Timer = new Timer(250, 0); // Matched to HTML event freq + private var progressTimer:Timer = new Timer(250, 0); // Matched to HTML event freq + private var seekingTimer:Timer = new Timer(100, 0); // Internal: How often seeking is checked to see if it is over. + + public function JplayerMp4(volume:Number) { + myConnection = new NetConnection(); + myConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); + myConnection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); + myVideo.smoothing = true; + this.addChild(myVideo); + + timeUpdateTimer.addEventListener(TimerEvent.TIMER, timeUpdateHandler); + progressTimer.addEventListener(TimerEvent.TIMER, progressHandler); + seekingTimer.addEventListener(TimerEvent.TIMER, seekingHandler); + + myStatus.volume = volume; + } + private function progressUpdates(active:Boolean):void { + if(active) { + progressTimer.start(); + } else { + progressTimer.stop(); + } + } + private function progressHandler(e:TimerEvent):void { + if(myStatus.isLoading) { + if(getLoadRatio() == 1) { // Close as can get to a loadComplete event since client.onPlayStatus only works with FMS + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "progressHandler: loadComplete")); + myStatus.loaded(); + progressUpdates(false); + } + } + progressEvent(); + } + private function progressEvent():void { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "progressEvent:")); + updateStatusValues(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PROGRESS, myStatus)); + } + private function timeUpdates(active:Boolean):void { + if(active) { + timeUpdateTimer.start(); + } else { + timeUpdateTimer.stop(); + } + } + private function timeUpdateHandler(e:TimerEvent):void { + timeUpdateEvent(); + } + private function timeUpdateEvent():void { + updateStatusValues(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_TIMEUPDATE, myStatus)); + } + private function seeking(active:Boolean):void { + if(active) { + if(!myStatus.isSeeking) { + seekingEvent(); + } + seekingTimer.start(); + } else { + if(myStatus.isSeeking) { + seekedEvent(); + } + seekingTimer.stop(); + } + } + private function seekingHandler(e:TimerEvent):void { + if(getSeekTimeRatio() <= getLoadRatio()) { + seeking(false); + if(myStatus.playOnSeek) { + myStatus.playOnSeek = false; // Capture the flag. + play(myStatus.pausePosition); // Must pass time or the seek time is never set. + } else { + pause(myStatus.pausePosition); // Must pass time or the stream.time is read. + } + } else if(myStatus.metaDataReady && myStatus.pausePosition > myStatus.duration) { + // Illegal seek time + seeking(false); + pause(0); + } + } + private function seekingEvent():void { + myStatus.isSeeking = true; + updateStatusValues(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_SEEKING, myStatus)); + } + private function seekedEvent():void { + myStatus.isSeeking = false; + updateStatusValues(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_SEEKED, myStatus)); + } + private function netStatusHandler(e:NetStatusEvent):void { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "netStatusHandler: '" + e.info.code + "'")); + switch(e.info.code) { + case "NetConnection.Connect.Success": + connectStream(); + break; + case "NetStream.Play.Start": + // This event code occurs once, when the media is opened. Equiv to loadOpen() in mp3 player. + myStatus.loading(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADSTART, myStatus)); + progressUpdates(true); + // See onMetaDataHandler() for other condition, since duration is vital. + break; + case "NetStream.Play.Stop": + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "NetStream.Play.Stop: getDuration() - getCurrentTime() = " + (getDuration() - getCurrentTime()))); + + // Check if media is at the end (or close) otherwise this was due to download bandwidth stopping playback. ie., Download is not fast enough. + if(Math.abs(getDuration() - getCurrentTime()) < 150) { // Testing found 150ms worked best for M4A files, where playHead(99.9) caused a stuck state due to firing with ~116ms left to play. + endedEvent(); + } + break; + case "NetStream.Seek.InvalidTime": + // Used for capturing invalid set times and clicks on the end of the progress bar. + endedEvent(); + break; + case "NetStream.Play.StreamNotFound": + myStatus.error(); // Resets status except the src, and it sets srcError property. + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ERROR, myStatus)); + break; + } + // "NetStream.Seek.Notify" event code is not very useful. It occurs after every seek(t) command issued and does not appear to wait for the media to be ready. + } + private function endedEvent():void { + var wasPlaying:Boolean = myStatus.isPlaying; + pause(0); + timeUpdates(false); + timeUpdateEvent(); + if(wasPlaying) { + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ENDED, myStatus)); + } + } + private function securityErrorHandler(event:SecurityErrorEvent):void { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "securityErrorHandler.")); + } + private function connectStream():void { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "connectStream.")); + var customClient:Object = new Object(); + customClient.onMetaData = onMetaDataHandler; + // customClient.onPlayStatus = onPlayStatusHandler; // According to the forums and my tests, onPlayStatus only works with FMS (Flash Media Server). + myStream = null; + myStream = new NetStream(myConnection); + myStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); + myStream.client = customClient; + myVideo.attachNetStream(myStream); + setVolume(myStatus.volume); + myStream.play(myStatus.src); + } + public function setFile(src:String):void { + if(myStream != null) { + myStream.close(); + } + myVideo.clear(); + progressUpdates(false); + timeUpdates(false); + + myStatus.reset(); + myStatus.src = src; + myStatus.srcSet = true; + timeUpdateEvent(); + } + public function clearFile():void { + setFile(""); + myStatus.srcSet = false; + } + public function load():Boolean { + if(myStatus.loadRequired()) { + myStatus.startingDownload(); + myConnection.connect(null); + return true; + } else { + return false; + } + } + public function play(time:Number = NaN):Boolean { + var wasPlaying:Boolean = myStatus.isPlaying; + + if(!isNaN(time) && myStatus.srcSet) { + if(myStatus.isPlaying) { + myStream.pause(); + myStatus.isPlaying = false; + } + myStatus.pausePosition = time; + } + + if(myStatus.isStartingDownload) { + myStatus.playOnLoad = true; // Raise flag, captured in onMetaDataHandler() + return true; + } else if(myStatus.loadRequired()) { + myStatus.playOnLoad = true; // Raise flag, captured in onMetaDataHandler() + return load(); + } else if((myStatus.isLoading || myStatus.isLoaded) && !myStatus.isPlaying) { + if(myStatus.metaDataReady && myStatus.pausePosition > myStatus.duration) { // The time is invalid, ie., past the end. + myStream.pause(); // Since it is playing by default at this point. + myStatus.pausePosition = 0; + myStream.seek(0); + timeUpdates(false); + timeUpdateEvent(); + if(wasPlaying) { // For when playing and then get a play(huge) + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PAUSE, myStatus)); + } + } else if(getSeekTimeRatio() > getLoadRatio()) { // Use an estimate based on the downloaded amount + myStatus.playOnSeek = true; + seeking(true); + myStream.pause(); // Since it is playing by default at this point. + } else { + if(!isNaN(time)) { // Avoid using seek() when it is already correct. + myStream.seek(myStatus.pausePosition/1000); // Since time is in ms and seek() takes seconds + } + myStatus.isPlaying = true; // Set immediately before playing. Could affects events. + myStream.resume(); + timeUpdates(true); + if(!wasPlaying) { + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PLAY, myStatus)); + } + } + return true; + } else { + return false; + } + } + public function pause(time:Number = NaN):Boolean { + myStatus.playOnLoad = false; // Reset flag in case load/play issued immediately before this command, ie., before onMetadata() event. + myStatus.playOnSeek = false; // Reset flag in case play(time) issued before the command and is still seeking to time set. + + var wasPlaying:Boolean = myStatus.isPlaying; + + // To avoid possible loops with timeupdate and pause(time). A pause() does not have the problem. + var alreadyPausedAtTime:Boolean = false; + if(!isNaN(time) && myStatus.pausePosition == time) { + alreadyPausedAtTime = true; + } + + // Need to wait for metadata to load before ever issuing a pause. The metadata handler will call this function if needed, when ready. + if(myStream != null && myStatus.metaDataReady) { // myStream is a null until the 1st media is loaded. ie., The 1st ever setMedia being followed by a pause() or pause(t). + myStream.pause(); + } + if(myStatus.isPlaying) { + myStatus.isPlaying = false; + myStatus.pausePosition = myStream.time * 1000; + } + + if(!isNaN(time) && myStatus.srcSet) { + myStatus.pausePosition = time; + } + + if(wasPlaying) { + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PAUSE, myStatus)); + } + + if(myStatus.isStartingDownload) { + return true; + } else if(myStatus.loadRequired()) { + if(time > 0) { // We do not want the stop() command, which does pause(0), causing a load operation. + return load(); + } else { + return true; // Technically the pause(0) succeeded. ie., It did nothing, since nothing was required. + } + } else if(myStatus.isLoading || myStatus.isLoaded) { + if(myStatus.metaDataReady && myStatus.pausePosition > myStatus.duration) { // The time is invalid, ie., past the end. + myStatus.pausePosition = 0; + myStream.seek(0); + seekedEvent(); // Deals with seeking effect when using setMedia() then pause(huge). NB: There is no preceeding seeking event. + } else if(!isNaN(time)) { + if(getSeekTimeRatio() > getLoadRatio()) { // Use an estimate based on the downloaded amount + seeking(true); + } else { + if(myStatus.metaDataReady) { // Otherwise seek(0) will stop the metadata loading. + myStream.seek(myStatus.pausePosition/1000); + } + } + } + timeUpdates(false); + // Need to be careful with timeupdate event, otherwise a pause in a timeupdate event can cause a loop. + // Neither pause() nor pause(time) will cause a timeupdate loop. + if(wasPlaying || !isNaN(time) && !alreadyPausedAtTime) { + timeUpdateEvent(); + } + return true; + } else { + return false; + } + } + public function playHead(percent:Number):Boolean { + var time:Number = percent * getDuration() * getLoadRatio() / 100; + if(myStatus.isPlaying || myStatus.playOnLoad || myStatus.playOnSeek) { + return play(time); + } else { + return pause(time); + } + } + public function setVolume(v:Number):void { + myStatus.volume = v; + myTransform.volume = v; + if(myStream != null) { + myStream.soundTransform = myTransform; + } + } + private function updateStatusValues():void { + myStatus.seekPercent = 100 * getLoadRatio(); + myStatus.currentTime = getCurrentTime(); + myStatus.currentPercentRelative = 100 * getCurrentRatioRel(); + myStatus.currentPercentAbsolute = 100 * getCurrentRatioAbs(); + myStatus.duration = getDuration(); + } + public function getLoadRatio():Number { + if((myStatus.isLoading || myStatus.isLoaded) && myStream.bytesTotal > 0) { + return myStream.bytesLoaded / myStream.bytesTotal; + } else { + return 0; + } + } + public function getDuration():Number { + return myStatus.duration; // Set from meta data. + } + public function getCurrentTime():Number { + if(myStatus.isPlaying) { + return myStream.time * 1000; + } else { + return myStatus.pausePosition; + } + } + public function getCurrentRatioRel():Number { + if((getLoadRatio() > 0) && (getCurrentRatioAbs() <= getLoadRatio())) { + return getCurrentRatioAbs() / getLoadRatio(); + } else { + return 0; + } + } + public function getCurrentRatioAbs():Number { + if(getDuration() > 0) { + return getCurrentTime() / getDuration(); + } else { + return 0; + } + } + public function getSeekTimeRatio():Number { + if(getDuration() > 0) { + return myStatus.pausePosition / getDuration(); + } else { + return 1; + } + } + public function onMetaDataHandler(info:Object):void { // Used in connectStream() in myStream.client object. + // This event occurs when jumping to the start of static files! ie., seek(0) will cause this event to occur. + if(!myStatus.metaDataReady) { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "onMetaDataHandler: " + info.duration + " | " + info.width + "x" + info.height)); + + myStatus.metaDataReady = true; // Set flag so that this event only effects jPlayer the 1st time. + myStatus.metaData = info; + myStatus.duration = info.duration * 1000; // Only available via Meta Data. + if(info.width != undefined) { + myVideo.width = info.width; + } + if(info.height != undefined) { + myVideo.height = info.height; + } + + if(myStatus.playOnLoad) { + myStatus.playOnLoad = false; // Capture the flag + if(myStatus.pausePosition > 0 ) { // Important for setMedia followed by play(time). + play(myStatus.pausePosition); + } else { + play(); // Not always sending pausePosition avoids the extra seek(0) for a normal play() command. + } + } else { + pause(myStatus.pausePosition); // Always send the pausePosition. Important for setMedia() followed by pause(time). Deals with not reading stream.time with setMedia() and play() immediately followed by stop() or pause(0) + } + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADEDMETADATA, myStatus)); + } else { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "onMetaDataHandler: Already read (NO EFFECT)")); + } + } + } +} diff --git a/airtime_mvc/public/js/jplayer/happyworm/jPlayer/JplayerStatus.as b/airtime_mvc/public/js/jplayer/happyworm/jPlayer/JplayerStatus.as new file mode 100644 index 000000000..5cc1e1ff4 --- /dev/null +++ b/airtime_mvc/public/js/jplayer/happyworm/jPlayer/JplayerStatus.as @@ -0,0 +1,101 @@ +/* + * jPlayer Plugin for jQuery JavaScript Library + * http://www.happyworm.com/jquery/jplayer + * + * Copyright (c) 2009 - 2011 Happyworm Ltd + * Dual licensed under the MIT and GPL licenses. + * - http://www.opensource.org/licenses/mit-license.php + * - http://www.gnu.org/copyleft/gpl.html + * + * Author: Mark J Panaghiston + * Date: 1st September 2011 + */ + +package happyworm.jPlayer { + public class JplayerStatus { + + public static const VERSION:String = "2.1.0"; // The version of the Flash jPlayer entity. + + public var volume:Number = 0.5; // Not affected by reset() + public var muted:Boolean = false; // Not affected by reset() + + public var src:String; + public var srcError:Boolean; + + public var srcSet:Boolean; + public var isPlaying:Boolean; + public var isSeeking:Boolean; + + public var playOnLoad:Boolean; + public var playOnSeek:Boolean; + + public var isStartingDownload:Boolean; + public var isLoading:Boolean; + public var isLoaded:Boolean; + + public var pausePosition:Number; + + public var seekPercent:Number; + public var currentTime:Number; + public var currentPercentRelative:Number; + public var currentPercentAbsolute:Number; + public var duration:Number; + + public var metaDataReady:Boolean; + public var metaData:Object; + + public function JplayerStatus() { + reset(); + } + public function reset():void { + src = ""; + srcError = false; + + srcSet = false; + isPlaying = false; + isSeeking = false; + + playOnLoad = false; + playOnSeek = false; + + isStartingDownload = false; + isLoading = false; + isLoaded = false; + + pausePosition = 0; + + seekPercent = 0; + currentTime = 0; + currentPercentRelative = 0; + currentPercentAbsolute = 0; + duration = 0; + + metaDataReady = false; + metaData = {}; + } + public function error():void { + var srcSaved:String = src; + reset(); + src = srcSaved; + srcError = true; + } + public function loadRequired():Boolean { + return (srcSet && !isStartingDownload && !isLoading && !isLoaded); + } + public function startingDownload():void { + isStartingDownload = true; + isLoading = false; + isLoaded = false; + } + public function loading():void { + isStartingDownload = false; + isLoading = true; + isLoaded = false; + } + public function loaded():void { + isStartingDownload = false; + isLoading = false; + isLoaded = true; + } + } +} From 82e680e69498373f41c6f5422d14ad42c23af56d Mon Sep 17 00:00:00 2001 From: Paul Baranowski Date: Mon, 5 Mar 2012 17:09:48 -0500 Subject: [PATCH 29/35] Removed headers about GPL and allow these files to fall under the generic Airtime license. --- utils/airtime-check-system | 21 ------ utils/airtime-log | 24 ------- utils/airtime-update-db-settings | 27 ------- utils/serbianLatinToCyrillicConverter.py | 92 ------------------------ 4 files changed, 164 deletions(-) delete mode 100644 utils/serbianLatinToCyrillicConverter.py diff --git a/utils/airtime-check-system b/utils/airtime-check-system index 164fac6f9..3c00235c2 100755 --- a/utils/airtime-check-system +++ b/utils/airtime-check-system @@ -1,26 +1,5 @@ #!/bin/bash #------------------------------------------------------------------------------- -# Copyright (c) 2010 Sourcefabric O.P.S. -# -# This file is part of the Airtime project. -# http://airtime.sourcefabric.org/ -# -# Airtime is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# Airtime is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Airtime; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -#------------------------------------------------------------------------------- -#------------------------------------------------------------------------------- # This script for a correct system environment for Airtime. # # Absolute path to this script diff --git a/utils/airtime-log b/utils/airtime-log index c6053de5e..b606d9217 100755 --- a/utils/airtime-log +++ b/utils/airtime-log @@ -1,28 +1,4 @@ #!/bin/bash -#------------------------------------------------------------------------------- -# Copyright (c) 2010 Sourcefabric O.P.S. -# -# This file is part of the Airtime project. -# http://airtime.sourcefabric.org/ -# -# Airtime is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# Airtime is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Airtime; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -#------------------------------------------------------------------------------- -#------------------------------------------------------------------------------- -# This script sets stream setting(max bitrate and number of streams in Airtime. -# # Absolute path to this script SCRIPT=`readlink -f $0` # Absolute directory this script is in diff --git a/utils/airtime-update-db-settings b/utils/airtime-update-db-settings index af255803a..5ed0fcd89 100755 --- a/utils/airtime-update-db-settings +++ b/utils/airtime-update-db-settings @@ -1,31 +1,4 @@ #!/bin/bash -#------------------------------------------------------------------------------- -# Copyright (c) 2010 Sourcefabric O.P.S. -# -# This file is part of the Airtime project. -# http://airtime.sourcefabric.org/ -# -# Airtime is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# Airtime is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Airtime; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -#------------------------------------------------------------------------------- -#------------------------------------------------------------------------------- -# This script imports audio files to the Airtime storageServer. -# -# To get usage help, try the -h option -#------------------------------------------------------------------------------- - #------------------------------------------------------------------------------- # Determine directories, files #------------------------------------------------------------------------------- diff --git a/utils/serbianLatinToCyrillicConverter.py b/utils/serbianLatinToCyrillicConverter.py deleted file mode 100644 index 44c22cd32..000000000 --- a/utils/serbianLatinToCyrillicConverter.py +++ /dev/null @@ -1,92 +0,0 @@ -# -*- coding: utf-8 -*- -#------------------------------------------------------------------------------- -# Copyright (c) 2010 Sourcefabric O.P.S. -# -# This file is part of the Airtime project. -# http://airtime.sourcefabric.org/ -# To report bugs, send an e-mail to contact@sourcefabric.org -# -# Airtime is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# Airtime is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Airtime; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# -#------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# This script converts an ICU localization file from Serbian Latin -# to Serbian Cyrillic. -#------------------------------------------------------------------------------- - -import sys, re, codecs - -usageString = 'Usage: serbianLatinToCyrillicConverter.py' \ - ' inputfile outputfile' - -if len(sys.argv) >= 3: - fileNameIn = sys.argv[1] - fileNameOut = sys.argv[2] -else: - print usageString - sys.exit(1) - -oldLines = codecs.open(fileNameIn, 'r', 'utf-8').readlines() -newLines = [ ] - -def cyrillize(word): - if re.match(r'#.*#\Z', word): - return word - - compound = { u'lj' : u'љ', u'Lj' : u'Љ', - u'nj' : u'њ', u'Nj' : u'Њ', - u'dž' : u'џ', u'Dž' : u'Џ' } - simple = dict(zip(u'abvgdđežzijklmnoprstćufhcčšw', - u'абвгдђежзијклмнопрстћуфхцчшв')) - simple.update(dict(zip(u'ABVGDĐEŽZIJKLMNOPRSTĆUFHCČŠW', - u'АБВГДЂЕЖЗИЈКЛМНОПРСТЋУФХЦЧШВ'))) - exceptions = { ur'\н' : ur'\n', - u'Фаде ин' : u'Фејд ин', - u'Фаде оут' : u'Фејд аут', - u'фаде ин' : u'фејд ин', - u'фаде оут' : u'фејд аут', - u'есцапе' : u'ескејп', - u'Плаy' : u'Плеј', - u'Паусе' : u'Поуз', - u'трацк' : u'трак', - u'УРИ' : u'URI', - u'РДС' : u'RDS', - u'БПМ' : u'BPM', - u'ИСРЦ' : u'ISRC' } - - for latin, cyrillic in compound.iteritems(): - word = word.replace(latin, cyrillic) - for latin, cyrillic in simple.iteritems(): - word = word.replace(latin, cyrillic) - for bad, good in exceptions.iteritems(): - word = word.replace(bad, good) - - return word - -for line in oldLines: - m = re.match(r'(.*)"(.*)"(.*)\n', line) - if m: - line = m.groups()[0] + '"' \ - + cyrillize(m.groups()[1]) + '"' \ - + m.groups()[2] + '\n' - - elif line == 'sr_CS:table\n': - line = 'sr_CS_CYRILLIC:table\n' - - newLines += [line] - -codecs.open(fileNameOut, 'w', 'utf-8').writelines(newLines) From 0dfcb77f1acd04acbb2fe63923de1853bf14d308 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 5 Mar 2012 23:53:25 -0500 Subject: [PATCH 30/35] CC-3386: array access for "media_played" flag is hardcoded to 0 -fixed --- airtime_mvc/application/models/Schedule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index cc12a5a47..6dc973447 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -195,7 +195,7 @@ class Application_Model_Schedule { $results['current'] = array("name"=>$row[$i]["artist_name"]." - ".$row[$i]["track_title"], "starts"=>$row[$i]["starts"], "ends"=>$row[$i]["ends"], - "media_item_played"=>$row[0]["media_item_played"], + "media_item_played"=>$row[$i]["media_item_played"], "record"=>0); if ( isset($row[$i+1])){ $results['next'] = array("name"=>$row[$i+1]["artist_name"]." - ".$row[$i+1]["track_title"], From c0f83a0e021d2e53dc478814853adb6af641c1e8 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Tue, 6 Mar 2012 00:05:06 -0500 Subject: [PATCH 31/35] CC-3387: Error with accessing database on Now Playing view -fixed --- airtime_mvc/application/models/Nowplaying.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/Nowplaying.php b/airtime_mvc/application/models/Nowplaying.php index cff2598ef..4e3ca308b 100644 --- a/airtime_mvc/application/models/Nowplaying.php +++ b/airtime_mvc/application/models/Nowplaying.php @@ -88,8 +88,6 @@ class Application_Model_Nowplaying $start_dt->sub(new DateInterval("PT60S")); $end_dt->add(new DateInterval("PT24H")); } else { - Logging::log("HIII"); - //convert to UTC $utc_dt = Application_Model_DateHelper::ConvertToUtcDateTime($p_dateString); $start_dt = $utc_dt; @@ -140,6 +138,7 @@ class Application_Model_Nowplaying $data[] = self::CreateGapRow($gapTime); } + $timeNow = gmdate("Y-m-d H:i:s"); $rows = Application_Model_Show::GetCurrentShow($timeNow); Application_Model_Show::ConvertToLocalTimeZone($rows, array("starts", "ends", "start_timestamp", "end_timestamp")); return array("currentShow"=>$rows, "rows"=>$data); From 5f4738dc7a92b12e860604db62dfbe314c10502e Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Tue, 6 Mar 2012 11:46:42 -0500 Subject: [PATCH 32/35] CC-3389: Login page says copyright is 2010-2011 rather than 2010-2012 -fixed --- airtime_mvc/application/configs/constants.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/configs/constants.php b/airtime_mvc/application/configs/constants.php index cfe93182e..bebedaa0c 100644 --- a/airtime_mvc/application/configs/constants.php +++ b/airtime_mvc/application/configs/constants.php @@ -1,6 +1,6 @@ Date: Mon, 12 Mar 2012 12:24:54 -0400 Subject: [PATCH 33/35] -remove unused function --- .../js/airtime/dashboard/helperfunctions.js | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/airtime_mvc/public/js/airtime/dashboard/helperfunctions.js b/airtime_mvc/public/js/airtime/dashboard/helperfunctions.js index ccedc28e9..1352e09c9 100644 --- a/airtime_mvc/public/js/airtime/dashboard/helperfunctions.js +++ b/airtime_mvc/public/js/airtime/dashboard/helperfunctions.js @@ -158,36 +158,6 @@ function getFileExt(filename){ return filename.split('.').pop(); } -function audioStream(){ - - if ($("#jquery_jplayer_1").data("jPlayer") && $("#jquery_jplayer_1").data("jPlayer").status.paused != true){ - $('#jquery_jplayer_1').jPlayer('clearMedia'); - $('#jquery_jplayer_1').jPlayer('destroy'); - return; - } - - var uri = "http://localhost:8000/airtime_128.ogg"; - var ext = getFileExt(uri); - - var media; - var supplied; - if (ext == "ogg"){ - media = {oga:uri}; - supplied = "oga"; - } else { - media = {mp3:uri}; - supplied = "mp3"; - } - - $("#jquery_jplayer_1").jPlayer({ - ready: function () { - $(this).jPlayer("setMedia", media).jPlayer("play"); - }, - swfPath: "/js/jplayer", - supplied: supplied - }); -} - function audioPreview(filename, elemID){ var elems = $('.ui-icon.ui-icon-pause'); From 6830af574aced77b17e798ebdd3b2a95f4e4fb33 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Tue, 13 Mar 2012 12:52:41 +0100 Subject: [PATCH 34/35] CC-3174 : showbuilder fixing some merge stuff. --- .../controllers/LibraryController.php | 4 +--- .../controllers/ShowbuilderController.php | 2 ++ .../public/js/airtime/library/main_library.js | 16 ---------------- airtime_mvc/public/js/airtime/library/spl.js | 16 +++++++++++++++- 4 files changed, 18 insertions(+), 20 deletions(-) delete mode 100644 airtime_mvc/public/js/airtime/library/main_library.js diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index 2b085b378..aa6b15bb6 100644 --- a/airtime_mvc/application/controllers/LibraryController.php +++ b/airtime_mvc/application/controllers/LibraryController.php @@ -37,7 +37,6 @@ class LibraryController extends Zend_Controller_Action $baseUrl = $request->getBaseUrl(); $this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_playlistbuilder.js'),'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/main_library.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->_helper->actionStack('library', 'library'); $this->_helper->actionStack('index', 'playlist'); @@ -64,8 +63,7 @@ class LibraryController extends Zend_Controller_Action $this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/main_library.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - + $this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']); diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php index 08edddcf0..59df1f870 100644 --- a/airtime_mvc/application/controllers/ShowbuilderController.php +++ b/airtime_mvc/application/controllers/ShowbuilderController.php @@ -96,6 +96,8 @@ class ShowbuilderController extends Zend_Controller_Action } public function builderAction() { + + global $CC_CONFIG; $this->_helper->viewRenderer->setResponseSegment('builder'); diff --git a/airtime_mvc/public/js/airtime/library/main_library.js b/airtime_mvc/public/js/airtime/library/main_library.js deleted file mode 100644 index 0682ee04a..000000000 --- a/airtime_mvc/public/js/airtime/library/main_library.js +++ /dev/null @@ -1,16 +0,0 @@ -$(document).ready(function() { - var viewport = AIRTIME.utilities.findViewportDimensions(), - lib = $("#library_content"), - pl = $("#side_playlist"), - widgetHeight = viewport.height - 185, - width = Math.floor(viewport.width - 110); - - lib.height(widgetHeight) - .width(Math.floor(width * 0.55)); - - pl.height(widgetHeight) - .width(Math.floor(width * 0.45)); - - AIRTIME.library.libraryInit(); - -}); \ No newline at end of file diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js index ea3b123fd..90e8d603f 100644 --- a/airtime_mvc/public/js/airtime/library/spl.js +++ b/airtime_mvc/public/js/airtime/library/spl.js @@ -702,5 +702,19 @@ var AIRTIME = (function(AIRTIME){ $(document).ready(function() { - AIRTIME.playlist.init(); + + var viewport = AIRTIME.utilities.findViewportDimensions(), + lib = $("#library_content"), + pl = $("#side_playlist"), + widgetHeight = viewport.height - 185, + width = Math.floor(viewport.width - 110); + + lib.height(widgetHeight) + .width(Math.floor(width * 0.55)); + + pl.height(widgetHeight) + .width(Math.floor(width * 0.45)); + + AIRTIME.library.libraryInit(); + AIRTIME.playlist.init(); }); From a8d61ff19cfa08a4e14769f80992d29ca095e8b5 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Tue, 13 Mar 2012 14:19:25 +0100 Subject: [PATCH 35/35] CC-3328 : Scrolling behaviour in Chrome on OSX makes Airtime unusable --- .../public/js/libs/jquery.stickyPanel.js | 68 ++++++++++++------- 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/airtime_mvc/public/js/libs/jquery.stickyPanel.js b/airtime_mvc/public/js/libs/jquery.stickyPanel.js index e666200e5..bb1cb2bc9 100644 --- a/airtime_mvc/public/js/libs/jquery.stickyPanel.js +++ b/airtime_mvc/public/js/libs/jquery.stickyPanel.js @@ -1,12 +1,12 @@ /* * jQuery.stickyPanel * ---------------------- -* version: 1.0.0 -* date: 1/17/11 +* version: 1.4.1 +* date: 7/21/11 * * Copyright (c) 2011 Donny Velazquez * http://donnyvblog.blogspot.com/ -* http://code.google.com/p/stickyPanel +* http://code.google.com/p/sticky-panel/ * * Licensed under the Apache License 2.0 * @@ -24,55 +24,71 @@ }; function Scroll(event) { + var node = event.data.selected; var o = event.data.options; + var isMobile = navigator.userAgent.toLowerCase().indexOf('mobile') > 0; + + var windowHeight = $(window).height(); + var nodeHeight = node.outerHeight(true); + var scrollTop = $(document).scrollTop(); + // when top of window reaches the top of the panel detach - if ($(document).scrollTop() >= node.offset().top) { + if (!isMobile && + scrollTop <= $(document).height() - windowHeight && // Fix for rubberband scrolling in Safari on Lion + scrollTop > node.offset().top - o.topPadding) { // topPadding - var top = 0; + var newNodeTop = 0; if (o.topPadding != "undefined") { - top = top + o.topPadding; + newNodeTop = newNodeTop + o.topPadding; } + // get left before adding spacer + var nodeLeft = node.offset().left; + // save panels top - node.data("PanelsTop", node.offset().top - top); + node.data("PanelsTop", node.offset().top - newNodeTop); + + // MOVED: savePanelSpace before afterDetachCSSClass to handle afterDetachCSSClass changing size of node + // savePanelSpace + if (o.savePanelSpace == true) { + var nodeWidth = node.outerWidth(true); + var nodeCssfloat = node.css("float"); + var nodeCssdisplay = node.css("display"); + var randomNum = Math.ceil(Math.random() * 9999); /* Pick random number between 1 and 9999 */ + node.data("PanelSpaceID", "stickyPanelSpace" + randomNum); + node.before("
 
"); + } // afterDetachCSSClass if (o.afterDetachCSSClass != "") { node.addClass(o.afterDetachCSSClass); } - // savePanelSpace - if (o.savePanelSpace == true) { - var width = node.outerWidth(true); - var height = node.outerHeight(true); - var float = node.css("float"); - var randomNum = Math.ceil(Math.random() * 9999); /* Pick random number between 1 and 9999 */ - node.data("PanelSpaceID", "stickyPanelSpace" + randomNum); - node.before("
"); - } + // save inline css + node.data("Original_Inline_CSS", (!node.attr("style") ? "" : node.attr("style"))); // detach panel node.css({ - "top": top, + "margin": 0, + "left": nodeLeft, + "top": newNodeTop, "position": "fixed" }); } - if ($(document).scrollTop() <= node.data("PanelsTop")) { + // ADDED: css top check to avoid continuous reattachment + if (scrollTop <= node.data("PanelsTop") && node.css("top") != "auto") { + + if (o.savePanelSpace == true) { + $("#" + node.data("PanelSpaceID")).remove(); + } - if (o.savePanelSpace == true) { - $("#" + node.data("PanelSpaceID")).remove(); - } - // attach panel - node.css({ - "top": "auto", - "position": "static" - }); + node.attr("style", node.data("Original_Inline_CSS")); if (o.afterDetachCSSClass != "") { node.removeClass(o.afterDetachCSSClass);