diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php
index ff80a4a65..7f333960a 100644
--- a/airtime_mvc/application/Bootstrap.php
+++ b/airtime_mvc/application/Bootstrap.php
@@ -3,7 +3,7 @@ require_once __DIR__."/configs/conf.php";
$CC_CONFIG = Config::getConfig();
require_once __DIR__."/configs/ACL.php";
-require_once 'propel/runtime/lib/Propel.php';
+require_once 'propel/vendor/propel/propel1/runtime/lib/Propel.php';
Propel::init(__DIR__."/configs/airtime-conf-production.php");
diff --git a/airtime_mvc/application/configs/airtime-conf-production.php b/airtime_mvc/application/configs/airtime-conf-production.php
index aaef0e371..429dfa9e0 100644
--- a/airtime_mvc/application/configs/airtime-conf-production.php
+++ b/airtime_mvc/application/configs/airtime-conf-production.php
@@ -28,7 +28,7 @@ $conf = array (
),
'default' => 'airtime',
),
- 'generator_version' => '1.5.2',
+ 'generator_version' => '1.7.0',
);
$conf['classmap'] = include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classmap-airtime-conf.php');
return $conf;
diff --git a/airtime_mvc/application/configs/airtime-conf.php b/airtime_mvc/application/configs/airtime-conf.php
index e767e18b8..b23a37334 100644
--- a/airtime_mvc/application/configs/airtime-conf.php
+++ b/airtime_mvc/application/configs/airtime-conf.php
@@ -1,5 +1,5 @@
@@ -22,7 +22,7 @@ $conf = array (
),
'default' => 'airtime',
),
- 'generator_version' => '1.5.2',
+ 'generator_version' => '1.7.0',
);
$conf['classmap'] = include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classmap-airtime-conf.php');
return $conf;
\ No newline at end of file
diff --git a/airtime_mvc/application/configs/classmap-airtime-conf.php b/airtime_mvc/application/configs/classmap-airtime-conf.php
index fb4284681..3bd595d17 100644
--- a/airtime_mvc/application/configs/classmap-airtime-conf.php
+++ b/airtime_mvc/application/configs/classmap-airtime-conf.php
@@ -1,242 +1,242 @@
'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',
- 'CcBlockTableMap' => 'airtime/map/CcBlockTableMap.php',
- 'CcBlockPeer' => 'airtime/CcBlockPeer.php',
- 'CcBlock' => 'airtime/CcBlock.php',
- 'CcBlockQuery' => 'airtime/CcBlockQuery.php',
- 'BaseCcBlockPeer' => 'airtime/om/BaseCcBlockPeer.php',
'BaseCcBlock' => 'airtime/om/BaseCcBlock.php',
+ 'BaseCcBlockPeer' => 'airtime/om/BaseCcBlockPeer.php',
'BaseCcBlockQuery' => 'airtime/om/BaseCcBlockQuery.php',
- 'CcBlockcontentsTableMap' => 'airtime/map/CcBlockcontentsTableMap.php',
- 'CcBlockcontentsPeer' => 'airtime/CcBlockcontentsPeer.php',
- 'CcBlockcontents' => 'airtime/CcBlockcontents.php',
- 'CcBlockcontentsQuery' => 'airtime/CcBlockcontentsQuery.php',
- 'BaseCcBlockcontentsPeer' => 'airtime/om/BaseCcBlockcontentsPeer.php',
'BaseCcBlockcontents' => 'airtime/om/BaseCcBlockcontents.php',
+ 'BaseCcBlockcontentsPeer' => 'airtime/om/BaseCcBlockcontentsPeer.php',
'BaseCcBlockcontentsQuery' => 'airtime/om/BaseCcBlockcontentsQuery.php',
- 'CcBlockcriteriaTableMap' => 'airtime/map/CcBlockcriteriaTableMap.php',
- 'CcBlockcriteriaPeer' => 'airtime/CcBlockcriteriaPeer.php',
- 'CcBlockcriteria' => 'airtime/CcBlockcriteria.php',
- 'CcBlockcriteriaQuery' => 'airtime/CcBlockcriteriaQuery.php',
- 'BaseCcBlockcriteriaPeer' => 'airtime/om/BaseCcBlockcriteriaPeer.php',
'BaseCcBlockcriteria' => 'airtime/om/BaseCcBlockcriteria.php',
+ 'BaseCcBlockcriteriaPeer' => 'airtime/om/BaseCcBlockcriteriaPeer.php',
'BaseCcBlockcriteriaQuery' => 'airtime/om/BaseCcBlockcriteriaQuery.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',
- 'CcSubjsTokenTableMap' => 'airtime/map/CcSubjsTokenTableMap.php',
- 'CcSubjsTokenPeer' => 'airtime/CcSubjsTokenPeer.php',
- 'CcSubjsToken' => 'airtime/CcSubjsToken.php',
- 'CcSubjsTokenQuery' => 'airtime/CcSubjsTokenQuery.php',
- 'BaseCcSubjsTokenPeer' => 'airtime/om/BaseCcSubjsTokenPeer.php',
- 'BaseCcSubjsToken' => 'airtime/om/BaseCcSubjsToken.php',
- 'BaseCcSubjsTokenQuery' => 'airtime/om/BaseCcSubjsTokenQuery.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',
+ 'BaseCcCountryPeer' => 'airtime/om/BaseCcCountryPeer.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',
- 'CcLiveLogTableMap' => 'airtime/map/CcLiveLogTableMap.php',
- 'CcLiveLogPeer' => 'airtime/CcLiveLogPeer.php',
- 'CcLiveLog' => 'airtime/CcLiveLog.php',
- 'CcLiveLogQuery' => 'airtime/CcLiveLogQuery.php',
- 'BaseCcLiveLogPeer' => 'airtime/om/BaseCcLiveLogPeer.php',
- 'BaseCcLiveLog' => 'airtime/om/BaseCcLiveLog.php',
- 'BaseCcLiveLogQuery' => 'airtime/om/BaseCcLiveLogQuery.php',
- 'CcWebstreamTableMap' => 'airtime/map/CcWebstreamTableMap.php',
- 'CcWebstreamPeer' => 'airtime/CcWebstreamPeer.php',
- 'CcWebstream' => 'airtime/CcWebstream.php',
- 'CcWebstreamQuery' => 'airtime/CcWebstreamQuery.php',
- 'BaseCcWebstreamPeer' => 'airtime/om/BaseCcWebstreamPeer.php',
- 'BaseCcWebstream' => 'airtime/om/BaseCcWebstream.php',
- 'BaseCcWebstreamQuery' => 'airtime/om/BaseCcWebstreamQuery.php',
- 'CcWebstreamMetadataTableMap' => 'airtime/map/CcWebstreamMetadataTableMap.php',
- 'CcWebstreamMetadataPeer' => 'airtime/CcWebstreamMetadataPeer.php',
- 'CcWebstreamMetadata' => 'airtime/CcWebstreamMetadata.php',
- 'CcWebstreamMetadataQuery' => 'airtime/CcWebstreamMetadataQuery.php',
- 'BaseCcWebstreamMetadataPeer' => 'airtime/om/BaseCcWebstreamMetadataPeer.php',
- 'BaseCcWebstreamMetadata' => 'airtime/om/BaseCcWebstreamMetadata.php',
- 'BaseCcWebstreamMetadataQuery' => 'airtime/om/BaseCcWebstreamMetadataQuery.php',
- 'CcMountNameTableMap' => 'airtime/map/CcMountNameTableMap.php',
- 'CcMountNamePeer' => 'airtime/CcMountNamePeer.php',
- 'CcMountName' => 'airtime/CcMountName.php',
- 'CcMountNameQuery' => 'airtime/CcMountNameQuery.php',
- 'BaseCcMountNamePeer' => 'airtime/om/BaseCcMountNamePeer.php',
- 'BaseCcMountName' => 'airtime/om/BaseCcMountName.php',
- 'BaseCcMountNameQuery' => 'airtime/om/BaseCcMountNameQuery.php',
- 'CcTimestampTableMap' => 'airtime/map/CcTimestampTableMap.php',
- 'CcTimestampPeer' => 'airtime/CcTimestampPeer.php',
- 'CcTimestamp' => 'airtime/CcTimestamp.php',
- 'CcTimestampQuery' => 'airtime/CcTimestampQuery.php',
- 'BaseCcTimestampPeer' => 'airtime/om/BaseCcTimestampPeer.php',
- 'BaseCcTimestamp' => 'airtime/om/BaseCcTimestamp.php',
- 'BaseCcTimestampQuery' => 'airtime/om/BaseCcTimestampQuery.php',
- 'CcListenerCountTableMap' => 'airtime/map/CcListenerCountTableMap.php',
- 'CcListenerCountPeer' => 'airtime/CcListenerCountPeer.php',
- 'CcListenerCount' => 'airtime/CcListenerCount.php',
- 'CcListenerCountQuery' => 'airtime/CcListenerCountQuery.php',
- 'BaseCcListenerCountPeer' => 'airtime/om/BaseCcListenerCountPeer.php',
+ 'BaseCcFiles' => 'airtime/om/BaseCcFiles.php',
+ 'BaseCcFilesPeer' => 'airtime/om/BaseCcFilesPeer.php',
+ 'BaseCcFilesQuery' => 'airtime/om/BaseCcFilesQuery.php',
'BaseCcListenerCount' => 'airtime/om/BaseCcListenerCount.php',
+ 'BaseCcListenerCountPeer' => 'airtime/om/BaseCcListenerCountPeer.php',
'BaseCcListenerCountQuery' => 'airtime/om/BaseCcListenerCountQuery.php',
- 'CcLocaleTableMap' => 'airtime/map/CcLocaleTableMap.php',
- 'CcLocalePeer' => 'airtime/CcLocalePeer.php',
- 'CcLocale' => 'airtime/CcLocale.php',
- 'CcLocaleQuery' => 'airtime/CcLocaleQuery.php',
- 'BaseCcLocalePeer' => 'airtime/om/BaseCcLocalePeer.php',
+ 'BaseCcLiveLog' => 'airtime/om/BaseCcLiveLog.php',
+ 'BaseCcLiveLogPeer' => 'airtime/om/BaseCcLiveLogPeer.php',
+ 'BaseCcLiveLogQuery' => 'airtime/om/BaseCcLiveLogQuery.php',
'BaseCcLocale' => 'airtime/om/BaseCcLocale.php',
+ 'BaseCcLocalePeer' => 'airtime/om/BaseCcLocalePeer.php',
'BaseCcLocaleQuery' => 'airtime/om/BaseCcLocaleQuery.php',
- 'CcPlayoutHistoryTableMap' => 'airtime/map/CcPlayoutHistoryTableMap.php',
- 'CcPlayoutHistoryPeer' => 'airtime/CcPlayoutHistoryPeer.php',
- 'CcPlayoutHistory' => 'airtime/CcPlayoutHistory.php',
- 'CcPlayoutHistoryQuery' => 'airtime/CcPlayoutHistoryQuery.php',
- 'BaseCcPlayoutHistoryPeer' => 'airtime/om/BaseCcPlayoutHistoryPeer.php',
+ 'BaseCcLoginAttempts' => 'airtime/om/BaseCcLoginAttempts.php',
+ 'BaseCcLoginAttemptsPeer' => 'airtime/om/BaseCcLoginAttemptsPeer.php',
+ 'BaseCcLoginAttemptsQuery' => 'airtime/om/BaseCcLoginAttemptsQuery.php',
+ 'BaseCcMountName' => 'airtime/om/BaseCcMountName.php',
+ 'BaseCcMountNamePeer' => 'airtime/om/BaseCcMountNamePeer.php',
+ 'BaseCcMountNameQuery' => 'airtime/om/BaseCcMountNameQuery.php',
+ 'BaseCcMusicDirs' => 'airtime/om/BaseCcMusicDirs.php',
+ 'BaseCcMusicDirsPeer' => 'airtime/om/BaseCcMusicDirsPeer.php',
+ 'BaseCcMusicDirsQuery' => 'airtime/om/BaseCcMusicDirsQuery.php',
+ 'BaseCcPerms' => 'airtime/om/BaseCcPerms.php',
+ 'BaseCcPermsPeer' => 'airtime/om/BaseCcPermsPeer.php',
+ 'BaseCcPermsQuery' => 'airtime/om/BaseCcPermsQuery.php',
+ 'BaseCcPlaylist' => 'airtime/om/BaseCcPlaylist.php',
+ 'BaseCcPlaylistPeer' => 'airtime/om/BaseCcPlaylistPeer.php',
+ 'BaseCcPlaylistQuery' => 'airtime/om/BaseCcPlaylistQuery.php',
+ 'BaseCcPlaylistcontents' => 'airtime/om/BaseCcPlaylistcontents.php',
+ 'BaseCcPlaylistcontentsPeer' => 'airtime/om/BaseCcPlaylistcontentsPeer.php',
+ 'BaseCcPlaylistcontentsQuery' => 'airtime/om/BaseCcPlaylistcontentsQuery.php',
'BaseCcPlayoutHistory' => 'airtime/om/BaseCcPlayoutHistory.php',
- 'BaseCcPlayoutHistoryQuery' => 'airtime/om/BaseCcPlayoutHistoryQuery.php',
- 'CcPlayoutHistoryMetaDataTableMap' => 'airtime/map/CcPlayoutHistoryMetaDataTableMap.php',
- 'CcPlayoutHistoryMetaDataPeer' => 'airtime/CcPlayoutHistoryMetaDataPeer.php',
- 'CcPlayoutHistoryMetaData' => 'airtime/CcPlayoutHistoryMetaData.php',
- 'CcPlayoutHistoryMetaDataQuery' => 'airtime/CcPlayoutHistoryMetaDataQuery.php',
- 'BaseCcPlayoutHistoryMetaDataPeer' => 'airtime/om/BaseCcPlayoutHistoryMetaDataPeer.php',
'BaseCcPlayoutHistoryMetaData' => 'airtime/om/BaseCcPlayoutHistoryMetaData.php',
+ 'BaseCcPlayoutHistoryMetaDataPeer' => 'airtime/om/BaseCcPlayoutHistoryMetaDataPeer.php',
'BaseCcPlayoutHistoryMetaDataQuery' => 'airtime/om/BaseCcPlayoutHistoryMetaDataQuery.php',
- 'CcPlayoutHistoryTemplateTableMap' => 'airtime/map/CcPlayoutHistoryTemplateTableMap.php',
- 'CcPlayoutHistoryTemplatePeer' => 'airtime/CcPlayoutHistoryTemplatePeer.php',
- 'CcPlayoutHistoryTemplate' => 'airtime/CcPlayoutHistoryTemplate.php',
- 'CcPlayoutHistoryTemplateQuery' => 'airtime/CcPlayoutHistoryTemplateQuery.php',
- 'BaseCcPlayoutHistoryTemplatePeer' => 'airtime/om/BaseCcPlayoutHistoryTemplatePeer.php',
+ 'BaseCcPlayoutHistoryPeer' => 'airtime/om/BaseCcPlayoutHistoryPeer.php',
+ 'BaseCcPlayoutHistoryQuery' => 'airtime/om/BaseCcPlayoutHistoryQuery.php',
'BaseCcPlayoutHistoryTemplate' => 'airtime/om/BaseCcPlayoutHistoryTemplate.php',
- 'BaseCcPlayoutHistoryTemplateQuery' => 'airtime/om/BaseCcPlayoutHistoryTemplateQuery.php',
- 'CcPlayoutHistoryTemplateFieldTableMap' => 'airtime/map/CcPlayoutHistoryTemplateFieldTableMap.php',
- 'CcPlayoutHistoryTemplateFieldPeer' => 'airtime/CcPlayoutHistoryTemplateFieldPeer.php',
- 'CcPlayoutHistoryTemplateField' => 'airtime/CcPlayoutHistoryTemplateField.php',
- 'CcPlayoutHistoryTemplateFieldQuery' => 'airtime/CcPlayoutHistoryTemplateFieldQuery.php',
- 'BaseCcPlayoutHistoryTemplateFieldPeer' => 'airtime/om/BaseCcPlayoutHistoryTemplateFieldPeer.php',
'BaseCcPlayoutHistoryTemplateField' => 'airtime/om/BaseCcPlayoutHistoryTemplateField.php',
+ 'BaseCcPlayoutHistoryTemplateFieldPeer' => 'airtime/om/BaseCcPlayoutHistoryTemplateFieldPeer.php',
'BaseCcPlayoutHistoryTemplateFieldQuery' => 'airtime/om/BaseCcPlayoutHistoryTemplateFieldQuery.php',
+ 'BaseCcPlayoutHistoryTemplatePeer' => 'airtime/om/BaseCcPlayoutHistoryTemplatePeer.php',
+ 'BaseCcPlayoutHistoryTemplateQuery' => 'airtime/om/BaseCcPlayoutHistoryTemplateQuery.php',
+ 'BaseCcPref' => 'airtime/om/BaseCcPref.php',
+ 'BaseCcPrefPeer' => 'airtime/om/BaseCcPrefPeer.php',
+ 'BaseCcPrefQuery' => 'airtime/om/BaseCcPrefQuery.php',
+ 'BaseCcSchedule' => 'airtime/om/BaseCcSchedule.php',
+ 'BaseCcSchedulePeer' => 'airtime/om/BaseCcSchedulePeer.php',
+ 'BaseCcScheduleQuery' => 'airtime/om/BaseCcScheduleQuery.php',
+ 'BaseCcServiceRegister' => 'airtime/om/BaseCcServiceRegister.php',
+ 'BaseCcServiceRegisterPeer' => 'airtime/om/BaseCcServiceRegisterPeer.php',
+ 'BaseCcServiceRegisterQuery' => 'airtime/om/BaseCcServiceRegisterQuery.php',
+ 'BaseCcSess' => 'airtime/om/BaseCcSess.php',
+ 'BaseCcSessPeer' => 'airtime/om/BaseCcSessPeer.php',
+ 'BaseCcSessQuery' => 'airtime/om/BaseCcSessQuery.php',
+ 'BaseCcShow' => 'airtime/om/BaseCcShow.php',
+ 'BaseCcShowDays' => 'airtime/om/BaseCcShowDays.php',
+ 'BaseCcShowDaysPeer' => 'airtime/om/BaseCcShowDaysPeer.php',
+ 'BaseCcShowDaysQuery' => 'airtime/om/BaseCcShowDaysQuery.php',
+ 'BaseCcShowHosts' => 'airtime/om/BaseCcShowHosts.php',
+ 'BaseCcShowHostsPeer' => 'airtime/om/BaseCcShowHostsPeer.php',
+ 'BaseCcShowHostsQuery' => 'airtime/om/BaseCcShowHostsQuery.php',
+ 'BaseCcShowInstances' => 'airtime/om/BaseCcShowInstances.php',
+ 'BaseCcShowInstancesPeer' => 'airtime/om/BaseCcShowInstancesPeer.php',
+ 'BaseCcShowInstancesQuery' => 'airtime/om/BaseCcShowInstancesQuery.php',
+ 'BaseCcShowPeer' => 'airtime/om/BaseCcShowPeer.php',
+ 'BaseCcShowQuery' => 'airtime/om/BaseCcShowQuery.php',
+ 'BaseCcShowRebroadcast' => 'airtime/om/BaseCcShowRebroadcast.php',
+ 'BaseCcShowRebroadcastPeer' => 'airtime/om/BaseCcShowRebroadcastPeer.php',
+ 'BaseCcShowRebroadcastQuery' => 'airtime/om/BaseCcShowRebroadcastQuery.php',
+ 'BaseCcSmemb' => 'airtime/om/BaseCcSmemb.php',
+ 'BaseCcSmembPeer' => 'airtime/om/BaseCcSmembPeer.php',
+ 'BaseCcSmembQuery' => 'airtime/om/BaseCcSmembQuery.php',
+ 'BaseCcStreamSetting' => 'airtime/om/BaseCcStreamSetting.php',
+ 'BaseCcStreamSettingPeer' => 'airtime/om/BaseCcStreamSettingPeer.php',
+ 'BaseCcStreamSettingQuery' => 'airtime/om/BaseCcStreamSettingQuery.php',
+ 'BaseCcSubjs' => 'airtime/om/BaseCcSubjs.php',
+ 'BaseCcSubjsPeer' => 'airtime/om/BaseCcSubjsPeer.php',
+ 'BaseCcSubjsQuery' => 'airtime/om/BaseCcSubjsQuery.php',
+ 'BaseCcSubjsToken' => 'airtime/om/BaseCcSubjsToken.php',
+ 'BaseCcSubjsTokenPeer' => 'airtime/om/BaseCcSubjsTokenPeer.php',
+ 'BaseCcSubjsTokenQuery' => 'airtime/om/BaseCcSubjsTokenQuery.php',
+ 'BaseCcTimestamp' => 'airtime/om/BaseCcTimestamp.php',
+ 'BaseCcTimestampPeer' => 'airtime/om/BaseCcTimestampPeer.php',
+ 'BaseCcTimestampQuery' => 'airtime/om/BaseCcTimestampQuery.php',
+ 'BaseCcWebstream' => 'airtime/om/BaseCcWebstream.php',
+ 'BaseCcWebstreamMetadata' => 'airtime/om/BaseCcWebstreamMetadata.php',
+ 'BaseCcWebstreamMetadataPeer' => 'airtime/om/BaseCcWebstreamMetadataPeer.php',
+ 'BaseCcWebstreamMetadataQuery' => 'airtime/om/BaseCcWebstreamMetadataQuery.php',
+ 'BaseCcWebstreamPeer' => 'airtime/om/BaseCcWebstreamPeer.php',
+ 'BaseCcWebstreamQuery' => 'airtime/om/BaseCcWebstreamQuery.php',
+ 'CcBlock' => 'airtime/CcBlock.php',
+ 'CcBlockPeer' => 'airtime/CcBlockPeer.php',
+ 'CcBlockQuery' => 'airtime/CcBlockQuery.php',
+ 'CcBlockTableMap' => 'airtime/map/CcBlockTableMap.php',
+ 'CcBlockcontents' => 'airtime/CcBlockcontents.php',
+ 'CcBlockcontentsPeer' => 'airtime/CcBlockcontentsPeer.php',
+ 'CcBlockcontentsQuery' => 'airtime/CcBlockcontentsQuery.php',
+ 'CcBlockcontentsTableMap' => 'airtime/map/CcBlockcontentsTableMap.php',
+ 'CcBlockcriteria' => 'airtime/CcBlockcriteria.php',
+ 'CcBlockcriteriaPeer' => 'airtime/CcBlockcriteriaPeer.php',
+ 'CcBlockcriteriaQuery' => 'airtime/CcBlockcriteriaQuery.php',
+ 'CcBlockcriteriaTableMap' => 'airtime/map/CcBlockcriteriaTableMap.php',
+ 'CcCountry' => 'airtime/CcCountry.php',
+ 'CcCountryPeer' => 'airtime/CcCountryPeer.php',
+ 'CcCountryQuery' => 'airtime/CcCountryQuery.php',
+ 'CcCountryTableMap' => 'airtime/map/CcCountryTableMap.php',
+ 'CcFiles' => 'airtime/CcFiles.php',
+ 'CcFilesPeer' => 'airtime/CcFilesPeer.php',
+ 'CcFilesQuery' => 'airtime/CcFilesQuery.php',
+ 'CcFilesTableMap' => 'airtime/map/CcFilesTableMap.php',
+ 'CcListenerCount' => 'airtime/CcListenerCount.php',
+ 'CcListenerCountPeer' => 'airtime/CcListenerCountPeer.php',
+ 'CcListenerCountQuery' => 'airtime/CcListenerCountQuery.php',
+ 'CcListenerCountTableMap' => 'airtime/map/CcListenerCountTableMap.php',
+ 'CcLiveLog' => 'airtime/CcLiveLog.php',
+ 'CcLiveLogPeer' => 'airtime/CcLiveLogPeer.php',
+ 'CcLiveLogQuery' => 'airtime/CcLiveLogQuery.php',
+ 'CcLiveLogTableMap' => 'airtime/map/CcLiveLogTableMap.php',
+ 'CcLocale' => 'airtime/CcLocale.php',
+ 'CcLocalePeer' => 'airtime/CcLocalePeer.php',
+ 'CcLocaleQuery' => 'airtime/CcLocaleQuery.php',
+ 'CcLocaleTableMap' => 'airtime/map/CcLocaleTableMap.php',
+ 'CcLoginAttempts' => 'airtime/CcLoginAttempts.php',
+ 'CcLoginAttemptsPeer' => 'airtime/CcLoginAttemptsPeer.php',
+ 'CcLoginAttemptsQuery' => 'airtime/CcLoginAttemptsQuery.php',
+ 'CcLoginAttemptsTableMap' => 'airtime/map/CcLoginAttemptsTableMap.php',
+ 'CcMountName' => 'airtime/CcMountName.php',
+ 'CcMountNamePeer' => 'airtime/CcMountNamePeer.php',
+ 'CcMountNameQuery' => 'airtime/CcMountNameQuery.php',
+ 'CcMountNameTableMap' => 'airtime/map/CcMountNameTableMap.php',
+ 'CcMusicDirs' => 'airtime/CcMusicDirs.php',
+ 'CcMusicDirsPeer' => 'airtime/CcMusicDirsPeer.php',
+ 'CcMusicDirsQuery' => 'airtime/CcMusicDirsQuery.php',
+ 'CcMusicDirsTableMap' => 'airtime/map/CcMusicDirsTableMap.php',
+ 'CcPerms' => 'airtime/CcPerms.php',
+ 'CcPermsPeer' => 'airtime/CcPermsPeer.php',
+ 'CcPermsQuery' => 'airtime/CcPermsQuery.php',
+ 'CcPermsTableMap' => 'airtime/map/CcPermsTableMap.php',
+ 'CcPlaylist' => 'airtime/CcPlaylist.php',
+ 'CcPlaylistPeer' => 'airtime/CcPlaylistPeer.php',
+ 'CcPlaylistQuery' => 'airtime/CcPlaylistQuery.php',
+ 'CcPlaylistTableMap' => 'airtime/map/CcPlaylistTableMap.php',
+ 'CcPlaylistcontents' => 'airtime/CcPlaylistcontents.php',
+ 'CcPlaylistcontentsPeer' => 'airtime/CcPlaylistcontentsPeer.php',
+ 'CcPlaylistcontentsQuery' => 'airtime/CcPlaylistcontentsQuery.php',
+ 'CcPlaylistcontentsTableMap' => 'airtime/map/CcPlaylistcontentsTableMap.php',
+ 'CcPlayoutHistory' => 'airtime/CcPlayoutHistory.php',
+ 'CcPlayoutHistoryMetaData' => 'airtime/CcPlayoutHistoryMetaData.php',
+ 'CcPlayoutHistoryMetaDataPeer' => 'airtime/CcPlayoutHistoryMetaDataPeer.php',
+ 'CcPlayoutHistoryMetaDataQuery' => 'airtime/CcPlayoutHistoryMetaDataQuery.php',
+ 'CcPlayoutHistoryMetaDataTableMap' => 'airtime/map/CcPlayoutHistoryMetaDataTableMap.php',
+ 'CcPlayoutHistoryPeer' => 'airtime/CcPlayoutHistoryPeer.php',
+ 'CcPlayoutHistoryQuery' => 'airtime/CcPlayoutHistoryQuery.php',
+ 'CcPlayoutHistoryTableMap' => 'airtime/map/CcPlayoutHistoryTableMap.php',
+ 'CcPlayoutHistoryTemplate' => 'airtime/CcPlayoutHistoryTemplate.php',
+ 'CcPlayoutHistoryTemplateField' => 'airtime/CcPlayoutHistoryTemplateField.php',
+ 'CcPlayoutHistoryTemplateFieldPeer' => 'airtime/CcPlayoutHistoryTemplateFieldPeer.php',
+ 'CcPlayoutHistoryTemplateFieldQuery' => 'airtime/CcPlayoutHistoryTemplateFieldQuery.php',
+ 'CcPlayoutHistoryTemplateFieldTableMap' => 'airtime/map/CcPlayoutHistoryTemplateFieldTableMap.php',
+ 'CcPlayoutHistoryTemplatePeer' => 'airtime/CcPlayoutHistoryTemplatePeer.php',
+ 'CcPlayoutHistoryTemplateQuery' => 'airtime/CcPlayoutHistoryTemplateQuery.php',
+ 'CcPlayoutHistoryTemplateTableMap' => 'airtime/map/CcPlayoutHistoryTemplateTableMap.php',
+ 'CcPref' => 'airtime/CcPref.php',
+ 'CcPrefPeer' => 'airtime/CcPrefPeer.php',
+ 'CcPrefQuery' => 'airtime/CcPrefQuery.php',
+ 'CcPrefTableMap' => 'airtime/map/CcPrefTableMap.php',
+ 'CcSchedule' => 'airtime/CcSchedule.php',
+ 'CcSchedulePeer' => 'airtime/CcSchedulePeer.php',
+ 'CcScheduleQuery' => 'airtime/CcScheduleQuery.php',
+ 'CcScheduleTableMap' => 'airtime/map/CcScheduleTableMap.php',
+ 'CcServiceRegister' => 'airtime/CcServiceRegister.php',
+ 'CcServiceRegisterPeer' => 'airtime/CcServiceRegisterPeer.php',
+ 'CcServiceRegisterQuery' => 'airtime/CcServiceRegisterQuery.php',
+ 'CcServiceRegisterTableMap' => 'airtime/map/CcServiceRegisterTableMap.php',
+ 'CcSess' => 'airtime/CcSess.php',
+ 'CcSessPeer' => 'airtime/CcSessPeer.php',
+ 'CcSessQuery' => 'airtime/CcSessQuery.php',
+ 'CcSessTableMap' => 'airtime/map/CcSessTableMap.php',
+ 'CcShow' => 'airtime/CcShow.php',
+ 'CcShowDays' => 'airtime/CcShowDays.php',
+ 'CcShowDaysPeer' => 'airtime/CcShowDaysPeer.php',
+ 'CcShowDaysQuery' => 'airtime/CcShowDaysQuery.php',
+ 'CcShowDaysTableMap' => 'airtime/map/CcShowDaysTableMap.php',
+ 'CcShowHosts' => 'airtime/CcShowHosts.php',
+ 'CcShowHostsPeer' => 'airtime/CcShowHostsPeer.php',
+ 'CcShowHostsQuery' => 'airtime/CcShowHostsQuery.php',
+ 'CcShowHostsTableMap' => 'airtime/map/CcShowHostsTableMap.php',
+ 'CcShowInstances' => 'airtime/CcShowInstances.php',
+ 'CcShowInstancesPeer' => 'airtime/CcShowInstancesPeer.php',
+ 'CcShowInstancesQuery' => 'airtime/CcShowInstancesQuery.php',
+ 'CcShowInstancesTableMap' => 'airtime/map/CcShowInstancesTableMap.php',
+ 'CcShowPeer' => 'airtime/CcShowPeer.php',
+ 'CcShowQuery' => 'airtime/CcShowQuery.php',
+ 'CcShowRebroadcast' => 'airtime/CcShowRebroadcast.php',
+ 'CcShowRebroadcastPeer' => 'airtime/CcShowRebroadcastPeer.php',
+ 'CcShowRebroadcastQuery' => 'airtime/CcShowRebroadcastQuery.php',
+ 'CcShowRebroadcastTableMap' => 'airtime/map/CcShowRebroadcastTableMap.php',
+ 'CcShowTableMap' => 'airtime/map/CcShowTableMap.php',
+ 'CcSmemb' => 'airtime/CcSmemb.php',
+ 'CcSmembPeer' => 'airtime/CcSmembPeer.php',
+ 'CcSmembQuery' => 'airtime/CcSmembQuery.php',
+ 'CcSmembTableMap' => 'airtime/map/CcSmembTableMap.php',
+ 'CcStreamSetting' => 'airtime/CcStreamSetting.php',
+ 'CcStreamSettingPeer' => 'airtime/CcStreamSettingPeer.php',
+ 'CcStreamSettingQuery' => 'airtime/CcStreamSettingQuery.php',
+ 'CcStreamSettingTableMap' => 'airtime/map/CcStreamSettingTableMap.php',
+ 'CcSubjs' => 'airtime/CcSubjs.php',
+ 'CcSubjsPeer' => 'airtime/CcSubjsPeer.php',
+ 'CcSubjsQuery' => 'airtime/CcSubjsQuery.php',
+ 'CcSubjsTableMap' => 'airtime/map/CcSubjsTableMap.php',
+ 'CcSubjsToken' => 'airtime/CcSubjsToken.php',
+ 'CcSubjsTokenPeer' => 'airtime/CcSubjsTokenPeer.php',
+ 'CcSubjsTokenQuery' => 'airtime/CcSubjsTokenQuery.php',
+ 'CcSubjsTokenTableMap' => 'airtime/map/CcSubjsTokenTableMap.php',
+ 'CcTimestamp' => 'airtime/CcTimestamp.php',
+ 'CcTimestampPeer' => 'airtime/CcTimestampPeer.php',
+ 'CcTimestampQuery' => 'airtime/CcTimestampQuery.php',
+ 'CcTimestampTableMap' => 'airtime/map/CcTimestampTableMap.php',
+ 'CcWebstream' => 'airtime/CcWebstream.php',
+ 'CcWebstreamMetadata' => 'airtime/CcWebstreamMetadata.php',
+ 'CcWebstreamMetadataPeer' => 'airtime/CcWebstreamMetadataPeer.php',
+ 'CcWebstreamMetadataQuery' => 'airtime/CcWebstreamMetadataQuery.php',
+ 'CcWebstreamMetadataTableMap' => 'airtime/map/CcWebstreamMetadataTableMap.php',
+ 'CcWebstreamPeer' => 'airtime/CcWebstreamPeer.php',
+ 'CcWebstreamQuery' => 'airtime/CcWebstreamQuery.php',
+ 'CcWebstreamTableMap' => 'airtime/map/CcWebstreamTableMap.php',
);
\ No newline at end of file
diff --git a/airtime_mvc/application/models/airtime/map/CcBlockTableMap.php b/airtime_mvc/application/models/airtime/map/CcBlockTableMap.php
index 0ce86613c..dfc5c95ff 100644
--- a/airtime_mvc/application/models/airtime/map/CcBlockTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcBlockTableMap.php
@@ -14,63 +14,70 @@
*
* @package propel.generator.airtime.map
*/
-class CcBlockTableMap extends TableMap {
+class CcBlockTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcBlockTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcBlockTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->setName('cc_block');
- $this->setPhpName('CcBlock');
- $this->setClassname('CcBlock');
- $this->setPackage('airtime');
- $this->setUseIdGenerator(true);
- $this->setPrimaryKeyMethodInfo('cc_block_id_seq');
- // columns
- $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
- $this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, '');
- $this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', false, 6, null);
- $this->addColumn('UTIME', 'DbUtime', 'TIMESTAMP', false, 6, null);
- $this->addForeignKey('CREATOR_ID', 'DbCreatorId', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
- $this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', false, 512, null);
- $this->addColumn('LENGTH', 'DbLength', 'VARCHAR', false, null, '00:00:00');
- $this->addColumn('TYPE', 'DbType', 'VARCHAR', false, 7, 'static');
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('cc_block');
+ $this->setPhpName('CcBlock');
+ $this->setClassname('CcBlock');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_block_id_seq');
+ // columns
+ $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
+ $this->addColumn('name', 'DbName', 'VARCHAR', true, 255, '');
+ $this->addColumn('mtime', 'DbMtime', 'TIMESTAMP', false, 6, null);
+ $this->addColumn('utime', 'DbUtime', 'TIMESTAMP', false, 6, null);
+ $this->addForeignKey('creator_id', 'DbCreatorId', 'INTEGER', 'cc_subjs', 'id', false, null, null);
+ $this->addColumn('description', 'DbDescription', 'VARCHAR', false, 512, null);
+ $this->addColumn('length', 'DbLength', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('type', 'DbType', 'VARCHAR', false, 7, 'static');
+ // validators
+ } // initialize()
- /**
- * Build the RelationMap objects for this table relationships
- */
- public function buildRelations()
- {
- $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), 'CASCADE', null);
- $this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null);
- $this->addRelation('CcBlockcontents', 'CcBlockcontents', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null);
- $this->addRelation('CcBlockcriteria', 'CcBlockcriteria', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null);
- } // buildRelations()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), 'CASCADE', null);
+ $this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null, 'CcPlaylistcontentss');
+ $this->addRelation('CcBlockcontents', 'CcBlockcontents', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null, 'CcBlockcontentss');
+ $this->addRelation('CcBlockcriteria', 'CcBlockcriteria', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null, 'CcBlockcriterias');
+ } // 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' => 'length', 'expression' => 'SUM(cliplength)', 'foreign_table' => 'cc_blockcontents', ),
- );
- } // getBehaviors()
+ /**
+ *
+ * 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' => 'length',
+ 'expression' => 'SUM(cliplength)',
+ 'condition' => NULL,
+ 'foreign_table' => 'cc_blockcontents',
+ 'foreign_schema' => NULL,
+),
+ );
+ } // getBehaviors()
} // CcBlockTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcBlockcontentsTableMap.php b/airtime_mvc/application/models/airtime/map/CcBlockcontentsTableMap.php
index ec74e8b7e..da16caa4c 100644
--- a/airtime_mvc/application/models/airtime/map/CcBlockcontentsTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcBlockcontentsTableMap.php
@@ -14,63 +14,67 @@
*
* @package propel.generator.airtime.map
*/
-class CcBlockcontentsTableMap extends TableMap {
+class CcBlockcontentsTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcBlockcontentsTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcBlockcontentsTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->setName('cc_blockcontents');
- $this->setPhpName('CcBlockcontents');
- $this->setClassname('CcBlockcontents');
- $this->setPackage('airtime');
- $this->setUseIdGenerator(true);
- $this->setPrimaryKeyMethodInfo('cc_blockcontents_id_seq');
- // columns
- $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
- $this->addForeignKey('BLOCK_ID', 'DbBlockId', 'INTEGER', 'cc_block', '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('TRACKOFFSET', 'DbTrackOffset', 'REAL', true, null, 0);
- $this->addColumn('CLIPLENGTH', 'DbCliplength', 'VARCHAR', false, null, '00:00:00');
- $this->addColumn('CUEIN', 'DbCuein', 'VARCHAR', false, null, '00:00:00');
- $this->addColumn('CUEOUT', 'DbCueout', 'VARCHAR', 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()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('cc_blockcontents');
+ $this->setPhpName('CcBlockcontents');
+ $this->setClassname('CcBlockcontents');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_blockcontents_id_seq');
+ // columns
+ $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
+ $this->addForeignKey('block_id', 'DbBlockId', 'INTEGER', 'cc_block', '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('trackoffset', 'DbTrackOffset', 'REAL', true, null, 0);
+ $this->addColumn('cliplength', 'DbCliplength', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('cuein', 'DbCuein', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('cueout', 'DbCueout', 'VARCHAR', 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('CcBlock', 'CcBlock', RelationMap::MANY_TO_ONE, array('block_id' => 'id', ), 'CASCADE', null);
- } // buildRelations()
+ /**
+ * 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('CcBlock', 'CcBlock', RelationMap::MANY_TO_ONE, array('block_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_block', 'update_method' => 'updateDbLength', ),
- );
- } // getBehaviors()
+ /**
+ *
+ * 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_block',
+ 'update_method' => 'updateDbLength',
+),
+ );
+ } // getBehaviors()
} // CcBlockcontentsTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcBlockcriteriaTableMap.php b/airtime_mvc/application/models/airtime/map/CcBlockcriteriaTableMap.php
index 6565bf259..cf4a5e2ec 100644
--- a/airtime_mvc/application/models/airtime/map/CcBlockcriteriaTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcBlockcriteriaTableMap.php
@@ -14,45 +14,46 @@
*
* @package propel.generator.airtime.map
*/
-class CcBlockcriteriaTableMap extends TableMap {
+class CcBlockcriteriaTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcBlockcriteriaTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcBlockcriteriaTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->setName('cc_blockcriteria');
- $this->setPhpName('CcBlockcriteria');
- $this->setClassname('CcBlockcriteria');
- $this->setPackage('airtime');
- $this->setUseIdGenerator(true);
- $this->setPrimaryKeyMethodInfo('cc_blockcriteria_id_seq');
- // columns
- $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
- $this->addColumn('CRITERIA', 'DbCriteria', 'VARCHAR', true, 32, null);
- $this->addColumn('MODIFIER', 'DbModifier', 'VARCHAR', true, 16, null);
- $this->addColumn('VALUE', 'DbValue', 'VARCHAR', true, 512, null);
- $this->addColumn('EXTRA', 'DbExtra', 'VARCHAR', false, 512, null);
- $this->addForeignKey('BLOCK_ID', 'DbBlockId', 'INTEGER', 'cc_block', 'ID', true, null, null);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('cc_blockcriteria');
+ $this->setPhpName('CcBlockcriteria');
+ $this->setClassname('CcBlockcriteria');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_blockcriteria_id_seq');
+ // columns
+ $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
+ $this->addColumn('criteria', 'DbCriteria', 'VARCHAR', true, 32, null);
+ $this->addColumn('modifier', 'DbModifier', 'VARCHAR', true, 16, null);
+ $this->addColumn('value', 'DbValue', 'VARCHAR', true, 512, null);
+ $this->addColumn('extra', 'DbExtra', 'VARCHAR', false, 512, null);
+ $this->addForeignKey('block_id', 'DbBlockId', 'INTEGER', 'cc_block', 'id', true, null, null);
+ // validators
+ } // initialize()
- /**
- * Build the RelationMap objects for this table relationships
- */
- public function buildRelations()
- {
- $this->addRelation('CcBlock', 'CcBlock', RelationMap::MANY_TO_ONE, array('block_id' => 'id', ), 'CASCADE', null);
- } // buildRelations()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcBlock', 'CcBlock', RelationMap::MANY_TO_ONE, array('block_id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
} // CcBlockcriteriaTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcCountryTableMap.php b/airtime_mvc/application/models/airtime/map/CcCountryTableMap.php
index b839d0359..b016f703d 100644
--- a/airtime_mvc/application/models/airtime/map/CcCountryTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcCountryTableMap.php
@@ -14,39 +14,40 @@
*
* @package propel.generator.airtime.map
*/
-class CcCountryTableMap extends TableMap {
+class CcCountryTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcCountryTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcCountryTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ } // buildRelations()
} // CcCountryTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php
index cfe0830fb..f58689f3a 100644
--- a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php
@@ -14,117 +14,118 @@
*
* @package propel.generator.airtime.map
*/
-class CcFilesTableMap extends TableMap {
+class CcFilesTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcFilesTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcFilesTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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('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('IMPORT_STATUS', 'DbImportStatus', 'INTEGER', true, null, 1);
- $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('UTIME', 'DbUtime', 'TIMESTAMP', false, 6, null);
- $this->addColumn('LPTIME', 'DbLPtime', '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', 'INTEGER', false, null, null);
- $this->addColumn('SAMPLE_RATE', 'DbSampleRate', 'INTEGER', false, null, null);
- $this->addColumn('FORMAT', 'DbFormat', 'VARCHAR', false, 128, null);
- $this->addColumn('LENGTH', 'DbLength', 'VARCHAR', false, null, '00:00:00');
- $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', 'INTEGER', false, null, 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('FILE_EXISTS', 'DbFileExists', 'BOOLEAN', false, null, true);
- $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);
- $this->addColumn('SOUNDCLOUD_UPLOAD_TIME', 'DbSoundCloundUploadTime', 'TIMESTAMP', false, 6, null);
- $this->addColumn('REPLAY_GAIN', 'DbReplayGain', 'NUMERIC', false, null, null);
- $this->addForeignKey('OWNER_ID', 'DbOwnerId', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
- $this->addColumn('CUEIN', 'DbCuein', 'VARCHAR', false, null, '00:00:00');
- $this->addColumn('CUEOUT', 'DbCueout', 'VARCHAR', false, null, '00:00:00');
- $this->addColumn('SILAN_CHECK', 'DbSilanCheck', 'BOOLEAN', false, null, false);
- $this->addColumn('HIDDEN', 'DbHidden', 'BOOLEAN', false, null, false);
- $this->addColumn('IS_SCHEDULED', 'DbIsScheduled', 'BOOLEAN', false, null, false);
- $this->addColumn('IS_PLAYLIST', 'DbIsPlaylist', 'BOOLEAN', false, null, false);
- $this->addColumn('RESOURCE_ID', 'DbResourceId', 'LONGVARCHAR', false, null, null);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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('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('import_status', 'DbImportStatus', 'INTEGER', true, null, 1);
+ $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('utime', 'DbUtime', 'TIMESTAMP', false, 6, null);
+ $this->addColumn('lptime', 'DbLPtime', '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', 'INTEGER', false, null, null);
+ $this->addColumn('sample_rate', 'DbSampleRate', 'INTEGER', false, null, null);
+ $this->addColumn('format', 'DbFormat', 'VARCHAR', false, 128, null);
+ $this->addColumn('length', 'DbLength', 'VARCHAR', false, null, '00:00:00');
+ $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', 'INTEGER', false, null, 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('file_exists', 'DbFileExists', 'BOOLEAN', false, null, true);
+ $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);
+ $this->addColumn('soundcloud_upload_time', 'DbSoundCloundUploadTime', 'TIMESTAMP', false, 6, null);
+ $this->addColumn('replay_gain', 'DbReplayGain', 'NUMERIC', false, null, null);
+ $this->addForeignKey('owner_id', 'DbOwnerId', 'INTEGER', 'cc_subjs', 'id', false, null, null);
+ $this->addColumn('cuein', 'DbCuein', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('cueout', 'DbCueout', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('silan_check', 'DbSilanCheck', 'BOOLEAN', false, null, false);
+ $this->addColumn('hidden', 'DbHidden', 'BOOLEAN', false, null, false);
+ $this->addColumn('is_scheduled', 'DbIsScheduled', 'BOOLEAN', false, null, false);
+ $this->addColumn('is_playlist', 'DbIsPlaylist', 'BOOLEAN', false, null, false);
+ $this->addColumn('resource_id', 'DbResourceId', 'LONGVARCHAR', false, null, null);
+ // validators
+ } // initialize()
- /**
- * Build the RelationMap objects for this table relationships
- */
- public function buildRelations()
- {
- $this->addRelation('FkOwner', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner_id' => 'id', ), null, null);
- $this->addRelation('CcSubjsRelatedByDbEditedby', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null);
- $this->addRelation('CcMusicDirs', 'CcMusicDirs', RelationMap::MANY_TO_ONE, array('directory' => 'id', ), null, 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('CcBlockcontents', 'CcBlockcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
- $this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
- $this->addRelation('CcPlayoutHistory', 'CcPlayoutHistory', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
- } // buildRelations()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('FkOwner', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner_id' => 'id', ), null, null);
+ $this->addRelation('CcSubjsRelatedByDbEditedby', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null);
+ $this->addRelation('CcMusicDirs', 'CcMusicDirs', RelationMap::MANY_TO_ONE, array('directory' => 'id', ), null, null);
+ $this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcShowInstancess');
+ $this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcPlaylistcontentss');
+ $this->addRelation('CcBlockcontents', 'CcBlockcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcBlockcontentss');
+ $this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcSchedules');
+ $this->addRelation('CcPlayoutHistory', 'CcPlayoutHistory', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'CcPlayoutHistorys');
+ } // buildRelations()
} // CcFilesTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcListenerCountTableMap.php b/airtime_mvc/application/models/airtime/map/CcListenerCountTableMap.php
index 2b9476a75..c3592f15d 100644
--- a/airtime_mvc/application/models/airtime/map/CcListenerCountTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcListenerCountTableMap.php
@@ -14,44 +14,45 @@
*
* @package propel.generator.airtime.map
*/
-class CcListenerCountTableMap extends TableMap {
+class CcListenerCountTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcListenerCountTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcListenerCountTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->setName('cc_listener_count');
- $this->setPhpName('CcListenerCount');
- $this->setClassname('CcListenerCount');
- $this->setPackage('airtime');
- $this->setUseIdGenerator(true);
- $this->setPrimaryKeyMethodInfo('cc_listener_count_id_seq');
- // columns
- $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
- $this->addForeignKey('TIMESTAMP_ID', 'DbTimestampId', 'INTEGER', 'cc_timestamp', 'ID', true, null, null);
- $this->addForeignKey('MOUNT_NAME_ID', 'DbMountNameId', 'INTEGER', 'cc_mount_name', 'ID', true, null, null);
- $this->addColumn('LISTENER_COUNT', 'DbListenerCount', 'INTEGER', true, null, null);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('cc_listener_count');
+ $this->setPhpName('CcListenerCount');
+ $this->setClassname('CcListenerCount');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_listener_count_id_seq');
+ // columns
+ $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
+ $this->addForeignKey('timestamp_id', 'DbTimestampId', 'INTEGER', 'cc_timestamp', 'id', true, null, null);
+ $this->addForeignKey('mount_name_id', 'DbMountNameId', 'INTEGER', 'cc_mount_name', 'id', true, null, null);
+ $this->addColumn('listener_count', 'DbListenerCount', 'INTEGER', true, null, null);
+ // validators
+ } // initialize()
- /**
- * Build the RelationMap objects for this table relationships
- */
- public function buildRelations()
- {
- $this->addRelation('CcTimestamp', 'CcTimestamp', RelationMap::MANY_TO_ONE, array('timestamp_id' => 'id', ), 'CASCADE', null);
- $this->addRelation('CcMountName', 'CcMountName', RelationMap::MANY_TO_ONE, array('mount_name_id' => 'id', ), 'CASCADE', null);
- } // buildRelations()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcTimestamp', 'CcTimestamp', RelationMap::MANY_TO_ONE, array('timestamp_id' => 'id', ), 'CASCADE', null);
+ $this->addRelation('CcMountName', 'CcMountName', RelationMap::MANY_TO_ONE, array('mount_name_id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
} // CcListenerCountTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcLiveLogTableMap.php b/airtime_mvc/application/models/airtime/map/CcLiveLogTableMap.php
index 4c8c2f088..d907f347e 100644
--- a/airtime_mvc/application/models/airtime/map/CcLiveLogTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcLiveLogTableMap.php
@@ -14,42 +14,43 @@
*
* @package propel.generator.airtime.map
*/
-class CcLiveLogTableMap extends TableMap {
+class CcLiveLogTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcLiveLogTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcLiveLogTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->setName('cc_live_log');
- $this->setPhpName('CcLiveLog');
- $this->setClassname('CcLiveLog');
- $this->setPackage('airtime');
- $this->setUseIdGenerator(true);
- $this->setPrimaryKeyMethodInfo('cc_live_log_id_seq');
- // columns
- $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
- $this->addColumn('STATE', 'DbState', 'VARCHAR', true, 32, null);
- $this->addColumn('START_TIME', 'DbStartTime', 'TIMESTAMP', true, null, null);
- $this->addColumn('END_TIME', 'DbEndTime', 'TIMESTAMP', false, null, null);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('cc_live_log');
+ $this->setPhpName('CcLiveLog');
+ $this->setClassname('CcLiveLog');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_live_log_id_seq');
+ // columns
+ $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
+ $this->addColumn('state', 'DbState', 'VARCHAR', true, 32, null);
+ $this->addColumn('start_time', 'DbStartTime', 'TIMESTAMP', true, null, null);
+ $this->addColumn('end_time', 'DbEndTime', 'TIMESTAMP', false, null, null);
+ // validators
+ } // initialize()
- /**
- * Build the RelationMap objects for this table relationships
- */
- public function buildRelations()
- {
- } // buildRelations()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ } // buildRelations()
} // CcLiveLogTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcLocaleTableMap.php b/airtime_mvc/application/models/airtime/map/CcLocaleTableMap.php
index e6b51fc12..5d58c6675 100644
--- a/airtime_mvc/application/models/airtime/map/CcLocaleTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcLocaleTableMap.php
@@ -14,41 +14,42 @@
*
* @package propel.generator.airtime.map
*/
-class CcLocaleTableMap extends TableMap {
+class CcLocaleTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcLocaleTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcLocaleTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->setName('cc_locale');
- $this->setPhpName('CcLocale');
- $this->setClassname('CcLocale');
- $this->setPackage('airtime');
- $this->setUseIdGenerator(true);
- $this->setPrimaryKeyMethodInfo('cc_locale_id_seq');
- // columns
- $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
- $this->addColumn('LOCALE_CODE', 'DbLocaleCode', 'VARCHAR', true, 16, null);
- $this->addColumn('LOCALE_LANG', 'DbLocaleLang', 'VARCHAR', true, 128, null);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('cc_locale');
+ $this->setPhpName('CcLocale');
+ $this->setClassname('CcLocale');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_locale_id_seq');
+ // columns
+ $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
+ $this->addColumn('locale_code', 'DbLocaleCode', 'VARCHAR', true, 16, null);
+ $this->addColumn('locale_lang', 'DbLocaleLang', 'VARCHAR', true, 128, null);
+ // validators
+ } // initialize()
- /**
- * Build the RelationMap objects for this table relationships
- */
- public function buildRelations()
- {
- } // buildRelations()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ } // buildRelations()
} // CcLocaleTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcLoginAttemptsTableMap.php b/airtime_mvc/application/models/airtime/map/CcLoginAttemptsTableMap.php
index 32ce73743..21b6b8d34 100644
--- a/airtime_mvc/application/models/airtime/map/CcLoginAttemptsTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcLoginAttemptsTableMap.php
@@ -14,39 +14,40 @@
*
* @package propel.generator.airtime.map
*/
-class CcLoginAttemptsTableMap extends TableMap {
+class CcLoginAttemptsTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcLoginAttemptsTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcLoginAttemptsTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ } // buildRelations()
} // CcLoginAttemptsTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcMountNameTableMap.php b/airtime_mvc/application/models/airtime/map/CcMountNameTableMap.php
index f07bc5403..d9bca27f0 100644
--- a/airtime_mvc/application/models/airtime/map/CcMountNameTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcMountNameTableMap.php
@@ -14,41 +14,42 @@
*
* @package propel.generator.airtime.map
*/
-class CcMountNameTableMap extends TableMap {
+class CcMountNameTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcMountNameTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcMountNameTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->setName('cc_mount_name');
- $this->setPhpName('CcMountName');
- $this->setClassname('CcMountName');
- $this->setPackage('airtime');
- $this->setUseIdGenerator(true);
- $this->setPrimaryKeyMethodInfo('cc_mount_name_id_seq');
- // columns
- $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
- $this->addColumn('MOUNT_NAME', 'DbMountName', 'VARCHAR', true, 255, null);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('cc_mount_name');
+ $this->setPhpName('CcMountName');
+ $this->setClassname('CcMountName');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_mount_name_id_seq');
+ // columns
+ $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
+ $this->addColumn('mount_name', 'DbMountName', 'VARCHAR', true, null, null);
+ // validators
+ } // initialize()
- /**
- * Build the RelationMap objects for this table relationships
- */
- public function buildRelations()
- {
- $this->addRelation('CcListenerCount', 'CcListenerCount', RelationMap::ONE_TO_MANY, array('id' => 'mount_name_id', ), 'CASCADE', null);
- } // buildRelations()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcListenerCount', 'CcListenerCount', RelationMap::ONE_TO_MANY, array('id' => 'mount_name_id', ), 'CASCADE', null, 'CcListenerCounts');
+ } // buildRelations()
} // CcMountNameTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcMusicDirsTableMap.php b/airtime_mvc/application/models/airtime/map/CcMusicDirsTableMap.php
index 5af51394e..ca02ed7d9 100644
--- a/airtime_mvc/application/models/airtime/map/CcMusicDirsTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcMusicDirsTableMap.php
@@ -14,44 +14,45 @@
*
* @package propel.generator.airtime.map
*/
-class CcMusicDirsTableMap extends TableMap {
+class CcMusicDirsTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcMusicDirsTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcMusicDirsTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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);
- $this->addColumn('EXISTS', 'Exists', 'BOOLEAN', false, null, true);
- $this->addColumn('WATCHED', 'Watched', 'BOOLEAN', false, null, true);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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);
+ $this->addColumn('exists', 'Exists', 'BOOLEAN', false, null, true);
+ $this->addColumn('watched', 'Watched', 'BOOLEAN', false, null, true);
+ // validators
+ } // initialize()
- /**
- * Build the RelationMap objects for this table relationships
- */
- public function buildRelations()
- {
- $this->addRelation('CcFiles', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'directory', ), null, null);
- } // buildRelations()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcFiles', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'directory', ), null, null, 'CcFiless');
+ } // buildRelations()
} // CcMusicDirsTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcPermsTableMap.php b/airtime_mvc/application/models/airtime/map/CcPermsTableMap.php
index 481d17c96..ea9833a63 100644
--- a/airtime_mvc/application/models/airtime/map/CcPermsTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcPermsTableMap.php
@@ -14,43 +14,44 @@
*
* @package propel.generator.airtime.map
*/
-class CcPermsTableMap extends TableMap {
+class CcPermsTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcPermsTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcPermsTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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()
+ /**
+ * 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/airtime_mvc/application/models/airtime/map/CcPlaylistTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlaylistTableMap.php
index 8dba50bbd..e14663e13 100644
--- a/airtime_mvc/application/models/airtime/map/CcPlaylistTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcPlaylistTableMap.php
@@ -14,60 +14,67 @@
*
* @package propel.generator.airtime.map
*/
-class CcPlaylistTableMap extends TableMap {
+class CcPlaylistTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcPlaylistTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcPlaylistTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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('MTIME', 'DbMtime', 'TIMESTAMP', false, 6, null);
- $this->addColumn('UTIME', 'DbUtime', 'TIMESTAMP', false, 6, null);
- $this->addForeignKey('CREATOR_ID', 'DbCreatorId', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
- $this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', false, 512, null);
- $this->addColumn('LENGTH', 'DbLength', 'VARCHAR', false, null, '00:00:00');
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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('mtime', 'DbMtime', 'TIMESTAMP', false, 6, null);
+ $this->addColumn('utime', 'DbUtime', 'TIMESTAMP', false, 6, null);
+ $this->addForeignKey('creator_id', 'DbCreatorId', 'INTEGER', 'cc_subjs', 'id', false, null, null);
+ $this->addColumn('description', 'DbDescription', 'VARCHAR', false, 512, null);
+ $this->addColumn('length', 'DbLength', 'VARCHAR', false, null, '00:00:00');
+ // validators
+ } // initialize()
- /**
- * Build the RelationMap objects for this table relationships
- */
- public function buildRelations()
- {
- $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), 'CASCADE', null);
- $this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'playlist_id', ), 'CASCADE', null);
- } // buildRelations()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), 'CASCADE', null);
+ $this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'playlist_id', ), 'CASCADE', null, 'CcPlaylistcontentss');
+ } // 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' => 'length', 'expression' => 'SUM(cliplength)', 'foreign_table' => 'cc_playlistcontents', ),
- );
- } // getBehaviors()
+ /**
+ *
+ * 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' => 'length',
+ 'expression' => 'SUM(cliplength)',
+ 'condition' => NULL,
+ 'foreign_table' => 'cc_playlistcontents',
+ 'foreign_schema' => NULL,
+),
+ );
+ } // getBehaviors()
} // CcPlaylistTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php
index 3122f64d5..25edcd6e8 100644
--- a/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php
@@ -14,67 +14,71 @@
*
* @package propel.generator.airtime.map
*/
-class CcPlaylistcontentsTableMap extends TableMap {
+class CcPlaylistcontentsTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcPlaylistcontentsTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcPlaylistcontentsTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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->addForeignKey('BLOCK_ID', 'DbBlockId', 'INTEGER', 'cc_block', 'ID', false, null, null);
- $this->addColumn('STREAM_ID', 'DbStreamId', 'INTEGER', false, null, null);
- $this->addColumn('TYPE', 'DbType', 'SMALLINT', true, null, 0);
- $this->addColumn('POSITION', 'DbPosition', 'INTEGER', false, null, null);
- $this->addColumn('TRACKOFFSET', 'DbTrackOffset', 'REAL', true, null, 0);
- $this->addColumn('CLIPLENGTH', 'DbCliplength', 'VARCHAR', false, null, '00:00:00');
- $this->addColumn('CUEIN', 'DbCuein', 'VARCHAR', false, null, '00:00:00');
- $this->addColumn('CUEOUT', 'DbCueout', 'VARCHAR', 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()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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->addForeignKey('block_id', 'DbBlockId', 'INTEGER', 'cc_block', 'id', false, null, null);
+ $this->addColumn('stream_id', 'DbStreamId', 'INTEGER', false, null, null);
+ $this->addColumn('type', 'DbType', 'SMALLINT', true, null, 0);
+ $this->addColumn('position', 'DbPosition', 'INTEGER', false, null, null);
+ $this->addColumn('trackoffset', 'DbTrackOffset', 'REAL', true, null, 0);
+ $this->addColumn('cliplength', 'DbCliplength', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('cuein', 'DbCuein', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('cueout', 'DbCueout', 'VARCHAR', 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('CcBlock', 'CcBlock', RelationMap::MANY_TO_ONE, array('block_id' => 'id', ), 'CASCADE', null);
- $this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::MANY_TO_ONE, array('playlist_id' => 'id', ), 'CASCADE', null);
- } // buildRelations()
+ /**
+ * 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('CcBlock', 'CcBlock', RelationMap::MANY_TO_ONE, array('block_id' => 'id', ), 'CASCADE', null);
+ $this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::MANY_TO_ONE, array('playlist_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_playlist', 'update_method' => 'updateDbLength', ),
- );
- } // getBehaviors()
+ /**
+ *
+ * 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_playlist',
+ 'update_method' => 'updateDbLength',
+),
+ );
+ } // getBehaviors()
} // CcPlaylistcontentsTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryMetaDataTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryMetaDataTableMap.php
index 8e937f6e5..76a68db35 100644
--- a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryMetaDataTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryMetaDataTableMap.php
@@ -14,43 +14,44 @@
*
* @package propel.generator.airtime.map
*/
-class CcPlayoutHistoryMetaDataTableMap extends TableMap {
+class CcPlayoutHistoryMetaDataTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcPlayoutHistoryMetaDataTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcPlayoutHistoryMetaDataTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->setName('cc_playout_history_metadata');
- $this->setPhpName('CcPlayoutHistoryMetaData');
- $this->setClassname('CcPlayoutHistoryMetaData');
- $this->setPackage('airtime');
- $this->setUseIdGenerator(true);
- $this->setPrimaryKeyMethodInfo('cc_playout_history_metadata_id_seq');
- // columns
- $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
- $this->addForeignKey('HISTORY_ID', 'DbHistoryId', 'INTEGER', 'cc_playout_history', 'ID', true, null, null);
- $this->addColumn('KEY', 'DbKey', 'VARCHAR', true, 128, null);
- $this->addColumn('VALUE', 'DbValue', 'VARCHAR', true, 128, null);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('cc_playout_history_metadata');
+ $this->setPhpName('CcPlayoutHistoryMetaData');
+ $this->setClassname('CcPlayoutHistoryMetaData');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_playout_history_metadata_id_seq');
+ // columns
+ $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
+ $this->addForeignKey('history_id', 'DbHistoryId', 'INTEGER', 'cc_playout_history', 'id', true, null, null);
+ $this->addColumn('key', 'DbKey', 'VARCHAR', true, 128, null);
+ $this->addColumn('value', 'DbValue', 'VARCHAR', true, 128, null);
+ // validators
+ } // initialize()
- /**
- * Build the RelationMap objects for this table relationships
- */
- public function buildRelations()
- {
- $this->addRelation('CcPlayoutHistory', 'CcPlayoutHistory', RelationMap::MANY_TO_ONE, array('history_id' => 'id', ), 'CASCADE', null);
- } // buildRelations()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcPlayoutHistory', 'CcPlayoutHistory', RelationMap::MANY_TO_ONE, array('history_id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
} // CcPlayoutHistoryMetaDataTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTableMap.php
index 23696f18d..93b3cd8a0 100644
--- a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTableMap.php
@@ -14,46 +14,47 @@
*
* @package propel.generator.airtime.map
*/
-class CcPlayoutHistoryTableMap extends TableMap {
+class CcPlayoutHistoryTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcPlayoutHistoryTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcPlayoutHistoryTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->setName('cc_playout_history');
- $this->setPhpName('CcPlayoutHistory');
- $this->setClassname('CcPlayoutHistory');
- $this->setPackage('airtime');
- $this->setUseIdGenerator(true);
- $this->setPrimaryKeyMethodInfo('cc_playout_history_id_seq');
- // columns
- $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
- $this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
- $this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null);
- $this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', false, null, null);
- $this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', false, null, null);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('cc_playout_history');
+ $this->setPhpName('CcPlayoutHistory');
+ $this->setClassname('CcPlayoutHistory');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_playout_history_id_seq');
+ // columns
+ $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
+ $this->addForeignKey('file_id', 'DbFileId', 'INTEGER', 'cc_files', 'id', false, null, null);
+ $this->addColumn('starts', 'DbStarts', 'TIMESTAMP', true, null, null);
+ $this->addColumn('ends', 'DbEnds', 'TIMESTAMP', false, null, null);
+ $this->addForeignKey('instance_id', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'id', false, null, null);
+ // 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('CcShowInstances', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'SET NULL', null);
- $this->addRelation('CcPlayoutHistoryMetaData', 'CcPlayoutHistoryMetaData', RelationMap::ONE_TO_MANY, array('id' => 'history_id', ), 'CASCADE', null);
- } // buildRelations()
+ /**
+ * 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('CcShowInstances', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'SET NULL', null);
+ $this->addRelation('CcPlayoutHistoryMetaData', 'CcPlayoutHistoryMetaData', RelationMap::ONE_TO_MANY, array('id' => 'history_id', ), 'CASCADE', null, 'CcPlayoutHistoryMetaDatas');
+ } // buildRelations()
} // CcPlayoutHistoryTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateFieldTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateFieldTableMap.php
index f68db26a1..495f7f1f2 100644
--- a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateFieldTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateFieldTableMap.php
@@ -14,46 +14,47 @@
*
* @package propel.generator.airtime.map
*/
-class CcPlayoutHistoryTemplateFieldTableMap extends TableMap {
+class CcPlayoutHistoryTemplateFieldTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcPlayoutHistoryTemplateFieldTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcPlayoutHistoryTemplateFieldTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->setName('cc_playout_history_template_field');
- $this->setPhpName('CcPlayoutHistoryTemplateField');
- $this->setClassname('CcPlayoutHistoryTemplateField');
- $this->setPackage('airtime');
- $this->setUseIdGenerator(true);
- $this->setPrimaryKeyMethodInfo('cc_playout_history_template_field_id_seq');
- // columns
- $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
- $this->addForeignKey('TEMPLATE_ID', 'DbTemplateId', 'INTEGER', 'cc_playout_history_template', 'ID', true, null, null);
- $this->addColumn('NAME', 'DbName', 'VARCHAR', true, 128, null);
- $this->addColumn('LABEL', 'DbLabel', 'VARCHAR', true, 128, null);
- $this->addColumn('TYPE', 'DbType', 'VARCHAR', true, 128, null);
- $this->addColumn('IS_FILE_MD', 'DbIsFileMD', 'BOOLEAN', true, null, false);
- $this->addColumn('POSITION', 'DbPosition', 'INTEGER', true, null, null);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('cc_playout_history_template_field');
+ $this->setPhpName('CcPlayoutHistoryTemplateField');
+ $this->setClassname('CcPlayoutHistoryTemplateField');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_playout_history_template_field_id_seq');
+ // columns
+ $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
+ $this->addForeignKey('template_id', 'DbTemplateId', 'INTEGER', 'cc_playout_history_template', 'id', true, null, null);
+ $this->addColumn('name', 'DbName', 'VARCHAR', true, 128, null);
+ $this->addColumn('label', 'DbLabel', 'VARCHAR', true, 128, null);
+ $this->addColumn('type', 'DbType', 'VARCHAR', true, 128, null);
+ $this->addColumn('is_file_md', 'DbIsFileMD', 'BOOLEAN', true, null, false);
+ $this->addColumn('position', 'DbPosition', 'INTEGER', true, null, null);
+ // validators
+ } // initialize()
- /**
- * Build the RelationMap objects for this table relationships
- */
- public function buildRelations()
- {
- $this->addRelation('CcPlayoutHistoryTemplate', 'CcPlayoutHistoryTemplate', RelationMap::MANY_TO_ONE, array('template_id' => 'id', ), 'CASCADE', null);
- } // buildRelations()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcPlayoutHistoryTemplate', 'CcPlayoutHistoryTemplate', RelationMap::MANY_TO_ONE, array('template_id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
} // CcPlayoutHistoryTemplateFieldTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateTableMap.php
index e5aea573d..78be57d28 100644
--- a/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcPlayoutHistoryTemplateTableMap.php
@@ -14,42 +14,43 @@
*
* @package propel.generator.airtime.map
*/
-class CcPlayoutHistoryTemplateTableMap extends TableMap {
+class CcPlayoutHistoryTemplateTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcPlayoutHistoryTemplateTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcPlayoutHistoryTemplateTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->setName('cc_playout_history_template');
- $this->setPhpName('CcPlayoutHistoryTemplate');
- $this->setClassname('CcPlayoutHistoryTemplate');
- $this->setPackage('airtime');
- $this->setUseIdGenerator(true);
- $this->setPrimaryKeyMethodInfo('cc_playout_history_template_id_seq');
- // columns
- $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
- $this->addColumn('NAME', 'DbName', 'VARCHAR', true, 128, null);
- $this->addColumn('TYPE', 'DbType', 'VARCHAR', true, 35, null);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('cc_playout_history_template');
+ $this->setPhpName('CcPlayoutHistoryTemplate');
+ $this->setClassname('CcPlayoutHistoryTemplate');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_playout_history_template_id_seq');
+ // columns
+ $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
+ $this->addColumn('name', 'DbName', 'VARCHAR', true, 128, null);
+ $this->addColumn('type', 'DbType', 'VARCHAR', true, 35, null);
+ // validators
+ } // initialize()
- /**
- * Build the RelationMap objects for this table relationships
- */
- public function buildRelations()
- {
- $this->addRelation('CcPlayoutHistoryTemplateField', 'CcPlayoutHistoryTemplateField', RelationMap::ONE_TO_MANY, array('id' => 'template_id', ), 'CASCADE', null);
- } // buildRelations()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcPlayoutHistoryTemplateField', 'CcPlayoutHistoryTemplateField', RelationMap::ONE_TO_MANY, array('id' => 'template_id', ), 'CASCADE', null, 'CcPlayoutHistoryTemplateFields');
+ } // buildRelations()
} // CcPlayoutHistoryTemplateTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcPrefTableMap.php b/airtime_mvc/application/models/airtime/map/CcPrefTableMap.php
index 1d22a122d..843264a50 100644
--- a/airtime_mvc/application/models/airtime/map/CcPrefTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcPrefTableMap.php
@@ -14,43 +14,44 @@
*
* @package propel.generator.airtime.map
*/
-class CcPrefTableMap extends TableMap {
+class CcPrefTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcPrefTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcPrefTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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()
+ /**
+ * 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/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php b/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php
index 54d25cdb8..6c0cec7c0 100644
--- a/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php
@@ -14,57 +14,58 @@
*
* @package propel.generator.airtime.map
*/
-class CcScheduleTableMap extends TableMap {
+class CcScheduleTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcScheduleTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcScheduleTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null);
- $this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null);
- $this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
- $this->addForeignKey('STREAM_ID', 'DbStreamId', 'INTEGER', 'cc_webstream', 'ID', false, null, null);
- $this->addColumn('CLIP_LENGTH', 'DbClipLength', 'VARCHAR', 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', 'VARCHAR', true, null, null);
- $this->addColumn('CUE_OUT', 'DbCueOut', 'VARCHAR', true, null, null);
- $this->addColumn('MEDIA_ITEM_PLAYED', 'DbMediaItemPlayed', 'BOOLEAN', false, null, false);
- $this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', true, null, null);
- $this->addColumn('PLAYOUT_STATUS', 'DbPlayoutStatus', 'SMALLINT', true, null, 1);
- $this->addColumn('BROADCASTED', 'DbBroadcasted', 'SMALLINT', true, null, 0);
- $this->addColumn('POSITION', 'DbPosition', 'INTEGER', true, null, 0);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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('starts', 'DbStarts', 'TIMESTAMP', true, null, null);
+ $this->addColumn('ends', 'DbEnds', 'TIMESTAMP', true, null, null);
+ $this->addForeignKey('file_id', 'DbFileId', 'INTEGER', 'cc_files', 'id', false, null, null);
+ $this->addForeignKey('stream_id', 'DbStreamId', 'INTEGER', 'cc_webstream', 'id', false, null, null);
+ $this->addColumn('clip_length', 'DbClipLength', 'VARCHAR', 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', 'VARCHAR', true, null, null);
+ $this->addColumn('cue_out', 'DbCueOut', 'VARCHAR', true, null, null);
+ $this->addColumn('media_item_played', 'DbMediaItemPlayed', 'BOOLEAN', false, null, false);
+ $this->addForeignKey('instance_id', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'id', true, null, null);
+ $this->addColumn('playout_status', 'DbPlayoutStatus', 'SMALLINT', true, null, 1);
+ $this->addColumn('broadcasted', 'DbBroadcasted', 'SMALLINT', true, null, 0);
+ $this->addColumn('position', 'DbPosition', 'INTEGER', true, null, 0);
+ // 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);
- $this->addRelation('CcWebstream', 'CcWebstream', RelationMap::MANY_TO_ONE, array('stream_id' => 'id', ), 'CASCADE', null);
- $this->addRelation('CcWebstreamMetadata', 'CcWebstreamMetadata', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null);
- } // buildRelations()
+ /**
+ * 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);
+ $this->addRelation('CcWebstream', 'CcWebstream', RelationMap::MANY_TO_ONE, array('stream_id' => 'id', ), 'CASCADE', null);
+ $this->addRelation('CcWebstreamMetadata', 'CcWebstreamMetadata', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null, 'CcWebstreamMetadatas');
+ } // buildRelations()
} // CcScheduleTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcServiceRegisterTableMap.php b/airtime_mvc/application/models/airtime/map/CcServiceRegisterTableMap.php
index f4eae5e60..d6e6d7b86 100644
--- a/airtime_mvc/application/models/airtime/map/CcServiceRegisterTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcServiceRegisterTableMap.php
@@ -14,39 +14,40 @@
*
* @package propel.generator.airtime.map
*/
-class CcServiceRegisterTableMap extends TableMap {
+class CcServiceRegisterTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcServiceRegisterTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcServiceRegisterTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ } // buildRelations()
} // CcServiceRegisterTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcSessTableMap.php b/airtime_mvc/application/models/airtime/map/CcSessTableMap.php
index 66605b4eb..c1ced0934 100644
--- a/airtime_mvc/application/models/airtime/map/CcSessTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcSessTableMap.php
@@ -14,42 +14,43 @@
*
* @package propel.generator.airtime.map
*/
-class CcSessTableMap extends TableMap {
+class CcSessTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcSessTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcSessTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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()
+ /**
+ * 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/airtime_mvc/application/models/airtime/map/CcShowDaysTableMap.php b/airtime_mvc/application/models/airtime/map/CcShowDaysTableMap.php
index 7d6b8a10e..dcfa0391d 100644
--- a/airtime_mvc/application/models/airtime/map/CcShowDaysTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcShowDaysTableMap.php
@@ -14,50 +14,51 @@
*
* @package propel.generator.airtime.map
*/
-class CcShowDaysTableMap extends TableMap {
+class CcShowDaysTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcShowDaysTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcShowDaysTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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, null, null);
+ $this->addColumn('duration', 'DbDuration', 'VARCHAR', true, null, 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()
+ /**
+ * 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/airtime_mvc/application/models/airtime/map/CcShowHostsTableMap.php b/airtime_mvc/application/models/airtime/map/CcShowHostsTableMap.php
index c76efdbd3..752c36665 100644
--- a/airtime_mvc/application/models/airtime/map/CcShowHostsTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcShowHostsTableMap.php
@@ -14,43 +14,44 @@
*
* @package propel.generator.airtime.map
*/
-class CcShowHostsTableMap extends TableMap {
+class CcShowHostsTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcShowHostsTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcShowHostsTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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()
+ /**
+ * 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/airtime_mvc/application/models/airtime/map/CcShowInstancesTableMap.php b/airtime_mvc/application/models/airtime/map/CcShowInstancesTableMap.php
index c55e86080..153c4dbbf 100644
--- a/airtime_mvc/application/models/airtime/map/CcShowInstancesTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcShowInstancesTableMap.php
@@ -14,56 +14,57 @@
*
* @package propel.generator.airtime.map
*/
-class CcShowInstancesTableMap extends TableMap {
+class CcShowInstancesTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcShowInstancesTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcShowInstancesTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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', 'VARCHAR', false, null, '00:00:00');
- $this->addColumn('CREATED', 'DbCreated', 'TIMESTAMP', true, null, null);
- $this->addColumn('LAST_SCHEDULED', 'DbLastScheduled', 'TIMESTAMP', false, null, null);
- $this->addColumn('MODIFIED_INSTANCE', 'DbModifiedInstance', 'BOOLEAN', true, null, false);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('created', 'DbCreated', 'TIMESTAMP', true, null, null);
+ $this->addColumn('last_scheduled', 'DbLastScheduled', 'TIMESTAMP', 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);
- $this->addRelation('CcPlayoutHistory', 'CcPlayoutHistory', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'SET NULL', null);
- } // buildRelations()
+ /**
+ * 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, 'CcShowInstancessRelatedByDbId');
+ $this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'CASCADE', null, 'CcSchedules');
+ $this->addRelation('CcPlayoutHistory', 'CcPlayoutHistory', RelationMap::ONE_TO_MANY, array('id' => 'instance_id', ), 'SET NULL', null, 'CcPlayoutHistorys');
+ } // buildRelations()
} // CcShowInstancesTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcShowRebroadcastTableMap.php b/airtime_mvc/application/models/airtime/map/CcShowRebroadcastTableMap.php
index 60a9ba980..55b557b4f 100644
--- a/airtime_mvc/application/models/airtime/map/CcShowRebroadcastTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcShowRebroadcastTableMap.php
@@ -14,43 +14,44 @@
*
* @package propel.generator.airtime.map
*/
-class CcShowRebroadcastTableMap extends TableMap {
+class CcShowRebroadcastTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcShowRebroadcastTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcShowRebroadcastTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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, null, 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()
+ /**
+ * 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/airtime_mvc/application/models/airtime/map/CcShowTableMap.php b/airtime_mvc/application/models/airtime/map/CcShowTableMap.php
index 8a2686670..96087d4ba 100644
--- a/airtime_mvc/application/models/airtime/map/CcShowTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcShowTableMap.php
@@ -14,55 +14,56 @@
*
* @package propel.generator.airtime.map
*/
-class CcShowTableMap extends TableMap {
+class CcShowTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcShowTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcShowTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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);
- $this->addColumn('LIVE_STREAM_USING_AIRTIME_AUTH', 'DbLiveStreamUsingAirtimeAuth', 'BOOLEAN', false, null, false);
- $this->addColumn('LIVE_STREAM_USING_CUSTOM_AUTH', 'DbLiveStreamUsingCustomAuth', 'BOOLEAN', false, null, false);
- $this->addColumn('LIVE_STREAM_USER', 'DbLiveStreamUser', 'VARCHAR', false, 255, null);
- $this->addColumn('LIVE_STREAM_PASS', 'DbLiveStreamPass', 'VARCHAR', false, 255, null);
- $this->addColumn('LINKED', 'DbLinked', 'BOOLEAN', true, null, false);
- $this->addColumn('IS_LINKABLE', 'DbIsLinkable', 'BOOLEAN', true, null, true);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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);
+ $this->addColumn('live_stream_using_airtime_auth', 'DbLiveStreamUsingAirtimeAuth', 'BOOLEAN', false, null, false);
+ $this->addColumn('live_stream_using_custom_auth', 'DbLiveStreamUsingCustomAuth', 'BOOLEAN', false, null, false);
+ $this->addColumn('live_stream_user', 'DbLiveStreamUser', 'VARCHAR', false, 255, null);
+ $this->addColumn('live_stream_pass', 'DbLiveStreamPass', 'VARCHAR', false, 255, null);
+ $this->addColumn('linked', 'DbLinked', 'BOOLEAN', true, null, false);
+ $this->addColumn('is_linkable', 'DbIsLinkable', 'BOOLEAN', true, null, true);
+ // 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()
+ /**
+ * 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, 'CcShowInstancess');
+ $this->addRelation('CcShowDays', 'CcShowDays', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null, 'CcShowDayss');
+ $this->addRelation('CcShowRebroadcast', 'CcShowRebroadcast', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null, 'CcShowRebroadcasts');
+ $this->addRelation('CcShowHosts', 'CcShowHosts', RelationMap::ONE_TO_MANY, array('id' => 'show_id', ), 'CASCADE', null, 'CcShowHostss');
+ } // buildRelations()
} // CcShowTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcSmembTableMap.php b/airtime_mvc/application/models/airtime/map/CcSmembTableMap.php
index 236cdd016..4067e5e47 100644
--- a/airtime_mvc/application/models/airtime/map/CcSmembTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcSmembTableMap.php
@@ -14,42 +14,43 @@
*
* @package propel.generator.airtime.map
*/
-class CcSmembTableMap extends TableMap {
+class CcSmembTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcSmembTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcSmembTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ } // buildRelations()
} // CcSmembTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcStreamSettingTableMap.php b/airtime_mvc/application/models/airtime/map/CcStreamSettingTableMap.php
index d401ce096..a0638089e 100644
--- a/airtime_mvc/application/models/airtime/map/CcStreamSettingTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcStreamSettingTableMap.php
@@ -14,40 +14,41 @@
*
* @package propel.generator.airtime.map
*/
-class CcStreamSettingTableMap extends TableMap {
+class CcStreamSettingTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcStreamSettingTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcStreamSettingTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ } // buildRelations()
} // CcStreamSettingTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php b/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php
index d4f83529a..8ffb5bf4f 100644
--- a/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php
@@ -14,60 +14,61 @@
*
* @package propel.generator.airtime.map
*/
-class CcSubjsTableMap extends TableMap {
+class CcSubjsTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcSubjsTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcSubjsTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->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('CELL_PHONE', 'DbCellPhone', 'VARCHAR', false, 255, null);
- $this->addColumn('LOGIN_ATTEMPTS', 'DbLoginAttempts', 'INTEGER', false, null, 0);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->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, null, null);
+ $this->addColumn('jabber_contact', 'DbJabberContact', 'VARCHAR', false, null, null);
+ $this->addColumn('email', 'DbEmail', 'VARCHAR', false, null, null);
+ $this->addColumn('cell_phone', 'DbCellPhone', 'VARCHAR', false, null, 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('CcFilesRelatedByDbOwnerId', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'owner_id', ), null, null);
- $this->addRelation('CcFilesRelatedByDbEditedby', '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' => 'creator_id', ), 'CASCADE', null);
- $this->addRelation('CcBlock', 'CcBlock', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), 'CASCADE', 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);
- $this->addRelation('CcSubjsToken', 'CcSubjsToken', RelationMap::ONE_TO_MANY, array('id' => 'user_id', ), 'CASCADE', null);
- } // buildRelations()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcFilesRelatedByDbOwnerId', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'owner_id', ), null, null, 'CcFilessRelatedByDbOwnerId');
+ $this->addRelation('CcFilesRelatedByDbEditedby', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'editedby', ), null, null, 'CcFilessRelatedByDbEditedby');
+ $this->addRelation('CcPerms', 'CcPerms', RelationMap::ONE_TO_MANY, array('id' => 'subj', ), 'CASCADE', null, 'CcPermss');
+ $this->addRelation('CcShowHosts', 'CcShowHosts', RelationMap::ONE_TO_MANY, array('id' => 'subjs_id', ), 'CASCADE', null, 'CcShowHostss');
+ $this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), 'CASCADE', null, 'CcPlaylists');
+ $this->addRelation('CcBlock', 'CcBlock', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), 'CASCADE', null, 'CcBlocks');
+ $this->addRelation('CcPref', 'CcPref', RelationMap::ONE_TO_MANY, array('id' => 'subjid', ), 'CASCADE', null, 'CcPrefs');
+ $this->addRelation('CcSess', 'CcSess', RelationMap::ONE_TO_MANY, array('id' => 'userid', ), 'CASCADE', null, 'CcSesss');
+ $this->addRelation('CcSubjsToken', 'CcSubjsToken', RelationMap::ONE_TO_MANY, array('id' => 'user_id', ), 'CASCADE', null, 'CcSubjsTokens');
+ } // buildRelations()
} // CcSubjsTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcSubjsTokenTableMap.php b/airtime_mvc/application/models/airtime/map/CcSubjsTokenTableMap.php
index 2aeb7ad64..b33c8d091 100644
--- a/airtime_mvc/application/models/airtime/map/CcSubjsTokenTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcSubjsTokenTableMap.php
@@ -14,44 +14,45 @@
*
* @package propel.generator.airtime.map
*/
-class CcSubjsTokenTableMap extends TableMap {
+class CcSubjsTokenTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcSubjsTokenTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcSubjsTokenTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->setName('cc_subjs_token');
- $this->setPhpName('CcSubjsToken');
- $this->setClassname('CcSubjsToken');
- $this->setPackage('airtime');
- $this->setUseIdGenerator(true);
- $this->setPrimaryKeyMethodInfo('cc_subjs_token_id_seq');
- // columns
- $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
- $this->addForeignKey('USER_ID', 'DbUserId', 'INTEGER', 'cc_subjs', 'ID', true, null, null);
- $this->addColumn('ACTION', 'DbAction', 'VARCHAR', true, 255, null);
- $this->addColumn('TOKEN', 'DbToken', 'VARCHAR', true, 40, null);
- $this->addColumn('CREATED', 'DbCreated', 'TIMESTAMP', true, null, null);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('cc_subjs_token');
+ $this->setPhpName('CcSubjsToken');
+ $this->setClassname('CcSubjsToken');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_subjs_token_id_seq');
+ // columns
+ $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
+ $this->addForeignKey('user_id', 'DbUserId', 'INTEGER', 'cc_subjs', 'id', true, null, null);
+ $this->addColumn('action', 'DbAction', 'VARCHAR', true, 255, null);
+ $this->addColumn('token', 'DbToken', 'VARCHAR', true, 40, null);
+ $this->addColumn('created', 'DbCreated', 'TIMESTAMP', true, null, null);
+ // validators
+ } // initialize()
- /**
- * Build the RelationMap objects for this table relationships
- */
- public function buildRelations()
- {
- $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('user_id' => 'id', ), 'CASCADE', null);
- } // buildRelations()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('user_id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
} // CcSubjsTokenTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcTimestampTableMap.php b/airtime_mvc/application/models/airtime/map/CcTimestampTableMap.php
index 6df327d36..fcc8544a7 100644
--- a/airtime_mvc/application/models/airtime/map/CcTimestampTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcTimestampTableMap.php
@@ -14,41 +14,42 @@
*
* @package propel.generator.airtime.map
*/
-class CcTimestampTableMap extends TableMap {
+class CcTimestampTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcTimestampTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcTimestampTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->setName('cc_timestamp');
- $this->setPhpName('CcTimestamp');
- $this->setClassname('CcTimestamp');
- $this->setPackage('airtime');
- $this->setUseIdGenerator(true);
- $this->setPrimaryKeyMethodInfo('cc_timestamp_id_seq');
- // columns
- $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
- $this->addColumn('TIMESTAMP', 'DbTimestamp', 'TIMESTAMP', true, null, null);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('cc_timestamp');
+ $this->setPhpName('CcTimestamp');
+ $this->setClassname('CcTimestamp');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_timestamp_id_seq');
+ // columns
+ $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
+ $this->addColumn('timestamp', 'DbTimestamp', 'TIMESTAMP', true, null, null);
+ // validators
+ } // initialize()
- /**
- * Build the RelationMap objects for this table relationships
- */
- public function buildRelations()
- {
- $this->addRelation('CcListenerCount', 'CcListenerCount', RelationMap::ONE_TO_MANY, array('id' => 'timestamp_id', ), 'CASCADE', null);
- } // buildRelations()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcListenerCount', 'CcListenerCount', RelationMap::ONE_TO_MANY, array('id' => 'timestamp_id', ), 'CASCADE', null, 'CcListenerCounts');
+ } // buildRelations()
} // CcTimestampTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcWebstreamMetadataTableMap.php b/airtime_mvc/application/models/airtime/map/CcWebstreamMetadataTableMap.php
index 305d8189a..38e4b71a2 100644
--- a/airtime_mvc/application/models/airtime/map/CcWebstreamMetadataTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcWebstreamMetadataTableMap.php
@@ -14,43 +14,44 @@
*
* @package propel.generator.airtime.map
*/
-class CcWebstreamMetadataTableMap extends TableMap {
+class CcWebstreamMetadataTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcWebstreamMetadataTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcWebstreamMetadataTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->setName('cc_webstream_metadata');
- $this->setPhpName('CcWebstreamMetadata');
- $this->setClassname('CcWebstreamMetadata');
- $this->setPackage('airtime');
- $this->setUseIdGenerator(true);
- $this->setPrimaryKeyMethodInfo('cc_webstream_metadata_id_seq');
- // columns
- $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
- $this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_schedule', 'ID', true, null, null);
- $this->addColumn('START_TIME', 'DbStartTime', 'TIMESTAMP', true, null, null);
- $this->addColumn('LIQUIDSOAP_DATA', 'DbLiquidsoapData', 'VARCHAR', true, 1024, null);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('cc_webstream_metadata');
+ $this->setPhpName('CcWebstreamMetadata');
+ $this->setClassname('CcWebstreamMetadata');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_webstream_metadata_id_seq');
+ // columns
+ $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
+ $this->addForeignKey('instance_id', 'DbInstanceId', 'INTEGER', 'cc_schedule', 'id', true, null, null);
+ $this->addColumn('start_time', 'DbStartTime', 'TIMESTAMP', true, null, null);
+ $this->addColumn('liquidsoap_data', 'DbLiquidsoapData', 'VARCHAR', true, 1024, null);
+ // validators
+ } // initialize()
- /**
- * Build the RelationMap objects for this table relationships
- */
- public function buildRelations()
- {
- $this->addRelation('CcSchedule', 'CcSchedule', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'CASCADE', null);
- } // buildRelations()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcSchedule', 'CcSchedule', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
} // CcWebstreamMetadataTableMap
diff --git a/airtime_mvc/application/models/airtime/map/CcWebstreamTableMap.php b/airtime_mvc/application/models/airtime/map/CcWebstreamTableMap.php
index c4b28a516..e76fbbd8a 100644
--- a/airtime_mvc/application/models/airtime/map/CcWebstreamTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcWebstreamTableMap.php
@@ -14,49 +14,50 @@
*
* @package propel.generator.airtime.map
*/
-class CcWebstreamTableMap extends TableMap {
+class CcWebstreamTableMap extends TableMap
+{
- /**
- * The (dot-path) name of this class
- */
- const CLASS_NAME = 'airtime.map.CcWebstreamTableMap';
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'airtime.map.CcWebstreamTableMap';
- /**
- * Initialize the table attributes, columns and validators
- * Relations are not initialized by this method since they are lazy loaded
- *
- * @return void
- * @throws PropelException
- */
- public function initialize()
- {
- // attributes
- $this->setName('cc_webstream');
- $this->setPhpName('CcWebstream');
- $this->setClassname('CcWebstream');
- $this->setPackage('airtime');
- $this->setUseIdGenerator(true);
- $this->setPrimaryKeyMethodInfo('cc_webstream_id_seq');
- // columns
- $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
- $this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, null);
- $this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', true, 255, null);
- $this->addColumn('URL', 'DbUrl', 'VARCHAR', true, 512, null);
- $this->addColumn('LENGTH', 'DbLength', 'VARCHAR', true, null, '00:00:00');
- $this->addColumn('CREATOR_ID', 'DbCreatorId', 'INTEGER', true, null, null);
- $this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', true, 6, null);
- $this->addColumn('UTIME', 'DbUtime', 'TIMESTAMP', true, 6, null);
- $this->addColumn('LPTIME', 'DbLPtime', 'TIMESTAMP', false, 6, null);
- $this->addColumn('MIME', 'DbMime', 'VARCHAR', false, 255, null);
- // validators
- } // initialize()
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('cc_webstream');
+ $this->setPhpName('CcWebstream');
+ $this->setClassname('CcWebstream');
+ $this->setPackage('airtime');
+ $this->setUseIdGenerator(true);
+ $this->setPrimaryKeyMethodInfo('cc_webstream_id_seq');
+ // columns
+ $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null);
+ $this->addColumn('name', 'DbName', 'VARCHAR', true, 255, null);
+ $this->addColumn('description', 'DbDescription', 'VARCHAR', true, 255, null);
+ $this->addColumn('url', 'DbUrl', 'VARCHAR', true, 512, null);
+ $this->addColumn('length', 'DbLength', 'VARCHAR', true, null, '00:00:00');
+ $this->addColumn('creator_id', 'DbCreatorId', 'INTEGER', true, null, null);
+ $this->addColumn('mtime', 'DbMtime', 'TIMESTAMP', true, 6, null);
+ $this->addColumn('utime', 'DbUtime', 'TIMESTAMP', true, 6, null);
+ $this->addColumn('lptime', 'DbLPtime', 'TIMESTAMP', false, 6, null);
+ $this->addColumn('mime', 'DbMime', 'VARCHAR', false, null, null);
+ // validators
+ } // initialize()
- /**
- * Build the RelationMap objects for this table relationships
- */
- public function buildRelations()
- {
- $this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'stream_id', ), 'CASCADE', null);
- } // buildRelations()
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'stream_id', ), 'CASCADE', null, 'CcSchedules');
+ } // buildRelations()
} // CcWebstreamTableMap
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlock.php b/airtime_mvc/application/models/airtime/om/BaseCcBlock.php
index f9c900c81..236d3542d 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcBlock.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcBlock.php
@@ -4,1780 +4,2341 @@
/**
* Base class that represents a row from the 'cc_block' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcBlock extends BaseObject implements Persistent
+abstract class BaseCcBlock extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcBlockPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcBlockPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the name field.
- * Note: this column has a database default value of: ''
- * @var string
- */
- protected $name;
-
- /**
- * The value for the mtime field.
- * @var string
- */
- protected $mtime;
-
- /**
- * The value for the utime field.
- * @var string
- */
- protected $utime;
-
- /**
- * The value for the creator_id field.
- * @var int
- */
- protected $creator_id;
-
- /**
- * The value for the description field.
- * @var string
- */
- protected $description;
-
- /**
- * The value for the length field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $length;
-
- /**
- * The value for the type field.
- * Note: this column has a database default value of: 'static'
- * @var string
- */
- protected $type;
-
- /**
- * @var CcSubjs
- */
- protected $aCcSubjs;
-
- /**
- * @var array CcPlaylistcontents[] Collection to store aggregation of CcPlaylistcontents objects.
- */
- protected $collCcPlaylistcontentss;
-
- /**
- * @var array CcBlockcontents[] Collection to store aggregation of CcBlockcontents objects.
- */
- protected $collCcBlockcontentss;
-
- /**
- * @var array CcBlockcriteria[] Collection to store aggregation of CcBlockcriteria objects.
- */
- protected $collCcBlockcriterias;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Applies default values to this object.
- * This method should be called from the object's constructor (or
- * equivalent initialization method).
- * @see __construct()
- */
- public function applyDefaultValues()
- {
- $this->name = '';
- $this->length = '00:00:00';
- $this->type = 'static';
- }
-
- /**
- * Initializes internal state of BaseCcBlock 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 [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 [optionally formatted] temporal [utime] 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 getDbUtime($format = 'Y-m-d H:i:s')
- {
- if ($this->utime === null) {
- return null;
- }
-
-
-
- try {
- $dt = new DateTime($this->utime);
- } catch (Exception $x) {
- throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->utime, 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_id] column value.
- *
- * @return int
- */
- public function getDbCreatorId()
- {
- return $this->creator_id;
- }
-
- /**
- * Get the [description] column value.
- *
- * @return string
- */
- public function getDbDescription()
- {
- return $this->description;
- }
-
- /**
- * Get the [length] column value.
- *
- * @return string
- */
- public function getDbLength()
- {
- return $this->length;
- }
-
- /**
- * Get the [type] column value.
- *
- * @return string
- */
- public function getDbType()
- {
- return $this->type;
- }
-
- /**
- * Set the value of [id] column.
- *
- * @param int $v new value
- * @return CcBlock 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[] = CcBlockPeer::ID;
- }
-
- return $this;
- } // setDbId()
-
- /**
- * Set the value of [name] column.
- *
- * @param string $v new value
- * @return CcBlock 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[] = CcBlockPeer::NAME;
- }
-
- return $this;
- } // setDbName()
-
- /**
- * 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 CcBlock 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[] = CcBlockPeer::MTIME;
- }
- } // if either are not null
-
- return $this;
- } // setDbMtime()
-
- /**
- * Sets the value of [utime] 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 CcBlock The current object (for fluent API support)
- */
- public function setDbUtime($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->utime !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->utime !== null && $tmpDt = new DateTime($this->utime)) ? $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->utime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
- $this->modifiedColumns[] = CcBlockPeer::UTIME;
- }
- } // if either are not null
-
- return $this;
- } // setDbUtime()
-
- /**
- * Set the value of [creator_id] column.
- *
- * @param int $v new value
- * @return CcBlock The current object (for fluent API support)
- */
- public function setDbCreatorId($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->creator_id !== $v) {
- $this->creator_id = $v;
- $this->modifiedColumns[] = CcBlockPeer::CREATOR_ID;
- }
-
- if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) {
- $this->aCcSubjs = null;
- }
-
- return $this;
- } // setDbCreatorId()
-
- /**
- * Set the value of [description] column.
- *
- * @param string $v new value
- * @return CcBlock 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[] = CcBlockPeer::DESCRIPTION;
- }
-
- return $this;
- } // setDbDescription()
-
- /**
- * Set the value of [length] column.
- *
- * @param string $v new value
- * @return CcBlock The current object (for fluent API support)
- */
- public function setDbLength($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->length !== $v || $this->isNew()) {
- $this->length = $v;
- $this->modifiedColumns[] = CcBlockPeer::LENGTH;
- }
-
- return $this;
- } // setDbLength()
-
- /**
- * Set the value of [type] column.
- *
- * @param string $v new value
- * @return CcBlock 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[] = CcBlockPeer::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()
- {
- if ($this->name !== '') {
- return false;
- }
-
- if ($this->length !== '00:00:00') {
- return false;
- }
-
- if ($this->type !== 'static') {
- 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->mtime = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
- $this->utime = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
- $this->creator_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
- $this->description = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
- $this->length = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
- $this->type = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 8; // 8 = CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS).
-
- } catch (Exception $e) {
- throw new PropelException("Error populating CcBlock 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->creator_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(CcBlockPeer::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 = CcBlockPeer::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;
-
- $this->collCcBlockcontentss = null;
-
- $this->collCcBlockcriterias = 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(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $con->beginTransaction();
- try {
- $ret = $this->preDelete($con);
- if ($ret) {
- CcBlockQuery::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(CcBlockPeer::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);
- CcBlockPeer::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[] = CcBlockPeer::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(CcBlockPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcBlockPeer::ID.')');
- }
-
- $pk = BasePeer::doInsert($criteria, $con);
- $affectedRows += 1;
- $this->setDbId($pk); //[IMV] update autoincrement primary key
- $this->setNew(false);
- } else {
- $affectedRows += CcBlockPeer::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);
- }
- }
- }
-
- if ($this->collCcBlockcontentss !== null) {
- foreach ($this->collCcBlockcontentss as $referrerFK) {
- if (!$referrerFK->isDeleted()) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
- if ($this->collCcBlockcriterias !== null) {
- foreach ($this->collCcBlockcriterias 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 = CcBlockPeer::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());
- }
- }
- }
-
- if ($this->collCcBlockcontentss !== null) {
- foreach ($this->collCcBlockcontentss as $referrerFK) {
- if (!$referrerFK->validate($columns)) {
- $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
- }
- }
- }
-
- if ($this->collCcBlockcriterias !== null) {
- foreach ($this->collCcBlockcriterias 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 = CcBlockPeer::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->getDbMtime();
- break;
- case 3:
- return $this->getDbUtime();
- break;
- case 4:
- return $this->getDbCreatorId();
- break;
- case 5:
- return $this->getDbDescription();
- break;
- case 6:
- return $this->getDbLength();
- break;
- case 7:
- 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.
- * @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 = CcBlockPeer::getFieldNames($keyType);
- $result = array(
- $keys[0] => $this->getDbId(),
- $keys[1] => $this->getDbName(),
- $keys[2] => $this->getDbMtime(),
- $keys[3] => $this->getDbUtime(),
- $keys[4] => $this->getDbCreatorId(),
- $keys[5] => $this->getDbDescription(),
- $keys[6] => $this->getDbLength(),
- $keys[7] => $this->getDbType(),
- );
- 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 = CcBlockPeer::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->setDbMtime($value);
- break;
- case 3:
- $this->setDbUtime($value);
- break;
- case 4:
- $this->setDbCreatorId($value);
- break;
- case 5:
- $this->setDbDescription($value);
- break;
- case 6:
- $this->setDbLength($value);
- break;
- case 7:
- $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 = CcBlockPeer::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->setDbMtime($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setDbUtime($arr[$keys[3]]);
- if (array_key_exists($keys[4], $arr)) $this->setDbCreatorId($arr[$keys[4]]);
- if (array_key_exists($keys[5], $arr)) $this->setDbDescription($arr[$keys[5]]);
- if (array_key_exists($keys[6], $arr)) $this->setDbLength($arr[$keys[6]]);
- if (array_key_exists($keys[7], $arr)) $this->setDbType($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(CcBlockPeer::DATABASE_NAME);
-
- if ($this->isColumnModified(CcBlockPeer::ID)) $criteria->add(CcBlockPeer::ID, $this->id);
- if ($this->isColumnModified(CcBlockPeer::NAME)) $criteria->add(CcBlockPeer::NAME, $this->name);
- if ($this->isColumnModified(CcBlockPeer::MTIME)) $criteria->add(CcBlockPeer::MTIME, $this->mtime);
- if ($this->isColumnModified(CcBlockPeer::UTIME)) $criteria->add(CcBlockPeer::UTIME, $this->utime);
- if ($this->isColumnModified(CcBlockPeer::CREATOR_ID)) $criteria->add(CcBlockPeer::CREATOR_ID, $this->creator_id);
- if ($this->isColumnModified(CcBlockPeer::DESCRIPTION)) $criteria->add(CcBlockPeer::DESCRIPTION, $this->description);
- if ($this->isColumnModified(CcBlockPeer::LENGTH)) $criteria->add(CcBlockPeer::LENGTH, $this->length);
- if ($this->isColumnModified(CcBlockPeer::TYPE)) $criteria->add(CcBlockPeer::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(CcBlockPeer::DATABASE_NAME);
- $criteria->add(CcBlockPeer::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 CcBlock (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->setDbMtime($this->mtime);
- $copyObj->setDbUtime($this->utime);
- $copyObj->setDbCreatorId($this->creator_id);
- $copyObj->setDbDescription($this->description);
- $copyObj->setDbLength($this->length);
- $copyObj->setDbType($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->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->getCcBlockcontentss() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addCcBlockcontents($relObj->copy($deepCopy));
- }
- }
-
- foreach ($this->getCcBlockcriterias() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addCcBlockcriteria($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 CcBlock 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 CcBlockPeer
- */
- public function getPeer()
- {
- if (self::$peer === null) {
- self::$peer = new CcBlockPeer();
- }
- return self::$peer;
- }
-
- /**
- * Declares an association between this object and a CcSubjs object.
- *
- * @param CcSubjs $v
- * @return CcBlock The current object (for fluent API support)
- * @throws PropelException
- */
- public function setCcSubjs(CcSubjs $v = null)
- {
- if ($v === null) {
- $this->setDbCreatorId(NULL);
- } else {
- $this->setDbCreatorId($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->addCcBlock($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->creator_id !== null)) {
- $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->creator_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->addCcBlocks($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 CcBlock 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)
- ->filterByCcBlock($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
- ->filterByCcBlock($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->setCcBlock($this);
- }
- }
-
-
- /**
- * If this collection has already been initialized with
- * an identical criteria, it returns the collection.
- * Otherwise if this CcBlock is new, it will return
- * an empty collection; or if this CcBlock 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 CcBlock.
- *
- * @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);
- }
-
-
- /**
- * If this collection has already been initialized with
- * an identical criteria, it returns the collection.
- * Otherwise if this CcBlock is new, it will return
- * an empty collection; or if this CcBlock 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 CcBlock.
- *
- * @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 collCcBlockcontentss 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 addCcBlockcontentss()
- */
- public function clearCcBlockcontentss()
- {
- $this->collCcBlockcontentss = null; // important to set this to NULL since that means it is uninitialized
- }
-
- /**
- * Initializes the collCcBlockcontentss collection.
- *
- * By default this just sets the collCcBlockcontentss collection to an empty array (like clearcollCcBlockcontentss());
- * 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 initCcBlockcontentss()
- {
- $this->collCcBlockcontentss = new PropelObjectCollection();
- $this->collCcBlockcontentss->setModel('CcBlockcontents');
- }
-
- /**
- * Gets an array of CcBlockcontents 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 CcBlock 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 CcBlockcontents[] List of CcBlockcontents objects
- * @throws PropelException
- */
- public function getCcBlockcontentss($criteria = null, PropelPDO $con = null)
- {
- if(null === $this->collCcBlockcontentss || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcBlockcontentss) {
- // return empty collection
- $this->initCcBlockcontentss();
- } else {
- $collCcBlockcontentss = CcBlockcontentsQuery::create(null, $criteria)
- ->filterByCcBlock($this)
- ->find($con);
- if (null !== $criteria) {
- return $collCcBlockcontentss;
- }
- $this->collCcBlockcontentss = $collCcBlockcontentss;
- }
- }
- return $this->collCcBlockcontentss;
- }
-
- /**
- * Returns the number of related CcBlockcontents objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related CcBlockcontents objects.
- * @throws PropelException
- */
- public function countCcBlockcontentss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- if(null === $this->collCcBlockcontentss || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcBlockcontentss) {
- return 0;
- } else {
- $query = CcBlockcontentsQuery::create(null, $criteria);
- if($distinct) {
- $query->distinct();
- }
- return $query
- ->filterByCcBlock($this)
- ->count($con);
- }
- } else {
- return count($this->collCcBlockcontentss);
- }
- }
-
- /**
- * Method called to associate a CcBlockcontents object to this object
- * through the CcBlockcontents foreign key attribute.
- *
- * @param CcBlockcontents $l CcBlockcontents
- * @return void
- * @throws PropelException
- */
- public function addCcBlockcontents(CcBlockcontents $l)
- {
- if ($this->collCcBlockcontentss === null) {
- $this->initCcBlockcontentss();
- }
- if (!$this->collCcBlockcontentss->contains($l)) { // only add it if the **same** object is not already associated
- $this->collCcBlockcontentss[]= $l;
- $l->setCcBlock($this);
- }
- }
-
-
- /**
- * If this collection has already been initialized with
- * an identical criteria, it returns the collection.
- * Otherwise if this CcBlock is new, it will return
- * an empty collection; or if this CcBlock has previously
- * been saved, it will retrieve related CcBlockcontentss 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 CcBlock.
- *
- * @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 CcBlockcontents[] List of CcBlockcontents objects
- */
- public function getCcBlockcontentssJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
- {
- $query = CcBlockcontentsQuery::create(null, $criteria);
- $query->joinWith('CcFiles', $join_behavior);
-
- return $this->getCcBlockcontentss($query, $con);
- }
-
- /**
- * Clears out the collCcBlockcriterias 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 addCcBlockcriterias()
- */
- public function clearCcBlockcriterias()
- {
- $this->collCcBlockcriterias = null; // important to set this to NULL since that means it is uninitialized
- }
-
- /**
- * Initializes the collCcBlockcriterias collection.
- *
- * By default this just sets the collCcBlockcriterias collection to an empty array (like clearcollCcBlockcriterias());
- * 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 initCcBlockcriterias()
- {
- $this->collCcBlockcriterias = new PropelObjectCollection();
- $this->collCcBlockcriterias->setModel('CcBlockcriteria');
- }
-
- /**
- * Gets an array of CcBlockcriteria 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 CcBlock 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 CcBlockcriteria[] List of CcBlockcriteria objects
- * @throws PropelException
- */
- public function getCcBlockcriterias($criteria = null, PropelPDO $con = null)
- {
- if(null === $this->collCcBlockcriterias || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcBlockcriterias) {
- // return empty collection
- $this->initCcBlockcriterias();
- } else {
- $collCcBlockcriterias = CcBlockcriteriaQuery::create(null, $criteria)
- ->filterByCcBlock($this)
- ->find($con);
- if (null !== $criteria) {
- return $collCcBlockcriterias;
- }
- $this->collCcBlockcriterias = $collCcBlockcriterias;
- }
- }
- return $this->collCcBlockcriterias;
- }
-
- /**
- * Returns the number of related CcBlockcriteria objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related CcBlockcriteria objects.
- * @throws PropelException
- */
- public function countCcBlockcriterias(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- if(null === $this->collCcBlockcriterias || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcBlockcriterias) {
- return 0;
- } else {
- $query = CcBlockcriteriaQuery::create(null, $criteria);
- if($distinct) {
- $query->distinct();
- }
- return $query
- ->filterByCcBlock($this)
- ->count($con);
- }
- } else {
- return count($this->collCcBlockcriterias);
- }
- }
-
- /**
- * Method called to associate a CcBlockcriteria object to this object
- * through the CcBlockcriteria foreign key attribute.
- *
- * @param CcBlockcriteria $l CcBlockcriteria
- * @return void
- * @throws PropelException
- */
- public function addCcBlockcriteria(CcBlockcriteria $l)
- {
- if ($this->collCcBlockcriterias === null) {
- $this->initCcBlockcriterias();
- }
- if (!$this->collCcBlockcriterias->contains($l)) { // only add it if the **same** object is not already associated
- $this->collCcBlockcriterias[]= $l;
- $l->setCcBlock($this);
- }
- }
-
- /**
- * Clears the current object and sets all attributes to their default values
- */
- public function clear()
- {
- $this->id = null;
- $this->name = null;
- $this->mtime = null;
- $this->utime = null;
- $this->creator_id = null;
- $this->description = null;
- $this->length = null;
- $this->type = 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 ($this->collCcBlockcontentss) {
- foreach ((array) $this->collCcBlockcontentss as $o) {
- $o->clearAllReferences($deep);
- }
- }
- if ($this->collCcBlockcriterias) {
- foreach ((array) $this->collCcBlockcriterias as $o) {
- $o->clearAllReferences($deep);
- }
- }
- } // if ($deep)
-
- $this->collCcPlaylistcontentss = null;
- $this->collCcBlockcontentss = null;
- $this->collCcBlockcriterias = null;
- $this->aCcSubjs = null;
- }
-
- // aggregate_column behavior
-
- /**
- * Computes the value of the aggregate column length
- *
- * @param PropelPDO $con A connection object
- *
- * @return mixed The scalar result from the aggregate query
- */
- public function computeDbLength(PropelPDO $con)
- {
- $stmt = $con->prepare('SELECT SUM(cliplength) FROM "cc_blockcontents" WHERE cc_blockcontents.BLOCK_ID = :p1');
- $stmt->bindValue(':p1', $this->getDbId());
- $stmt->execute();
- return $stmt->fetchColumn();
- }
-
- /**
- * Updates the aggregate column length
- *
- * @param PropelPDO $con A connection object
- */
- public function updateDbLength(PropelPDO $con)
- {
- $this->setDbLength($this->computeDbLength($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);
- }
-
-} // BaseCcBlock
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcBlockPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcBlockPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the name field.
+ * Note: this column has a database default value of: ''
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * The value for the mtime field.
+ * @var string
+ */
+ protected $mtime;
+
+ /**
+ * The value for the utime field.
+ * @var string
+ */
+ protected $utime;
+
+ /**
+ * The value for the creator_id field.
+ * @var int
+ */
+ protected $creator_id;
+
+ /**
+ * The value for the description field.
+ * @var string
+ */
+ protected $description;
+
+ /**
+ * The value for the length field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $length;
+
+ /**
+ * The value for the type field.
+ * Note: this column has a database default value of: 'static'
+ * @var string
+ */
+ protected $type;
+
+ /**
+ * @var CcSubjs
+ */
+ protected $aCcSubjs;
+
+ /**
+ * @var PropelObjectCollection|CcPlaylistcontents[] Collection to store aggregation of CcPlaylistcontents objects.
+ */
+ protected $collCcPlaylistcontentss;
+ protected $collCcPlaylistcontentssPartial;
+
+ /**
+ * @var PropelObjectCollection|CcBlockcontents[] Collection to store aggregation of CcBlockcontents objects.
+ */
+ protected $collCcBlockcontentss;
+ protected $collCcBlockcontentssPartial;
+
+ /**
+ * @var PropelObjectCollection|CcBlockcriteria[] Collection to store aggregation of CcBlockcriteria objects.
+ */
+ protected $collCcBlockcriterias;
+ protected $collCcBlockcriteriasPartial;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccPlaylistcontentssScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccBlockcontentssScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccBlockcriteriasScheduledForDeletion = null;
+
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->name = '';
+ $this->length = '00:00:00';
+ $this->type = 'static';
+ }
+
+ /**
+ * Initializes internal state of BaseCcBlock 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 [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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [utime] 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 getDbUtime($format = 'Y-m-d H:i:s')
+ {
+ if ($this->utime === null) {
+ return null;
+ }
+
+
+ try {
+ $dt = new DateTime($this->utime);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->utime, true), $x);
+ }
+
+ if ($format === null) {
+ // Because propel.useDateTimeClass is true, we return a DateTime object.
+ return $dt;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Get the [creator_id] column value.
+ *
+ * @return int
+ */
+ public function getDbCreatorId()
+ {
+
+ return $this->creator_id;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDbDescription()
+ {
+
+ return $this->description;
+ }
+
+ /**
+ * Get the [length] column value.
+ *
+ * @return string
+ */
+ public function getDbLength()
+ {
+
+ return $this->length;
+ }
+
+ /**
+ * Get the [type] column value.
+ *
+ * @return string
+ */
+ public function getDbType()
+ {
+
+ return $this->type;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcBlockPeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [name] column.
+ *
+ * @param string $v new value
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setDbName($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->name !== $v) {
+ $this->name = $v;
+ $this->modifiedColumns[] = CcBlockPeer::NAME;
+ }
+
+
+ return $this;
+ } // setDbName()
+
+ /**
+ * 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 strings are treated as null.
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setDbMtime($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->mtime !== null || $dt !== null) {
+ $currentDateAsString = ($this->mtime !== null && $tmpDt = new DateTime($this->mtime)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->mtime = $newDateAsString;
+ $this->modifiedColumns[] = CcBlockPeer::MTIME;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbMtime()
+
+ /**
+ * Sets the value of [utime] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or DateTime value.
+ * Empty strings are treated as null.
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setDbUtime($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->utime !== null || $dt !== null) {
+ $currentDateAsString = ($this->utime !== null && $tmpDt = new DateTime($this->utime)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->utime = $newDateAsString;
+ $this->modifiedColumns[] = CcBlockPeer::UTIME;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbUtime()
+
+ /**
+ * Set the value of [creator_id] column.
+ *
+ * @param int $v new value
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setDbCreatorId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->creator_id !== $v) {
+ $this->creator_id = $v;
+ $this->modifiedColumns[] = CcBlockPeer::CREATOR_ID;
+ }
+
+ if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) {
+ $this->aCcSubjs = null;
+ }
+
+
+ return $this;
+ } // setDbCreatorId()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setDbDescription($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = CcBlockPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDbDescription()
+
+ /**
+ * Set the value of [length] column.
+ *
+ * @param string $v new value
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setDbLength($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->length !== $v) {
+ $this->length = $v;
+ $this->modifiedColumns[] = CcBlockPeer::LENGTH;
+ }
+
+
+ return $this;
+ } // setDbLength()
+
+ /**
+ * Set the value of [type] column.
+ *
+ * @param string $v new value
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setDbType($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->type !== $v) {
+ $this->type = $v;
+ $this->modifiedColumns[] = CcBlockPeer::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()
+ {
+ if ($this->name !== '') {
+ return false;
+ }
+
+ if ($this->length !== '00:00:00') {
+ return false;
+ }
+
+ if ($this->type !== 'static') {
+ 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 resultset 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->mtime = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->utime = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->creator_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
+ $this->description = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->length = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
+ $this->type = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 8; // 8 = CcBlockPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcBlock 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->creator_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(CcBlockPeer::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 = CcBlockPeer::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;
+
+ $this->collCcBlockcontentss = null;
+
+ $this->collCcBlockcriterias = null;
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @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(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = CcBlockQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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(CcBlockPeer::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 behavior
+ if (null !== $this->collCcBlockcontentss) {
+ $this->setDbLength($this->computeDbLength($con));
+ if ($this->isModified()) {
+ $this->save($con);
+ }
+ }
+
+ CcBlockPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $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 corresponding 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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ if ($this->ccPlaylistcontentssScheduledForDeletion !== null) {
+ if (!$this->ccPlaylistcontentssScheduledForDeletion->isEmpty()) {
+ CcPlaylistcontentsQuery::create()
+ ->filterByPrimaryKeys($this->ccPlaylistcontentssScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccPlaylistcontentssScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcPlaylistcontentss !== null) {
+ foreach ($this->collCcPlaylistcontentss as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccBlockcontentssScheduledForDeletion !== null) {
+ if (!$this->ccBlockcontentssScheduledForDeletion->isEmpty()) {
+ CcBlockcontentsQuery::create()
+ ->filterByPrimaryKeys($this->ccBlockcontentssScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccBlockcontentssScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcBlockcontentss !== null) {
+ foreach ($this->collCcBlockcontentss as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccBlockcriteriasScheduledForDeletion !== null) {
+ if (!$this->ccBlockcriteriasScheduledForDeletion->isEmpty()) {
+ CcBlockcriteriaQuery::create()
+ ->filterByPrimaryKeys($this->ccBlockcriteriasScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccBlockcriteriasScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcBlockcriterias !== null) {
+ foreach ($this->collCcBlockcriterias as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcBlockPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcBlockPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_block_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcBlockPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcBlockPeer::NAME)) {
+ $modifiedColumns[':p' . $index++] = '"name"';
+ }
+ if ($this->isColumnModified(CcBlockPeer::MTIME)) {
+ $modifiedColumns[':p' . $index++] = '"mtime"';
+ }
+ if ($this->isColumnModified(CcBlockPeer::UTIME)) {
+ $modifiedColumns[':p' . $index++] = '"utime"';
+ }
+ if ($this->isColumnModified(CcBlockPeer::CREATOR_ID)) {
+ $modifiedColumns[':p' . $index++] = '"creator_id"';
+ }
+ if ($this->isColumnModified(CcBlockPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '"description"';
+ }
+ if ($this->isColumnModified(CcBlockPeer::LENGTH)) {
+ $modifiedColumns[':p' . $index++] = '"length"';
+ }
+ if ($this->isColumnModified(CcBlockPeer::TYPE)) {
+ $modifiedColumns[':p' . $index++] = '"type"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_block" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"name"':
+ $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
+ break;
+ case '"mtime"':
+ $stmt->bindValue($identifier, $this->mtime, PDO::PARAM_STR);
+ break;
+ case '"utime"':
+ $stmt->bindValue($identifier, $this->utime, PDO::PARAM_STR);
+ break;
+ case '"creator_id"':
+ $stmt->bindValue($identifier, $this->creator_id, PDO::PARAM_INT);
+ break;
+ case '"description"':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '"length"':
+ $stmt->bindValue($identifier, $this->length, PDO::PARAM_STR);
+ break;
+ case '"type"':
+ $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding 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 = CcBlockPeer::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());
+ }
+ }
+ }
+
+ if ($this->collCcBlockcontentss !== null) {
+ foreach ($this->collCcBlockcontentss as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+ if ($this->collCcBlockcriterias !== null) {
+ foreach ($this->collCcBlockcriterias 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcBlockPeer::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->getDbMtime();
+ break;
+ case 3:
+ return $this->getDbUtime();
+ break;
+ case 4:
+ return $this->getDbCreatorId();
+ break;
+ case 5:
+ return $this->getDbDescription();
+ break;
+ case 6:
+ return $this->getDbLength();
+ break;
+ case 7:
+ 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.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcBlock'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcBlock'][$this->getPrimaryKey()] = true;
+ $keys = CcBlockPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbName(),
+ $keys[2] => $this->getDbMtime(),
+ $keys[3] => $this->getDbUtime(),
+ $keys[4] => $this->getDbCreatorId(),
+ $keys[5] => $this->getDbDescription(),
+ $keys[6] => $this->getDbLength(),
+ $keys[7] => $this->getDbType(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcSubjs) {
+ $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->collCcPlaylistcontentss) {
+ $result['CcPlaylistcontentss'] = $this->collCcPlaylistcontentss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcBlockcontentss) {
+ $result['CcBlockcontentss'] = $this->collCcBlockcontentss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcBlockcriterias) {
+ $result['CcBlockcriterias'] = $this->collCcBlockcriterias->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ }
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcBlockPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbMtime($value);
+ break;
+ case 3:
+ $this->setDbUtime($value);
+ break;
+ case 4:
+ $this->setDbCreatorId($value);
+ break;
+ case 5:
+ $this->setDbDescription($value);
+ break;
+ case 6:
+ $this->setDbLength($value);
+ break;
+ case 7:
+ $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 BasePeer::TYPE_PHPNAME
+ *
+ * @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 = CcBlockPeer::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->setDbMtime($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbUtime($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbCreatorId($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDbDescription($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setDbLength($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setDbType($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(CcBlockPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcBlockPeer::ID)) $criteria->add(CcBlockPeer::ID, $this->id);
+ if ($this->isColumnModified(CcBlockPeer::NAME)) $criteria->add(CcBlockPeer::NAME, $this->name);
+ if ($this->isColumnModified(CcBlockPeer::MTIME)) $criteria->add(CcBlockPeer::MTIME, $this->mtime);
+ if ($this->isColumnModified(CcBlockPeer::UTIME)) $criteria->add(CcBlockPeer::UTIME, $this->utime);
+ if ($this->isColumnModified(CcBlockPeer::CREATOR_ID)) $criteria->add(CcBlockPeer::CREATOR_ID, $this->creator_id);
+ if ($this->isColumnModified(CcBlockPeer::DESCRIPTION)) $criteria->add(CcBlockPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(CcBlockPeer::LENGTH)) $criteria->add(CcBlockPeer::LENGTH, $this->length);
+ if ($this->isColumnModified(CcBlockPeer::TYPE)) $criteria->add(CcBlockPeer::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(CcBlockPeer::DATABASE_NAME);
+ $criteria->add(CcBlockPeer::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 CcBlock (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbName($this->getDbName());
+ $copyObj->setDbMtime($this->getDbMtime());
+ $copyObj->setDbUtime($this->getDbUtime());
+ $copyObj->setDbCreatorId($this->getDbCreatorId());
+ $copyObj->setDbDescription($this->getDbDescription());
+ $copyObj->setDbLength($this->getDbLength());
+ $copyObj->setDbType($this->getDbType());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ 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->getCcBlockcontentss() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcBlockcontents($relObj->copy($deepCopy));
+ }
+ }
+
+ foreach ($this->getCcBlockcriterias() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcBlockcriteria($relObj->copy($deepCopy));
+ }
+ }
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 CcBlock 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 CcBlockPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcBlockPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcSubjs object.
+ *
+ * @param CcSubjs $v
+ * @return CcBlock The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcSubjs(CcSubjs $v = null)
+ {
+ if ($v === null) {
+ $this->setDbCreatorId(NULL);
+ } else {
+ $this->setDbCreatorId($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->addCcBlock($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcSubjs object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcSubjs The associated CcSubjs object.
+ * @throws PropelException
+ */
+ public function getCcSubjs(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcSubjs === null && ($this->creator_id !== null) && $doQuery) {
+ $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->creator_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->addCcBlocks($this);
+ */
+ }
+
+ return $this->aCcSubjs;
+ }
+
+
+ /**
+ * Initializes a collection based on the name of a relation.
+ * Avoids crafting an 'init[$relationName]s' method name
+ * that wouldn't work when StandardEnglishPluralizer is used.
+ *
+ * @param string $relationName The name of the relation to initialize
+ * @return void
+ */
+ public function initRelation($relationName)
+ {
+ if ('CcPlaylistcontents' == $relationName) {
+ $this->initCcPlaylistcontentss();
+ }
+ if ('CcBlockcontents' == $relationName) {
+ $this->initCcBlockcontentss();
+ }
+ if ('CcBlockcriteria' == $relationName) {
+ $this->initCcBlockcriterias();
+ }
+ }
+
+ /**
+ * 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 CcBlock The current object (for fluent API support)
+ * @see addCcPlaylistcontentss()
+ */
+ public function clearCcPlaylistcontentss()
+ {
+ $this->collCcPlaylistcontentss = null; // important to set this to null since that means it is uninitialized
+ $this->collCcPlaylistcontentssPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcPlaylistcontentss collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcPlaylistcontentss($v = true)
+ {
+ $this->collCcPlaylistcontentssPartial = $v;
+ }
+
+ /**
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcPlaylistcontentss($overrideExisting = true)
+ {
+ if (null !== $this->collCcPlaylistcontentss && !$overrideExisting) {
+ return;
+ }
+ $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 CcBlock 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 PropelObjectCollection|CcPlaylistcontents[] List of CcPlaylistcontents objects
+ * @throws PropelException
+ */
+ public function getCcPlaylistcontentss($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcPlaylistcontentssPartial && !$this->isNew();
+ if (null === $this->collCcPlaylistcontentss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPlaylistcontentss) {
+ // return empty collection
+ $this->initCcPlaylistcontentss();
+ } else {
+ $collCcPlaylistcontentss = CcPlaylistcontentsQuery::create(null, $criteria)
+ ->filterByCcBlock($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcPlaylistcontentssPartial && count($collCcPlaylistcontentss)) {
+ $this->initCcPlaylistcontentss(false);
+
+ foreach ($collCcPlaylistcontentss as $obj) {
+ if (false == $this->collCcPlaylistcontentss->contains($obj)) {
+ $this->collCcPlaylistcontentss->append($obj);
+ }
+ }
+
+ $this->collCcPlaylistcontentssPartial = true;
+ }
+
+ $collCcPlaylistcontentss->getInternalIterator()->rewind();
+
+ return $collCcPlaylistcontentss;
+ }
+
+ if ($partial && $this->collCcPlaylistcontentss) {
+ foreach ($this->collCcPlaylistcontentss as $obj) {
+ if ($obj->isNew()) {
+ $collCcPlaylistcontentss[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcPlaylistcontentss = $collCcPlaylistcontentss;
+ $this->collCcPlaylistcontentssPartial = false;
+ }
+ }
+
+ return $this->collCcPlaylistcontentss;
+ }
+
+ /**
+ * Sets a collection of CcPlaylistcontents objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccPlaylistcontentss A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setCcPlaylistcontentss(PropelCollection $ccPlaylistcontentss, PropelPDO $con = null)
+ {
+ $ccPlaylistcontentssToDelete = $this->getCcPlaylistcontentss(new Criteria(), $con)->diff($ccPlaylistcontentss);
+
+
+ $this->ccPlaylistcontentssScheduledForDeletion = $ccPlaylistcontentssToDelete;
+
+ foreach ($ccPlaylistcontentssToDelete as $ccPlaylistcontentsRemoved) {
+ $ccPlaylistcontentsRemoved->setCcBlock(null);
+ }
+
+ $this->collCcPlaylistcontentss = null;
+ foreach ($ccPlaylistcontentss as $ccPlaylistcontents) {
+ $this->addCcPlaylistcontents($ccPlaylistcontents);
+ }
+
+ $this->collCcPlaylistcontentss = $ccPlaylistcontentss;
+ $this->collCcPlaylistcontentssPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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)
+ {
+ $partial = $this->collCcPlaylistcontentssPartial && !$this->isNew();
+ if (null === $this->collCcPlaylistcontentss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPlaylistcontentss) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcPlaylistcontentss());
+ }
+ $query = CcPlaylistcontentsQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcBlock($this)
+ ->count($con);
+ }
+
+ 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 CcBlock The current object (for fluent API support)
+ */
+ public function addCcPlaylistcontents(CcPlaylistcontents $l)
+ {
+ if ($this->collCcPlaylistcontentss === null) {
+ $this->initCcPlaylistcontentss();
+ $this->collCcPlaylistcontentssPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcPlaylistcontentss->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcPlaylistcontents($l);
+
+ if ($this->ccPlaylistcontentssScheduledForDeletion and $this->ccPlaylistcontentssScheduledForDeletion->contains($l)) {
+ $this->ccPlaylistcontentssScheduledForDeletion->remove($this->ccPlaylistcontentssScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcPlaylistcontents $ccPlaylistcontents The ccPlaylistcontents object to add.
+ */
+ protected function doAddCcPlaylistcontents($ccPlaylistcontents)
+ {
+ $this->collCcPlaylistcontentss[]= $ccPlaylistcontents;
+ $ccPlaylistcontents->setCcBlock($this);
+ }
+
+ /**
+ * @param CcPlaylistcontents $ccPlaylistcontents The ccPlaylistcontents object to remove.
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function removeCcPlaylistcontents($ccPlaylistcontents)
+ {
+ if ($this->getCcPlaylistcontentss()->contains($ccPlaylistcontents)) {
+ $this->collCcPlaylistcontentss->remove($this->collCcPlaylistcontentss->search($ccPlaylistcontents));
+ if (null === $this->ccPlaylistcontentssScheduledForDeletion) {
+ $this->ccPlaylistcontentssScheduledForDeletion = clone $this->collCcPlaylistcontentss;
+ $this->ccPlaylistcontentssScheduledForDeletion->clear();
+ }
+ $this->ccPlaylistcontentssScheduledForDeletion[]= $ccPlaylistcontents;
+ $ccPlaylistcontents->setCcBlock(null);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this CcBlock is new, it will return
+ * an empty collection; or if this CcBlock 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 CcBlock.
+ *
+ * @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 PropelObjectCollection|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);
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this CcBlock is new, it will return
+ * an empty collection; or if this CcBlock 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 CcBlock.
+ *
+ * @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 PropelObjectCollection|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 collCcBlockcontentss 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 CcBlock The current object (for fluent API support)
+ * @see addCcBlockcontentss()
+ */
+ public function clearCcBlockcontentss()
+ {
+ $this->collCcBlockcontentss = null; // important to set this to null since that means it is uninitialized
+ $this->collCcBlockcontentssPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcBlockcontentss collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcBlockcontentss($v = true)
+ {
+ $this->collCcBlockcontentssPartial = $v;
+ }
+
+ /**
+ * Initializes the collCcBlockcontentss collection.
+ *
+ * By default this just sets the collCcBlockcontentss collection to an empty array (like clearcollCcBlockcontentss());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcBlockcontentss($overrideExisting = true)
+ {
+ if (null !== $this->collCcBlockcontentss && !$overrideExisting) {
+ return;
+ }
+ $this->collCcBlockcontentss = new PropelObjectCollection();
+ $this->collCcBlockcontentss->setModel('CcBlockcontents');
+ }
+
+ /**
+ * Gets an array of CcBlockcontents 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 CcBlock 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 PropelObjectCollection|CcBlockcontents[] List of CcBlockcontents objects
+ * @throws PropelException
+ */
+ public function getCcBlockcontentss($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcBlockcontentssPartial && !$this->isNew();
+ if (null === $this->collCcBlockcontentss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcBlockcontentss) {
+ // return empty collection
+ $this->initCcBlockcontentss();
+ } else {
+ $collCcBlockcontentss = CcBlockcontentsQuery::create(null, $criteria)
+ ->filterByCcBlock($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcBlockcontentssPartial && count($collCcBlockcontentss)) {
+ $this->initCcBlockcontentss(false);
+
+ foreach ($collCcBlockcontentss as $obj) {
+ if (false == $this->collCcBlockcontentss->contains($obj)) {
+ $this->collCcBlockcontentss->append($obj);
+ }
+ }
+
+ $this->collCcBlockcontentssPartial = true;
+ }
+
+ $collCcBlockcontentss->getInternalIterator()->rewind();
+
+ return $collCcBlockcontentss;
+ }
+
+ if ($partial && $this->collCcBlockcontentss) {
+ foreach ($this->collCcBlockcontentss as $obj) {
+ if ($obj->isNew()) {
+ $collCcBlockcontentss[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcBlockcontentss = $collCcBlockcontentss;
+ $this->collCcBlockcontentssPartial = false;
+ }
+ }
+
+ return $this->collCcBlockcontentss;
+ }
+
+ /**
+ * Sets a collection of CcBlockcontents objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccBlockcontentss A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setCcBlockcontentss(PropelCollection $ccBlockcontentss, PropelPDO $con = null)
+ {
+ $ccBlockcontentssToDelete = $this->getCcBlockcontentss(new Criteria(), $con)->diff($ccBlockcontentss);
+
+
+ $this->ccBlockcontentssScheduledForDeletion = $ccBlockcontentssToDelete;
+
+ foreach ($ccBlockcontentssToDelete as $ccBlockcontentsRemoved) {
+ $ccBlockcontentsRemoved->setCcBlock(null);
+ }
+
+ $this->collCcBlockcontentss = null;
+ foreach ($ccBlockcontentss as $ccBlockcontents) {
+ $this->addCcBlockcontents($ccBlockcontents);
+ }
+
+ $this->collCcBlockcontentss = $ccBlockcontentss;
+ $this->collCcBlockcontentssPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related CcBlockcontents objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcBlockcontents objects.
+ * @throws PropelException
+ */
+ public function countCcBlockcontentss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collCcBlockcontentssPartial && !$this->isNew();
+ if (null === $this->collCcBlockcontentss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcBlockcontentss) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcBlockcontentss());
+ }
+ $query = CcBlockcontentsQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcBlock($this)
+ ->count($con);
+ }
+
+ return count($this->collCcBlockcontentss);
+ }
+
+ /**
+ * Method called to associate a CcBlockcontents object to this object
+ * through the CcBlockcontents foreign key attribute.
+ *
+ * @param CcBlockcontents $l CcBlockcontents
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function addCcBlockcontents(CcBlockcontents $l)
+ {
+ if ($this->collCcBlockcontentss === null) {
+ $this->initCcBlockcontentss();
+ $this->collCcBlockcontentssPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcBlockcontentss->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcBlockcontents($l);
+
+ if ($this->ccBlockcontentssScheduledForDeletion and $this->ccBlockcontentssScheduledForDeletion->contains($l)) {
+ $this->ccBlockcontentssScheduledForDeletion->remove($this->ccBlockcontentssScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcBlockcontents $ccBlockcontents The ccBlockcontents object to add.
+ */
+ protected function doAddCcBlockcontents($ccBlockcontents)
+ {
+ $this->collCcBlockcontentss[]= $ccBlockcontents;
+ $ccBlockcontents->setCcBlock($this);
+ }
+
+ /**
+ * @param CcBlockcontents $ccBlockcontents The ccBlockcontents object to remove.
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function removeCcBlockcontents($ccBlockcontents)
+ {
+ if ($this->getCcBlockcontentss()->contains($ccBlockcontents)) {
+ $this->collCcBlockcontentss->remove($this->collCcBlockcontentss->search($ccBlockcontents));
+ if (null === $this->ccBlockcontentssScheduledForDeletion) {
+ $this->ccBlockcontentssScheduledForDeletion = clone $this->collCcBlockcontentss;
+ $this->ccBlockcontentssScheduledForDeletion->clear();
+ }
+ $this->ccBlockcontentssScheduledForDeletion[]= $ccBlockcontents;
+ $ccBlockcontents->setCcBlock(null);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this CcBlock is new, it will return
+ * an empty collection; or if this CcBlock has previously
+ * been saved, it will retrieve related CcBlockcontentss 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 CcBlock.
+ *
+ * @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 PropelObjectCollection|CcBlockcontents[] List of CcBlockcontents objects
+ */
+ public function getCcBlockcontentssJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcBlockcontentsQuery::create(null, $criteria);
+ $query->joinWith('CcFiles', $join_behavior);
+
+ return $this->getCcBlockcontentss($query, $con);
+ }
+
+ /**
+ * Clears out the collCcBlockcriterias 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 CcBlock The current object (for fluent API support)
+ * @see addCcBlockcriterias()
+ */
+ public function clearCcBlockcriterias()
+ {
+ $this->collCcBlockcriterias = null; // important to set this to null since that means it is uninitialized
+ $this->collCcBlockcriteriasPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcBlockcriterias collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcBlockcriterias($v = true)
+ {
+ $this->collCcBlockcriteriasPartial = $v;
+ }
+
+ /**
+ * Initializes the collCcBlockcriterias collection.
+ *
+ * By default this just sets the collCcBlockcriterias collection to an empty array (like clearcollCcBlockcriterias());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcBlockcriterias($overrideExisting = true)
+ {
+ if (null !== $this->collCcBlockcriterias && !$overrideExisting) {
+ return;
+ }
+ $this->collCcBlockcriterias = new PropelObjectCollection();
+ $this->collCcBlockcriterias->setModel('CcBlockcriteria');
+ }
+
+ /**
+ * Gets an array of CcBlockcriteria 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 CcBlock 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 PropelObjectCollection|CcBlockcriteria[] List of CcBlockcriteria objects
+ * @throws PropelException
+ */
+ public function getCcBlockcriterias($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcBlockcriteriasPartial && !$this->isNew();
+ if (null === $this->collCcBlockcriterias || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcBlockcriterias) {
+ // return empty collection
+ $this->initCcBlockcriterias();
+ } else {
+ $collCcBlockcriterias = CcBlockcriteriaQuery::create(null, $criteria)
+ ->filterByCcBlock($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcBlockcriteriasPartial && count($collCcBlockcriterias)) {
+ $this->initCcBlockcriterias(false);
+
+ foreach ($collCcBlockcriterias as $obj) {
+ if (false == $this->collCcBlockcriterias->contains($obj)) {
+ $this->collCcBlockcriterias->append($obj);
+ }
+ }
+
+ $this->collCcBlockcriteriasPartial = true;
+ }
+
+ $collCcBlockcriterias->getInternalIterator()->rewind();
+
+ return $collCcBlockcriterias;
+ }
+
+ if ($partial && $this->collCcBlockcriterias) {
+ foreach ($this->collCcBlockcriterias as $obj) {
+ if ($obj->isNew()) {
+ $collCcBlockcriterias[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcBlockcriterias = $collCcBlockcriterias;
+ $this->collCcBlockcriteriasPartial = false;
+ }
+ }
+
+ return $this->collCcBlockcriterias;
+ }
+
+ /**
+ * Sets a collection of CcBlockcriteria objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccBlockcriterias A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function setCcBlockcriterias(PropelCollection $ccBlockcriterias, PropelPDO $con = null)
+ {
+ $ccBlockcriteriasToDelete = $this->getCcBlockcriterias(new Criteria(), $con)->diff($ccBlockcriterias);
+
+
+ $this->ccBlockcriteriasScheduledForDeletion = $ccBlockcriteriasToDelete;
+
+ foreach ($ccBlockcriteriasToDelete as $ccBlockcriteriaRemoved) {
+ $ccBlockcriteriaRemoved->setCcBlock(null);
+ }
+
+ $this->collCcBlockcriterias = null;
+ foreach ($ccBlockcriterias as $ccBlockcriteria) {
+ $this->addCcBlockcriteria($ccBlockcriteria);
+ }
+
+ $this->collCcBlockcriterias = $ccBlockcriterias;
+ $this->collCcBlockcriteriasPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related CcBlockcriteria objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcBlockcriteria objects.
+ * @throws PropelException
+ */
+ public function countCcBlockcriterias(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collCcBlockcriteriasPartial && !$this->isNew();
+ if (null === $this->collCcBlockcriterias || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcBlockcriterias) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcBlockcriterias());
+ }
+ $query = CcBlockcriteriaQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcBlock($this)
+ ->count($con);
+ }
+
+ return count($this->collCcBlockcriterias);
+ }
+
+ /**
+ * Method called to associate a CcBlockcriteria object to this object
+ * through the CcBlockcriteria foreign key attribute.
+ *
+ * @param CcBlockcriteria $l CcBlockcriteria
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function addCcBlockcriteria(CcBlockcriteria $l)
+ {
+ if ($this->collCcBlockcriterias === null) {
+ $this->initCcBlockcriterias();
+ $this->collCcBlockcriteriasPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcBlockcriterias->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcBlockcriteria($l);
+
+ if ($this->ccBlockcriteriasScheduledForDeletion and $this->ccBlockcriteriasScheduledForDeletion->contains($l)) {
+ $this->ccBlockcriteriasScheduledForDeletion->remove($this->ccBlockcriteriasScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcBlockcriteria $ccBlockcriteria The ccBlockcriteria object to add.
+ */
+ protected function doAddCcBlockcriteria($ccBlockcriteria)
+ {
+ $this->collCcBlockcriterias[]= $ccBlockcriteria;
+ $ccBlockcriteria->setCcBlock($this);
+ }
+
+ /**
+ * @param CcBlockcriteria $ccBlockcriteria The ccBlockcriteria object to remove.
+ * @return CcBlock The current object (for fluent API support)
+ */
+ public function removeCcBlockcriteria($ccBlockcriteria)
+ {
+ if ($this->getCcBlockcriterias()->contains($ccBlockcriteria)) {
+ $this->collCcBlockcriterias->remove($this->collCcBlockcriterias->search($ccBlockcriteria));
+ if (null === $this->ccBlockcriteriasScheduledForDeletion) {
+ $this->ccBlockcriteriasScheduledForDeletion = clone $this->collCcBlockcriterias;
+ $this->ccBlockcriteriasScheduledForDeletion->clear();
+ }
+ $this->ccBlockcriteriasScheduledForDeletion[]= clone $ccBlockcriteria;
+ $ccBlockcriteria->setCcBlock(null);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->name = null;
+ $this->mtime = null;
+ $this->utime = null;
+ $this->creator_id = null;
+ $this->description = null;
+ $this->length = null;
+ $this->type = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->collCcPlaylistcontentss) {
+ foreach ($this->collCcPlaylistcontentss as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcBlockcontentss) {
+ foreach ($this->collCcBlockcontentss as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcBlockcriterias) {
+ foreach ($this->collCcBlockcriterias as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->aCcSubjs instanceof Persistent) {
+ $this->aCcSubjs->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ if ($this->collCcPlaylistcontentss instanceof PropelCollection) {
+ $this->collCcPlaylistcontentss->clearIterator();
+ }
+ $this->collCcPlaylistcontentss = null;
+ if ($this->collCcBlockcontentss instanceof PropelCollection) {
+ $this->collCcBlockcontentss->clearIterator();
+ }
+ $this->collCcBlockcontentss = null;
+ if ($this->collCcBlockcriterias instanceof PropelCollection) {
+ $this->collCcBlockcriterias->clearIterator();
+ }
+ $this->collCcBlockcriterias = null;
+ $this->aCcSubjs = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcBlockPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+ // aggregate_column behavior
+
+ /**
+ * Computes the value of the aggregate column length *
+ * @param PropelPDO $con A connection object
+ *
+ * @return mixed The scalar result from the aggregate query
+ */
+ public function computeDbLength(PropelPDO $con)
+ {
+ $stmt = $con->prepare('SELECT SUM(cliplength) FROM "cc_blockcontents" WHERE cc_blockcontents.block_id = :p1');
+ $stmt->bindValue(':p1', $this->getDbId());
+ $stmt->execute();
+
+ return $stmt->fetchColumn();
+ }
+
+ /**
+ * Updates the aggregate column length *
+ * @param PropelPDO $con A connection object
+ */
+ public function updateDbLength(PropelPDO $con)
+ {
+ $this->setDbLength($this->computeDbLength($con));
+ $this->save($con);
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockPeer.php
index 48003ffc5..403a64747 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcBlockPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockPeer.php
@@ -4,1005 +4,1031 @@
/**
* Base static class for performing query and update operations on the 'cc_block' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcBlockPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_block';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcBlock';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcBlock';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcBlockTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 8;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_block.ID';
-
- /** the column name for the NAME field */
- const NAME = 'cc_block.NAME';
-
- /** the column name for the MTIME field */
- const MTIME = 'cc_block.MTIME';
-
- /** the column name for the UTIME field */
- const UTIME = 'cc_block.UTIME';
-
- /** the column name for the CREATOR_ID field */
- const CREATOR_ID = 'cc_block.CREATOR_ID';
-
- /** the column name for the DESCRIPTION field */
- const DESCRIPTION = 'cc_block.DESCRIPTION';
-
- /** the column name for the LENGTH field */
- const LENGTH = 'cc_block.LENGTH';
-
- /** the column name for the TYPE field */
- const TYPE = 'cc_block.TYPE';
-
- /**
- * An identiy map to hold any loaded instances of CcBlock objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcBlock[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMtime', 'DbUtime', 'DbCreatorId', 'DbDescription', 'DbLength', 'DbType', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMtime', 'dbUtime', 'dbCreatorId', 'dbDescription', 'dbLength', 'dbType', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::MTIME, self::UTIME, self::CREATOR_ID, self::DESCRIPTION, self::LENGTH, self::TYPE, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MTIME', 'UTIME', 'CREATOR_ID', 'DESCRIPTION', 'LENGTH', 'TYPE', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mtime', 'utime', 'creator_id', 'description', 'length', 'type', ),
- 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, 'DbMtime' => 2, 'DbUtime' => 3, 'DbCreatorId' => 4, 'DbDescription' => 5, 'DbLength' => 6, 'DbType' => 7, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMtime' => 2, 'dbUtime' => 3, 'dbCreatorId' => 4, 'dbDescription' => 5, 'dbLength' => 6, 'dbType' => 7, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::MTIME => 2, self::UTIME => 3, self::CREATOR_ID => 4, self::DESCRIPTION => 5, self::LENGTH => 6, self::TYPE => 7, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MTIME' => 2, 'UTIME' => 3, 'CREATOR_ID' => 4, 'DESCRIPTION' => 5, 'LENGTH' => 6, 'TYPE' => 7, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mtime' => 2, 'utime' => 3, 'creator_id' => 4, 'description' => 5, 'length' => 6, 'type' => 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. CcBlockPeer::COLUMN_NAME).
- * @return string
- */
- public static function alias($alias, $column)
- {
- return str_replace(CcBlockPeer::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(CcBlockPeer::ID);
- $criteria->addSelectColumn(CcBlockPeer::NAME);
- $criteria->addSelectColumn(CcBlockPeer::MTIME);
- $criteria->addSelectColumn(CcBlockPeer::UTIME);
- $criteria->addSelectColumn(CcBlockPeer::CREATOR_ID);
- $criteria->addSelectColumn(CcBlockPeer::DESCRIPTION);
- $criteria->addSelectColumn(CcBlockPeer::LENGTH);
- $criteria->addSelectColumn(CcBlockPeer::TYPE);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.NAME');
- $criteria->addSelectColumn($alias . '.MTIME');
- $criteria->addSelectColumn($alias . '.UTIME');
- $criteria->addSelectColumn($alias . '.CREATOR_ID');
- $criteria->addSelectColumn($alias . '.DESCRIPTION');
- $criteria->addSelectColumn($alias . '.LENGTH');
- $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(CcBlockPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcBlockPeer::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(CcBlockPeer::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 CcBlock
- * @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 = CcBlockPeer::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 CcBlockPeer::populateObjects(CcBlockPeer::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(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- if (!$criteria->hasSelectClause()) {
- $criteria = clone $criteria;
- CcBlockPeer::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 CcBlock $value A CcBlock object.
- * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
- */
- public static function addInstanceToPool(CcBlock $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 CcBlock object or a primary key value.
- */
- public static function removeInstanceFromPool($value)
- {
- if (Propel::isInstancePoolingEnabled() && $value !== null) {
- if (is_object($value) && $value instanceof CcBlock) {
- $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 CcBlock 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 CcBlock 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_block
- * 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();
- // Invalidate objects in CcBlockcontentsPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CcBlockcontentsPeer::clearInstancePool();
- // Invalidate objects in CcBlockcriteriaPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CcBlockcriteriaPeer::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 = CcBlockPeer::getOMClass(false);
- // populate the object(s)
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key = CcBlockPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj = CcBlockPeer::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;
- CcBlockPeer::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 (CcBlock object, last column rank)
- */
- public static function populateObject($row, $startcol = 0)
- {
- $key = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol);
- if (null !== ($obj = CcBlockPeer::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 + CcBlockPeer::NUM_COLUMNS;
- } else {
- $cls = CcBlockPeer::OM_CLASS;
- $obj = new $cls();
- $col = $obj->hydrate($row, $startcol);
- CcBlockPeer::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(CcBlockPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcBlockPeer::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(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcBlockPeer::CREATOR_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 CcBlock 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 CcBlock 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);
- }
-
- CcBlockPeer::addSelectColumns($criteria);
- $startcol = (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
- CcSubjsPeer::addSelectColumns($criteria);
-
- $criteria->addJoin(CcBlockPeer::CREATOR_ID, CcSubjsPeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcBlockPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcBlockPeer::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 = CcBlockPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcBlockPeer::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 (CcBlock) to $obj2 (CcSubjs)
- $obj2->addCcBlock($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(CcBlockPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcBlockPeer::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(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcBlockPeer::CREATOR_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 CcBlock 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 CcBlock 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);
- }
-
- CcBlockPeer::addSelectColumns($criteria);
- $startcol2 = (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcSubjsPeer::addSelectColumns($criteria);
- $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcBlockPeer::CREATOR_ID, CcSubjsPeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcBlockPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcBlockPeer::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 = CcBlockPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcBlockPeer::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 (CcBlock) to the collection in $obj2 (CcSubjs)
- $obj2->addCcBlock($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(BaseCcBlockPeer::DATABASE_NAME);
- if (!$dbMap->hasTable(BaseCcBlockPeer::TABLE_NAME))
- {
- $dbMap->addTableObject(new CcBlockTableMap());
- }
- }
-
- /**
- * 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 ? CcBlockPeer::CLASS_DEFAULT : CcBlockPeer::OM_CLASS;
- }
-
- /**
- * Method perform an INSERT on the database, given a CcBlock or Criteria object.
- *
- * @param mixed $values Criteria or CcBlock 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(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
- } else {
- $criteria = $values->buildCriteria(); // build Criteria from CcBlock object
- }
-
- if ($criteria->containsKey(CcBlockPeer::ID) && $criteria->keyContainsValue(CcBlockPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcBlockPeer::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 CcBlock or Criteria object.
- *
- * @param mixed $values Criteria or CcBlock 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(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $selectCriteria = new Criteria(self::DATABASE_NAME);
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
-
- $comparison = $criteria->getComparison(CcBlockPeer::ID);
- $value = $criteria->remove(CcBlockPeer::ID);
- if ($value) {
- $selectCriteria->add(CcBlockPeer::ID, $value, $comparison);
- } else {
- $selectCriteria->setPrimaryTableName(CcBlockPeer::TABLE_NAME);
- }
-
- } else { // $values is CcBlock 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_block 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(CcBlockPeer::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(CcBlockPeer::TABLE_NAME, $con, CcBlockPeer::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).
- CcBlockPeer::clearInstancePool();
- CcBlockPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Method perform a DELETE on the database, given a CcBlock or Criteria object OR a primary key value.
- *
- * @param mixed $values Criteria or CcBlock 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(CcBlockPeer::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.
- CcBlockPeer::clearInstancePool();
- // rename for clarity
- $criteria = clone $values;
- } elseif ($values instanceof CcBlock) { // it's a model object
- // invalidate the cache for this single object
- CcBlockPeer::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(CcBlockPeer::ID, (array) $values, Criteria::IN);
- // invalidate the cache for this object(s)
- foreach ((array) $values as $singleval) {
- CcBlockPeer::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);
- CcBlockPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Validates all modified columns of given CcBlock 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 CcBlock $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(CcBlock $obj, $cols = null)
- {
- $columns = array();
-
- if ($cols) {
- $dbMap = Propel::getDatabaseMap(CcBlockPeer::DATABASE_NAME);
- $tableMap = $dbMap->getTable(CcBlockPeer::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(CcBlockPeer::DATABASE_NAME, CcBlockPeer::TABLE_NAME, $columns);
- }
-
- /**
- * Retrieve a single object by pkey.
- *
- * @param int $pk the primary key.
- * @param PropelPDO $con the connection to use
- * @return CcBlock
- */
- public static function retrieveByPK($pk, PropelPDO $con = null)
- {
-
- if (null !== ($obj = CcBlockPeer::getInstanceFromPool((string) $pk))) {
- return $obj;
- }
-
- if ($con === null) {
- $con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria = new Criteria(CcBlockPeer::DATABASE_NAME);
- $criteria->add(CcBlockPeer::ID, $pk);
-
- $v = CcBlockPeer::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(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $objs = null;
- if (empty($pks)) {
- $objs = array();
- } else {
- $criteria = new Criteria(CcBlockPeer::DATABASE_NAME);
- $criteria->add(CcBlockPeer::ID, $pks, Criteria::IN);
- $objs = CcBlockPeer::doSelect($criteria, $con);
- }
- return $objs;
- }
+abstract class BaseCcBlockPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_block';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcBlock';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcBlockTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 8;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 8;
+
+ /** the column name for the id field */
+ const ID = 'cc_block.id';
+
+ /** the column name for the name field */
+ const NAME = 'cc_block.name';
+
+ /** the column name for the mtime field */
+ const MTIME = 'cc_block.mtime';
+
+ /** the column name for the utime field */
+ const UTIME = 'cc_block.utime';
+
+ /** the column name for the creator_id field */
+ const CREATOR_ID = 'cc_block.creator_id';
+
+ /** the column name for the description field */
+ const DESCRIPTION = 'cc_block.description';
+
+ /** the column name for the length field */
+ const LENGTH = 'cc_block.length';
+
+ /** the column name for the type field */
+ const TYPE = 'cc_block.type';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcBlock objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcBlock[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcBlockPeer::$fieldNames[CcBlockPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMtime', 'DbUtime', 'DbCreatorId', 'DbDescription', 'DbLength', 'DbType', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMtime', 'dbUtime', 'dbCreatorId', 'dbDescription', 'dbLength', 'dbType', ),
+ BasePeer::TYPE_COLNAME => array (CcBlockPeer::ID, CcBlockPeer::NAME, CcBlockPeer::MTIME, CcBlockPeer::UTIME, CcBlockPeer::CREATOR_ID, CcBlockPeer::DESCRIPTION, CcBlockPeer::LENGTH, CcBlockPeer::TYPE, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MTIME', 'UTIME', 'CREATOR_ID', 'DESCRIPTION', 'LENGTH', 'TYPE', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mtime', 'utime', 'creator_id', 'description', 'length', 'type', ),
+ 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. CcBlockPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMtime' => 2, 'DbUtime' => 3, 'DbCreatorId' => 4, 'DbDescription' => 5, 'DbLength' => 6, 'DbType' => 7, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMtime' => 2, 'dbUtime' => 3, 'dbCreatorId' => 4, 'dbDescription' => 5, 'dbLength' => 6, 'dbType' => 7, ),
+ BasePeer::TYPE_COLNAME => array (CcBlockPeer::ID => 0, CcBlockPeer::NAME => 1, CcBlockPeer::MTIME => 2, CcBlockPeer::UTIME => 3, CcBlockPeer::CREATOR_ID => 4, CcBlockPeer::DESCRIPTION => 5, CcBlockPeer::LENGTH => 6, CcBlockPeer::TYPE => 7, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MTIME' => 2, 'UTIME' => 3, 'CREATOR_ID' => 4, 'DESCRIPTION' => 5, 'LENGTH' => 6, 'TYPE' => 7, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mtime' => 2, 'utime' => 3, 'creator_id' => 4, 'description' => 5, 'length' => 6, 'type' => 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcBlockPeer::getFieldNames($toType);
+ $key = isset(CcBlockPeer::$fieldKeys[$fromType][$name]) ? CcBlockPeer::$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(CcBlockPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcBlockPeer::$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 CcBlockPeer::$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. CcBlockPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcBlockPeer::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(CcBlockPeer::ID);
+ $criteria->addSelectColumn(CcBlockPeer::NAME);
+ $criteria->addSelectColumn(CcBlockPeer::MTIME);
+ $criteria->addSelectColumn(CcBlockPeer::UTIME);
+ $criteria->addSelectColumn(CcBlockPeer::CREATOR_ID);
+ $criteria->addSelectColumn(CcBlockPeer::DESCRIPTION);
+ $criteria->addSelectColumn(CcBlockPeer::LENGTH);
+ $criteria->addSelectColumn(CcBlockPeer::TYPE);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.name');
+ $criteria->addSelectColumn($alias . '.mtime');
+ $criteria->addSelectColumn($alias . '.utime');
+ $criteria->addSelectColumn($alias . '.creator_id');
+ $criteria->addSelectColumn($alias . '.description');
+ $criteria->addSelectColumn($alias . '.length');
+ $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(CcBlockPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(CcBlockPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::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;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcBlock
+ * @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 = CcBlockPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 CcBlockPeer::populateObjects(CcBlockPeer::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 directly (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(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcBlockPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcBlockPeer::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 CcBlock $obj A CcBlock object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcBlockPeer::$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 CcBlock object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcBlock) {
+ $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 CcBlock object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(CcBlockPeer::$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 CcBlock 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(CcBlockPeer::$instances[$key])) {
+ return CcBlockPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcBlockPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcBlockPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_block
+ * 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();
+ // Invalidate objects in CcBlockcontentsPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcBlockcontentsPeer::clearInstancePool();
+ // Invalidate objects in CcBlockcriteriaPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcBlockcriteriaPeer::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 = CcBlockPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcBlockPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcBlockPeer::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;
+ CcBlockPeer::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 (CcBlock object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcBlockPeer::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 + CcBlockPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = CcBlockPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcBlockPeer::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(CcBlockPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcBlockPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcBlockPeer::CREATOR_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 CcBlock 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 CcBlock 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(CcBlockPeer::DATABASE_NAME);
+ }
+
+ CcBlockPeer::addSelectColumns($criteria);
+ $startcol = CcBlockPeer::NUM_HYDRATE_COLUMNS;
+ CcSubjsPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcBlockPeer::CREATOR_ID, CcSubjsPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcBlockPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcBlockPeer::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 = CcBlockPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcBlockPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcSubjsPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcSubjsPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcSubjsPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcBlock) to $obj2 (CcSubjs)
+ $obj2->addCcBlock($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(CcBlockPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcBlockPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcBlockPeer::CREATOR_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 CcBlock 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 CcBlock 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(CcBlockPeer::DATABASE_NAME);
+ }
+
+ CcBlockPeer::addSelectColumns($criteria);
+ $startcol2 = CcBlockPeer::NUM_HYDRATE_COLUMNS;
+
+ CcSubjsPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcSubjsPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcBlockPeer::CREATOR_ID, CcSubjsPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcBlockPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcBlockPeer::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 = CcBlockPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcBlockPeer::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();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcSubjsPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CcBlock) to the collection in $obj2 (CcSubjs)
+ $obj2->addCcBlock($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(CcBlockPeer::DATABASE_NAME)->getTable(CcBlockPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcBlockPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcBlockPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \CcBlockTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcBlockPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a CcBlock or Criteria object.
+ *
+ * @param mixed $values Criteria or CcBlock 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(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcBlock object
+ }
+
+ if ($criteria->containsKey(CcBlockPeer::ID) && $criteria->keyContainsValue(CcBlockPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcBlockPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(CcBlockPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a CcBlock or Criteria object.
+ *
+ * @param mixed $values Criteria or CcBlock 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(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(CcBlockPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcBlockPeer::ID);
+ $value = $criteria->remove(CcBlockPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcBlockPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcBlockPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcBlock object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(CcBlockPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_block table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::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(CcBlockPeer::TABLE_NAME, $con, CcBlockPeer::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).
+ CcBlockPeer::clearInstancePool();
+ CcBlockPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a CcBlock or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcBlock 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(CcBlockPeer::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.
+ CcBlockPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcBlock) { // it's a model object
+ // invalidate the cache for this single object
+ CcBlockPeer::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(CcBlockPeer::DATABASE_NAME);
+ $criteria->add(CcBlockPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcBlockPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcBlockPeer::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);
+ CcBlockPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcBlock 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 CcBlock $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($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcBlockPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcBlockPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcBlockPeer::DATABASE_NAME, CcBlockPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcBlock
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcBlockPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcBlockPeer::DATABASE_NAME);
+ $criteria->add(CcBlockPeer::ID, $pk);
+
+ $v = CcBlockPeer::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
+ * @return CcBlock[]
+ * @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(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcBlockPeer::DATABASE_NAME);
+ $criteria->add(CcBlockPeer::ID, $pks, Criteria::IN);
+ $objs = CcBlockPeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
} // BaseCcBlockPeer
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockQuery.php
index 100efd61e..5ffad787a 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcBlockQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockQuery.php
@@ -4,643 +4,861 @@
/**
* Base class that represents a query for the 'cc_block' table.
*
- *
*
- * @method CcBlockQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcBlockQuery orderByDbName($order = Criteria::ASC) Order by the name column
- * @method CcBlockQuery orderByDbMtime($order = Criteria::ASC) Order by the mtime column
- * @method CcBlockQuery orderByDbUtime($order = Criteria::ASC) Order by the utime column
- * @method CcBlockQuery orderByDbCreatorId($order = Criteria::ASC) Order by the creator_id column
- * @method CcBlockQuery orderByDbDescription($order = Criteria::ASC) Order by the description column
- * @method CcBlockQuery orderByDbLength($order = Criteria::ASC) Order by the length column
- * @method CcBlockQuery orderByDbType($order = Criteria::ASC) Order by the type column
*
- * @method CcBlockQuery groupByDbId() Group by the id column
- * @method CcBlockQuery groupByDbName() Group by the name column
- * @method CcBlockQuery groupByDbMtime() Group by the mtime column
- * @method CcBlockQuery groupByDbUtime() Group by the utime column
- * @method CcBlockQuery groupByDbCreatorId() Group by the creator_id column
- * @method CcBlockQuery groupByDbDescription() Group by the description column
- * @method CcBlockQuery groupByDbLength() Group by the length column
- * @method CcBlockQuery groupByDbType() Group by the type column
+ * @method CcBlockQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcBlockQuery orderByDbName($order = Criteria::ASC) Order by the name column
+ * @method CcBlockQuery orderByDbMtime($order = Criteria::ASC) Order by the mtime column
+ * @method CcBlockQuery orderByDbUtime($order = Criteria::ASC) Order by the utime column
+ * @method CcBlockQuery orderByDbCreatorId($order = Criteria::ASC) Order by the creator_id column
+ * @method CcBlockQuery orderByDbDescription($order = Criteria::ASC) Order by the description column
+ * @method CcBlockQuery orderByDbLength($order = Criteria::ASC) Order by the length column
+ * @method CcBlockQuery orderByDbType($order = Criteria::ASC) Order by the type column
*
- * @method CcBlockQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcBlockQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcBlockQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcBlockQuery groupByDbId() Group by the id column
+ * @method CcBlockQuery groupByDbName() Group by the name column
+ * @method CcBlockQuery groupByDbMtime() Group by the mtime column
+ * @method CcBlockQuery groupByDbUtime() Group by the utime column
+ * @method CcBlockQuery groupByDbCreatorId() Group by the creator_id column
+ * @method CcBlockQuery groupByDbDescription() Group by the description column
+ * @method CcBlockQuery groupByDbLength() Group by the length column
+ * @method CcBlockQuery groupByDbType() Group by the type column
*
- * @method CcBlockQuery leftJoinCcSubjs($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjs relation
- * @method CcBlockQuery rightJoinCcSubjs($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjs relation
- * @method CcBlockQuery innerJoinCcSubjs($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjs relation
+ * @method CcBlockQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcBlockQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcBlockQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcBlockQuery leftJoinCcPlaylistcontents($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlaylistcontents relation
- * @method CcBlockQuery rightJoinCcPlaylistcontents($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlaylistcontents relation
- * @method CcBlockQuery innerJoinCcPlaylistcontents($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlaylistcontents relation
+ * @method CcBlockQuery leftJoinCcSubjs($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSubjs relation
+ * @method CcBlockQuery rightJoinCcSubjs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjs relation
+ * @method CcBlockQuery innerJoinCcSubjs($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjs relation
*
- * @method CcBlockQuery leftJoinCcBlockcontents($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcBlockcontents relation
- * @method CcBlockQuery rightJoinCcBlockcontents($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcBlockcontents relation
- * @method CcBlockQuery innerJoinCcBlockcontents($relationAlias = '') Adds a INNER JOIN clause to the query using the CcBlockcontents relation
+ * @method CcBlockQuery leftJoinCcPlaylistcontents($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPlaylistcontents relation
+ * @method CcBlockQuery rightJoinCcPlaylistcontents($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPlaylistcontents relation
+ * @method CcBlockQuery innerJoinCcPlaylistcontents($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPlaylistcontents relation
*
- * @method CcBlockQuery leftJoinCcBlockcriteria($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcBlockcriteria relation
- * @method CcBlockQuery rightJoinCcBlockcriteria($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcBlockcriteria relation
- * @method CcBlockQuery innerJoinCcBlockcriteria($relationAlias = '') Adds a INNER JOIN clause to the query using the CcBlockcriteria relation
+ * @method CcBlockQuery leftJoinCcBlockcontents($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcBlockcontents relation
+ * @method CcBlockQuery rightJoinCcBlockcontents($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcBlockcontents relation
+ * @method CcBlockQuery innerJoinCcBlockcontents($relationAlias = null) Adds a INNER JOIN clause to the query using the CcBlockcontents relation
*
- * @method CcBlock findOne(PropelPDO $con = null) Return the first CcBlock matching the query
- * @method CcBlock findOneOrCreate(PropelPDO $con = null) Return the first CcBlock matching the query, or a new CcBlock object populated from the query conditions when no match is found
+ * @method CcBlockQuery leftJoinCcBlockcriteria($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcBlockcriteria relation
+ * @method CcBlockQuery rightJoinCcBlockcriteria($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcBlockcriteria relation
+ * @method CcBlockQuery innerJoinCcBlockcriteria($relationAlias = null) Adds a INNER JOIN clause to the query using the CcBlockcriteria relation
*
- * @method CcBlock findOneByDbId(int $id) Return the first CcBlock filtered by the id column
- * @method CcBlock findOneByDbName(string $name) Return the first CcBlock filtered by the name column
- * @method CcBlock findOneByDbMtime(string $mtime) Return the first CcBlock filtered by the mtime column
- * @method CcBlock findOneByDbUtime(string $utime) Return the first CcBlock filtered by the utime column
- * @method CcBlock findOneByDbCreatorId(int $creator_id) Return the first CcBlock filtered by the creator_id column
- * @method CcBlock findOneByDbDescription(string $description) Return the first CcBlock filtered by the description column
- * @method CcBlock findOneByDbLength(string $length) Return the first CcBlock filtered by the length column
- * @method CcBlock findOneByDbType(string $type) Return the first CcBlock filtered by the type column
+ * @method CcBlock findOne(PropelPDO $con = null) Return the first CcBlock matching the query
+ * @method CcBlock findOneOrCreate(PropelPDO $con = null) Return the first CcBlock matching the query, or a new CcBlock object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcBlock objects filtered by the id column
- * @method array findByDbName(string $name) Return CcBlock objects filtered by the name column
- * @method array findByDbMtime(string $mtime) Return CcBlock objects filtered by the mtime column
- * @method array findByDbUtime(string $utime) Return CcBlock objects filtered by the utime column
- * @method array findByDbCreatorId(int $creator_id) Return CcBlock objects filtered by the creator_id column
- * @method array findByDbDescription(string $description) Return CcBlock objects filtered by the description column
- * @method array findByDbLength(string $length) Return CcBlock objects filtered by the length column
- * @method array findByDbType(string $type) Return CcBlock objects filtered by the type column
+ * @method CcBlock findOneByDbName(string $name) Return the first CcBlock filtered by the name column
+ * @method CcBlock findOneByDbMtime(string $mtime) Return the first CcBlock filtered by the mtime column
+ * @method CcBlock findOneByDbUtime(string $utime) Return the first CcBlock filtered by the utime column
+ * @method CcBlock findOneByDbCreatorId(int $creator_id) Return the first CcBlock filtered by the creator_id column
+ * @method CcBlock findOneByDbDescription(string $description) Return the first CcBlock filtered by the description column
+ * @method CcBlock findOneByDbLength(string $length) Return the first CcBlock filtered by the length column
+ * @method CcBlock findOneByDbType(string $type) Return the first CcBlock filtered by the type column
+ *
+ * @method array findByDbId(int $id) Return CcBlock objects filtered by the id column
+ * @method array findByDbName(string $name) Return CcBlock objects filtered by the name column
+ * @method array findByDbMtime(string $mtime) Return CcBlock objects filtered by the mtime column
+ * @method array findByDbUtime(string $utime) Return CcBlock objects filtered by the utime column
+ * @method array findByDbCreatorId(int $creator_id) Return CcBlock objects filtered by the creator_id column
+ * @method array findByDbDescription(string $description) Return CcBlock objects filtered by the description column
+ * @method array findByDbLength(string $length) Return CcBlock objects filtered by the length column
+ * @method array findByDbType(string $type) Return CcBlock objects filtered by the type column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcBlockQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcBlockQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcBlock';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcBlockQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcBlock', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcBlockQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcBlockQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcBlockQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcBlockQuery) {
+ return $criteria;
+ }
+ $query = new CcBlockQuery(null, null, $modelAlias);
- /**
- * Returns a new CcBlockQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcBlockQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcBlockQuery) {
- return $criteria;
- }
- $query = new CcBlockQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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 CcBlock|array|mixed the result, formatted by the current formatter
- */
- public function findPk($key, $con = null)
- {
- if ((null !== ($obj = CcBlockPeer::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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcBlock|CcBlock[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcBlockPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
- /**
- * Filter the query by primary key
- *
- * @param mixed $key Primary key to use for the query
- *
- * @return CcBlockQuery The current query, for fluid interface
- */
- public function filterByPrimaryKey($key)
- {
- return $this->addUsingAlias(CcBlockPeer::ID, $key, Criteria::EQUAL);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcBlock A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * Filter the query by a list of primary keys
- *
- * @param array $keys The list of primary key to use for the query
- *
- * @return CcBlockQuery The current query, for fluid interface
- */
- public function filterByPrimaryKeys($keys)
- {
- return $this->addUsingAlias(CcBlockPeer::ID, $keys, Criteria::IN);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcBlock A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "name", "mtime", "utime", "creator_id", "description", "length", "type" FROM "cc_block" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcBlock();
+ $obj->hydrate($row);
+ CcBlockPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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 CcBlockQuery 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(CcBlockPeer::ID, $dbId, $comparison);
- }
+ return $obj;
+ }
- /**
- * 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 CcBlockQuery 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(CcBlockPeer::NAME, $dbName, $comparison);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcBlock|CcBlock[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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 CcBlockQuery 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(CcBlockPeer::MTIME, $dbMtime['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbMtime['max'])) {
- $this->addUsingAlias(CcBlockPeer::MTIME, $dbMtime['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcBlockPeer::MTIME, $dbMtime, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * Filter the query on the utime column
- *
- * @param string|array $dbUtime 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 CcBlockQuery The current query, for fluid interface
- */
- public function filterByDbUtime($dbUtime = null, $comparison = null)
- {
- if (is_array($dbUtime)) {
- $useMinMax = false;
- if (isset($dbUtime['min'])) {
- $this->addUsingAlias(CcBlockPeer::UTIME, $dbUtime['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbUtime['max'])) {
- $this->addUsingAlias(CcBlockPeer::UTIME, $dbUtime['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcBlockPeer::UTIME, $dbUtime, $comparison);
- }
+ /**
+ * 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|CcBlock[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * Filter the query on the creator_id column
- *
- * @param int|array $dbCreatorId 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 CcBlockQuery The current query, for fluid interface
- */
- public function filterByDbCreatorId($dbCreatorId = null, $comparison = null)
- {
- if (is_array($dbCreatorId)) {
- $useMinMax = false;
- if (isset($dbCreatorId['min'])) {
- $this->addUsingAlias(CcBlockPeer::CREATOR_ID, $dbCreatorId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbCreatorId['max'])) {
- $this->addUsingAlias(CcBlockPeer::CREATOR_ID, $dbCreatorId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcBlockPeer::CREATOR_ID, $dbCreatorId, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * 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 CcBlockQuery 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(CcBlockPeer::DESCRIPTION, $dbDescription, $comparison);
- }
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
- /**
- * Filter the query on the length column
- *
- * @param string $dbLength 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 CcBlockQuery The current query, for fluid interface
- */
- public function filterByDbLength($dbLength = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbLength)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbLength)) {
- $dbLength = str_replace('*', '%', $dbLength);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcBlockPeer::LENGTH, $dbLength, $comparison);
- }
+ return $this->addUsingAlias(CcBlockPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * 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 CcBlockQuery 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(CcBlockPeer::TYPE, $dbType, $comparison);
- }
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
- /**
- * 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 CcBlockQuery The current query, for fluid interface
- */
- public function filterByCcSubjs($ccSubjs, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcBlockPeer::CREATOR_ID, $ccSubjs->getDbId(), $comparison);
- }
+ return $this->addUsingAlias(CcBlockPeer::ID, $keys, Criteria::IN);
+ }
- /**
- * 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 CcBlockQuery 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;
- }
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcBlockPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcBlockPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * 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');
- }
+ return $this->addUsingAlias(CcBlockPeer::ID, $dbId, $comparison);
+ }
- /**
- * 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 CcBlockQuery The current query, for fluid interface
- */
- public function filterByCcPlaylistcontents($ccPlaylistcontents, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcBlockPeer::ID, $ccPlaylistcontents->getDbBlockId(), $comparison);
- }
+ /**
+ * Filter the query on the name column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbName('fooValue'); // WHERE name = 'fooValue'
+ * $query->filterByDbName('%fooValue%'); // WHERE name LIKE '%fooValue%'
+ *
+ *
+ * @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 CcBlockQuery 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;
+ }
+ }
- /**
- * 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 CcBlockQuery 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;
- }
+ return $this->addUsingAlias(CcBlockPeer::NAME, $dbName, $comparison);
+ }
- /**
- * 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 on the mtime column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbMtime('2011-03-14'); // WHERE mtime = '2011-03-14'
+ * $query->filterByDbMtime('now'); // WHERE mtime = '2011-03-14'
+ * $query->filterByDbMtime(array('max' => 'yesterday')); // WHERE mtime < '2011-03-13'
+ *
+ *
+ * @param mixed $dbMtime The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockQuery 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(CcBlockPeer::MTIME, $dbMtime['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbMtime['max'])) {
+ $this->addUsingAlias(CcBlockPeer::MTIME, $dbMtime['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * Filter the query by a related CcBlockcontents object
- *
- * @param CcBlockcontents $ccBlockcontents the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return CcBlockQuery The current query, for fluid interface
- */
- public function filterByCcBlockcontents($ccBlockcontents, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcBlockPeer::ID, $ccBlockcontents->getDbBlockId(), $comparison);
- }
+ return $this->addUsingAlias(CcBlockPeer::MTIME, $dbMtime, $comparison);
+ }
- /**
- * Adds a JOIN clause to the query using the CcBlockcontents relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return CcBlockQuery The current query, for fluid interface
- */
- public function joinCcBlockcontents($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcBlockcontents');
-
- // 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, 'CcBlockcontents');
- }
-
- return $this;
- }
+ /**
+ * Filter the query on the utime column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbUtime('2011-03-14'); // WHERE utime = '2011-03-14'
+ * $query->filterByDbUtime('now'); // WHERE utime = '2011-03-14'
+ * $query->filterByDbUtime(array('max' => 'yesterday')); // WHERE utime < '2011-03-13'
+ *
+ *
+ * @param mixed $dbUtime The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ */
+ public function filterByDbUtime($dbUtime = null, $comparison = null)
+ {
+ if (is_array($dbUtime)) {
+ $useMinMax = false;
+ if (isset($dbUtime['min'])) {
+ $this->addUsingAlias(CcBlockPeer::UTIME, $dbUtime['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbUtime['max'])) {
+ $this->addUsingAlias(CcBlockPeer::UTIME, $dbUtime['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * Use the CcBlockcontents relation CcBlockcontents 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 CcBlockcontentsQuery A secondary query class using the current class as primary query
- */
- public function useCcBlockcontentsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- return $this
- ->joinCcBlockcontents($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcBlockcontents', 'CcBlockcontentsQuery');
- }
+ return $this->addUsingAlias(CcBlockPeer::UTIME, $dbUtime, $comparison);
+ }
- /**
- * Filter the query by a related CcBlockcriteria object
- *
- * @param CcBlockcriteria $ccBlockcriteria the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return CcBlockQuery The current query, for fluid interface
- */
- public function filterByCcBlockcriteria($ccBlockcriteria, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcBlockPeer::ID, $ccBlockcriteria->getDbBlockId(), $comparison);
- }
+ /**
+ * Filter the query on the creator_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCreatorId(1234); // WHERE creator_id = 1234
+ * $query->filterByDbCreatorId(array(12, 34)); // WHERE creator_id IN (12, 34)
+ * $query->filterByDbCreatorId(array('min' => 12)); // WHERE creator_id >= 12
+ * $query->filterByDbCreatorId(array('max' => 12)); // WHERE creator_id <= 12
+ *
+ *
+ * @see filterByCcSubjs()
+ *
+ * @param mixed $dbCreatorId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ */
+ public function filterByDbCreatorId($dbCreatorId = null, $comparison = null)
+ {
+ if (is_array($dbCreatorId)) {
+ $useMinMax = false;
+ if (isset($dbCreatorId['min'])) {
+ $this->addUsingAlias(CcBlockPeer::CREATOR_ID, $dbCreatorId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbCreatorId['max'])) {
+ $this->addUsingAlias(CcBlockPeer::CREATOR_ID, $dbCreatorId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * Adds a JOIN clause to the query using the CcBlockcriteria relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return CcBlockQuery The current query, for fluid interface
- */
- public function joinCcBlockcriteria($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcBlockcriteria');
-
- // 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, 'CcBlockcriteria');
- }
-
- return $this;
- }
+ return $this->addUsingAlias(CcBlockPeer::CREATOR_ID, $dbCreatorId, $comparison);
+ }
- /**
- * Use the CcBlockcriteria relation CcBlockcriteria 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 CcBlockcriteriaQuery A secondary query class using the current class as primary query
- */
- public function useCcBlockcriteriaQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinCcBlockcriteria($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcBlockcriteria', 'CcBlockcriteriaQuery');
- }
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDbDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @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 CcBlockQuery 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;
+ }
+ }
- /**
- * Exclude object from result
- *
- * @param CcBlock $ccBlock Object to remove from the list of results
- *
- * @return CcBlockQuery The current query, for fluid interface
- */
- public function prune($ccBlock = null)
- {
- if ($ccBlock) {
- $this->addUsingAlias(CcBlockPeer::ID, $ccBlock->getDbId(), Criteria::NOT_EQUAL);
- }
-
- return $this;
- }
+ return $this->addUsingAlias(CcBlockPeer::DESCRIPTION, $dbDescription, $comparison);
+ }
-} // BaseCcBlockQuery
+ /**
+ * Filter the query on the length column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLength('fooValue'); // WHERE length = 'fooValue'
+ * $query->filterByDbLength('%fooValue%'); // WHERE length LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbLength 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 CcBlockQuery The current query, for fluid interface
+ */
+ public function filterByDbLength($dbLength = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbLength)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbLength)) {
+ $dbLength = str_replace('*', '%', $dbLength);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcBlockPeer::LENGTH, $dbLength, $comparison);
+ }
+
+ /**
+ * Filter the query on the type column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbType('fooValue'); // WHERE type = 'fooValue'
+ * $query->filterByDbType('%fooValue%'); // WHERE type LIKE '%fooValue%'
+ *
+ *
+ * @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 CcBlockQuery 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(CcBlockPeer::TYPE, $dbType, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcSubjs object
+ *
+ * @param CcSubjs|PropelObjectCollection $ccSubjs The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcSubjs($ccSubjs, $comparison = null)
+ {
+ if ($ccSubjs instanceof CcSubjs) {
+ return $this
+ ->addUsingAlias(CcBlockPeer::CREATOR_ID, $ccSubjs->getDbId(), $comparison);
+ } elseif ($ccSubjs instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcBlockPeer::CREATOR_ID, $ccSubjs->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcSubjs() only accepts arguments of type CcSubjs or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 CcBlockQuery The current query, for fluid interface
+ */
+ public function joinCcSubjs($relationAlias = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcSubjs($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery');
+ }
+
+ /**
+ * Filter the query by a related CcPlaylistcontents object
+ *
+ * @param CcPlaylistcontents|PropelObjectCollection $ccPlaylistcontents the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcPlaylistcontents($ccPlaylistcontents, $comparison = null)
+ {
+ if ($ccPlaylistcontents instanceof CcPlaylistcontents) {
+ return $this
+ ->addUsingAlias(CcBlockPeer::ID, $ccPlaylistcontents->getDbBlockId(), $comparison);
+ } elseif ($ccPlaylistcontents instanceof PropelObjectCollection) {
+ return $this
+ ->useCcPlaylistcontentsQuery()
+ ->filterByPrimaryKeys($ccPlaylistcontents->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcPlaylistcontents() only accepts arguments of type CcPlaylistcontents or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 CcBlockQuery The current query, for fluid interface
+ */
+ public function joinCcPlaylistcontents($relationAlias = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcPlaylistcontents($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlaylistcontents', 'CcPlaylistcontentsQuery');
+ }
+
+ /**
+ * Filter the query by a related CcBlockcontents object
+ *
+ * @param CcBlockcontents|PropelObjectCollection $ccBlockcontents the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcBlockcontents($ccBlockcontents, $comparison = null)
+ {
+ if ($ccBlockcontents instanceof CcBlockcontents) {
+ return $this
+ ->addUsingAlias(CcBlockPeer::ID, $ccBlockcontents->getDbBlockId(), $comparison);
+ } elseif ($ccBlockcontents instanceof PropelObjectCollection) {
+ return $this
+ ->useCcBlockcontentsQuery()
+ ->filterByPrimaryKeys($ccBlockcontents->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcBlockcontents() only accepts arguments of type CcBlockcontents or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcBlockcontents relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ */
+ public function joinCcBlockcontents($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcBlockcontents');
+
+ // 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, 'CcBlockcontents');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcBlockcontents relation CcBlockcontents 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 CcBlockcontentsQuery A secondary query class using the current class as primary query
+ */
+ public function useCcBlockcontentsQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcBlockcontents($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcBlockcontents', 'CcBlockcontentsQuery');
+ }
+
+ /**
+ * Filter the query by a related CcBlockcriteria object
+ *
+ * @param CcBlockcriteria|PropelObjectCollection $ccBlockcriteria the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcBlockcriteria($ccBlockcriteria, $comparison = null)
+ {
+ if ($ccBlockcriteria instanceof CcBlockcriteria) {
+ return $this
+ ->addUsingAlias(CcBlockPeer::ID, $ccBlockcriteria->getDbBlockId(), $comparison);
+ } elseif ($ccBlockcriteria instanceof PropelObjectCollection) {
+ return $this
+ ->useCcBlockcriteriaQuery()
+ ->filterByPrimaryKeys($ccBlockcriteria->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcBlockcriteria() only accepts arguments of type CcBlockcriteria or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcBlockcriteria relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ */
+ public function joinCcBlockcriteria($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcBlockcriteria');
+
+ // 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, 'CcBlockcriteria');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcBlockcriteria relation CcBlockcriteria 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 CcBlockcriteriaQuery A secondary query class using the current class as primary query
+ */
+ public function useCcBlockcriteriaQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcBlockcriteria($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcBlockcriteria', 'CcBlockcriteriaQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcBlock $ccBlock Object to remove from the list of results
+ *
+ * @return CcBlockQuery The current query, for fluid interface
+ */
+ public function prune($ccBlock = null)
+ {
+ if ($ccBlock) {
+ $this->addUsingAlias(CcBlockPeer::ID, $ccBlock->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php
index f2e6fb6d1..ec32bc9c8 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php
@@ -4,1459 +4,1611 @@
/**
* Base class that represents a row from the 'cc_blockcontents' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcBlockcontents extends BaseObject implements Persistent
+abstract class BaseCcBlockcontents extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcBlockcontentsPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcBlockcontentsPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the block_id field.
- * @var int
- */
- protected $block_id;
-
- /**
- * The value for the file_id field.
- * @var int
- */
- protected $file_id;
-
- /**
- * The value for the position field.
- * @var int
- */
- protected $position;
-
- /**
- * The value for the trackoffset field.
- * Note: this column has a database default value of: 0
- * @var double
- */
- protected $trackoffset;
-
- /**
- * The value for the cliplength field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $cliplength;
-
- /**
- * The value for the cuein field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $cuein;
-
- /**
- * The value for the cueout field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $cueout;
-
- /**
- * The value for the fadein field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $fadein;
-
- /**
- * The value for the fadeout field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $fadeout;
-
- /**
- * @var CcFiles
- */
- protected $aCcFiles;
-
- /**
- * @var CcBlock
- */
- protected $aCcBlock;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- // aggregate_column_relation behavior
- protected $oldCcBlock;
-
- /**
- * Applies default values to this object.
- * This method should be called from the object's constructor (or
- * equivalent initialization method).
- * @see __construct()
- */
- public function applyDefaultValues()
- {
- $this->trackoffset = 0;
- $this->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 BaseCcBlockcontents 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 [block_id] column value.
- *
- * @return int
- */
- public function getDbBlockId()
- {
- return $this->block_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 [trackoffset] column value.
- *
- * @return double
- */
- public function getDbTrackOffset()
- {
- return $this->trackoffset;
- }
-
- /**
- * Get the [cliplength] column value.
- *
- * @return string
- */
- public function getDbCliplength()
- {
- return $this->cliplength;
- }
-
- /**
- * Get the [cuein] column value.
- *
- * @return string
- */
- public function getDbCuein()
- {
- return $this->cuein;
- }
-
- /**
- * Get the [cueout] column value.
- *
- * @return string
- */
- public function getDbCueout()
- {
- return $this->cueout;
- }
-
- /**
- * 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 CcBlockcontents 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[] = CcBlockcontentsPeer::ID;
- }
-
- return $this;
- } // setDbId()
-
- /**
- * Set the value of [block_id] column.
- *
- * @param int $v new value
- * @return CcBlockcontents The current object (for fluent API support)
- */
- public function setDbBlockId($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->block_id !== $v) {
- $this->block_id = $v;
- $this->modifiedColumns[] = CcBlockcontentsPeer::BLOCK_ID;
- }
-
- if ($this->aCcBlock !== null && $this->aCcBlock->getDbId() !== $v) {
- $this->aCcBlock = null;
- }
-
- return $this;
- } // setDbBlockId()
-
- /**
- * Set the value of [file_id] column.
- *
- * @param int $v new value
- * @return CcBlockcontents 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[] = CcBlockcontentsPeer::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 CcBlockcontents 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[] = CcBlockcontentsPeer::POSITION;
- }
-
- return $this;
- } // setDbPosition()
-
- /**
- * Set the value of [trackoffset] column.
- *
- * @param double $v new value
- * @return CcBlockcontents The current object (for fluent API support)
- */
- public function setDbTrackOffset($v)
- {
- if ($v !== null) {
- $v = (double) $v;
- }
-
- if ($this->trackoffset !== $v || $this->isNew()) {
- $this->trackoffset = $v;
- $this->modifiedColumns[] = CcBlockcontentsPeer::TRACKOFFSET;
- }
-
- return $this;
- } // setDbTrackOffset()
-
- /**
- * Set the value of [cliplength] column.
- *
- * @param string $v new value
- * @return CcBlockcontents The current object (for fluent API support)
- */
- public function setDbCliplength($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->cliplength !== $v || $this->isNew()) {
- $this->cliplength = $v;
- $this->modifiedColumns[] = CcBlockcontentsPeer::CLIPLENGTH;
- }
-
- return $this;
- } // setDbCliplength()
-
- /**
- * Set the value of [cuein] column.
- *
- * @param string $v new value
- * @return CcBlockcontents The current object (for fluent API support)
- */
- public function setDbCuein($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->cuein !== $v || $this->isNew()) {
- $this->cuein = $v;
- $this->modifiedColumns[] = CcBlockcontentsPeer::CUEIN;
- }
-
- return $this;
- } // setDbCuein()
-
- /**
- * Set the value of [cueout] column.
- *
- * @param string $v new value
- * @return CcBlockcontents The current object (for fluent API support)
- */
- public function setDbCueout($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->cueout !== $v || $this->isNew()) {
- $this->cueout = $v;
- $this->modifiedColumns[] = CcBlockcontentsPeer::CUEOUT;
- }
-
- 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 CcBlockcontents 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[] = CcBlockcontentsPeer::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 CcBlockcontents 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[] = CcBlockcontentsPeer::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->trackoffset !== 0) {
- return false;
- }
-
- 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->block_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->trackoffset = ($row[$startcol + 4] !== null) ? (double) $row[$startcol + 4] : null;
- $this->cliplength = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
- $this->cuein = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
- $this->cueout = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
- $this->fadein = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
- $this->fadeout = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 10; // 10 = CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS).
-
- } catch (Exception $e) {
- throw new PropelException("Error populating CcBlockcontents 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->aCcBlock !== null && $this->block_id !== $this->aCcBlock->getDbId()) {
- $this->aCcBlock = 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(CcBlockcontentsPeer::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 = CcBlockcontentsPeer::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->aCcBlock = 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(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $con->beginTransaction();
- try {
- $ret = $this->preDelete($con);
- if ($ret) {
- CcBlockcontentsQuery::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(CcBlockcontentsPeer::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->updateRelatedCcBlock($con);
- CcBlockcontentsPeer::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->aCcBlock !== null) {
- if ($this->aCcBlock->isModified() || $this->aCcBlock->isNew()) {
- $affectedRows += $this->aCcBlock->save($con);
- }
- $this->setCcBlock($this->aCcBlock);
- }
-
- if ($this->isNew() ) {
- $this->modifiedColumns[] = CcBlockcontentsPeer::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(CcBlockcontentsPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcBlockcontentsPeer::ID.')');
- }
-
- $pk = BasePeer::doInsert($criteria, $con);
- $affectedRows += 1;
- $this->setDbId($pk); //[IMV] update autoincrement primary key
- $this->setNew(false);
- } else {
- $affectedRows += CcBlockcontentsPeer::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->aCcBlock !== null) {
- if (!$this->aCcBlock->validate($columns)) {
- $failureMap = array_merge($failureMap, $this->aCcBlock->getValidationFailures());
- }
- }
-
-
- if (($retval = CcBlockcontentsPeer::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 = CcBlockcontentsPeer::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->getDbBlockId();
- break;
- case 2:
- return $this->getDbFileId();
- break;
- case 3:
- return $this->getDbPosition();
- break;
- case 4:
- return $this->getDbTrackOffset();
- break;
- case 5:
- return $this->getDbCliplength();
- break;
- case 6:
- return $this->getDbCuein();
- break;
- case 7:
- return $this->getDbCueout();
- break;
- case 8:
- return $this->getDbFadein();
- break;
- case 9:
- 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 = CcBlockcontentsPeer::getFieldNames($keyType);
- $result = array(
- $keys[0] => $this->getDbId(),
- $keys[1] => $this->getDbBlockId(),
- $keys[2] => $this->getDbFileId(),
- $keys[3] => $this->getDbPosition(),
- $keys[4] => $this->getDbTrackOffset(),
- $keys[5] => $this->getDbCliplength(),
- $keys[6] => $this->getDbCuein(),
- $keys[7] => $this->getDbCueout(),
- $keys[8] => $this->getDbFadein(),
- $keys[9] => $this->getDbFadeout(),
- );
- if ($includeForeignObjects) {
- if (null !== $this->aCcFiles) {
- $result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, true);
- }
- if (null !== $this->aCcBlock) {
- $result['CcBlock'] = $this->aCcBlock->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 = CcBlockcontentsPeer::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->setDbBlockId($value);
- break;
- case 2:
- $this->setDbFileId($value);
- break;
- case 3:
- $this->setDbPosition($value);
- break;
- case 4:
- $this->setDbTrackOffset($value);
- break;
- case 5:
- $this->setDbCliplength($value);
- break;
- case 6:
- $this->setDbCuein($value);
- break;
- case 7:
- $this->setDbCueout($value);
- break;
- case 8:
- $this->setDbFadein($value);
- break;
- case 9:
- $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 = CcBlockcontentsPeer::getFieldNames($keyType);
-
- if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
- if (array_key_exists($keys[1], $arr)) $this->setDbBlockId($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->setDbTrackOffset($arr[$keys[4]]);
- if (array_key_exists($keys[5], $arr)) $this->setDbCliplength($arr[$keys[5]]);
- if (array_key_exists($keys[6], $arr)) $this->setDbCuein($arr[$keys[6]]);
- if (array_key_exists($keys[7], $arr)) $this->setDbCueout($arr[$keys[7]]);
- if (array_key_exists($keys[8], $arr)) $this->setDbFadein($arr[$keys[8]]);
- if (array_key_exists($keys[9], $arr)) $this->setDbFadeout($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(CcBlockcontentsPeer::DATABASE_NAME);
-
- if ($this->isColumnModified(CcBlockcontentsPeer::ID)) $criteria->add(CcBlockcontentsPeer::ID, $this->id);
- if ($this->isColumnModified(CcBlockcontentsPeer::BLOCK_ID)) $criteria->add(CcBlockcontentsPeer::BLOCK_ID, $this->block_id);
- if ($this->isColumnModified(CcBlockcontentsPeer::FILE_ID)) $criteria->add(CcBlockcontentsPeer::FILE_ID, $this->file_id);
- if ($this->isColumnModified(CcBlockcontentsPeer::POSITION)) $criteria->add(CcBlockcontentsPeer::POSITION, $this->position);
- if ($this->isColumnModified(CcBlockcontentsPeer::TRACKOFFSET)) $criteria->add(CcBlockcontentsPeer::TRACKOFFSET, $this->trackoffset);
- if ($this->isColumnModified(CcBlockcontentsPeer::CLIPLENGTH)) $criteria->add(CcBlockcontentsPeer::CLIPLENGTH, $this->cliplength);
- if ($this->isColumnModified(CcBlockcontentsPeer::CUEIN)) $criteria->add(CcBlockcontentsPeer::CUEIN, $this->cuein);
- if ($this->isColumnModified(CcBlockcontentsPeer::CUEOUT)) $criteria->add(CcBlockcontentsPeer::CUEOUT, $this->cueout);
- if ($this->isColumnModified(CcBlockcontentsPeer::FADEIN)) $criteria->add(CcBlockcontentsPeer::FADEIN, $this->fadein);
- if ($this->isColumnModified(CcBlockcontentsPeer::FADEOUT)) $criteria->add(CcBlockcontentsPeer::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(CcBlockcontentsPeer::DATABASE_NAME);
- $criteria->add(CcBlockcontentsPeer::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 CcBlockcontents (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->setDbBlockId($this->block_id);
- $copyObj->setDbFileId($this->file_id);
- $copyObj->setDbPosition($this->position);
- $copyObj->setDbTrackOffset($this->trackoffset);
- $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 CcBlockcontents 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 CcBlockcontentsPeer
- */
- public function getPeer()
- {
- if (self::$peer === null) {
- self::$peer = new CcBlockcontentsPeer();
- }
- return self::$peer;
- }
-
- /**
- * Declares an association between this object and a CcFiles object.
- *
- * @param CcFiles $v
- * @return CcBlockcontents 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->addCcBlockcontents($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->addCcBlockcontentss($this);
- */
- }
- return $this->aCcFiles;
- }
-
- /**
- * Declares an association between this object and a CcBlock object.
- *
- * @param CcBlock $v
- * @return CcBlockcontents The current object (for fluent API support)
- * @throws PropelException
- */
- public function setCcBlock(CcBlock $v = null)
- {
- // aggregate_column_relation behavior
- if (null !== $this->aCcBlock && $v !== $this->aCcBlock) {
- $this->oldCcBlock = $this->aCcBlock;
- }
- if ($v === null) {
- $this->setDbBlockId(NULL);
- } else {
- $this->setDbBlockId($v->getDbId());
- }
-
- $this->aCcBlock = $v;
-
- // Add binding for other direction of this n:n relationship.
- // If this object has already been added to the CcBlock object, it will not be re-added.
- if ($v !== null) {
- $v->addCcBlockcontents($this);
- }
-
- return $this;
- }
-
-
- /**
- * Get the associated CcBlock object
- *
- * @param PropelPDO Optional Connection object.
- * @return CcBlock The associated CcBlock object.
- * @throws PropelException
- */
- public function getCcBlock(PropelPDO $con = null)
- {
- if ($this->aCcBlock === null && ($this->block_id !== null)) {
- $this->aCcBlock = CcBlockQuery::create()->findPk($this->block_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->aCcBlock->addCcBlockcontentss($this);
- */
- }
- return $this->aCcBlock;
- }
-
- /**
- * Clears the current object and sets all attributes to their default values
- */
- public function clear()
- {
- $this->id = null;
- $this->block_id = null;
- $this->file_id = null;
- $this->position = null;
- $this->trackoffset = 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->aCcBlock = null;
- }
-
- // aggregate_column_relation behavior
-
- /**
- * Update the aggregate column in the related CcBlock object
- *
- * @param PropelPDO $con A connection object
- */
- protected function updateRelatedCcBlock(PropelPDO $con)
- {
- if ($ccBlock = $this->getCcBlock()) {
- $ccBlock->updateDbLength($con);
- }
- if ($this->oldCcBlock) {
- $this->oldCcBlock->updateDbLength($con);
- $this->oldCcBlock = 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);
- }
-
-} // BaseCcBlockcontents
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcBlockcontentsPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcBlockcontentsPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the block_id field.
+ * @var int
+ */
+ protected $block_id;
+
+ /**
+ * The value for the file_id field.
+ * @var int
+ */
+ protected $file_id;
+
+ /**
+ * The value for the position field.
+ * @var int
+ */
+ protected $position;
+
+ /**
+ * The value for the trackoffset field.
+ * Note: this column has a database default value of: 0
+ * @var double
+ */
+ protected $trackoffset;
+
+ /**
+ * The value for the cliplength field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $cliplength;
+
+ /**
+ * The value for the cuein field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $cuein;
+
+ /**
+ * The value for the cueout field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $cueout;
+
+ /**
+ * The value for the fadein field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $fadein;
+
+ /**
+ * The value for the fadeout field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $fadeout;
+
+ /**
+ * @var CcFiles
+ */
+ protected $aCcFiles;
+
+ /**
+ * @var CcBlock
+ */
+ protected $aCcBlock;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ // aggregate_column_relation behavior
+ protected $oldCcBlock;
+
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->trackoffset = 0;
+ $this->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 BaseCcBlockcontents 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 [block_id] column value.
+ *
+ * @return int
+ */
+ public function getDbBlockId()
+ {
+
+ return $this->block_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 [trackoffset] column value.
+ *
+ * @return double
+ */
+ public function getDbTrackOffset()
+ {
+
+ return $this->trackoffset;
+ }
+
+ /**
+ * Get the [cliplength] column value.
+ *
+ * @return string
+ */
+ public function getDbCliplength()
+ {
+
+ return $this->cliplength;
+ }
+
+ /**
+ * Get the [cuein] column value.
+ *
+ * @return string
+ */
+ public function getDbCuein()
+ {
+
+ return $this->cuein;
+ }
+
+ /**
+ * Get the [cueout] column value.
+ *
+ * @return string
+ */
+ public function getDbCueout()
+ {
+
+ return $this->cueout;
+ }
+
+ /**
+ * 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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ 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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcBlockcontentsPeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [block_id] column.
+ *
+ * @param int $v new value
+ * @return CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbBlockId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->block_id !== $v) {
+ $this->block_id = $v;
+ $this->modifiedColumns[] = CcBlockcontentsPeer::BLOCK_ID;
+ }
+
+ if ($this->aCcBlock !== null && $this->aCcBlock->getDbId() !== $v) {
+ $this->aCcBlock = null;
+ }
+
+
+ return $this;
+ } // setDbBlockId()
+
+ /**
+ * Set the value of [file_id] column.
+ *
+ * @param int $v new value
+ * @return CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbFileId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->file_id !== $v) {
+ $this->file_id = $v;
+ $this->modifiedColumns[] = CcBlockcontentsPeer::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 CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbPosition($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->position !== $v) {
+ $this->position = $v;
+ $this->modifiedColumns[] = CcBlockcontentsPeer::POSITION;
+ }
+
+
+ return $this;
+ } // setDbPosition()
+
+ /**
+ * Set the value of [trackoffset] column.
+ *
+ * @param double $v new value
+ * @return CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbTrackOffset($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (double) $v;
+ }
+
+ if ($this->trackoffset !== $v) {
+ $this->trackoffset = $v;
+ $this->modifiedColumns[] = CcBlockcontentsPeer::TRACKOFFSET;
+ }
+
+
+ return $this;
+ } // setDbTrackOffset()
+
+ /**
+ * Set the value of [cliplength] column.
+ *
+ * @param string $v new value
+ * @return CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbCliplength($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->cliplength !== $v) {
+ $this->cliplength = $v;
+ $this->modifiedColumns[] = CcBlockcontentsPeer::CLIPLENGTH;
+ }
+
+
+ return $this;
+ } // setDbCliplength()
+
+ /**
+ * Set the value of [cuein] column.
+ *
+ * @param string $v new value
+ * @return CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbCuein($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->cuein !== $v) {
+ $this->cuein = $v;
+ $this->modifiedColumns[] = CcBlockcontentsPeer::CUEIN;
+ }
+
+
+ return $this;
+ } // setDbCuein()
+
+ /**
+ * Set the value of [cueout] column.
+ *
+ * @param string $v new value
+ * @return CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbCueout($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->cueout !== $v) {
+ $this->cueout = $v;
+ $this->modifiedColumns[] = CcBlockcontentsPeer::CUEOUT;
+ }
+
+
+ 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 strings are treated as null.
+ * @return CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbFadein($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->fadein !== null || $dt !== null) {
+ $currentDateAsString = ($this->fadein !== null && $tmpDt = new DateTime($this->fadein)) ? $tmpDt->format('H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('H:i:s') : null;
+ if ( ($currentDateAsString !== $newDateAsString) // normalized values don't match
+ || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
+ ) {
+ $this->fadein = $newDateAsString;
+ $this->modifiedColumns[] = CcBlockcontentsPeer::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 strings are treated as null.
+ * @return CcBlockcontents The current object (for fluent API support)
+ */
+ public function setDbFadeout($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->fadeout !== null || $dt !== null) {
+ $currentDateAsString = ($this->fadeout !== null && $tmpDt = new DateTime($this->fadeout)) ? $tmpDt->format('H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('H:i:s') : null;
+ if ( ($currentDateAsString !== $newDateAsString) // normalized values don't match
+ || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
+ ) {
+ $this->fadeout = $newDateAsString;
+ $this->modifiedColumns[] = CcBlockcontentsPeer::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->trackoffset !== 0) {
+ return false;
+ }
+
+ 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 resultset 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->block_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->trackoffset = ($row[$startcol + 4] !== null) ? (double) $row[$startcol + 4] : null;
+ $this->cliplength = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->cuein = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
+ $this->cueout = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
+ $this->fadein = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
+ $this->fadeout = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 10; // 10 = CcBlockcontentsPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcBlockcontents 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->aCcBlock !== null && $this->block_id !== $this->aCcBlock->getDbId()) {
+ $this->aCcBlock = 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(CcBlockcontentsPeer::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 = CcBlockcontentsPeer::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->aCcBlock = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @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(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = CcBlockcontentsQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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(CcBlockcontentsPeer::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->updateRelatedCcBlock($con);
+ CcBlockcontentsPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $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 corresponding 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->aCcBlock !== null) {
+ if ($this->aCcBlock->isModified() || $this->aCcBlock->isNew()) {
+ $affectedRows += $this->aCcBlock->save($con);
+ }
+ $this->setCcBlock($this->aCcBlock);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcBlockcontentsPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcBlockcontentsPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_blockcontents_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcBlockcontentsPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcBlockcontentsPeer::BLOCK_ID)) {
+ $modifiedColumns[':p' . $index++] = '"block_id"';
+ }
+ if ($this->isColumnModified(CcBlockcontentsPeer::FILE_ID)) {
+ $modifiedColumns[':p' . $index++] = '"file_id"';
+ }
+ if ($this->isColumnModified(CcBlockcontentsPeer::POSITION)) {
+ $modifiedColumns[':p' . $index++] = '"position"';
+ }
+ if ($this->isColumnModified(CcBlockcontentsPeer::TRACKOFFSET)) {
+ $modifiedColumns[':p' . $index++] = '"trackoffset"';
+ }
+ if ($this->isColumnModified(CcBlockcontentsPeer::CLIPLENGTH)) {
+ $modifiedColumns[':p' . $index++] = '"cliplength"';
+ }
+ if ($this->isColumnModified(CcBlockcontentsPeer::CUEIN)) {
+ $modifiedColumns[':p' . $index++] = '"cuein"';
+ }
+ if ($this->isColumnModified(CcBlockcontentsPeer::CUEOUT)) {
+ $modifiedColumns[':p' . $index++] = '"cueout"';
+ }
+ if ($this->isColumnModified(CcBlockcontentsPeer::FADEIN)) {
+ $modifiedColumns[':p' . $index++] = '"fadein"';
+ }
+ if ($this->isColumnModified(CcBlockcontentsPeer::FADEOUT)) {
+ $modifiedColumns[':p' . $index++] = '"fadeout"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_blockcontents" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"block_id"':
+ $stmt->bindValue($identifier, $this->block_id, PDO::PARAM_INT);
+ break;
+ case '"file_id"':
+ $stmt->bindValue($identifier, $this->file_id, PDO::PARAM_INT);
+ break;
+ case '"position"':
+ $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
+ break;
+ case '"trackoffset"':
+ $stmt->bindValue($identifier, $this->trackoffset, PDO::PARAM_STR);
+ break;
+ case '"cliplength"':
+ $stmt->bindValue($identifier, $this->cliplength, PDO::PARAM_STR);
+ break;
+ case '"cuein"':
+ $stmt->bindValue($identifier, $this->cuein, PDO::PARAM_STR);
+ break;
+ case '"cueout"':
+ $stmt->bindValue($identifier, $this->cueout, PDO::PARAM_STR);
+ break;
+ case '"fadein"':
+ $stmt->bindValue($identifier, $this->fadein, PDO::PARAM_STR);
+ break;
+ case '"fadeout"':
+ $stmt->bindValue($identifier, $this->fadeout, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding 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->aCcBlock !== null) {
+ if (!$this->aCcBlock->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcBlock->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CcBlockcontentsPeer::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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcBlockcontentsPeer::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->getDbBlockId();
+ break;
+ case 2:
+ return $this->getDbFileId();
+ break;
+ case 3:
+ return $this->getDbPosition();
+ break;
+ case 4:
+ return $this->getDbTrackOffset();
+ break;
+ case 5:
+ return $this->getDbCliplength();
+ break;
+ case 6:
+ return $this->getDbCuein();
+ break;
+ case 7:
+ return $this->getDbCueout();
+ break;
+ case 8:
+ return $this->getDbFadein();
+ break;
+ case 9:
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcBlockcontents'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcBlockcontents'][$this->getPrimaryKey()] = true;
+ $keys = CcBlockcontentsPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbBlockId(),
+ $keys[2] => $this->getDbFileId(),
+ $keys[3] => $this->getDbPosition(),
+ $keys[4] => $this->getDbTrackOffset(),
+ $keys[5] => $this->getDbCliplength(),
+ $keys[6] => $this->getDbCuein(),
+ $keys[7] => $this->getDbCueout(),
+ $keys[8] => $this->getDbFadein(),
+ $keys[9] => $this->getDbFadeout(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcFiles) {
+ $result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->aCcBlock) {
+ $result['CcBlock'] = $this->aCcBlock->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcBlockcontentsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbBlockId($value);
+ break;
+ case 2:
+ $this->setDbFileId($value);
+ break;
+ case 3:
+ $this->setDbPosition($value);
+ break;
+ case 4:
+ $this->setDbTrackOffset($value);
+ break;
+ case 5:
+ $this->setDbCliplength($value);
+ break;
+ case 6:
+ $this->setDbCuein($value);
+ break;
+ case 7:
+ $this->setDbCueout($value);
+ break;
+ case 8:
+ $this->setDbFadein($value);
+ break;
+ case 9:
+ $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 BasePeer::TYPE_PHPNAME
+ *
+ * @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 = CcBlockcontentsPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbBlockId($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->setDbTrackOffset($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDbCliplength($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setDbCuein($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setDbCueout($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setDbFadein($arr[$keys[8]]);
+ if (array_key_exists($keys[9], $arr)) $this->setDbFadeout($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(CcBlockcontentsPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcBlockcontentsPeer::ID)) $criteria->add(CcBlockcontentsPeer::ID, $this->id);
+ if ($this->isColumnModified(CcBlockcontentsPeer::BLOCK_ID)) $criteria->add(CcBlockcontentsPeer::BLOCK_ID, $this->block_id);
+ if ($this->isColumnModified(CcBlockcontentsPeer::FILE_ID)) $criteria->add(CcBlockcontentsPeer::FILE_ID, $this->file_id);
+ if ($this->isColumnModified(CcBlockcontentsPeer::POSITION)) $criteria->add(CcBlockcontentsPeer::POSITION, $this->position);
+ if ($this->isColumnModified(CcBlockcontentsPeer::TRACKOFFSET)) $criteria->add(CcBlockcontentsPeer::TRACKOFFSET, $this->trackoffset);
+ if ($this->isColumnModified(CcBlockcontentsPeer::CLIPLENGTH)) $criteria->add(CcBlockcontentsPeer::CLIPLENGTH, $this->cliplength);
+ if ($this->isColumnModified(CcBlockcontentsPeer::CUEIN)) $criteria->add(CcBlockcontentsPeer::CUEIN, $this->cuein);
+ if ($this->isColumnModified(CcBlockcontentsPeer::CUEOUT)) $criteria->add(CcBlockcontentsPeer::CUEOUT, $this->cueout);
+ if ($this->isColumnModified(CcBlockcontentsPeer::FADEIN)) $criteria->add(CcBlockcontentsPeer::FADEIN, $this->fadein);
+ if ($this->isColumnModified(CcBlockcontentsPeer::FADEOUT)) $criteria->add(CcBlockcontentsPeer::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(CcBlockcontentsPeer::DATABASE_NAME);
+ $criteria->add(CcBlockcontentsPeer::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 CcBlockcontents (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbBlockId($this->getDbBlockId());
+ $copyObj->setDbFileId($this->getDbFileId());
+ $copyObj->setDbPosition($this->getDbPosition());
+ $copyObj->setDbTrackOffset($this->getDbTrackOffset());
+ $copyObj->setDbCliplength($this->getDbCliplength());
+ $copyObj->setDbCuein($this->getDbCuein());
+ $copyObj->setDbCueout($this->getDbCueout());
+ $copyObj->setDbFadein($this->getDbFadein());
+ $copyObj->setDbFadeout($this->getDbFadeout());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 CcBlockcontents 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 CcBlockcontentsPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcBlockcontentsPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcFiles object.
+ *
+ * @param CcFiles $v
+ * @return CcBlockcontents 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->addCcBlockcontents($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcFiles object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcFiles The associated CcFiles object.
+ * @throws PropelException
+ */
+ public function getCcFiles(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcFiles === null && ($this->file_id !== null) && $doQuery) {
+ $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->addCcBlockcontentss($this);
+ */
+ }
+
+ return $this->aCcFiles;
+ }
+
+ /**
+ * Declares an association between this object and a CcBlock object.
+ *
+ * @param CcBlock $v
+ * @return CcBlockcontents The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcBlock(CcBlock $v = null)
+ {
+ // aggregate_column_relation behavior
+ if (null !== $this->aCcBlock && $v !== $this->aCcBlock) {
+ $this->oldCcBlock = $this->aCcBlock;
+ }
+ if ($v === null) {
+ $this->setDbBlockId(NULL);
+ } else {
+ $this->setDbBlockId($v->getDbId());
+ }
+
+ $this->aCcBlock = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcBlock object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcBlockcontents($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcBlock object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcBlock The associated CcBlock object.
+ * @throws PropelException
+ */
+ public function getCcBlock(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcBlock === null && ($this->block_id !== null) && $doQuery) {
+ $this->aCcBlock = CcBlockQuery::create()->findPk($this->block_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->aCcBlock->addCcBlockcontentss($this);
+ */
+ }
+
+ return $this->aCcBlock;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->block_id = null;
+ $this->file_id = null;
+ $this->position = null;
+ $this->trackoffset = null;
+ $this->cliplength = null;
+ $this->cuein = null;
+ $this->cueout = null;
+ $this->fadein = null;
+ $this->fadeout = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->aCcFiles instanceof Persistent) {
+ $this->aCcFiles->clearAllReferences($deep);
+ }
+ if ($this->aCcBlock instanceof Persistent) {
+ $this->aCcBlock->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ $this->aCcFiles = null;
+ $this->aCcBlock = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcBlockcontentsPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+ // aggregate_column_relation behavior
+
+ /**
+ * Update the aggregate column in the related CcBlock object
+ *
+ * @param PropelPDO $con A connection object
+ */
+ protected function updateRelatedCcBlock(PropelPDO $con)
+ {
+ if ($ccBlock = $this->getCcBlock()) {
+ if (!$ccBlock->isAlreadyInSave()) {
+ $ccBlock->updateDbLength($con);
+ }
+ }
+ if ($this->oldCcBlock) {
+ $this->oldCcBlock->updateDbLength($con);
+ $this->oldCcBlock = null;
+ }
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsPeer.php
index 6cdb1e265..e3917377c 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsPeer.php
@@ -4,1393 +4,1425 @@
/**
* Base static class for performing query and update operations on the 'cc_blockcontents' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcBlockcontentsPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_blockcontents';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcBlockcontents';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcBlockcontents';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcBlockcontentsTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 10;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_blockcontents.ID';
-
- /** the column name for the BLOCK_ID field */
- const BLOCK_ID = 'cc_blockcontents.BLOCK_ID';
-
- /** the column name for the FILE_ID field */
- const FILE_ID = 'cc_blockcontents.FILE_ID';
-
- /** the column name for the POSITION field */
- const POSITION = 'cc_blockcontents.POSITION';
-
- /** the column name for the TRACKOFFSET field */
- const TRACKOFFSET = 'cc_blockcontents.TRACKOFFSET';
-
- /** the column name for the CLIPLENGTH field */
- const CLIPLENGTH = 'cc_blockcontents.CLIPLENGTH';
-
- /** the column name for the CUEIN field */
- const CUEIN = 'cc_blockcontents.CUEIN';
-
- /** the column name for the CUEOUT field */
- const CUEOUT = 'cc_blockcontents.CUEOUT';
-
- /** the column name for the FADEIN field */
- const FADEIN = 'cc_blockcontents.FADEIN';
-
- /** the column name for the FADEOUT field */
- const FADEOUT = 'cc_blockcontents.FADEOUT';
-
- /**
- * An identiy map to hold any loaded instances of CcBlockcontents objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcBlockcontents[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbBlockId', 'DbFileId', 'DbPosition', 'DbTrackOffset', 'DbCliplength', 'DbCuein', 'DbCueout', 'DbFadein', 'DbFadeout', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbBlockId', 'dbFileId', 'dbPosition', 'dbTrackOffset', 'dbCliplength', 'dbCuein', 'dbCueout', 'dbFadein', 'dbFadeout', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::BLOCK_ID, self::FILE_ID, self::POSITION, self::TRACKOFFSET, self::CLIPLENGTH, self::CUEIN, self::CUEOUT, self::FADEIN, self::FADEOUT, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'BLOCK_ID', 'FILE_ID', 'POSITION', 'TRACKOFFSET', 'CLIPLENGTH', 'CUEIN', 'CUEOUT', 'FADEIN', 'FADEOUT', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'block_id', 'file_id', 'position', 'trackoffset', 'cliplength', 'cuein', 'cueout', 'fadein', 'fadeout', ),
- 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, 'DbBlockId' => 1, 'DbFileId' => 2, 'DbPosition' => 3, 'DbTrackOffset' => 4, 'DbCliplength' => 5, 'DbCuein' => 6, 'DbCueout' => 7, 'DbFadein' => 8, 'DbFadeout' => 9, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbBlockId' => 1, 'dbFileId' => 2, 'dbPosition' => 3, 'dbTrackOffset' => 4, 'dbCliplength' => 5, 'dbCuein' => 6, 'dbCueout' => 7, 'dbFadein' => 8, 'dbFadeout' => 9, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::BLOCK_ID => 1, self::FILE_ID => 2, self::POSITION => 3, self::TRACKOFFSET => 4, self::CLIPLENGTH => 5, self::CUEIN => 6, self::CUEOUT => 7, self::FADEIN => 8, self::FADEOUT => 9, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'BLOCK_ID' => 1, 'FILE_ID' => 2, 'POSITION' => 3, 'TRACKOFFSET' => 4, 'CLIPLENGTH' => 5, 'CUEIN' => 6, 'CUEOUT' => 7, 'FADEIN' => 8, 'FADEOUT' => 9, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'block_id' => 1, 'file_id' => 2, 'position' => 3, 'trackoffset' => 4, 'cliplength' => 5, 'cuein' => 6, 'cueout' => 7, 'fadein' => 8, 'fadeout' => 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. CcBlockcontentsPeer::COLUMN_NAME).
- * @return string
- */
- public static function alias($alias, $column)
- {
- return str_replace(CcBlockcontentsPeer::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(CcBlockcontentsPeer::ID);
- $criteria->addSelectColumn(CcBlockcontentsPeer::BLOCK_ID);
- $criteria->addSelectColumn(CcBlockcontentsPeer::FILE_ID);
- $criteria->addSelectColumn(CcBlockcontentsPeer::POSITION);
- $criteria->addSelectColumn(CcBlockcontentsPeer::TRACKOFFSET);
- $criteria->addSelectColumn(CcBlockcontentsPeer::CLIPLENGTH);
- $criteria->addSelectColumn(CcBlockcontentsPeer::CUEIN);
- $criteria->addSelectColumn(CcBlockcontentsPeer::CUEOUT);
- $criteria->addSelectColumn(CcBlockcontentsPeer::FADEIN);
- $criteria->addSelectColumn(CcBlockcontentsPeer::FADEOUT);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.BLOCK_ID');
- $criteria->addSelectColumn($alias . '.FILE_ID');
- $criteria->addSelectColumn($alias . '.POSITION');
- $criteria->addSelectColumn($alias . '.TRACKOFFSET');
- $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(CcBlockcontentsPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcBlockcontentsPeer::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(CcBlockcontentsPeer::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 CcBlockcontents
- * @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 = CcBlockcontentsPeer::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 CcBlockcontentsPeer::populateObjects(CcBlockcontentsPeer::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(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- if (!$criteria->hasSelectClause()) {
- $criteria = clone $criteria;
- CcBlockcontentsPeer::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 CcBlockcontents $value A CcBlockcontents object.
- * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
- */
- public static function addInstanceToPool(CcBlockcontents $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 CcBlockcontents object or a primary key value.
- */
- public static function removeInstanceFromPool($value)
- {
- if (Propel::isInstancePoolingEnabled() && $value !== null) {
- if (is_object($value) && $value instanceof CcBlockcontents) {
- $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 CcBlockcontents 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 CcBlockcontents 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_blockcontents
- * 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 = CcBlockcontentsPeer::getOMClass(false);
- // populate the object(s)
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj = CcBlockcontentsPeer::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;
- CcBlockcontentsPeer::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 (CcBlockcontents object, last column rank)
- */
- public static function populateObject($row, $startcol = 0)
- {
- $key = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, $startcol);
- if (null !== ($obj = CcBlockcontentsPeer::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 + CcBlockcontentsPeer::NUM_COLUMNS;
- } else {
- $cls = CcBlockcontentsPeer::OM_CLASS;
- $obj = new $cls();
- $col = $obj->hydrate($row, $startcol);
- CcBlockcontentsPeer::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(CcBlockcontentsPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcBlockcontentsPeer::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(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcBlockcontentsPeer::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 CcBlock 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 doCountJoinCcBlock(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(CcBlockcontentsPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcBlockcontentsPeer::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(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::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 CcBlockcontents 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 CcBlockcontents 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);
- }
-
- CcBlockcontentsPeer::addSelectColumns($criteria);
- $startcol = (CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
- CcFilesPeer::addSelectColumns($criteria);
-
- $criteria->addJoin(CcBlockcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcBlockcontentsPeer::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 = CcBlockcontentsPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcBlockcontentsPeer::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 (CcBlockcontents) to $obj2 (CcFiles)
- $obj2->addCcBlockcontents($obj1);
-
- } // if joined row was not null
-
- $results[] = $obj1;
- }
- $stmt->closeCursor();
- return $results;
- }
-
-
- /**
- * Selects a collection of CcBlockcontents objects pre-filled with their CcBlock 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 CcBlockcontents objects.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelectJoinCcBlock(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);
- }
-
- CcBlockcontentsPeer::addSelectColumns($criteria);
- $startcol = (CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
- CcBlockPeer::addSelectColumns($criteria);
-
- $criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcBlockcontentsPeer::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 = CcBlockcontentsPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcBlockcontentsPeer::addInstanceToPool($obj1, $key1);
- } // if $obj1 already loaded
-
- $key2 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol);
- if ($key2 !== null) {
- $obj2 = CcBlockPeer::getInstanceFromPool($key2);
- if (!$obj2) {
-
- $cls = CcBlockPeer::getOMClass(false);
-
- $obj2 = new $cls();
- $obj2->hydrate($row, $startcol);
- CcBlockPeer::addInstanceToPool($obj2, $key2);
- } // if obj2 already loaded
-
- // Add the $obj1 (CcBlockcontents) to $obj2 (CcBlock)
- $obj2->addCcBlockcontents($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(CcBlockcontentsPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcBlockcontentsPeer::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(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcBlockcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
-
- $criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::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 CcBlockcontents 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 CcBlockcontents 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);
- }
-
- CcBlockcontentsPeer::addSelectColumns($criteria);
- $startcol2 = (CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcFilesPeer::addSelectColumns($criteria);
- $startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcBlockPeer::addSelectColumns($criteria);
- $startcol4 = $startcol3 + (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcBlockcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
-
- $criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcBlockcontentsPeer::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 = CcBlockcontentsPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcBlockcontentsPeer::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 (CcBlockcontents) to the collection in $obj2 (CcFiles)
- $obj2->addCcBlockcontents($obj1);
- } // if joined row not null
-
- // Add objects for joined CcBlock rows
-
- $key3 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol3);
- if ($key3 !== null) {
- $obj3 = CcBlockPeer::getInstanceFromPool($key3);
- if (!$obj3) {
-
- $cls = CcBlockPeer::getOMClass(false);
-
- $obj3 = new $cls();
- $obj3->hydrate($row, $startcol3);
- CcBlockPeer::addInstanceToPool($obj3, $key3);
- } // if obj3 loaded
-
- // Add the $obj1 (CcBlockcontents) to the collection in $obj3 (CcBlock)
- $obj3->addCcBlockcontents($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(CcBlockcontentsPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcBlockcontentsPeer::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(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::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 CcBlock 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 doCountJoinAllExceptCcBlock(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(CcBlockcontentsPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcBlockcontentsPeer::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(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcBlockcontentsPeer::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 CcBlockcontents 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 CcBlockcontents 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);
- }
-
- CcBlockcontentsPeer::addSelectColumns($criteria);
- $startcol2 = (CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcBlockPeer::addSelectColumns($criteria);
- $startcol3 = $startcol2 + (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
-
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcBlockcontentsPeer::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 = CcBlockcontentsPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcBlockcontentsPeer::addInstanceToPool($obj1, $key1);
- } // if obj1 already loaded
-
- // Add objects for joined CcBlock rows
-
- $key2 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol2);
- if ($key2 !== null) {
- $obj2 = CcBlockPeer::getInstanceFromPool($key2);
- if (!$obj2) {
-
- $cls = CcBlockPeer::getOMClass(false);
-
- $obj2 = new $cls();
- $obj2->hydrate($row, $startcol2);
- CcBlockPeer::addInstanceToPool($obj2, $key2);
- } // if $obj2 already loaded
-
- // Add the $obj1 (CcBlockcontents) to the collection in $obj2 (CcBlock)
- $obj2->addCcBlockcontents($obj1);
-
- } // if joined row is not null
-
- $results[] = $obj1;
- }
- $stmt->closeCursor();
- return $results;
- }
-
-
- /**
- * Selects a collection of CcBlockcontents objects pre-filled with all related objects except CcBlock.
- *
- * @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 CcBlockcontents objects.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelectJoinAllExceptCcBlock(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);
- }
-
- CcBlockcontentsPeer::addSelectColumns($criteria);
- $startcol2 = (CcBlockcontentsPeer::NUM_COLUMNS - CcBlockcontentsPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcFilesPeer::addSelectColumns($criteria);
- $startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcBlockcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
-
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcBlockcontentsPeer::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 = CcBlockcontentsPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcBlockcontentsPeer::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 (CcBlockcontents) to the collection in $obj2 (CcFiles)
- $obj2->addCcBlockcontents($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(BaseCcBlockcontentsPeer::DATABASE_NAME);
- if (!$dbMap->hasTable(BaseCcBlockcontentsPeer::TABLE_NAME))
- {
- $dbMap->addTableObject(new CcBlockcontentsTableMap());
- }
- }
-
- /**
- * 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 ? CcBlockcontentsPeer::CLASS_DEFAULT : CcBlockcontentsPeer::OM_CLASS;
- }
-
- /**
- * Method perform an INSERT on the database, given a CcBlockcontents or Criteria object.
- *
- * @param mixed $values Criteria or CcBlockcontents 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(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
- } else {
- $criteria = $values->buildCriteria(); // build Criteria from CcBlockcontents object
- }
-
- if ($criteria->containsKey(CcBlockcontentsPeer::ID) && $criteria->keyContainsValue(CcBlockcontentsPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcBlockcontentsPeer::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 CcBlockcontents or Criteria object.
- *
- * @param mixed $values Criteria or CcBlockcontents 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(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $selectCriteria = new Criteria(self::DATABASE_NAME);
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
-
- $comparison = $criteria->getComparison(CcBlockcontentsPeer::ID);
- $value = $criteria->remove(CcBlockcontentsPeer::ID);
- if ($value) {
- $selectCriteria->add(CcBlockcontentsPeer::ID, $value, $comparison);
- } else {
- $selectCriteria->setPrimaryTableName(CcBlockcontentsPeer::TABLE_NAME);
- }
-
- } else { // $values is CcBlockcontents 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_blockcontents 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(CcBlockcontentsPeer::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(CcBlockcontentsPeer::TABLE_NAME, $con, CcBlockcontentsPeer::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).
- CcBlockcontentsPeer::clearInstancePool();
- CcBlockcontentsPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Method perform a DELETE on the database, given a CcBlockcontents or Criteria object OR a primary key value.
- *
- * @param mixed $values Criteria or CcBlockcontents 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(CcBlockcontentsPeer::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.
- CcBlockcontentsPeer::clearInstancePool();
- // rename for clarity
- $criteria = clone $values;
- } elseif ($values instanceof CcBlockcontents) { // it's a model object
- // invalidate the cache for this single object
- CcBlockcontentsPeer::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(CcBlockcontentsPeer::ID, (array) $values, Criteria::IN);
- // invalidate the cache for this object(s)
- foreach ((array) $values as $singleval) {
- CcBlockcontentsPeer::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);
- CcBlockcontentsPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Validates all modified columns of given CcBlockcontents 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 CcBlockcontents $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(CcBlockcontents $obj, $cols = null)
- {
- $columns = array();
-
- if ($cols) {
- $dbMap = Propel::getDatabaseMap(CcBlockcontentsPeer::DATABASE_NAME);
- $tableMap = $dbMap->getTable(CcBlockcontentsPeer::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(CcBlockcontentsPeer::DATABASE_NAME, CcBlockcontentsPeer::TABLE_NAME, $columns);
- }
-
- /**
- * Retrieve a single object by pkey.
- *
- * @param int $pk the primary key.
- * @param PropelPDO $con the connection to use
- * @return CcBlockcontents
- */
- public static function retrieveByPK($pk, PropelPDO $con = null)
- {
-
- if (null !== ($obj = CcBlockcontentsPeer::getInstanceFromPool((string) $pk))) {
- return $obj;
- }
-
- if ($con === null) {
- $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria = new Criteria(CcBlockcontentsPeer::DATABASE_NAME);
- $criteria->add(CcBlockcontentsPeer::ID, $pk);
-
- $v = CcBlockcontentsPeer::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(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $objs = null;
- if (empty($pks)) {
- $objs = array();
- } else {
- $criteria = new Criteria(CcBlockcontentsPeer::DATABASE_NAME);
- $criteria->add(CcBlockcontentsPeer::ID, $pks, Criteria::IN);
- $objs = CcBlockcontentsPeer::doSelect($criteria, $con);
- }
- return $objs;
- }
+abstract class BaseCcBlockcontentsPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_blockcontents';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcBlockcontents';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcBlockcontentsTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 10;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 10;
+
+ /** the column name for the id field */
+ const ID = 'cc_blockcontents.id';
+
+ /** the column name for the block_id field */
+ const BLOCK_ID = 'cc_blockcontents.block_id';
+
+ /** the column name for the file_id field */
+ const FILE_ID = 'cc_blockcontents.file_id';
+
+ /** the column name for the position field */
+ const POSITION = 'cc_blockcontents.position';
+
+ /** the column name for the trackoffset field */
+ const TRACKOFFSET = 'cc_blockcontents.trackoffset';
+
+ /** the column name for the cliplength field */
+ const CLIPLENGTH = 'cc_blockcontents.cliplength';
+
+ /** the column name for the cuein field */
+ const CUEIN = 'cc_blockcontents.cuein';
+
+ /** the column name for the cueout field */
+ const CUEOUT = 'cc_blockcontents.cueout';
+
+ /** the column name for the fadein field */
+ const FADEIN = 'cc_blockcontents.fadein';
+
+ /** the column name for the fadeout field */
+ const FADEOUT = 'cc_blockcontents.fadeout';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcBlockcontents objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcBlockcontents[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcBlockcontentsPeer::$fieldNames[CcBlockcontentsPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbBlockId', 'DbFileId', 'DbPosition', 'DbTrackOffset', 'DbCliplength', 'DbCuein', 'DbCueout', 'DbFadein', 'DbFadeout', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbBlockId', 'dbFileId', 'dbPosition', 'dbTrackOffset', 'dbCliplength', 'dbCuein', 'dbCueout', 'dbFadein', 'dbFadeout', ),
+ BasePeer::TYPE_COLNAME => array (CcBlockcontentsPeer::ID, CcBlockcontentsPeer::BLOCK_ID, CcBlockcontentsPeer::FILE_ID, CcBlockcontentsPeer::POSITION, CcBlockcontentsPeer::TRACKOFFSET, CcBlockcontentsPeer::CLIPLENGTH, CcBlockcontentsPeer::CUEIN, CcBlockcontentsPeer::CUEOUT, CcBlockcontentsPeer::FADEIN, CcBlockcontentsPeer::FADEOUT, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'BLOCK_ID', 'FILE_ID', 'POSITION', 'TRACKOFFSET', 'CLIPLENGTH', 'CUEIN', 'CUEOUT', 'FADEIN', 'FADEOUT', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'block_id', 'file_id', 'position', 'trackoffset', 'cliplength', 'cuein', 'cueout', 'fadein', 'fadeout', ),
+ 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. CcBlockcontentsPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbBlockId' => 1, 'DbFileId' => 2, 'DbPosition' => 3, 'DbTrackOffset' => 4, 'DbCliplength' => 5, 'DbCuein' => 6, 'DbCueout' => 7, 'DbFadein' => 8, 'DbFadeout' => 9, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbBlockId' => 1, 'dbFileId' => 2, 'dbPosition' => 3, 'dbTrackOffset' => 4, 'dbCliplength' => 5, 'dbCuein' => 6, 'dbCueout' => 7, 'dbFadein' => 8, 'dbFadeout' => 9, ),
+ BasePeer::TYPE_COLNAME => array (CcBlockcontentsPeer::ID => 0, CcBlockcontentsPeer::BLOCK_ID => 1, CcBlockcontentsPeer::FILE_ID => 2, CcBlockcontentsPeer::POSITION => 3, CcBlockcontentsPeer::TRACKOFFSET => 4, CcBlockcontentsPeer::CLIPLENGTH => 5, CcBlockcontentsPeer::CUEIN => 6, CcBlockcontentsPeer::CUEOUT => 7, CcBlockcontentsPeer::FADEIN => 8, CcBlockcontentsPeer::FADEOUT => 9, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'BLOCK_ID' => 1, 'FILE_ID' => 2, 'POSITION' => 3, 'TRACKOFFSET' => 4, 'CLIPLENGTH' => 5, 'CUEIN' => 6, 'CUEOUT' => 7, 'FADEIN' => 8, 'FADEOUT' => 9, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'block_id' => 1, 'file_id' => 2, 'position' => 3, 'trackoffset' => 4, 'cliplength' => 5, 'cuein' => 6, 'cueout' => 7, 'fadein' => 8, 'fadeout' => 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcBlockcontentsPeer::getFieldNames($toType);
+ $key = isset(CcBlockcontentsPeer::$fieldKeys[$fromType][$name]) ? CcBlockcontentsPeer::$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(CcBlockcontentsPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcBlockcontentsPeer::$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 CcBlockcontentsPeer::$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. CcBlockcontentsPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcBlockcontentsPeer::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(CcBlockcontentsPeer::ID);
+ $criteria->addSelectColumn(CcBlockcontentsPeer::BLOCK_ID);
+ $criteria->addSelectColumn(CcBlockcontentsPeer::FILE_ID);
+ $criteria->addSelectColumn(CcBlockcontentsPeer::POSITION);
+ $criteria->addSelectColumn(CcBlockcontentsPeer::TRACKOFFSET);
+ $criteria->addSelectColumn(CcBlockcontentsPeer::CLIPLENGTH);
+ $criteria->addSelectColumn(CcBlockcontentsPeer::CUEIN);
+ $criteria->addSelectColumn(CcBlockcontentsPeer::CUEOUT);
+ $criteria->addSelectColumn(CcBlockcontentsPeer::FADEIN);
+ $criteria->addSelectColumn(CcBlockcontentsPeer::FADEOUT);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.block_id');
+ $criteria->addSelectColumn($alias . '.file_id');
+ $criteria->addSelectColumn($alias . '.position');
+ $criteria->addSelectColumn($alias . '.trackoffset');
+ $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(CcBlockcontentsPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::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;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcBlockcontents
+ * @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 = CcBlockcontentsPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 CcBlockcontentsPeer::populateObjects(CcBlockcontentsPeer::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 directly (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(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcBlockcontentsPeer::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 CcBlockcontents $obj A CcBlockcontents object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcBlockcontentsPeer::$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 CcBlockcontents object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcBlockcontents) {
+ $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 CcBlockcontents object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(CcBlockcontentsPeer::$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 CcBlockcontents 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(CcBlockcontentsPeer::$instances[$key])) {
+ return CcBlockcontentsPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcBlockcontentsPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcBlockcontentsPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_blockcontents
+ * 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 = CcBlockcontentsPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcBlockcontentsPeer::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;
+ CcBlockcontentsPeer::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 (CcBlockcontents object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcBlockcontentsPeer::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 + CcBlockcontentsPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = CcBlockcontentsPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcBlockcontentsPeer::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(CcBlockcontentsPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcBlockcontentsPeer::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 CcBlock 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 doCountJoinCcBlock(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(CcBlockcontentsPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::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 CcBlockcontents 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 CcBlockcontents 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(CcBlockcontentsPeer::DATABASE_NAME);
+ }
+
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ $startcol = CcBlockcontentsPeer::NUM_HYDRATE_COLUMNS;
+ CcFilesPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcBlockcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcBlockcontentsPeer::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 = CcBlockcontentsPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcBlockcontentsPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcFilesPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcFilesPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcFilesPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcBlockcontents) to $obj2 (CcFiles)
+ $obj2->addCcBlockcontents($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Selects a collection of CcBlockcontents objects pre-filled with their CcBlock 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 CcBlockcontents objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcBlock(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(CcBlockcontentsPeer::DATABASE_NAME);
+ }
+
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ $startcol = CcBlockcontentsPeer::NUM_HYDRATE_COLUMNS;
+ CcBlockPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcBlockcontentsPeer::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 = CcBlockcontentsPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcBlockcontentsPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcBlockPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcBlockPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcBlockPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcBlockcontents) to $obj2 (CcBlock)
+ $obj2->addCcBlockcontents($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(CcBlockcontentsPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcBlockcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::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 CcBlockcontents 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 CcBlockcontents 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(CcBlockcontentsPeer::DATABASE_NAME);
+ }
+
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ $startcol2 = CcBlockcontentsPeer::NUM_HYDRATE_COLUMNS;
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcFilesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcBlockPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + CcBlockPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcBlockcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcBlockcontentsPeer::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 = CcBlockcontentsPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcBlockcontentsPeer::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();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcFilesPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CcBlockcontents) to the collection in $obj2 (CcFiles)
+ $obj2->addCcBlockcontents($obj1);
+ } // if joined row not null
+
+ // Add objects for joined CcBlock rows
+
+ $key3 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol3);
+ if ($key3 !== null) {
+ $obj3 = CcBlockPeer::getInstanceFromPool($key3);
+ if (!$obj3) {
+
+ $cls = CcBlockPeer::getOMClass();
+
+ $obj3 = new $cls();
+ $obj3->hydrate($row, $startcol3);
+ CcBlockPeer::addInstanceToPool($obj3, $key3);
+ } // if obj3 loaded
+
+ // Add the $obj1 (CcBlockcontents) to the collection in $obj3 (CcBlock)
+ $obj3->addCcBlockcontents($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(CcBlockcontentsPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY should not affect count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::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 CcBlock 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 doCountJoinAllExceptCcBlock(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(CcBlockcontentsPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY should not affect count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcBlockcontentsPeer::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 CcBlockcontents 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 CcBlockcontents 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(CcBlockcontentsPeer::DATABASE_NAME);
+ }
+
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ $startcol2 = CcBlockcontentsPeer::NUM_HYDRATE_COLUMNS;
+
+ CcBlockPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcBlockPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcBlockcontentsPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcBlockcontentsPeer::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 = CcBlockcontentsPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcBlockcontentsPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcBlock rows
+
+ $key2 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcBlockPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcBlockPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcBlockPeer::addInstanceToPool($obj2, $key2);
+ } // if $obj2 already loaded
+
+ // Add the $obj1 (CcBlockcontents) to the collection in $obj2 (CcBlock)
+ $obj2->addCcBlockcontents($obj1);
+
+ } // if joined row is not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Selects a collection of CcBlockcontents objects pre-filled with all related objects except CcBlock.
+ *
+ * @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 CcBlockcontents objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAllExceptCcBlock(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(CcBlockcontentsPeer::DATABASE_NAME);
+ }
+
+ CcBlockcontentsPeer::addSelectColumns($criteria);
+ $startcol2 = CcBlockcontentsPeer::NUM_HYDRATE_COLUMNS;
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcFilesPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcBlockcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcBlockcontentsPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcBlockcontentsPeer::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 = CcBlockcontentsPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcBlockcontentsPeer::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();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcFilesPeer::addInstanceToPool($obj2, $key2);
+ } // if $obj2 already loaded
+
+ // Add the $obj1 (CcBlockcontents) to the collection in $obj2 (CcFiles)
+ $obj2->addCcBlockcontents($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(CcBlockcontentsPeer::DATABASE_NAME)->getTable(CcBlockcontentsPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcBlockcontentsPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcBlockcontentsPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \CcBlockcontentsTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcBlockcontentsPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a CcBlockcontents or Criteria object.
+ *
+ * @param mixed $values Criteria or CcBlockcontents 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(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcBlockcontents object
+ }
+
+ if ($criteria->containsKey(CcBlockcontentsPeer::ID) && $criteria->keyContainsValue(CcBlockcontentsPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcBlockcontentsPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(CcBlockcontentsPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a CcBlockcontents or Criteria object.
+ *
+ * @param mixed $values Criteria or CcBlockcontents 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(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(CcBlockcontentsPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcBlockcontentsPeer::ID);
+ $value = $criteria->remove(CcBlockcontentsPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcBlockcontentsPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcBlockcontentsPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcBlockcontents object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(CcBlockcontentsPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_blockcontents table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::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(CcBlockcontentsPeer::TABLE_NAME, $con, CcBlockcontentsPeer::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).
+ CcBlockcontentsPeer::clearInstancePool();
+ CcBlockcontentsPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a CcBlockcontents or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcBlockcontents 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(CcBlockcontentsPeer::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.
+ CcBlockcontentsPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcBlockcontents) { // it's a model object
+ // invalidate the cache for this single object
+ CcBlockcontentsPeer::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(CcBlockcontentsPeer::DATABASE_NAME);
+ $criteria->add(CcBlockcontentsPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcBlockcontentsPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcBlockcontentsPeer::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);
+ CcBlockcontentsPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcBlockcontents 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 CcBlockcontents $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($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcBlockcontentsPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcBlockcontentsPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcBlockcontentsPeer::DATABASE_NAME, CcBlockcontentsPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcBlockcontents
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcBlockcontentsPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcBlockcontentsPeer::DATABASE_NAME);
+ $criteria->add(CcBlockcontentsPeer::ID, $pk);
+
+ $v = CcBlockcontentsPeer::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
+ * @return CcBlockcontents[]
+ * @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(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcBlockcontentsPeer::DATABASE_NAME);
+ $criteria->add(CcBlockcontentsPeer::ID, $pks, Criteria::IN);
+ $objs = CcBlockcontentsPeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
} // BaseCcBlockcontentsPeer
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsQuery.php
index f648e3640..868c0b241 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontentsQuery.php
@@ -4,672 +4,900 @@
/**
* Base class that represents a query for the 'cc_blockcontents' table.
*
- *
*
- * @method CcBlockcontentsQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcBlockcontentsQuery orderByDbBlockId($order = Criteria::ASC) Order by the block_id column
- * @method CcBlockcontentsQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column
- * @method CcBlockcontentsQuery orderByDbPosition($order = Criteria::ASC) Order by the position column
- * @method CcBlockcontentsQuery orderByDbTrackOffset($order = Criteria::ASC) Order by the trackoffset column
- * @method CcBlockcontentsQuery orderByDbCliplength($order = Criteria::ASC) Order by the cliplength column
- * @method CcBlockcontentsQuery orderByDbCuein($order = Criteria::ASC) Order by the cuein column
- * @method CcBlockcontentsQuery orderByDbCueout($order = Criteria::ASC) Order by the cueout column
- * @method CcBlockcontentsQuery orderByDbFadein($order = Criteria::ASC) Order by the fadein column
- * @method CcBlockcontentsQuery orderByDbFadeout($order = Criteria::ASC) Order by the fadeout column
*
- * @method CcBlockcontentsQuery groupByDbId() Group by the id column
- * @method CcBlockcontentsQuery groupByDbBlockId() Group by the block_id column
- * @method CcBlockcontentsQuery groupByDbFileId() Group by the file_id column
- * @method CcBlockcontentsQuery groupByDbPosition() Group by the position column
- * @method CcBlockcontentsQuery groupByDbTrackOffset() Group by the trackoffset column
- * @method CcBlockcontentsQuery groupByDbCliplength() Group by the cliplength column
- * @method CcBlockcontentsQuery groupByDbCuein() Group by the cuein column
- * @method CcBlockcontentsQuery groupByDbCueout() Group by the cueout column
- * @method CcBlockcontentsQuery groupByDbFadein() Group by the fadein column
- * @method CcBlockcontentsQuery groupByDbFadeout() Group by the fadeout column
+ * @method CcBlockcontentsQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcBlockcontentsQuery orderByDbBlockId($order = Criteria::ASC) Order by the block_id column
+ * @method CcBlockcontentsQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column
+ * @method CcBlockcontentsQuery orderByDbPosition($order = Criteria::ASC) Order by the position column
+ * @method CcBlockcontentsQuery orderByDbTrackOffset($order = Criteria::ASC) Order by the trackoffset column
+ * @method CcBlockcontentsQuery orderByDbCliplength($order = Criteria::ASC) Order by the cliplength column
+ * @method CcBlockcontentsQuery orderByDbCuein($order = Criteria::ASC) Order by the cuein column
+ * @method CcBlockcontentsQuery orderByDbCueout($order = Criteria::ASC) Order by the cueout column
+ * @method CcBlockcontentsQuery orderByDbFadein($order = Criteria::ASC) Order by the fadein column
+ * @method CcBlockcontentsQuery orderByDbFadeout($order = Criteria::ASC) Order by the fadeout column
*
- * @method CcBlockcontentsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcBlockcontentsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcBlockcontentsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcBlockcontentsQuery groupByDbId() Group by the id column
+ * @method CcBlockcontentsQuery groupByDbBlockId() Group by the block_id column
+ * @method CcBlockcontentsQuery groupByDbFileId() Group by the file_id column
+ * @method CcBlockcontentsQuery groupByDbPosition() Group by the position column
+ * @method CcBlockcontentsQuery groupByDbTrackOffset() Group by the trackoffset column
+ * @method CcBlockcontentsQuery groupByDbCliplength() Group by the cliplength column
+ * @method CcBlockcontentsQuery groupByDbCuein() Group by the cuein column
+ * @method CcBlockcontentsQuery groupByDbCueout() Group by the cueout column
+ * @method CcBlockcontentsQuery groupByDbFadein() Group by the fadein column
+ * @method CcBlockcontentsQuery groupByDbFadeout() Group by the fadeout column
*
- * @method CcBlockcontentsQuery leftJoinCcFiles($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFiles relation
- * @method CcBlockcontentsQuery rightJoinCcFiles($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFiles relation
- * @method CcBlockcontentsQuery innerJoinCcFiles($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFiles relation
+ * @method CcBlockcontentsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcBlockcontentsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcBlockcontentsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcBlockcontentsQuery leftJoinCcBlock($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcBlock relation
- * @method CcBlockcontentsQuery rightJoinCcBlock($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcBlock relation
- * @method CcBlockcontentsQuery innerJoinCcBlock($relationAlias = '') Adds a INNER JOIN clause to the query using the CcBlock relation
+ * @method CcBlockcontentsQuery leftJoinCcFiles($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcFiles relation
+ * @method CcBlockcontentsQuery rightJoinCcFiles($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcFiles relation
+ * @method CcBlockcontentsQuery innerJoinCcFiles($relationAlias = null) Adds a INNER JOIN clause to the query using the CcFiles relation
*
- * @method CcBlockcontents findOne(PropelPDO $con = null) Return the first CcBlockcontents matching the query
- * @method CcBlockcontents findOneOrCreate(PropelPDO $con = null) Return the first CcBlockcontents matching the query, or a new CcBlockcontents object populated from the query conditions when no match is found
+ * @method CcBlockcontentsQuery leftJoinCcBlock($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcBlock relation
+ * @method CcBlockcontentsQuery rightJoinCcBlock($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcBlock relation
+ * @method CcBlockcontentsQuery innerJoinCcBlock($relationAlias = null) Adds a INNER JOIN clause to the query using the CcBlock relation
*
- * @method CcBlockcontents findOneByDbId(int $id) Return the first CcBlockcontents filtered by the id column
- * @method CcBlockcontents findOneByDbBlockId(int $block_id) Return the first CcBlockcontents filtered by the block_id column
- * @method CcBlockcontents findOneByDbFileId(int $file_id) Return the first CcBlockcontents filtered by the file_id column
- * @method CcBlockcontents findOneByDbPosition(int $position) Return the first CcBlockcontents filtered by the position column
- * @method CcBlockcontents findOneByDbTrackOffset(double $trackoffset) Return the first CcBlockcontents filtered by the trackoffset column
- * @method CcBlockcontents findOneByDbCliplength(string $cliplength) Return the first CcBlockcontents filtered by the cliplength column
- * @method CcBlockcontents findOneByDbCuein(string $cuein) Return the first CcBlockcontents filtered by the cuein column
- * @method CcBlockcontents findOneByDbCueout(string $cueout) Return the first CcBlockcontents filtered by the cueout column
- * @method CcBlockcontents findOneByDbFadein(string $fadein) Return the first CcBlockcontents filtered by the fadein column
- * @method CcBlockcontents findOneByDbFadeout(string $fadeout) Return the first CcBlockcontents filtered by the fadeout column
+ * @method CcBlockcontents findOne(PropelPDO $con = null) Return the first CcBlockcontents matching the query
+ * @method CcBlockcontents findOneOrCreate(PropelPDO $con = null) Return the first CcBlockcontents matching the query, or a new CcBlockcontents object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcBlockcontents objects filtered by the id column
- * @method array findByDbBlockId(int $block_id) Return CcBlockcontents objects filtered by the block_id column
- * @method array findByDbFileId(int $file_id) Return CcBlockcontents objects filtered by the file_id column
- * @method array findByDbPosition(int $position) Return CcBlockcontents objects filtered by the position column
- * @method array findByDbTrackOffset(double $trackoffset) Return CcBlockcontents objects filtered by the trackoffset column
- * @method array findByDbCliplength(string $cliplength) Return CcBlockcontents objects filtered by the cliplength column
- * @method array findByDbCuein(string $cuein) Return CcBlockcontents objects filtered by the cuein column
- * @method array findByDbCueout(string $cueout) Return CcBlockcontents objects filtered by the cueout column
- * @method array findByDbFadein(string $fadein) Return CcBlockcontents objects filtered by the fadein column
- * @method array findByDbFadeout(string $fadeout) Return CcBlockcontents objects filtered by the fadeout column
+ * @method CcBlockcontents findOneByDbBlockId(int $block_id) Return the first CcBlockcontents filtered by the block_id column
+ * @method CcBlockcontents findOneByDbFileId(int $file_id) Return the first CcBlockcontents filtered by the file_id column
+ * @method CcBlockcontents findOneByDbPosition(int $position) Return the first CcBlockcontents filtered by the position column
+ * @method CcBlockcontents findOneByDbTrackOffset(double $trackoffset) Return the first CcBlockcontents filtered by the trackoffset column
+ * @method CcBlockcontents findOneByDbCliplength(string $cliplength) Return the first CcBlockcontents filtered by the cliplength column
+ * @method CcBlockcontents findOneByDbCuein(string $cuein) Return the first CcBlockcontents filtered by the cuein column
+ * @method CcBlockcontents findOneByDbCueout(string $cueout) Return the first CcBlockcontents filtered by the cueout column
+ * @method CcBlockcontents findOneByDbFadein(string $fadein) Return the first CcBlockcontents filtered by the fadein column
+ * @method CcBlockcontents findOneByDbFadeout(string $fadeout) Return the first CcBlockcontents filtered by the fadeout column
+ *
+ * @method array findByDbId(int $id) Return CcBlockcontents objects filtered by the id column
+ * @method array findByDbBlockId(int $block_id) Return CcBlockcontents objects filtered by the block_id column
+ * @method array findByDbFileId(int $file_id) Return CcBlockcontents objects filtered by the file_id column
+ * @method array findByDbPosition(int $position) Return CcBlockcontents objects filtered by the position column
+ * @method array findByDbTrackOffset(double $trackoffset) Return CcBlockcontents objects filtered by the trackoffset column
+ * @method array findByDbCliplength(string $cliplength) Return CcBlockcontents objects filtered by the cliplength column
+ * @method array findByDbCuein(string $cuein) Return CcBlockcontents objects filtered by the cuein column
+ * @method array findByDbCueout(string $cueout) Return CcBlockcontents objects filtered by the cueout column
+ * @method array findByDbFadein(string $fadein) Return CcBlockcontents objects filtered by the fadein column
+ * @method array findByDbFadeout(string $fadeout) Return CcBlockcontents objects filtered by the fadeout column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcBlockcontentsQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcBlockcontentsQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcBlockcontents';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcBlockcontentsQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcBlockcontents', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcBlockcontentsQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcBlockcontentsQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcBlockcontentsQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcBlockcontentsQuery) {
+ return $criteria;
+ }
+ $query = new CcBlockcontentsQuery(null, null, $modelAlias);
- /**
- * Returns a new CcBlockcontentsQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcBlockcontentsQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcBlockcontentsQuery) {
- return $criteria;
- }
- $query = new CcBlockcontentsQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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 CcBlockcontents|array|mixed the result, formatted by the current formatter
- */
- public function findPk($key, $con = null)
- {
- if ((null !== ($obj = CcBlockcontentsPeer::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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcBlockcontents|CcBlockcontents[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcBlockcontentsPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
- /**
- * Filter the query by primary key
- *
- * @param mixed $key Primary key to use for the query
- *
- * @return CcBlockcontentsQuery The current query, for fluid interface
- */
- public function filterByPrimaryKey($key)
- {
- return $this->addUsingAlias(CcBlockcontentsPeer::ID, $key, Criteria::EQUAL);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcBlockcontents A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * Filter the query by a list of primary keys
- *
- * @param array $keys The list of primary key to use for the query
- *
- * @return CcBlockcontentsQuery The current query, for fluid interface
- */
- public function filterByPrimaryKeys($keys)
- {
- return $this->addUsingAlias(CcBlockcontentsPeer::ID, $keys, Criteria::IN);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcBlockcontents A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "block_id", "file_id", "position", "trackoffset", "cliplength", "cuein", "cueout", "fadein", "fadeout" FROM "cc_blockcontents" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcBlockcontents();
+ $obj->hydrate($row);
+ CcBlockcontentsPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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 CcBlockcontentsQuery 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(CcBlockcontentsPeer::ID, $dbId, $comparison);
- }
+ return $obj;
+ }
- /**
- * Filter the query on the block_id column
- *
- * @param int|array $dbBlockId 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 CcBlockcontentsQuery The current query, for fluid interface
- */
- public function filterByDbBlockId($dbBlockId = null, $comparison = null)
- {
- if (is_array($dbBlockId)) {
- $useMinMax = false;
- if (isset($dbBlockId['min'])) {
- $this->addUsingAlias(CcBlockcontentsPeer::BLOCK_ID, $dbBlockId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbBlockId['max'])) {
- $this->addUsingAlias(CcBlockcontentsPeer::BLOCK_ID, $dbBlockId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcBlockcontentsPeer::BLOCK_ID, $dbBlockId, $comparison);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcBlockcontents|CcBlockcontents[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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 CcBlockcontentsQuery 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(CcBlockcontentsPeer::FILE_ID, $dbFileId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbFileId['max'])) {
- $this->addUsingAlias(CcBlockcontentsPeer::FILE_ID, $dbFileId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcBlockcontentsPeer::FILE_ID, $dbFileId, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * 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 CcBlockcontentsQuery 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(CcBlockcontentsPeer::POSITION, $dbPosition['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbPosition['max'])) {
- $this->addUsingAlias(CcBlockcontentsPeer::POSITION, $dbPosition['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcBlockcontentsPeer::POSITION, $dbPosition, $comparison);
- }
+ /**
+ * 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|CcBlockcontents[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * Filter the query on the trackoffset column
- *
- * @param double|array $dbTrackOffset 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 CcBlockcontentsQuery The current query, for fluid interface
- */
- public function filterByDbTrackOffset($dbTrackOffset = null, $comparison = null)
- {
- if (is_array($dbTrackOffset)) {
- $useMinMax = false;
- if (isset($dbTrackOffset['min'])) {
- $this->addUsingAlias(CcBlockcontentsPeer::TRACKOFFSET, $dbTrackOffset['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbTrackOffset['max'])) {
- $this->addUsingAlias(CcBlockcontentsPeer::TRACKOFFSET, $dbTrackOffset['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcBlockcontentsPeer::TRACKOFFSET, $dbTrackOffset, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * Filter the query on the cliplength column
- *
- * @param string $dbCliplength 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 CcBlockcontentsQuery The current query, for fluid interface
- */
- public function filterByDbCliplength($dbCliplength = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbCliplength)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbCliplength)) {
- $dbCliplength = str_replace('*', '%', $dbCliplength);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcBlockcontentsPeer::CLIPLENGTH, $dbCliplength, $comparison);
- }
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
- /**
- * Filter the query on the cuein column
- *
- * @param string $dbCuein 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 CcBlockcontentsQuery The current query, for fluid interface
- */
- public function filterByDbCuein($dbCuein = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbCuein)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbCuein)) {
- $dbCuein = str_replace('*', '%', $dbCuein);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcBlockcontentsPeer::CUEIN, $dbCuein, $comparison);
- }
+ return $this->addUsingAlias(CcBlockcontentsPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * Filter the query on the cueout column
- *
- * @param string $dbCueout 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 CcBlockcontentsQuery The current query, for fluid interface
- */
- public function filterByDbCueout($dbCueout = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbCueout)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbCueout)) {
- $dbCueout = str_replace('*', '%', $dbCueout);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcBlockcontentsPeer::CUEOUT, $dbCueout, $comparison);
- }
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
- /**
- * 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 CcBlockcontentsQuery 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(CcBlockcontentsPeer::FADEIN, $dbFadein['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbFadein['max'])) {
- $this->addUsingAlias(CcBlockcontentsPeer::FADEIN, $dbFadein['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcBlockcontentsPeer::FADEIN, $dbFadein, $comparison);
- }
+ return $this->addUsingAlias(CcBlockcontentsPeer::ID, $keys, Criteria::IN);
+ }
- /**
- * 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 CcBlockcontentsQuery 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(CcBlockcontentsPeer::FADEOUT, $dbFadeout['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbFadeout['max'])) {
- $this->addUsingAlias(CcBlockcontentsPeer::FADEOUT, $dbFadeout['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcBlockcontentsPeer::FADEOUT, $dbFadeout, $comparison);
- }
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * 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 CcBlockcontentsQuery The current query, for fluid interface
- */
- public function filterByCcFiles($ccFiles, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcBlockcontentsPeer::FILE_ID, $ccFiles->getDbId(), $comparison);
- }
+ return $this->addUsingAlias(CcBlockcontentsPeer::ID, $dbId, $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 CcBlockcontentsQuery 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;
- }
+ /**
+ * Filter the query on the block_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbBlockId(1234); // WHERE block_id = 1234
+ * $query->filterByDbBlockId(array(12, 34)); // WHERE block_id IN (12, 34)
+ * $query->filterByDbBlockId(array('min' => 12)); // WHERE block_id >= 12
+ * $query->filterByDbBlockId(array('max' => 12)); // WHERE block_id <= 12
+ *
+ *
+ * @see filterByCcBlock()
+ *
+ * @param mixed $dbBlockId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbBlockId($dbBlockId = null, $comparison = null)
+ {
+ if (is_array($dbBlockId)) {
+ $useMinMax = false;
+ if (isset($dbBlockId['min'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::BLOCK_ID, $dbBlockId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbBlockId['max'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::BLOCK_ID, $dbBlockId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * 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');
- }
+ return $this->addUsingAlias(CcBlockcontentsPeer::BLOCK_ID, $dbBlockId, $comparison);
+ }
- /**
- * Filter the query by a related CcBlock object
- *
- * @param CcBlock $ccBlock the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return CcBlockcontentsQuery The current query, for fluid interface
- */
- public function filterByCcBlock($ccBlock, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcBlockcontentsPeer::BLOCK_ID, $ccBlock->getDbId(), $comparison);
- }
+ /**
+ * Filter the query on the file_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbFileId(1234); // WHERE file_id = 1234
+ * $query->filterByDbFileId(array(12, 34)); // WHERE file_id IN (12, 34)
+ * $query->filterByDbFileId(array('min' => 12)); // WHERE file_id >= 12
+ * $query->filterByDbFileId(array('max' => 12)); // WHERE file_id <= 12
+ *
+ *
+ * @see filterByCcFiles()
+ *
+ * @param mixed $dbFileId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcontentsQuery 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(CcBlockcontentsPeer::FILE_ID, $dbFileId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbFileId['max'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::FILE_ID, $dbFileId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * Adds a JOIN clause to the query using the CcBlock relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return CcBlockcontentsQuery The current query, for fluid interface
- */
- public function joinCcBlock($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcBlock');
-
- // 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, 'CcBlock');
- }
-
- return $this;
- }
+ return $this->addUsingAlias(CcBlockcontentsPeer::FILE_ID, $dbFileId, $comparison);
+ }
- /**
- * Use the CcBlock relation CcBlock 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 CcBlockQuery A secondary query class using the current class as primary query
- */
- public function useCcBlockQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- return $this
- ->joinCcBlock($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcBlock', 'CcBlockQuery');
- }
+ /**
+ * Filter the query on the position column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbPosition(1234); // WHERE position = 1234
+ * $query->filterByDbPosition(array(12, 34)); // WHERE position IN (12, 34)
+ * $query->filterByDbPosition(array('min' => 12)); // WHERE position >= 12
+ * $query->filterByDbPosition(array('max' => 12)); // WHERE position <= 12
+ *
+ *
+ * @param mixed $dbPosition The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcontentsQuery 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(CcBlockcontentsPeer::POSITION, $dbPosition['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbPosition['max'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::POSITION, $dbPosition['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * Exclude object from result
- *
- * @param CcBlockcontents $ccBlockcontents Object to remove from the list of results
- *
- * @return CcBlockcontentsQuery The current query, for fluid interface
- */
- public function prune($ccBlockcontents = null)
- {
- if ($ccBlockcontents) {
- $this->addUsingAlias(CcBlockcontentsPeer::ID, $ccBlockcontents->getDbId(), Criteria::NOT_EQUAL);
- }
-
- return $this;
- }
+ return $this->addUsingAlias(CcBlockcontentsPeer::POSITION, $dbPosition, $comparison);
+ }
- /**
- * 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->findRelatedCcBlocks($con);
-
- return $this->preDelete($con);
- }
+ /**
+ * Filter the query on the trackoffset column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbTrackOffset(1234); // WHERE trackoffset = 1234
+ * $query->filterByDbTrackOffset(array(12, 34)); // WHERE trackoffset IN (12, 34)
+ * $query->filterByDbTrackOffset(array('min' => 12)); // WHERE trackoffset >= 12
+ * $query->filterByDbTrackOffset(array('max' => 12)); // WHERE trackoffset <= 12
+ *
+ *
+ * @param mixed $dbTrackOffset The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbTrackOffset($dbTrackOffset = null, $comparison = null)
+ {
+ if (is_array($dbTrackOffset)) {
+ $useMinMax = false;
+ if (isset($dbTrackOffset['min'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::TRACKOFFSET, $dbTrackOffset['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbTrackOffset['max'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::TRACKOFFSET, $dbTrackOffset['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * 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->updateRelatedCcBlocks($con);
-
- return $this->postDelete($affectedRows, $con);
- }
+ return $this->addUsingAlias(CcBlockcontentsPeer::TRACKOFFSET, $dbTrackOffset, $comparison);
+ }
- /**
- * 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->findRelatedCcBlocks($con);
-
- return $this->preUpdate($values, $con, $forceIndividualSaves);
- }
+ /**
+ * Filter the query on the cliplength column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCliplength('fooValue'); // WHERE cliplength = 'fooValue'
+ * $query->filterByDbCliplength('%fooValue%'); // WHERE cliplength LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbCliplength 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 CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbCliplength($dbCliplength = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbCliplength)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCliplength)) {
+ $dbCliplength = str_replace('*', '%', $dbCliplength);
+ $comparison = Criteria::LIKE;
+ }
+ }
- /**
- * 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->updateRelatedCcBlocks($con);
-
- return $this->postUpdate($affectedRows, $con);
- }
+ return $this->addUsingAlias(CcBlockcontentsPeer::CLIPLENGTH, $dbCliplength, $comparison);
+ }
- // aggregate_column_relation behavior
-
- /**
- * Finds the related CcBlock objects and keep them for later
- *
- * @param PropelPDO $con A connection object
- */
- protected function findRelatedCcBlocks($con)
- {
- $criteria = clone $this;
- if ($this->useAliasInSQL) {
- $alias = $this->getModelAlias();
- $criteria->removeAlias($alias);
- } else {
- $alias = '';
- }
- $this->ccBlocks = CcBlockQuery::create()
- ->joinCcBlockcontents($alias)
- ->mergeWith($criteria)
- ->find($con);
- }
-
- protected function updateRelatedCcBlocks($con)
- {
- foreach ($this->ccBlocks as $ccBlock) {
- $ccBlock->updateDbLength($con);
- }
- $this->ccBlocks = array();
- }
+ /**
+ * Filter the query on the cuein column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCuein('fooValue'); // WHERE cuein = 'fooValue'
+ * $query->filterByDbCuein('%fooValue%'); // WHERE cuein LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbCuein 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 CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbCuein($dbCuein = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbCuein)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCuein)) {
+ $dbCuein = str_replace('*', '%', $dbCuein);
+ $comparison = Criteria::LIKE;
+ }
+ }
-} // BaseCcBlockcontentsQuery
+ return $this->addUsingAlias(CcBlockcontentsPeer::CUEIN, $dbCuein, $comparison);
+ }
+
+ /**
+ * Filter the query on the cueout column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCueout('fooValue'); // WHERE cueout = 'fooValue'
+ * $query->filterByDbCueout('%fooValue%'); // WHERE cueout LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbCueout 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 CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbCueout($dbCueout = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbCueout)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCueout)) {
+ $dbCueout = str_replace('*', '%', $dbCueout);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcBlockcontentsPeer::CUEOUT, $dbCueout, $comparison);
+ }
+
+ /**
+ * Filter the query on the fadein column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbFadein('2011-03-14'); // WHERE fadein = '2011-03-14'
+ * $query->filterByDbFadein('now'); // WHERE fadein = '2011-03-14'
+ * $query->filterByDbFadein(array('max' => 'yesterday')); // WHERE fadein < '2011-03-13'
+ *
+ *
+ * @param mixed $dbFadein The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcontentsQuery 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(CcBlockcontentsPeer::FADEIN, $dbFadein['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbFadein['max'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::FADEIN, $dbFadein['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcBlockcontentsPeer::FADEIN, $dbFadein, $comparison);
+ }
+
+ /**
+ * Filter the query on the fadeout column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbFadeout('2011-03-14'); // WHERE fadeout = '2011-03-14'
+ * $query->filterByDbFadeout('now'); // WHERE fadeout = '2011-03-14'
+ * $query->filterByDbFadeout(array('max' => 'yesterday')); // WHERE fadeout < '2011-03-13'
+ *
+ *
+ * @param mixed $dbFadeout The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcontentsQuery 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(CcBlockcontentsPeer::FADEOUT, $dbFadeout['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbFadeout['max'])) {
+ $this->addUsingAlias(CcBlockcontentsPeer::FADEOUT, $dbFadeout['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcBlockcontentsPeer::FADEOUT, $dbFadeout, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcFiles object
+ *
+ * @param CcFiles|PropelObjectCollection $ccFiles The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcFiles($ccFiles, $comparison = null)
+ {
+ if ($ccFiles instanceof CcFiles) {
+ return $this
+ ->addUsingAlias(CcBlockcontentsPeer::FILE_ID, $ccFiles->getDbId(), $comparison);
+ } elseif ($ccFiles instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcBlockcontentsPeer::FILE_ID, $ccFiles->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcFiles() only accepts arguments of type CcFiles or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function joinCcFiles($relationAlias = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcFiles($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery');
+ }
+
+ /**
+ * Filter the query by a related CcBlock object
+ *
+ * @param CcBlock|PropelObjectCollection $ccBlock The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcBlock($ccBlock, $comparison = null)
+ {
+ if ($ccBlock instanceof CcBlock) {
+ return $this
+ ->addUsingAlias(CcBlockcontentsPeer::BLOCK_ID, $ccBlock->getDbId(), $comparison);
+ } elseif ($ccBlock instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcBlockcontentsPeer::BLOCK_ID, $ccBlock->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcBlock() only accepts arguments of type CcBlock or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcBlock relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function joinCcBlock($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcBlock');
+
+ // 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, 'CcBlock');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcBlock relation CcBlock 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 CcBlockQuery A secondary query class using the current class as primary query
+ */
+ public function useCcBlockQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcBlock($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcBlock', 'CcBlockQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcBlockcontents $ccBlockcontents Object to remove from the list of results
+ *
+ * @return CcBlockcontentsQuery The current query, for fluid interface
+ */
+ public function prune($ccBlockcontents = null)
+ {
+ if ($ccBlockcontents) {
+ $this->addUsingAlias(CcBlockcontentsPeer::ID, $ccBlockcontents->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->findRelatedCcBlocks($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->updateRelatedCcBlocks($con);
+
+ return $this->postDelete($affectedRows, $con);
+ }
+
+ /**
+ * Code to execute before every UPDATE statement
+ *
+ * @param array $values The associative 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(), otherwise 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->findRelatedCcBlocks($con);
+
+ return $this->preUpdate($values, $con, $forceIndividualSaves);
+ }
+
+ /**
+ * Code to execute after every UPDATE statement
+ *
+ * @param int $affectedRows the number of updated rows
+ * @param PropelPDO $con The connection object used by the query
+ */
+ protected function basePostUpdate($affectedRows, PropelPDO $con)
+ {
+ // aggregate_column_relation behavior
+ $this->updateRelatedCcBlocks($con);
+
+ return $this->postUpdate($affectedRows, $con);
+ }
+
+ // aggregate_column_relation behavior
+
+ /**
+ * Finds the related CcBlock objects and keep them for later
+ *
+ * @param PropelPDO $con A connection object
+ */
+ protected function findRelatedCcBlocks($con)
+ {
+ $criteria = clone $this;
+ if ($this->useAliasInSQL) {
+ $alias = $this->getModelAlias();
+ $criteria->removeAlias($alias);
+ } else {
+ $alias = '';
+ }
+ $this->ccBlocks = CcBlockQuery::create()
+ ->joinCcBlockcontents($alias)
+ ->mergeWith($criteria)
+ ->find($con);
+ }
+
+ protected function updateRelatedCcBlocks($con)
+ {
+ foreach ($this->ccBlocks as $ccBlock) {
+ $ccBlock->updateDbLength($con);
+ }
+ $this->ccBlocks = array();
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteria.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteria.php
index 2982a3b86..069a8f96e 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteria.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteria.php
@@ -4,998 +4,1160 @@
/**
* Base class that represents a row from the 'cc_blockcriteria' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
+abstract class BaseCcBlockcriteria extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcBlockcriteriaPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcBlockcriteriaPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the criteria field.
- * @var string
- */
- protected $criteria;
-
- /**
- * The value for the modifier field.
- * @var string
- */
- protected $modifier;
-
- /**
- * The value for the value field.
- * @var string
- */
- protected $value;
-
- /**
- * The value for the extra field.
- * @var string
- */
- protected $extra;
-
- /**
- * The value for the block_id field.
- * @var int
- */
- protected $block_id;
-
- /**
- * @var CcBlock
- */
- protected $aCcBlock;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Get the [id] column value.
- *
- * @return int
- */
- public function getDbId()
- {
- return $this->id;
- }
-
- /**
- * Get the [criteria] column value.
- *
- * @return string
- */
- public function getDbCriteria()
- {
- return $this->criteria;
- }
-
- /**
- * Get the [modifier] column value.
- *
- * @return string
- */
- public function getDbModifier()
- {
- return $this->modifier;
- }
-
- /**
- * Get the [value] column value.
- *
- * @return string
- */
- public function getDbValue()
- {
- return $this->value;
- }
-
- /**
- * Get the [extra] column value.
- *
- * @return string
- */
- public function getDbExtra()
- {
- return $this->extra;
- }
-
- /**
- * Get the [block_id] column value.
- *
- * @return int
- */
- public function getDbBlockId()
- {
- return $this->block_id;
- }
-
- /**
- * Set the value of [id] column.
- *
- * @param int $v new value
- * @return CcBlockcriteria 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[] = CcBlockcriteriaPeer::ID;
- }
-
- return $this;
- } // setDbId()
-
- /**
- * Set the value of [criteria] column.
- *
- * @param string $v new value
- * @return CcBlockcriteria The current object (for fluent API support)
- */
- public function setDbCriteria($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->criteria !== $v) {
- $this->criteria = $v;
- $this->modifiedColumns[] = CcBlockcriteriaPeer::CRITERIA;
- }
-
- return $this;
- } // setDbCriteria()
-
- /**
- * Set the value of [modifier] column.
- *
- * @param string $v new value
- * @return CcBlockcriteria The current object (for fluent API support)
- */
- public function setDbModifier($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->modifier !== $v) {
- $this->modifier = $v;
- $this->modifiedColumns[] = CcBlockcriteriaPeer::MODIFIER;
- }
-
- return $this;
- } // setDbModifier()
-
- /**
- * Set the value of [value] column.
- *
- * @param string $v new value
- * @return CcBlockcriteria 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[] = CcBlockcriteriaPeer::VALUE;
- }
-
- return $this;
- } // setDbValue()
-
- /**
- * Set the value of [extra] column.
- *
- * @param string $v new value
- * @return CcBlockcriteria The current object (for fluent API support)
- */
- public function setDbExtra($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->extra !== $v) {
- $this->extra = $v;
- $this->modifiedColumns[] = CcBlockcriteriaPeer::EXTRA;
- }
-
- return $this;
- } // setDbExtra()
-
- /**
- * Set the value of [block_id] column.
- *
- * @param int $v new value
- * @return CcBlockcriteria The current object (for fluent API support)
- */
- public function setDbBlockId($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->block_id !== $v) {
- $this->block_id = $v;
- $this->modifiedColumns[] = CcBlockcriteriaPeer::BLOCK_ID;
- }
-
- if ($this->aCcBlock !== null && $this->aCcBlock->getDbId() !== $v) {
- $this->aCcBlock = null;
- }
-
- return $this;
- } // setDbBlockId()
-
- /**
- * 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->criteria = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
- $this->modifier = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
- $this->value = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
- $this->extra = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
- $this->block_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 6; // 6 = CcBlockcriteriaPeer::NUM_COLUMNS - CcBlockcriteriaPeer::NUM_LAZY_LOAD_COLUMNS).
-
- } catch (Exception $e) {
- throw new PropelException("Error populating CcBlockcriteria 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->aCcBlock !== null && $this->block_id !== $this->aCcBlock->getDbId()) {
- $this->aCcBlock = 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(CcBlockcriteriaPeer::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 = CcBlockcriteriaPeer::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->aCcBlock = 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(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $con->beginTransaction();
- try {
- $ret = $this->preDelete($con);
- if ($ret) {
- CcBlockcriteriaQuery::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(CcBlockcriteriaPeer::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);
- CcBlockcriteriaPeer::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->aCcBlock !== null) {
- if ($this->aCcBlock->isModified() || $this->aCcBlock->isNew()) {
- $affectedRows += $this->aCcBlock->save($con);
- }
- $this->setCcBlock($this->aCcBlock);
- }
-
- if ($this->isNew() ) {
- $this->modifiedColumns[] = CcBlockcriteriaPeer::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(CcBlockcriteriaPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcBlockcriteriaPeer::ID.')');
- }
-
- $pk = BasePeer::doInsert($criteria, $con);
- $affectedRows += 1;
- $this->setDbId($pk); //[IMV] update autoincrement primary key
- $this->setNew(false);
- } else {
- $affectedRows += CcBlockcriteriaPeer::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->aCcBlock !== null) {
- if (!$this->aCcBlock->validate($columns)) {
- $failureMap = array_merge($failureMap, $this->aCcBlock->getValidationFailures());
- }
- }
-
-
- if (($retval = CcBlockcriteriaPeer::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 = CcBlockcriteriaPeer::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->getDbCriteria();
- break;
- case 2:
- return $this->getDbModifier();
- break;
- case 3:
- return $this->getDbValue();
- break;
- case 4:
- return $this->getDbExtra();
- break;
- case 5:
- return $this->getDbBlockId();
- 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 = CcBlockcriteriaPeer::getFieldNames($keyType);
- $result = array(
- $keys[0] => $this->getDbId(),
- $keys[1] => $this->getDbCriteria(),
- $keys[2] => $this->getDbModifier(),
- $keys[3] => $this->getDbValue(),
- $keys[4] => $this->getDbExtra(),
- $keys[5] => $this->getDbBlockId(),
- );
- if ($includeForeignObjects) {
- if (null !== $this->aCcBlock) {
- $result['CcBlock'] = $this->aCcBlock->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 = CcBlockcriteriaPeer::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->setDbCriteria($value);
- break;
- case 2:
- $this->setDbModifier($value);
- break;
- case 3:
- $this->setDbValue($value);
- break;
- case 4:
- $this->setDbExtra($value);
- break;
- case 5:
- $this->setDbBlockId($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 = CcBlockcriteriaPeer::getFieldNames($keyType);
-
- if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
- if (array_key_exists($keys[1], $arr)) $this->setDbCriteria($arr[$keys[1]]);
- if (array_key_exists($keys[2], $arr)) $this->setDbModifier($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setDbValue($arr[$keys[3]]);
- if (array_key_exists($keys[4], $arr)) $this->setDbExtra($arr[$keys[4]]);
- if (array_key_exists($keys[5], $arr)) $this->setDbBlockId($arr[$keys[5]]);
- }
-
- /**
- * 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(CcBlockcriteriaPeer::DATABASE_NAME);
-
- if ($this->isColumnModified(CcBlockcriteriaPeer::ID)) $criteria->add(CcBlockcriteriaPeer::ID, $this->id);
- if ($this->isColumnModified(CcBlockcriteriaPeer::CRITERIA)) $criteria->add(CcBlockcriteriaPeer::CRITERIA, $this->criteria);
- if ($this->isColumnModified(CcBlockcriteriaPeer::MODIFIER)) $criteria->add(CcBlockcriteriaPeer::MODIFIER, $this->modifier);
- if ($this->isColumnModified(CcBlockcriteriaPeer::VALUE)) $criteria->add(CcBlockcriteriaPeer::VALUE, $this->value);
- if ($this->isColumnModified(CcBlockcriteriaPeer::EXTRA)) $criteria->add(CcBlockcriteriaPeer::EXTRA, $this->extra);
- if ($this->isColumnModified(CcBlockcriteriaPeer::BLOCK_ID)) $criteria->add(CcBlockcriteriaPeer::BLOCK_ID, $this->block_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(CcBlockcriteriaPeer::DATABASE_NAME);
- $criteria->add(CcBlockcriteriaPeer::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 CcBlockcriteria (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->setDbCriteria($this->criteria);
- $copyObj->setDbModifier($this->modifier);
- $copyObj->setDbValue($this->value);
- $copyObj->setDbExtra($this->extra);
- $copyObj->setDbBlockId($this->block_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 CcBlockcriteria 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 CcBlockcriteriaPeer
- */
- public function getPeer()
- {
- if (self::$peer === null) {
- self::$peer = new CcBlockcriteriaPeer();
- }
- return self::$peer;
- }
-
- /**
- * Declares an association between this object and a CcBlock object.
- *
- * @param CcBlock $v
- * @return CcBlockcriteria The current object (for fluent API support)
- * @throws PropelException
- */
- public function setCcBlock(CcBlock $v = null)
- {
- if ($v === null) {
- $this->setDbBlockId(NULL);
- } else {
- $this->setDbBlockId($v->getDbId());
- }
-
- $this->aCcBlock = $v;
-
- // Add binding for other direction of this n:n relationship.
- // If this object has already been added to the CcBlock object, it will not be re-added.
- if ($v !== null) {
- $v->addCcBlockcriteria($this);
- }
-
- return $this;
- }
-
-
- /**
- * Get the associated CcBlock object
- *
- * @param PropelPDO Optional Connection object.
- * @return CcBlock The associated CcBlock object.
- * @throws PropelException
- */
- public function getCcBlock(PropelPDO $con = null)
- {
- if ($this->aCcBlock === null && ($this->block_id !== null)) {
- $this->aCcBlock = CcBlockQuery::create()->findPk($this->block_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->aCcBlock->addCcBlockcriterias($this);
- */
- }
- return $this->aCcBlock;
- }
-
- /**
- * Clears the current object and sets all attributes to their default values
- */
- public function clear()
- {
- $this->id = null;
- $this->criteria = null;
- $this->modifier = null;
- $this->value = null;
- $this->extra = null;
- $this->block_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->aCcBlock = 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);
- }
-
-} // BaseCcBlockcriteria
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcBlockcriteriaPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcBlockcriteriaPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the criteria field.
+ * @var string
+ */
+ protected $criteria;
+
+ /**
+ * The value for the modifier field.
+ * @var string
+ */
+ protected $modifier;
+
+ /**
+ * The value for the value field.
+ * @var string
+ */
+ protected $value;
+
+ /**
+ * The value for the extra field.
+ * @var string
+ */
+ protected $extra;
+
+ /**
+ * The value for the block_id field.
+ * @var int
+ */
+ protected $block_id;
+
+ /**
+ * @var CcBlock
+ */
+ protected $aCcBlock;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getDbId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [criteria] column value.
+ *
+ * @return string
+ */
+ public function getDbCriteria()
+ {
+
+ return $this->criteria;
+ }
+
+ /**
+ * Get the [modifier] column value.
+ *
+ * @return string
+ */
+ public function getDbModifier()
+ {
+
+ return $this->modifier;
+ }
+
+ /**
+ * Get the [value] column value.
+ *
+ * @return string
+ */
+ public function getDbValue()
+ {
+
+ return $this->value;
+ }
+
+ /**
+ * Get the [extra] column value.
+ *
+ * @return string
+ */
+ public function getDbExtra()
+ {
+
+ return $this->extra;
+ }
+
+ /**
+ * Get the [block_id] column value.
+ *
+ * @return int
+ */
+ public function getDbBlockId()
+ {
+
+ return $this->block_id;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcBlockcriteria The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcBlockcriteriaPeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [criteria] column.
+ *
+ * @param string $v new value
+ * @return CcBlockcriteria The current object (for fluent API support)
+ */
+ public function setDbCriteria($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->criteria !== $v) {
+ $this->criteria = $v;
+ $this->modifiedColumns[] = CcBlockcriteriaPeer::CRITERIA;
+ }
+
+
+ return $this;
+ } // setDbCriteria()
+
+ /**
+ * Set the value of [modifier] column.
+ *
+ * @param string $v new value
+ * @return CcBlockcriteria The current object (for fluent API support)
+ */
+ public function setDbModifier($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->modifier !== $v) {
+ $this->modifier = $v;
+ $this->modifiedColumns[] = CcBlockcriteriaPeer::MODIFIER;
+ }
+
+
+ return $this;
+ } // setDbModifier()
+
+ /**
+ * Set the value of [value] column.
+ *
+ * @param string $v new value
+ * @return CcBlockcriteria The current object (for fluent API support)
+ */
+ public function setDbValue($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->value !== $v) {
+ $this->value = $v;
+ $this->modifiedColumns[] = CcBlockcriteriaPeer::VALUE;
+ }
+
+
+ return $this;
+ } // setDbValue()
+
+ /**
+ * Set the value of [extra] column.
+ *
+ * @param string $v new value
+ * @return CcBlockcriteria The current object (for fluent API support)
+ */
+ public function setDbExtra($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->extra !== $v) {
+ $this->extra = $v;
+ $this->modifiedColumns[] = CcBlockcriteriaPeer::EXTRA;
+ }
+
+
+ return $this;
+ } // setDbExtra()
+
+ /**
+ * Set the value of [block_id] column.
+ *
+ * @param int $v new value
+ * @return CcBlockcriteria The current object (for fluent API support)
+ */
+ public function setDbBlockId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->block_id !== $v) {
+ $this->block_id = $v;
+ $this->modifiedColumns[] = CcBlockcriteriaPeer::BLOCK_ID;
+ }
+
+ if ($this->aCcBlock !== null && $this->aCcBlock->getDbId() !== $v) {
+ $this->aCcBlock = null;
+ }
+
+
+ return $this;
+ } // setDbBlockId()
+
+ /**
+ * 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 resultset 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->criteria = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->modifier = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->value = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->extra = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->block_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 6; // 6 = CcBlockcriteriaPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcBlockcriteria 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->aCcBlock !== null && $this->block_id !== $this->aCcBlock->getDbId()) {
+ $this->aCcBlock = 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(CcBlockcriteriaPeer::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 = CcBlockcriteriaPeer::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->aCcBlock = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @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(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = CcBlockcriteriaQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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(CcBlockcriteriaPeer::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);
+ CcBlockcriteriaPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $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 corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcBlock !== null) {
+ if ($this->aCcBlock->isModified() || $this->aCcBlock->isNew()) {
+ $affectedRows += $this->aCcBlock->save($con);
+ }
+ $this->setCcBlock($this->aCcBlock);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcBlockcriteriaPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcBlockcriteriaPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_blockcriteria_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcBlockcriteriaPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcBlockcriteriaPeer::CRITERIA)) {
+ $modifiedColumns[':p' . $index++] = '"criteria"';
+ }
+ if ($this->isColumnModified(CcBlockcriteriaPeer::MODIFIER)) {
+ $modifiedColumns[':p' . $index++] = '"modifier"';
+ }
+ if ($this->isColumnModified(CcBlockcriteriaPeer::VALUE)) {
+ $modifiedColumns[':p' . $index++] = '"value"';
+ }
+ if ($this->isColumnModified(CcBlockcriteriaPeer::EXTRA)) {
+ $modifiedColumns[':p' . $index++] = '"extra"';
+ }
+ if ($this->isColumnModified(CcBlockcriteriaPeer::BLOCK_ID)) {
+ $modifiedColumns[':p' . $index++] = '"block_id"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_blockcriteria" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"criteria"':
+ $stmt->bindValue($identifier, $this->criteria, PDO::PARAM_STR);
+ break;
+ case '"modifier"':
+ $stmt->bindValue($identifier, $this->modifier, PDO::PARAM_STR);
+ break;
+ case '"value"':
+ $stmt->bindValue($identifier, $this->value, PDO::PARAM_STR);
+ break;
+ case '"extra"':
+ $stmt->bindValue($identifier, $this->extra, PDO::PARAM_STR);
+ break;
+ case '"block_id"':
+ $stmt->bindValue($identifier, $this->block_id, PDO::PARAM_INT);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcBlock !== null) {
+ if (!$this->aCcBlock->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcBlock->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CcBlockcriteriaPeer::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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcBlockcriteriaPeer::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->getDbCriteria();
+ break;
+ case 2:
+ return $this->getDbModifier();
+ break;
+ case 3:
+ return $this->getDbValue();
+ break;
+ case 4:
+ return $this->getDbExtra();
+ break;
+ case 5:
+ return $this->getDbBlockId();
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcBlockcriteria'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcBlockcriteria'][$this->getPrimaryKey()] = true;
+ $keys = CcBlockcriteriaPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbCriteria(),
+ $keys[2] => $this->getDbModifier(),
+ $keys[3] => $this->getDbValue(),
+ $keys[4] => $this->getDbExtra(),
+ $keys[5] => $this->getDbBlockId(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcBlock) {
+ $result['CcBlock'] = $this->aCcBlock->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcBlockcriteriaPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbCriteria($value);
+ break;
+ case 2:
+ $this->setDbModifier($value);
+ break;
+ case 3:
+ $this->setDbValue($value);
+ break;
+ case 4:
+ $this->setDbExtra($value);
+ break;
+ case 5:
+ $this->setDbBlockId($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 BasePeer::TYPE_PHPNAME
+ *
+ * @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 = CcBlockcriteriaPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbCriteria($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbModifier($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbValue($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbExtra($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDbBlockId($arr[$keys[5]]);
+ }
+
+ /**
+ * 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(CcBlockcriteriaPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcBlockcriteriaPeer::ID)) $criteria->add(CcBlockcriteriaPeer::ID, $this->id);
+ if ($this->isColumnModified(CcBlockcriteriaPeer::CRITERIA)) $criteria->add(CcBlockcriteriaPeer::CRITERIA, $this->criteria);
+ if ($this->isColumnModified(CcBlockcriteriaPeer::MODIFIER)) $criteria->add(CcBlockcriteriaPeer::MODIFIER, $this->modifier);
+ if ($this->isColumnModified(CcBlockcriteriaPeer::VALUE)) $criteria->add(CcBlockcriteriaPeer::VALUE, $this->value);
+ if ($this->isColumnModified(CcBlockcriteriaPeer::EXTRA)) $criteria->add(CcBlockcriteriaPeer::EXTRA, $this->extra);
+ if ($this->isColumnModified(CcBlockcriteriaPeer::BLOCK_ID)) $criteria->add(CcBlockcriteriaPeer::BLOCK_ID, $this->block_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(CcBlockcriteriaPeer::DATABASE_NAME);
+ $criteria->add(CcBlockcriteriaPeer::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 CcBlockcriteria (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbCriteria($this->getDbCriteria());
+ $copyObj->setDbModifier($this->getDbModifier());
+ $copyObj->setDbValue($this->getDbValue());
+ $copyObj->setDbExtra($this->getDbExtra());
+ $copyObj->setDbBlockId($this->getDbBlockId());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 CcBlockcriteria 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 CcBlockcriteriaPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcBlockcriteriaPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcBlock object.
+ *
+ * @param CcBlock $v
+ * @return CcBlockcriteria The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcBlock(CcBlock $v = null)
+ {
+ if ($v === null) {
+ $this->setDbBlockId(NULL);
+ } else {
+ $this->setDbBlockId($v->getDbId());
+ }
+
+ $this->aCcBlock = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcBlock object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcBlockcriteria($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcBlock object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcBlock The associated CcBlock object.
+ * @throws PropelException
+ */
+ public function getCcBlock(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcBlock === null && ($this->block_id !== null) && $doQuery) {
+ $this->aCcBlock = CcBlockQuery::create()->findPk($this->block_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->aCcBlock->addCcBlockcriterias($this);
+ */
+ }
+
+ return $this->aCcBlock;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->criteria = null;
+ $this->modifier = null;
+ $this->value = null;
+ $this->extra = null;
+ $this->block_id = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->aCcBlock instanceof Persistent) {
+ $this->aCcBlock->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ $this->aCcBlock = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcBlockcriteriaPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaPeer.php
index a523024ad..00024dfa6 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaPeer.php
@@ -4,986 +4,1012 @@
/**
* Base static class for performing query and update operations on the 'cc_blockcriteria' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcBlockcriteriaPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_blockcriteria';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcBlockcriteria';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcBlockcriteria';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcBlockcriteriaTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 6;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_blockcriteria.ID';
-
- /** the column name for the CRITERIA field */
- const CRITERIA = 'cc_blockcriteria.CRITERIA';
-
- /** the column name for the MODIFIER field */
- const MODIFIER = 'cc_blockcriteria.MODIFIER';
-
- /** the column name for the VALUE field */
- const VALUE = 'cc_blockcriteria.VALUE';
-
- /** the column name for the EXTRA field */
- const EXTRA = 'cc_blockcriteria.EXTRA';
-
- /** the column name for the BLOCK_ID field */
- const BLOCK_ID = 'cc_blockcriteria.BLOCK_ID';
-
- /**
- * An identiy map to hold any loaded instances of CcBlockcriteria objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcBlockcriteria[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbCriteria', 'DbModifier', 'DbValue', 'DbExtra', 'DbBlockId', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbCriteria', 'dbModifier', 'dbValue', 'dbExtra', 'dbBlockId', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::CRITERIA, self::MODIFIER, self::VALUE, self::EXTRA, self::BLOCK_ID, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CRITERIA', 'MODIFIER', 'VALUE', 'EXTRA', 'BLOCK_ID', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'criteria', 'modifier', 'value', 'extra', 'block_id', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
- );
-
- /**
- * 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, 'DbCriteria' => 1, 'DbModifier' => 2, 'DbValue' => 3, 'DbExtra' => 4, 'DbBlockId' => 5, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbCriteria' => 1, 'dbModifier' => 2, 'dbValue' => 3, 'dbExtra' => 4, 'dbBlockId' => 5, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::CRITERIA => 1, self::MODIFIER => 2, self::VALUE => 3, self::EXTRA => 4, self::BLOCK_ID => 5, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CRITERIA' => 1, 'MODIFIER' => 2, 'VALUE' => 3, 'EXTRA' => 4, 'BLOCK_ID' => 5, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'criteria' => 1, 'modifier' => 2, 'value' => 3, 'extra' => 4, 'block_id' => 5, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
- );
-
- /**
- * 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. CcBlockcriteriaPeer::COLUMN_NAME).
- * @return string
- */
- public static function alias($alias, $column)
- {
- return str_replace(CcBlockcriteriaPeer::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(CcBlockcriteriaPeer::ID);
- $criteria->addSelectColumn(CcBlockcriteriaPeer::CRITERIA);
- $criteria->addSelectColumn(CcBlockcriteriaPeer::MODIFIER);
- $criteria->addSelectColumn(CcBlockcriteriaPeer::VALUE);
- $criteria->addSelectColumn(CcBlockcriteriaPeer::EXTRA);
- $criteria->addSelectColumn(CcBlockcriteriaPeer::BLOCK_ID);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.CRITERIA');
- $criteria->addSelectColumn($alias . '.MODIFIER');
- $criteria->addSelectColumn($alias . '.VALUE');
- $criteria->addSelectColumn($alias . '.EXTRA');
- $criteria->addSelectColumn($alias . '.BLOCK_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(CcBlockcriteriaPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcBlockcriteriaPeer::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(CcBlockcriteriaPeer::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 CcBlockcriteria
- * @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 = CcBlockcriteriaPeer::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 CcBlockcriteriaPeer::populateObjects(CcBlockcriteriaPeer::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(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- if (!$criteria->hasSelectClause()) {
- $criteria = clone $criteria;
- CcBlockcriteriaPeer::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 CcBlockcriteria $value A CcBlockcriteria object.
- * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
- */
- public static function addInstanceToPool(CcBlockcriteria $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 CcBlockcriteria object or a primary key value.
- */
- public static function removeInstanceFromPool($value)
- {
- if (Propel::isInstancePoolingEnabled() && $value !== null) {
- if (is_object($value) && $value instanceof CcBlockcriteria) {
- $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 CcBlockcriteria 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 CcBlockcriteria 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_blockcriteria
- * 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 = CcBlockcriteriaPeer::getOMClass(false);
- // populate the object(s)
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key = CcBlockcriteriaPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj = CcBlockcriteriaPeer::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;
- CcBlockcriteriaPeer::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 (CcBlockcriteria object, last column rank)
- */
- public static function populateObject($row, $startcol = 0)
- {
- $key = CcBlockcriteriaPeer::getPrimaryKeyHashFromRow($row, $startcol);
- if (null !== ($obj = CcBlockcriteriaPeer::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 + CcBlockcriteriaPeer::NUM_COLUMNS;
- } else {
- $cls = CcBlockcriteriaPeer::OM_CLASS;
- $obj = new $cls();
- $col = $obj->hydrate($row, $startcol);
- CcBlockcriteriaPeer::addInstanceToPool($obj, $key);
- }
- return array($obj, $col);
- }
-
- /**
- * Returns the number of rows matching criteria, joining the related CcBlock 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 doCountJoinCcBlock(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(CcBlockcriteriaPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcBlockcriteriaPeer::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(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcBlockcriteriaPeer::BLOCK_ID, CcBlockPeer::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 CcBlockcriteria objects pre-filled with their CcBlock 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 CcBlockcriteria objects.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelectJoinCcBlock(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);
- }
-
- CcBlockcriteriaPeer::addSelectColumns($criteria);
- $startcol = (CcBlockcriteriaPeer::NUM_COLUMNS - CcBlockcriteriaPeer::NUM_LAZY_LOAD_COLUMNS);
- CcBlockPeer::addSelectColumns($criteria);
-
- $criteria->addJoin(CcBlockcriteriaPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcBlockcriteriaPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcBlockcriteriaPeer::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 = CcBlockcriteriaPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcBlockcriteriaPeer::addInstanceToPool($obj1, $key1);
- } // if $obj1 already loaded
-
- $key2 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol);
- if ($key2 !== null) {
- $obj2 = CcBlockPeer::getInstanceFromPool($key2);
- if (!$obj2) {
-
- $cls = CcBlockPeer::getOMClass(false);
-
- $obj2 = new $cls();
- $obj2->hydrate($row, $startcol);
- CcBlockPeer::addInstanceToPool($obj2, $key2);
- } // if obj2 already loaded
-
- // Add the $obj1 (CcBlockcriteria) to $obj2 (CcBlock)
- $obj2->addCcBlockcriteria($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(CcBlockcriteriaPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcBlockcriteriaPeer::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(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcBlockcriteriaPeer::BLOCK_ID, CcBlockPeer::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 CcBlockcriteria 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 CcBlockcriteria 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);
- }
-
- CcBlockcriteriaPeer::addSelectColumns($criteria);
- $startcol2 = (CcBlockcriteriaPeer::NUM_COLUMNS - CcBlockcriteriaPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcBlockPeer::addSelectColumns($criteria);
- $startcol3 = $startcol2 + (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcBlockcriteriaPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcBlockcriteriaPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcBlockcriteriaPeer::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 = CcBlockcriteriaPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcBlockcriteriaPeer::addInstanceToPool($obj1, $key1);
- } // if obj1 already loaded
-
- // Add objects for joined CcBlock rows
-
- $key2 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol2);
- if ($key2 !== null) {
- $obj2 = CcBlockPeer::getInstanceFromPool($key2);
- if (!$obj2) {
-
- $cls = CcBlockPeer::getOMClass(false);
-
- $obj2 = new $cls();
- $obj2->hydrate($row, $startcol2);
- CcBlockPeer::addInstanceToPool($obj2, $key2);
- } // if obj2 loaded
-
- // Add the $obj1 (CcBlockcriteria) to the collection in $obj2 (CcBlock)
- $obj2->addCcBlockcriteria($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(BaseCcBlockcriteriaPeer::DATABASE_NAME);
- if (!$dbMap->hasTable(BaseCcBlockcriteriaPeer::TABLE_NAME))
- {
- $dbMap->addTableObject(new CcBlockcriteriaTableMap());
- }
- }
-
- /**
- * 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 ? CcBlockcriteriaPeer::CLASS_DEFAULT : CcBlockcriteriaPeer::OM_CLASS;
- }
-
- /**
- * Method perform an INSERT on the database, given a CcBlockcriteria or Criteria object.
- *
- * @param mixed $values Criteria or CcBlockcriteria 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(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
- } else {
- $criteria = $values->buildCriteria(); // build Criteria from CcBlockcriteria object
- }
-
- if ($criteria->containsKey(CcBlockcriteriaPeer::ID) && $criteria->keyContainsValue(CcBlockcriteriaPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcBlockcriteriaPeer::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 CcBlockcriteria or Criteria object.
- *
- * @param mixed $values Criteria or CcBlockcriteria 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(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $selectCriteria = new Criteria(self::DATABASE_NAME);
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
-
- $comparison = $criteria->getComparison(CcBlockcriteriaPeer::ID);
- $value = $criteria->remove(CcBlockcriteriaPeer::ID);
- if ($value) {
- $selectCriteria->add(CcBlockcriteriaPeer::ID, $value, $comparison);
- } else {
- $selectCriteria->setPrimaryTableName(CcBlockcriteriaPeer::TABLE_NAME);
- }
-
- } else { // $values is CcBlockcriteria 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_blockcriteria 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(CcBlockcriteriaPeer::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(CcBlockcriteriaPeer::TABLE_NAME, $con, CcBlockcriteriaPeer::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).
- CcBlockcriteriaPeer::clearInstancePool();
- CcBlockcriteriaPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Method perform a DELETE on the database, given a CcBlockcriteria or Criteria object OR a primary key value.
- *
- * @param mixed $values Criteria or CcBlockcriteria 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(CcBlockcriteriaPeer::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.
- CcBlockcriteriaPeer::clearInstancePool();
- // rename for clarity
- $criteria = clone $values;
- } elseif ($values instanceof CcBlockcriteria) { // it's a model object
- // invalidate the cache for this single object
- CcBlockcriteriaPeer::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(CcBlockcriteriaPeer::ID, (array) $values, Criteria::IN);
- // invalidate the cache for this object(s)
- foreach ((array) $values as $singleval) {
- CcBlockcriteriaPeer::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);
- CcBlockcriteriaPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Validates all modified columns of given CcBlockcriteria 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 CcBlockcriteria $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(CcBlockcriteria $obj, $cols = null)
- {
- $columns = array();
-
- if ($cols) {
- $dbMap = Propel::getDatabaseMap(CcBlockcriteriaPeer::DATABASE_NAME);
- $tableMap = $dbMap->getTable(CcBlockcriteriaPeer::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(CcBlockcriteriaPeer::DATABASE_NAME, CcBlockcriteriaPeer::TABLE_NAME, $columns);
- }
-
- /**
- * Retrieve a single object by pkey.
- *
- * @param int $pk the primary key.
- * @param PropelPDO $con the connection to use
- * @return CcBlockcriteria
- */
- public static function retrieveByPK($pk, PropelPDO $con = null)
- {
-
- if (null !== ($obj = CcBlockcriteriaPeer::getInstanceFromPool((string) $pk))) {
- return $obj;
- }
-
- if ($con === null) {
- $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria = new Criteria(CcBlockcriteriaPeer::DATABASE_NAME);
- $criteria->add(CcBlockcriteriaPeer::ID, $pk);
-
- $v = CcBlockcriteriaPeer::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(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $objs = null;
- if (empty($pks)) {
- $objs = array();
- } else {
- $criteria = new Criteria(CcBlockcriteriaPeer::DATABASE_NAME);
- $criteria->add(CcBlockcriteriaPeer::ID, $pks, Criteria::IN);
- $objs = CcBlockcriteriaPeer::doSelect($criteria, $con);
- }
- return $objs;
- }
+abstract class BaseCcBlockcriteriaPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_blockcriteria';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcBlockcriteria';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcBlockcriteriaTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 6;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 6;
+
+ /** the column name for the id field */
+ const ID = 'cc_blockcriteria.id';
+
+ /** the column name for the criteria field */
+ const CRITERIA = 'cc_blockcriteria.criteria';
+
+ /** the column name for the modifier field */
+ const MODIFIER = 'cc_blockcriteria.modifier';
+
+ /** the column name for the value field */
+ const VALUE = 'cc_blockcriteria.value';
+
+ /** the column name for the extra field */
+ const EXTRA = 'cc_blockcriteria.extra';
+
+ /** the column name for the block_id field */
+ const BLOCK_ID = 'cc_blockcriteria.block_id';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcBlockcriteria objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcBlockcriteria[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcBlockcriteriaPeer::$fieldNames[CcBlockcriteriaPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbCriteria', 'DbModifier', 'DbValue', 'DbExtra', 'DbBlockId', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbCriteria', 'dbModifier', 'dbValue', 'dbExtra', 'dbBlockId', ),
+ BasePeer::TYPE_COLNAME => array (CcBlockcriteriaPeer::ID, CcBlockcriteriaPeer::CRITERIA, CcBlockcriteriaPeer::MODIFIER, CcBlockcriteriaPeer::VALUE, CcBlockcriteriaPeer::EXTRA, CcBlockcriteriaPeer::BLOCK_ID, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CRITERIA', 'MODIFIER', 'VALUE', 'EXTRA', 'BLOCK_ID', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'criteria', 'modifier', 'value', 'extra', 'block_id', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. CcBlockcriteriaPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbCriteria' => 1, 'DbModifier' => 2, 'DbValue' => 3, 'DbExtra' => 4, 'DbBlockId' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbCriteria' => 1, 'dbModifier' => 2, 'dbValue' => 3, 'dbExtra' => 4, 'dbBlockId' => 5, ),
+ BasePeer::TYPE_COLNAME => array (CcBlockcriteriaPeer::ID => 0, CcBlockcriteriaPeer::CRITERIA => 1, CcBlockcriteriaPeer::MODIFIER => 2, CcBlockcriteriaPeer::VALUE => 3, CcBlockcriteriaPeer::EXTRA => 4, CcBlockcriteriaPeer::BLOCK_ID => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CRITERIA' => 1, 'MODIFIER' => 2, 'VALUE' => 3, 'EXTRA' => 4, 'BLOCK_ID' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'criteria' => 1, 'modifier' => 2, 'value' => 3, 'extra' => 4, 'block_id' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcBlockcriteriaPeer::getFieldNames($toType);
+ $key = isset(CcBlockcriteriaPeer::$fieldKeys[$fromType][$name]) ? CcBlockcriteriaPeer::$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(CcBlockcriteriaPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcBlockcriteriaPeer::$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 CcBlockcriteriaPeer::$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. CcBlockcriteriaPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcBlockcriteriaPeer::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(CcBlockcriteriaPeer::ID);
+ $criteria->addSelectColumn(CcBlockcriteriaPeer::CRITERIA);
+ $criteria->addSelectColumn(CcBlockcriteriaPeer::MODIFIER);
+ $criteria->addSelectColumn(CcBlockcriteriaPeer::VALUE);
+ $criteria->addSelectColumn(CcBlockcriteriaPeer::EXTRA);
+ $criteria->addSelectColumn(CcBlockcriteriaPeer::BLOCK_ID);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.criteria');
+ $criteria->addSelectColumn($alias . '.modifier');
+ $criteria->addSelectColumn($alias . '.value');
+ $criteria->addSelectColumn($alias . '.extra');
+ $criteria->addSelectColumn($alias . '.block_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(CcBlockcriteriaPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockcriteriaPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(CcBlockcriteriaPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::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;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcBlockcriteria
+ * @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 = CcBlockcriteriaPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 CcBlockcriteriaPeer::populateObjects(CcBlockcriteriaPeer::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 directly (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(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcBlockcriteriaPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcBlockcriteriaPeer::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 CcBlockcriteria $obj A CcBlockcriteria object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcBlockcriteriaPeer::$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 CcBlockcriteria object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcBlockcriteria) {
+ $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 CcBlockcriteria object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(CcBlockcriteriaPeer::$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 CcBlockcriteria 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(CcBlockcriteriaPeer::$instances[$key])) {
+ return CcBlockcriteriaPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcBlockcriteriaPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcBlockcriteriaPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_blockcriteria
+ * 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 = CcBlockcriteriaPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcBlockcriteriaPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcBlockcriteriaPeer::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;
+ CcBlockcriteriaPeer::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 (CcBlockcriteria object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcBlockcriteriaPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcBlockcriteriaPeer::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 + CcBlockcriteriaPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = CcBlockcriteriaPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcBlockcriteriaPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcBlock 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 doCountJoinCcBlock(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(CcBlockcriteriaPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockcriteriaPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcBlockcriteriaPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcBlockcriteriaPeer::BLOCK_ID, CcBlockPeer::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 CcBlockcriteria objects pre-filled with their CcBlock 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 CcBlockcriteria objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcBlock(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(CcBlockcriteriaPeer::DATABASE_NAME);
+ }
+
+ CcBlockcriteriaPeer::addSelectColumns($criteria);
+ $startcol = CcBlockcriteriaPeer::NUM_HYDRATE_COLUMNS;
+ CcBlockPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcBlockcriteriaPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcBlockcriteriaPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcBlockcriteriaPeer::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 = CcBlockcriteriaPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcBlockcriteriaPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcBlockPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcBlockPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcBlockPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcBlockcriteria) to $obj2 (CcBlock)
+ $obj2->addCcBlockcriteria($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(CcBlockcriteriaPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcBlockcriteriaPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcBlockcriteriaPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcBlockcriteriaPeer::BLOCK_ID, CcBlockPeer::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 CcBlockcriteria 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 CcBlockcriteria 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(CcBlockcriteriaPeer::DATABASE_NAME);
+ }
+
+ CcBlockcriteriaPeer::addSelectColumns($criteria);
+ $startcol2 = CcBlockcriteriaPeer::NUM_HYDRATE_COLUMNS;
+
+ CcBlockPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcBlockPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcBlockcriteriaPeer::BLOCK_ID, CcBlockPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcBlockcriteriaPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcBlockcriteriaPeer::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 = CcBlockcriteriaPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcBlockcriteriaPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcBlock rows
+
+ $key2 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcBlockPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcBlockPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcBlockPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CcBlockcriteria) to the collection in $obj2 (CcBlock)
+ $obj2->addCcBlockcriteria($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(CcBlockcriteriaPeer::DATABASE_NAME)->getTable(CcBlockcriteriaPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcBlockcriteriaPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcBlockcriteriaPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \CcBlockcriteriaTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcBlockcriteriaPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a CcBlockcriteria or Criteria object.
+ *
+ * @param mixed $values Criteria or CcBlockcriteria 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(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcBlockcriteria object
+ }
+
+ if ($criteria->containsKey(CcBlockcriteriaPeer::ID) && $criteria->keyContainsValue(CcBlockcriteriaPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcBlockcriteriaPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(CcBlockcriteriaPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a CcBlockcriteria or Criteria object.
+ *
+ * @param mixed $values Criteria or CcBlockcriteria 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(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(CcBlockcriteriaPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcBlockcriteriaPeer::ID);
+ $value = $criteria->remove(CcBlockcriteriaPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcBlockcriteriaPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcBlockcriteriaPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcBlockcriteria object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(CcBlockcriteriaPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_blockcriteria table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::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(CcBlockcriteriaPeer::TABLE_NAME, $con, CcBlockcriteriaPeer::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).
+ CcBlockcriteriaPeer::clearInstancePool();
+ CcBlockcriteriaPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a CcBlockcriteria or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcBlockcriteria 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(CcBlockcriteriaPeer::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.
+ CcBlockcriteriaPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcBlockcriteria) { // it's a model object
+ // invalidate the cache for this single object
+ CcBlockcriteriaPeer::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(CcBlockcriteriaPeer::DATABASE_NAME);
+ $criteria->add(CcBlockcriteriaPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcBlockcriteriaPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcBlockcriteriaPeer::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);
+ CcBlockcriteriaPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcBlockcriteria 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 CcBlockcriteria $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($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcBlockcriteriaPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcBlockcriteriaPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcBlockcriteriaPeer::DATABASE_NAME, CcBlockcriteriaPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcBlockcriteria
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcBlockcriteriaPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcBlockcriteriaPeer::DATABASE_NAME);
+ $criteria->add(CcBlockcriteriaPeer::ID, $pk);
+
+ $v = CcBlockcriteriaPeer::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
+ * @return CcBlockcriteria[]
+ * @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(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcBlockcriteriaPeer::DATABASE_NAME);
+ $criteria->add(CcBlockcriteriaPeer::ID, $pks, Criteria::IN);
+ $objs = CcBlockcriteriaPeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
} // BaseCcBlockcriteriaPeer
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaQuery.php
index 9baabbd74..c91212458 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaQuery.php
@@ -4,369 +4,533 @@
/**
* Base class that represents a query for the 'cc_blockcriteria' table.
*
- *
*
- * @method CcBlockcriteriaQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcBlockcriteriaQuery orderByDbCriteria($order = Criteria::ASC) Order by the criteria column
- * @method CcBlockcriteriaQuery orderByDbModifier($order = Criteria::ASC) Order by the modifier column
- * @method CcBlockcriteriaQuery orderByDbValue($order = Criteria::ASC) Order by the value column
- * @method CcBlockcriteriaQuery orderByDbExtra($order = Criteria::ASC) Order by the extra column
- * @method CcBlockcriteriaQuery orderByDbBlockId($order = Criteria::ASC) Order by the block_id column
*
- * @method CcBlockcriteriaQuery groupByDbId() Group by the id column
- * @method CcBlockcriteriaQuery groupByDbCriteria() Group by the criteria column
- * @method CcBlockcriteriaQuery groupByDbModifier() Group by the modifier column
- * @method CcBlockcriteriaQuery groupByDbValue() Group by the value column
- * @method CcBlockcriteriaQuery groupByDbExtra() Group by the extra column
- * @method CcBlockcriteriaQuery groupByDbBlockId() Group by the block_id column
+ * @method CcBlockcriteriaQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcBlockcriteriaQuery orderByDbCriteria($order = Criteria::ASC) Order by the criteria column
+ * @method CcBlockcriteriaQuery orderByDbModifier($order = Criteria::ASC) Order by the modifier column
+ * @method CcBlockcriteriaQuery orderByDbValue($order = Criteria::ASC) Order by the value column
+ * @method CcBlockcriteriaQuery orderByDbExtra($order = Criteria::ASC) Order by the extra column
+ * @method CcBlockcriteriaQuery orderByDbBlockId($order = Criteria::ASC) Order by the block_id column
*
- * @method CcBlockcriteriaQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcBlockcriteriaQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcBlockcriteriaQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcBlockcriteriaQuery groupByDbId() Group by the id column
+ * @method CcBlockcriteriaQuery groupByDbCriteria() Group by the criteria column
+ * @method CcBlockcriteriaQuery groupByDbModifier() Group by the modifier column
+ * @method CcBlockcriteriaQuery groupByDbValue() Group by the value column
+ * @method CcBlockcriteriaQuery groupByDbExtra() Group by the extra column
+ * @method CcBlockcriteriaQuery groupByDbBlockId() Group by the block_id column
*
- * @method CcBlockcriteriaQuery leftJoinCcBlock($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcBlock relation
- * @method CcBlockcriteriaQuery rightJoinCcBlock($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcBlock relation
- * @method CcBlockcriteriaQuery innerJoinCcBlock($relationAlias = '') Adds a INNER JOIN clause to the query using the CcBlock relation
+ * @method CcBlockcriteriaQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcBlockcriteriaQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcBlockcriteriaQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcBlockcriteria findOne(PropelPDO $con = null) Return the first CcBlockcriteria matching the query
- * @method CcBlockcriteria findOneOrCreate(PropelPDO $con = null) Return the first CcBlockcriteria matching the query, or a new CcBlockcriteria object populated from the query conditions when no match is found
+ * @method CcBlockcriteriaQuery leftJoinCcBlock($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcBlock relation
+ * @method CcBlockcriteriaQuery rightJoinCcBlock($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcBlock relation
+ * @method CcBlockcriteriaQuery innerJoinCcBlock($relationAlias = null) Adds a INNER JOIN clause to the query using the CcBlock relation
*
- * @method CcBlockcriteria findOneByDbId(int $id) Return the first CcBlockcriteria filtered by the id column
- * @method CcBlockcriteria findOneByDbCriteria(string $criteria) Return the first CcBlockcriteria filtered by the criteria column
- * @method CcBlockcriteria findOneByDbModifier(string $modifier) Return the first CcBlockcriteria filtered by the modifier column
- * @method CcBlockcriteria findOneByDbValue(string $value) Return the first CcBlockcriteria filtered by the value column
- * @method CcBlockcriteria findOneByDbExtra(string $extra) Return the first CcBlockcriteria filtered by the extra column
- * @method CcBlockcriteria findOneByDbBlockId(int $block_id) Return the first CcBlockcriteria filtered by the block_id column
+ * @method CcBlockcriteria findOne(PropelPDO $con = null) Return the first CcBlockcriteria matching the query
+ * @method CcBlockcriteria findOneOrCreate(PropelPDO $con = null) Return the first CcBlockcriteria matching the query, or a new CcBlockcriteria object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcBlockcriteria objects filtered by the id column
- * @method array findByDbCriteria(string $criteria) Return CcBlockcriteria objects filtered by the criteria column
- * @method array findByDbModifier(string $modifier) Return CcBlockcriteria objects filtered by the modifier column
- * @method array findByDbValue(string $value) Return CcBlockcriteria objects filtered by the value column
- * @method array findByDbExtra(string $extra) Return CcBlockcriteria objects filtered by the extra column
- * @method array findByDbBlockId(int $block_id) Return CcBlockcriteria objects filtered by the block_id column
+ * @method CcBlockcriteria findOneByDbCriteria(string $criteria) Return the first CcBlockcriteria filtered by the criteria column
+ * @method CcBlockcriteria findOneByDbModifier(string $modifier) Return the first CcBlockcriteria filtered by the modifier column
+ * @method CcBlockcriteria findOneByDbValue(string $value) Return the first CcBlockcriteria filtered by the value column
+ * @method CcBlockcriteria findOneByDbExtra(string $extra) Return the first CcBlockcriteria filtered by the extra column
+ * @method CcBlockcriteria findOneByDbBlockId(int $block_id) Return the first CcBlockcriteria filtered by the block_id column
+ *
+ * @method array findByDbId(int $id) Return CcBlockcriteria objects filtered by the id column
+ * @method array findByDbCriteria(string $criteria) Return CcBlockcriteria objects filtered by the criteria column
+ * @method array findByDbModifier(string $modifier) Return CcBlockcriteria objects filtered by the modifier column
+ * @method array findByDbValue(string $value) Return CcBlockcriteria objects filtered by the value column
+ * @method array findByDbExtra(string $extra) Return CcBlockcriteria objects filtered by the extra column
+ * @method array findByDbBlockId(int $block_id) Return CcBlockcriteria objects filtered by the block_id column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcBlockcriteriaQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcBlockcriteriaQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcBlockcriteria';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcBlockcriteriaQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcBlockcriteria', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcBlockcriteriaQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcBlockcriteriaQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcBlockcriteriaQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcBlockcriteriaQuery) {
+ return $criteria;
+ }
+ $query = new CcBlockcriteriaQuery(null, null, $modelAlias);
- /**
- * Returns a new CcBlockcriteriaQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcBlockcriteriaQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcBlockcriteriaQuery) {
- return $criteria;
- }
- $query = new CcBlockcriteriaQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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 CcBlockcriteria|array|mixed the result, formatted by the current formatter
- */
- public function findPk($key, $con = null)
- {
- if ((null !== ($obj = CcBlockcriteriaPeer::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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcBlockcriteria|CcBlockcriteria[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcBlockcriteriaPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
- /**
- * Filter the query by primary key
- *
- * @param mixed $key Primary key to use for the query
- *
- * @return CcBlockcriteriaQuery The current query, for fluid interface
- */
- public function filterByPrimaryKey($key)
- {
- return $this->addUsingAlias(CcBlockcriteriaPeer::ID, $key, Criteria::EQUAL);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcBlockcriteria A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * Filter the query by a list of primary keys
- *
- * @param array $keys The list of primary key to use for the query
- *
- * @return CcBlockcriteriaQuery The current query, for fluid interface
- */
- public function filterByPrimaryKeys($keys)
- {
- return $this->addUsingAlias(CcBlockcriteriaPeer::ID, $keys, Criteria::IN);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcBlockcriteria A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "criteria", "modifier", "value", "extra", "block_id" FROM "cc_blockcriteria" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcBlockcriteria();
+ $obj->hydrate($row);
+ CcBlockcriteriaPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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 CcBlockcriteriaQuery 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(CcBlockcriteriaPeer::ID, $dbId, $comparison);
- }
+ return $obj;
+ }
- /**
- * Filter the query on the criteria column
- *
- * @param string $dbCriteria 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 CcBlockcriteriaQuery The current query, for fluid interface
- */
- public function filterByDbCriteria($dbCriteria = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbCriteria)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbCriteria)) {
- $dbCriteria = str_replace('*', '%', $dbCriteria);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcBlockcriteriaPeer::CRITERIA, $dbCriteria, $comparison);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcBlockcriteria|CcBlockcriteria[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * Filter the query on the modifier column
- *
- * @param string $dbModifier 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 CcBlockcriteriaQuery The current query, for fluid interface
- */
- public function filterByDbModifier($dbModifier = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbModifier)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbModifier)) {
- $dbModifier = str_replace('*', '%', $dbModifier);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcBlockcriteriaPeer::MODIFIER, $dbModifier, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * 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 CcBlockcriteriaQuery 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(CcBlockcriteriaPeer::VALUE, $dbValue, $comparison);
- }
+ /**
+ * 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|CcBlockcriteria[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * Filter the query on the extra column
- *
- * @param string $dbExtra 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 CcBlockcriteriaQuery The current query, for fluid interface
- */
- public function filterByDbExtra($dbExtra = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbExtra)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbExtra)) {
- $dbExtra = str_replace('*', '%', $dbExtra);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcBlockcriteriaPeer::EXTRA, $dbExtra, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * Filter the query on the block_id column
- *
- * @param int|array $dbBlockId 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 CcBlockcriteriaQuery The current query, for fluid interface
- */
- public function filterByDbBlockId($dbBlockId = null, $comparison = null)
- {
- if (is_array($dbBlockId)) {
- $useMinMax = false;
- if (isset($dbBlockId['min'])) {
- $this->addUsingAlias(CcBlockcriteriaPeer::BLOCK_ID, $dbBlockId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbBlockId['max'])) {
- $this->addUsingAlias(CcBlockcriteriaPeer::BLOCK_ID, $dbBlockId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcBlockcriteriaPeer::BLOCK_ID, $dbBlockId, $comparison);
- }
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
- /**
- * Filter the query by a related CcBlock object
- *
- * @param CcBlock $ccBlock the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return CcBlockcriteriaQuery The current query, for fluid interface
- */
- public function filterByCcBlock($ccBlock, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcBlockcriteriaPeer::BLOCK_ID, $ccBlock->getDbId(), $comparison);
- }
+ return $this->addUsingAlias(CcBlockcriteriaPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * Adds a JOIN clause to the query using the CcBlock relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return CcBlockcriteriaQuery The current query, for fluid interface
- */
- public function joinCcBlock($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcBlock');
-
- // 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, 'CcBlock');
- }
-
- return $this;
- }
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
- /**
- * Use the CcBlock relation CcBlock 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 CcBlockQuery A secondary query class using the current class as primary query
- */
- public function useCcBlockQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinCcBlock($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcBlock', 'CcBlockQuery');
- }
+ return $this->addUsingAlias(CcBlockcriteriaPeer::ID, $keys, Criteria::IN);
+ }
- /**
- * Exclude object from result
- *
- * @param CcBlockcriteria $ccBlockcriteria Object to remove from the list of results
- *
- * @return CcBlockcriteriaQuery The current query, for fluid interface
- */
- public function prune($ccBlockcriteria = null)
- {
- if ($ccBlockcriteria) {
- $this->addUsingAlias(CcBlockcriteriaPeer::ID, $ccBlockcriteria->getDbId(), Criteria::NOT_EQUAL);
- }
-
- return $this;
- }
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcBlockcriteriaPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcBlockcriteriaPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
-} // BaseCcBlockcriteriaQuery
+ return $this->addUsingAlias(CcBlockcriteriaPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the criteria column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCriteria('fooValue'); // WHERE criteria = 'fooValue'
+ * $query->filterByDbCriteria('%fooValue%'); // WHERE criteria LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbCriteria 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 CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function filterByDbCriteria($dbCriteria = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbCriteria)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCriteria)) {
+ $dbCriteria = str_replace('*', '%', $dbCriteria);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcBlockcriteriaPeer::CRITERIA, $dbCriteria, $comparison);
+ }
+
+ /**
+ * Filter the query on the modifier column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbModifier('fooValue'); // WHERE modifier = 'fooValue'
+ * $query->filterByDbModifier('%fooValue%'); // WHERE modifier LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbModifier 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 CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function filterByDbModifier($dbModifier = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbModifier)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbModifier)) {
+ $dbModifier = str_replace('*', '%', $dbModifier);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcBlockcriteriaPeer::MODIFIER, $dbModifier, $comparison);
+ }
+
+ /**
+ * Filter the query on the value column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbValue('fooValue'); // WHERE value = 'fooValue'
+ * $query->filterByDbValue('%fooValue%'); // WHERE value LIKE '%fooValue%'
+ *
+ *
+ * @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 CcBlockcriteriaQuery 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(CcBlockcriteriaPeer::VALUE, $dbValue, $comparison);
+ }
+
+ /**
+ * Filter the query on the extra column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbExtra('fooValue'); // WHERE extra = 'fooValue'
+ * $query->filterByDbExtra('%fooValue%'); // WHERE extra LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbExtra 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 CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function filterByDbExtra($dbExtra = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbExtra)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbExtra)) {
+ $dbExtra = str_replace('*', '%', $dbExtra);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcBlockcriteriaPeer::EXTRA, $dbExtra, $comparison);
+ }
+
+ /**
+ * Filter the query on the block_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbBlockId(1234); // WHERE block_id = 1234
+ * $query->filterByDbBlockId(array(12, 34)); // WHERE block_id IN (12, 34)
+ * $query->filterByDbBlockId(array('min' => 12)); // WHERE block_id >= 12
+ * $query->filterByDbBlockId(array('max' => 12)); // WHERE block_id <= 12
+ *
+ *
+ * @see filterByCcBlock()
+ *
+ * @param mixed $dbBlockId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function filterByDbBlockId($dbBlockId = null, $comparison = null)
+ {
+ if (is_array($dbBlockId)) {
+ $useMinMax = false;
+ if (isset($dbBlockId['min'])) {
+ $this->addUsingAlias(CcBlockcriteriaPeer::BLOCK_ID, $dbBlockId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbBlockId['max'])) {
+ $this->addUsingAlias(CcBlockcriteriaPeer::BLOCK_ID, $dbBlockId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcBlockcriteriaPeer::BLOCK_ID, $dbBlockId, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcBlock object
+ *
+ * @param CcBlock|PropelObjectCollection $ccBlock The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcBlockcriteriaQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcBlock($ccBlock, $comparison = null)
+ {
+ if ($ccBlock instanceof CcBlock) {
+ return $this
+ ->addUsingAlias(CcBlockcriteriaPeer::BLOCK_ID, $ccBlock->getDbId(), $comparison);
+ } elseif ($ccBlock instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcBlockcriteriaPeer::BLOCK_ID, $ccBlock->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcBlock() only accepts arguments of type CcBlock or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcBlock relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function joinCcBlock($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcBlock');
+
+ // 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, 'CcBlock');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcBlock relation CcBlock 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 CcBlockQuery A secondary query class using the current class as primary query
+ */
+ public function useCcBlockQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcBlock($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcBlock', 'CcBlockQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcBlockcriteria $ccBlockcriteria Object to remove from the list of results
+ *
+ * @return CcBlockcriteriaQuery The current query, for fluid interface
+ */
+ public function prune($ccBlockcriteria = null)
+ {
+ if ($ccBlockcriteria) {
+ $this->addUsingAlias(CcBlockcriteriaPeer::ID, $ccBlockcriteria->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcCountry.php b/airtime_mvc/application/models/airtime/om/BaseCcCountry.php
index 3f92c5493..dee0b4a90 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcCountry.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcCountry.php
@@ -4,705 +4,811 @@
/**
* Base class that represents a row from the 'cc_country' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcCountry extends BaseObject implements Persistent
+abstract class BaseCcCountry extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcCountryPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcCountryPeer
- */
- protected static $peer;
-
- /**
- * The value for the isocode field.
- * @var string
- */
- protected $isocode;
-
- /**
- * The value for the name field.
- * @var string
- */
- protected $name;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Get the [isocode] column value.
- *
- * @return string
- */
- public function getDbIsoCode()
- {
- return $this->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
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcCountryPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcCountryPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the isocode field.
+ * @var string
+ */
+ protected $isocode;
+
+ /**
+ * The value for the name field.
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Get the [isocode] column value.
+ *
+ * @return string
+ */
+ public function getDbIsoCode()
+ {
+
+ return $this->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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 resultset 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();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 2; // 2 = CcCountryPeer::NUM_HYDRATE_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
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcCountryQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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 (Exception $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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcCountryPeer::ISOCODE)) {
+ $modifiedColumns[':p' . $index++] = '"isocode"';
+ }
+ if ($this->isColumnModified(CcCountryPeer::NAME)) {
+ $modifiedColumns[':p' . $index++] = '"name"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_country" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"isocode"':
+ $stmt->bindValue($identifier, $this->isocode, PDO::PARAM_STR);
+ break;
+ case '"name"':
+ $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
+ {
+ if (isset($alreadyDumpedObjects['CcCountry'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcCountry'][$this->getPrimaryKey()] = true;
+ $keys = CcCountryPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbIsoCode(),
+ $keys[1] => $this->getDbName(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcCountryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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 BasePeer::TYPE_PHPNAME
+ *
+ * @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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbName($this->getDbName());
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setDbIsoCode(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 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->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcCountryPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcCountryPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcCountryPeer.php
index ee16e55bf..2970e29e0 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcCountryPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcCountryPeer.php
@@ -4,728 +4,750 @@
/**
* Base static class for performing query and update operations on the 'cc_country' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcCountryPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_country';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcCountry';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcCountry';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcCountryTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 2;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ISOCODE field */
- const ISOCODE = 'cc_country.ISOCODE';
-
- /** the column name for the NAME field */
- const NAME = 'cc_country.NAME';
-
- /**
- * An identiy map to hold any loaded instances of CcCountry objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcCountry[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => 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;
- }
+abstract class BaseCcCountryPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_country';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcCountry';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcCountryTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 2;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 2;
+
+ /** the column name for the isocode field */
+ const ISOCODE = 'cc_country.isocode';
+
+ /** the column name for the name field */
+ const NAME = 'cc_country.name';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcCountry objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcCountry[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcCountryPeer::$fieldNames[CcCountryPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbIsoCode', 'DbName', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbIsoCode', 'dbName', ),
+ BasePeer::TYPE_COLNAME => array (CcCountryPeer::ISOCODE, CcCountryPeer::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. CcCountryPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbIsoCode' => 0, 'DbName' => 1, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbIsoCode' => 0, 'dbName' => 1, ),
+ BasePeer::TYPE_COLNAME => array (CcCountryPeer::ISOCODE => 0, CcCountryPeer::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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcCountryPeer::getFieldNames($toType);
+ $key = isset(CcCountryPeer::$fieldKeys[$fromType][$name]) ? CcCountryPeer::$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(CcCountryPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcCountryPeer::$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 CcCountryPeer::$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(CcCountryPeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcCountryPeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbIsoCode();
+ } // if key === null
+ CcCountryPeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcCountryPeer::$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(CcCountryPeer::$instances[$key])) {
+ return CcCountryPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcCountryPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcCountryPeer::$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();
+ // 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_HYDRATE_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(CcCountryPeer::DATABASE_NAME)->getTable(CcCountryPeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcCountryPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcCountryPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcCountryPeer::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(CcCountryPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_country table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcCountryPeer::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(CcCountryPeer::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 (Exception $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($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->hasColumn($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
+ * @return CcCountry[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcCountryQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcCountryQuery.php
index 4e634ea19..85fd27e75 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcCountryQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcCountryQuery.php
@@ -4,193 +4,293 @@
/**
* Base class that represents a query for the 'cc_country' table.
*
- *
*
- * @method CcCountryQuery orderByDbIsoCode($order = Criteria::ASC) Order by the isocode column
- * @method CcCountryQuery orderByDbName($order = Criteria::ASC) Order by the name column
*
- * @method CcCountryQuery groupByDbIsoCode() Group by the isocode column
- * @method CcCountryQuery groupByDbName() Group by the name column
+ * @method CcCountryQuery orderByDbIsoCode($order = Criteria::ASC) Order by the isocode column
+ * @method CcCountryQuery orderByDbName($order = Criteria::ASC) Order by the name column
*
- * @method CcCountryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcCountryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcCountryQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcCountryQuery groupByDbIsoCode() Group by the isocode column
+ * @method CcCountryQuery groupByDbName() Group by the name column
*
- * @method CcCountry findOne(PropelPDO $con = null) Return the first CcCountry matching the query
- * @method CcCountry findOneOrCreate(PropelPDO $con = null) Return the first CcCountry matching the query, or a new CcCountry object populated from the query conditions when no match is found
+ * @method CcCountryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcCountryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcCountryQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcCountry findOneByDbIsoCode(string $isocode) Return the first CcCountry filtered by the isocode column
- * @method CcCountry findOneByDbName(string $name) Return the first CcCountry filtered by the name column
+ * @method CcCountry findOne(PropelPDO $con = null) Return the first CcCountry matching the query
+ * @method CcCountry findOneOrCreate(PropelPDO $con = null) Return the first CcCountry matching the query, or a new CcCountry object populated from the query conditions when no match is found
*
- * @method array findByDbIsoCode(string $isocode) Return CcCountry objects filtered by the isocode column
- * @method array findByDbName(string $name) Return CcCountry objects filtered by the name column
+ * @method CcCountry findOneByDbName(string $name) Return the first CcCountry filtered by the name column
+ *
+ * @method array findByDbIsoCode(string $isocode) Return CcCountry objects filtered by the isocode column
+ * @method array findByDbName(string $name) Return CcCountry objects filtered by the name column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcCountryQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcCountryQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcCountry';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcCountryQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcCountry', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcCountryQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcCountryQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcCountryQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcCountryQuery) {
+ return $criteria;
+ }
+ $query = new CcCountryQuery(null, null, $modelAlias);
- /**
- * Returns a new CcCountryQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcCountryQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcCountryQuery) {
- return $criteria;
- }
- $query = new CcCountryQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcCountry|CcCountry[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcCountryPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $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);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcCountry A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbIsoCode($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcCountry A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "isocode", "name" FROM "cc_country" WHERE "isocode" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcCountry();
+ $obj->hydrate($row);
+ CcCountryPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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);
- }
+ return $obj;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcCountry|CcCountry[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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;
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
-} // BaseCcCountryQuery
+ /**
+ * 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|CcCountry[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * 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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbIsoCode('fooValue'); // WHERE isocode = 'fooValue'
+ * $query->filterByDbIsoCode('%fooValue%'); // WHERE isocode LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbName('fooValue'); // WHERE name = 'fooValue'
+ * $query->filterByDbName('%fooValue%'); // WHERE name LIKE '%fooValue%'
+ *
+ *
+ * @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;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php
index 027786624..d23bd7a69 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php
@@ -4,5517 +4,6857 @@
/**
* Base class that represents a row from the 'cc_files' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcFiles extends BaseObject implements Persistent
+abstract class BaseCcFiles extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcFilesPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcFilesPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the name field.
- * Note: this column has a database default value of: ''
- * @var string
- */
- protected $name;
-
- /**
- * The value for the mime field.
- * Note: this column has a database default value of: ''
- * @var string
- */
- protected $mime;
-
- /**
- * The value for the ftype field.
- * Note: this column has a database default value of: ''
- * @var string
- */
- protected $ftype;
-
- /**
- * The value for the directory field.
- * @var int
- */
- protected $directory;
-
- /**
- * The value for the filepath field.
- * Note: this column has a database default value of: ''
- * @var string
- */
- protected $filepath;
-
- /**
- * The value for the import_status field.
- * Note: this column has a database default value of: 1
- * @var int
- */
- protected $import_status;
-
- /**
- * The value for the currentlyaccessing field.
- * Note: this column has a database default value of: 0
- * @var int
- */
- protected $currentlyaccessing;
-
- /**
- * The value for the editedby field.
- * @var int
- */
- protected $editedby;
-
- /**
- * The value for the mtime field.
- * @var string
- */
- protected $mtime;
-
- /**
- * The value for the utime field.
- * @var string
- */
- protected $utime;
-
- /**
- * The value for the lptime field.
- * @var string
- */
- protected $lptime;
-
- /**
- * The value for the md5 field.
- * @var string
- */
- protected $md5;
-
- /**
- * The value for the track_title field.
- * @var string
- */
- protected $track_title;
-
- /**
- * The value for the artist_name field.
- * @var string
- */
- protected $artist_name;
-
- /**
- * The value for the bit_rate field.
- * @var int
- */
- protected $bit_rate;
-
- /**
- * The value for the sample_rate field.
- * @var int
- */
- protected $sample_rate;
-
- /**
- * The value for the format field.
- * @var string
- */
- protected $format;
-
- /**
- * The value for the length field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $length;
-
- /**
- * The value for the album_title field.
- * @var string
- */
- protected $album_title;
-
- /**
- * The value for the genre field.
- * @var string
- */
- protected $genre;
-
- /**
- * The value for the comments field.
- * @var string
- */
- protected $comments;
-
- /**
- * The value for the year field.
- * @var string
- */
- protected $year;
-
- /**
- * The value for the track_number field.
- * @var int
- */
- protected $track_number;
-
- /**
- * The value for the channels field.
- * @var int
- */
- protected $channels;
-
- /**
- * The value for the url field.
- * @var string
- */
- protected $url;
-
- /**
- * The value for the bpm field.
- * @var int
- */
- protected $bpm;
-
- /**
- * The value for the rating field.
- * @var string
- */
- protected $rating;
-
- /**
- * The value for the encoded_by field.
- * @var string
- */
- protected $encoded_by;
-
- /**
- * The value for the disc_number field.
- * @var string
- */
- protected $disc_number;
-
- /**
- * The value for the mood field.
- * @var string
- */
- protected $mood;
-
- /**
- * The value for the label field.
- * @var string
- */
- protected $label;
-
- /**
- * The value for the composer field.
- * @var string
- */
- protected $composer;
-
- /**
- * The value for the encoder field.
- * @var string
- */
- protected $encoder;
-
- /**
- * The value for the checksum field.
- * @var string
- */
- protected $checksum;
-
- /**
- * The value for the lyrics field.
- * @var string
- */
- protected $lyrics;
-
- /**
- * The value for the orchestra field.
- * @var string
- */
- protected $orchestra;
-
- /**
- * The value for the conductor field.
- * @var string
- */
- protected $conductor;
-
- /**
- * The value for the lyricist field.
- * @var string
- */
- protected $lyricist;
-
- /**
- * The value for the original_lyricist field.
- * @var string
- */
- protected $original_lyricist;
-
- /**
- * The value for the radio_station_name field.
- * @var string
- */
- protected $radio_station_name;
-
- /**
- * The value for the info_url field.
- * @var string
- */
- protected $info_url;
-
- /**
- * The value for the artist_url field.
- * @var string
- */
- protected $artist_url;
-
- /**
- * The value for the audio_source_url field.
- * @var string
- */
- protected $audio_source_url;
-
- /**
- * The value for the radio_station_url field.
- * @var string
- */
- protected $radio_station_url;
-
- /**
- * The value for the buy_this_url field.
- * @var string
- */
- protected $buy_this_url;
-
- /**
- * The value for the isrc_number field.
- * @var string
- */
- protected $isrc_number;
-
- /**
- * The value for the catalog_number field.
- * @var string
- */
- protected $catalog_number;
-
- /**
- * The value for the original_artist field.
- * @var string
- */
- protected $original_artist;
-
- /**
- * The value for the copyright field.
- * @var string
- */
- protected $copyright;
-
- /**
- * The value for the report_datetime field.
- * @var string
- */
- protected $report_datetime;
-
- /**
- * The value for the report_location field.
- * @var string
- */
- protected $report_location;
-
- /**
- * The value for the report_organization field.
- * @var string
- */
- protected $report_organization;
-
- /**
- * The value for the subject field.
- * @var string
- */
- protected $subject;
-
- /**
- * The value for the contributor field.
- * @var string
- */
- protected $contributor;
-
- /**
- * The value for the language field.
- * @var string
- */
- protected $language;
-
- /**
- * The value for the file_exists field.
- * Note: this column has a database default value of: true
- * @var boolean
- */
- protected $file_exists;
-
- /**
- * The value for the soundcloud_id field.
- * @var int
- */
- protected $soundcloud_id;
-
- /**
- * The value for the soundcloud_error_code field.
- * @var int
- */
- protected $soundcloud_error_code;
-
- /**
- * The value for the soundcloud_error_msg field.
- * @var string
- */
- protected $soundcloud_error_msg;
-
- /**
- * The value for the soundcloud_link_to_file field.
- * @var string
- */
- protected $soundcloud_link_to_file;
-
- /**
- * The value for the soundcloud_upload_time field.
- * @var string
- */
- protected $soundcloud_upload_time;
-
- /**
- * The value for the replay_gain field.
- * @var string
- */
- protected $replay_gain;
-
- /**
- * The value for the owner_id field.
- * @var int
- */
- protected $owner_id;
-
- /**
- * The value for the cuein field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $cuein;
-
- /**
- * The value for the cueout field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $cueout;
-
- /**
- * The value for the silan_check field.
- * Note: this column has a database default value of: false
- * @var boolean
- */
- protected $silan_check;
-
- /**
- * The value for the hidden field.
- * Note: this column has a database default value of: false
- * @var boolean
- */
- protected $hidden;
-
- /**
- * The value for the is_scheduled field.
- * Note: this column has a database default value of: false
- * @var boolean
- */
- protected $is_scheduled;
-
- /**
- * The value for the is_playlist field.
- * Note: this column has a database default value of: false
- * @var boolean
- */
- protected $is_playlist;
-
- /**
- * The value for the resource_id field.
- * @var string
- */
- protected $resource_id;
-
- /**
- * @var CcSubjs
- */
- protected $aFkOwner;
-
- /**
- * @var CcSubjs
- */
- protected $aCcSubjsRelatedByDbEditedby;
-
- /**
- * @var CcMusicDirs
- */
- protected $aCcMusicDirs;
-
- /**
- * @var array CcShowInstances[] Collection to store aggregation of CcShowInstances objects.
- */
- protected $collCcShowInstancess;
-
- /**
- * @var array CcPlaylistcontents[] Collection to store aggregation of CcPlaylistcontents objects.
- */
- protected $collCcPlaylistcontentss;
-
- /**
- * @var array CcBlockcontents[] Collection to store aggregation of CcBlockcontents objects.
- */
- protected $collCcBlockcontentss;
-
- /**
- * @var array CcSchedule[] Collection to store aggregation of CcSchedule objects.
- */
- protected $collCcSchedules;
-
- /**
- * @var array CcPlayoutHistory[] Collection to store aggregation of CcPlayoutHistory objects.
- */
- protected $collCcPlayoutHistorys;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Applies default values to this object.
- * This method should be called from the object's constructor (or
- * equivalent initialization method).
- * @see __construct()
- */
- public function applyDefaultValues()
- {
- $this->name = '';
- $this->mime = '';
- $this->ftype = '';
- $this->filepath = '';
- $this->import_status = 1;
- $this->currentlyaccessing = 0;
- $this->length = '00:00:00';
- $this->file_exists = true;
- $this->cuein = '00:00:00';
- $this->cueout = '00:00:00';
- $this->silan_check = false;
- $this->hidden = false;
- $this->is_scheduled = false;
- $this->is_playlist = false;
- }
-
- /**
- * 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 [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 [import_status] column value.
- *
- * @return int
- */
- public function getDbImportStatus()
- {
- return $this->import_status;
- }
-
- /**
- * 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 [optionally formatted] temporal [utime] 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 getDbUtime($format = 'Y-m-d H:i:s')
- {
- if ($this->utime === null) {
- return null;
- }
-
-
-
- try {
- $dt = new DateTime($this->utime);
- } catch (Exception $x) {
- throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->utime, 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 [lptime] 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 getDbLPtime($format = 'Y-m-d H:i:s')
- {
- if ($this->lptime === null) {
- return null;
- }
-
-
-
- try {
- $dt = new DateTime($this->lptime);
- } catch (Exception $x) {
- throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->lptime, 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 int
- */
- public function getDbBitRate()
- {
- return $this->bit_rate;
- }
-
- /**
- * Get the [sample_rate] column value.
- *
- * @return int
- */
- public function getDbSampleRate()
- {
- return $this->sample_rate;
- }
-
- /**
- * Get the [format] column value.
- *
- * @return string
- */
- public function getDbFormat()
- {
- return $this->format;
- }
-
- /**
- * Get the [length] column value.
- *
- * @return string
- */
- public function getDbLength()
- {
- return $this->length;
- }
-
- /**
- * 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 int
- */
- 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 [file_exists] column value.
- *
- * @return boolean
- */
- public function getDbFileExists()
- {
- return $this->file_exists;
- }
-
- /**
- * 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;
- }
-
- /**
- * Get the [optionally formatted] temporal [soundcloud_upload_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 getDbSoundCloundUploadTime($format = 'Y-m-d H:i:s')
- {
- if ($this->soundcloud_upload_time === null) {
- return null;
- }
-
-
-
- try {
- $dt = new DateTime($this->soundcloud_upload_time);
- } catch (Exception $x) {
- throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->soundcloud_upload_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 [replay_gain] column value.
- *
- * @return string
- */
- public function getDbReplayGain()
- {
- return $this->replay_gain;
- }
-
- /**
- * Get the [owner_id] column value.
- *
- * @return int
- */
- public function getDbOwnerId()
- {
- return $this->owner_id;
- }
-
- /**
- * Get the [cuein] column value.
- *
- * @return string
- */
- public function getDbCuein()
- {
- return $this->cuein;
- }
-
- /**
- * Get the [cueout] column value.
- *
- * @return string
- */
- public function getDbCueout()
- {
- return $this->cueout;
- }
-
- /**
- * Get the [silan_check] column value.
- *
- * @return boolean
- */
- public function getDbSilanCheck()
- {
- return $this->silan_check;
- }
-
- /**
- * Get the [hidden] column value.
- *
- * @return boolean
- */
- public function getDbHidden()
- {
- return $this->hidden;
- }
-
- /**
- * Get the [is_scheduled] column value.
- *
- * @return boolean
- */
- public function getDbIsScheduled()
- {
- return $this->is_scheduled;
- }
-
- /**
- * Get the [is_playlist] column value.
- *
- * @return boolean
- */
- public function getDbIsPlaylist()
- {
- return $this->is_playlist;
- }
-
- /**
- * Get the [resource_id] column value.
- *
- * @return string
- */
- public function getDbResourceId()
- {
- return $this->resource_id;
- }
-
- /**
- * 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 [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 [import_status] column.
- *
- * @param int $v new value
- * @return CcFiles The current object (for fluent API support)
- */
- public function setDbImportStatus($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->import_status !== $v || $this->isNew()) {
- $this->import_status = $v;
- $this->modifiedColumns[] = CcFilesPeer::IMPORT_STATUS;
- }
-
- return $this;
- } // setDbImportStatus()
-
- /**
- * 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->aCcSubjsRelatedByDbEditedby !== null && $this->aCcSubjsRelatedByDbEditedby->getDbId() !== $v) {
- $this->aCcSubjsRelatedByDbEditedby = 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()
-
- /**
- * Sets the value of [utime] 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 setDbUtime($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->utime !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->utime !== null && $tmpDt = new DateTime($this->utime)) ? $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->utime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
- $this->modifiedColumns[] = CcFilesPeer::UTIME;
- }
- } // if either are not null
-
- return $this;
- } // setDbUtime()
-
- /**
- * Sets the value of [lptime] 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 setDbLPtime($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->lptime !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->lptime !== null && $tmpDt = new DateTime($this->lptime)) ? $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->lptime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
- $this->modifiedColumns[] = CcFilesPeer::LPTIME;
- }
- } // if either are not null
-
- return $this;
- } // setDbLPtime()
-
- /**
- * 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 int $v new value
- * @return CcFiles The current object (for fluent API support)
- */
- public function setDbBitRate($v)
- {
- if ($v !== null) {
- $v = (int) $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 int $v new value
- * @return CcFiles The current object (for fluent API support)
- */
- public function setDbSampleRate($v)
- {
- if ($v !== null) {
- $v = (int) $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()
-
- /**
- * Set the value of [length] column.
- *
- * @param string $v new value
- * @return CcFiles The current object (for fluent API support)
- */
- public function setDbLength($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->length !== $v || $this->isNew()) {
- $this->length = $v;
- $this->modifiedColumns[] = CcFilesPeer::LENGTH;
- }
-
- 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 int $v new value
- * @return CcFiles The current object (for fluent API support)
- */
- public function setDbBpm($v)
- {
- if ($v !== null) {
- $v = (int) $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 [file_exists] column.
- *
- * @param boolean $v new value
- * @return CcFiles The current object (for fluent API support)
- */
- public function setDbFileExists($v)
- {
- if ($v !== null) {
- $v = (boolean) $v;
- }
-
- if ($this->file_exists !== $v || $this->isNew()) {
- $this->file_exists = $v;
- $this->modifiedColumns[] = CcFilesPeer::FILE_EXISTS;
- }
-
- return $this;
- } // setDbFileExists()
-
- /**
- * 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()
-
- /**
- * Sets the value of [soundcloud_upload_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 CcFiles The current object (for fluent API support)
- */
- public function setDbSoundCloundUploadTime($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->soundcloud_upload_time !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->soundcloud_upload_time !== null && $tmpDt = new DateTime($this->soundcloud_upload_time)) ? $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->soundcloud_upload_time = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
- $this->modifiedColumns[] = CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME;
- }
- } // if either are not null
-
- return $this;
- } // setDbSoundCloundUploadTime()
-
- /**
- * Set the value of [replay_gain] column.
- *
- * @param string $v new value
- * @return CcFiles The current object (for fluent API support)
- */
- public function setDbReplayGain($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->replay_gain !== $v) {
- $this->replay_gain = $v;
- $this->modifiedColumns[] = CcFilesPeer::REPLAY_GAIN;
- }
-
- return $this;
- } // setDbReplayGain()
-
- /**
- * Set the value of [owner_id] column.
- *
- * @param int $v new value
- * @return CcFiles The current object (for fluent API support)
- */
- public function setDbOwnerId($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->owner_id !== $v) {
- $this->owner_id = $v;
- $this->modifiedColumns[] = CcFilesPeer::OWNER_ID;
- }
-
- if ($this->aFkOwner !== null && $this->aFkOwner->getDbId() !== $v) {
- $this->aFkOwner = null;
- }
-
- return $this;
- } // setDbOwnerId()
-
- /**
- * Set the value of [cuein] column.
- *
- * @param string $v new value
- * @return CcFiles The current object (for fluent API support)
- */
- public function setDbCuein($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->cuein !== $v || $this->isNew()) {
- $this->cuein = $v;
- $this->modifiedColumns[] = CcFilesPeer::CUEIN;
- }
-
- return $this;
- } // setDbCuein()
-
- /**
- * Set the value of [cueout] column.
- *
- * @param string $v new value
- * @return CcFiles The current object (for fluent API support)
- */
- public function setDbCueout($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->cueout !== $v || $this->isNew()) {
- $this->cueout = $v;
- $this->modifiedColumns[] = CcFilesPeer::CUEOUT;
- }
-
- return $this;
- } // setDbCueout()
-
- /**
- * Set the value of [silan_check] column.
- *
- * @param boolean $v new value
- * @return CcFiles The current object (for fluent API support)
- */
- public function setDbSilanCheck($v)
- {
- if ($v !== null) {
- $v = (boolean) $v;
- }
-
- if ($this->silan_check !== $v || $this->isNew()) {
- $this->silan_check = $v;
- $this->modifiedColumns[] = CcFilesPeer::SILAN_CHECK;
- }
-
- return $this;
- } // setDbSilanCheck()
-
- /**
- * Set the value of [hidden] column.
- *
- * @param boolean $v new value
- * @return CcFiles The current object (for fluent API support)
- */
- public function setDbHidden($v)
- {
- if ($v !== null) {
- $v = (boolean) $v;
- }
-
- if ($this->hidden !== $v || $this->isNew()) {
- $this->hidden = $v;
- $this->modifiedColumns[] = CcFilesPeer::HIDDEN;
- }
-
- return $this;
- } // setDbHidden()
-
- /**
- * Set the value of [is_scheduled] column.
- *
- * @param boolean $v new value
- * @return CcFiles The current object (for fluent API support)
- */
- public function setDbIsScheduled($v)
- {
- if ($v !== null) {
- $v = (boolean) $v;
- }
-
- if ($this->is_scheduled !== $v || $this->isNew()) {
- $this->is_scheduled = $v;
- $this->modifiedColumns[] = CcFilesPeer::IS_SCHEDULED;
- }
-
- return $this;
- } // setDbIsScheduled()
-
- /**
- * Set the value of [is_playlist] column.
- *
- * @param boolean $v new value
- * @return CcFiles The current object (for fluent API support)
- */
- public function setDbIsPlaylist($v)
- {
- if ($v !== null) {
- $v = (boolean) $v;
- }
-
- if ($this->is_playlist !== $v || $this->isNew()) {
- $this->is_playlist = $v;
- $this->modifiedColumns[] = CcFilesPeer::IS_PLAYLIST;
- }
-
- return $this;
- } // setDbIsPlaylist()
-
- /**
- * Set the value of [resource_id] column.
- *
- * @param string $v new value
- * @return CcFiles The current object (for fluent API support)
- */
- public function setDbResourceId($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->resource_id !== $v) {
- $this->resource_id = $v;
- $this->modifiedColumns[] = CcFilesPeer::RESOURCE_ID;
- }
-
- return $this;
- } // setDbResourceId()
-
- /**
- * 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->import_status !== 1) {
- return false;
- }
-
- if ($this->currentlyaccessing !== 0) {
- return false;
- }
-
- if ($this->length !== '00:00:00') {
- return false;
- }
-
- if ($this->file_exists !== true) {
- return false;
- }
-
- if ($this->cuein !== '00:00:00') {
- return false;
- }
-
- if ($this->cueout !== '00:00:00') {
- return false;
- }
-
- if ($this->silan_check !== false) {
- return false;
- }
-
- if ($this->hidden !== false) {
- return false;
- }
-
- if ($this->is_scheduled !== false) {
- return false;
- }
-
- if ($this->is_playlist !== 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->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
- $this->mime = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
- $this->ftype = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
- $this->directory = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
- $this->filepath = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
- $this->import_status = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
- $this->currentlyaccessing = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null;
- $this->editedby = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null;
- $this->mtime = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
- $this->utime = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
- $this->lptime = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
- $this->md5 = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null;
- $this->track_title = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null;
- $this->artist_name = ($row[$startcol + 14] !== null) ? (string) $row[$startcol + 14] : null;
- $this->bit_rate = ($row[$startcol + 15] !== null) ? (int) $row[$startcol + 15] : null;
- $this->sample_rate = ($row[$startcol + 16] !== null) ? (int) $row[$startcol + 16] : null;
- $this->format = ($row[$startcol + 17] !== null) ? (string) $row[$startcol + 17] : null;
- $this->length = ($row[$startcol + 18] !== null) ? (string) $row[$startcol + 18] : null;
- $this->album_title = ($row[$startcol + 19] !== null) ? (string) $row[$startcol + 19] : null;
- $this->genre = ($row[$startcol + 20] !== null) ? (string) $row[$startcol + 20] : null;
- $this->comments = ($row[$startcol + 21] !== null) ? (string) $row[$startcol + 21] : null;
- $this->year = ($row[$startcol + 22] !== null) ? (string) $row[$startcol + 22] : null;
- $this->track_number = ($row[$startcol + 23] !== null) ? (int) $row[$startcol + 23] : null;
- $this->channels = ($row[$startcol + 24] !== null) ? (int) $row[$startcol + 24] : null;
- $this->url = ($row[$startcol + 25] !== null) ? (string) $row[$startcol + 25] : null;
- $this->bpm = ($row[$startcol + 26] !== null) ? (int) $row[$startcol + 26] : null;
- $this->rating = ($row[$startcol + 27] !== null) ? (string) $row[$startcol + 27] : null;
- $this->encoded_by = ($row[$startcol + 28] !== null) ? (string) $row[$startcol + 28] : null;
- $this->disc_number = ($row[$startcol + 29] !== null) ? (string) $row[$startcol + 29] : null;
- $this->mood = ($row[$startcol + 30] !== null) ? (string) $row[$startcol + 30] : null;
- $this->label = ($row[$startcol + 31] !== null) ? (string) $row[$startcol + 31] : null;
- $this->composer = ($row[$startcol + 32] !== null) ? (string) $row[$startcol + 32] : null;
- $this->encoder = ($row[$startcol + 33] !== null) ? (string) $row[$startcol + 33] : null;
- $this->checksum = ($row[$startcol + 34] !== null) ? (string) $row[$startcol + 34] : null;
- $this->lyrics = ($row[$startcol + 35] !== null) ? (string) $row[$startcol + 35] : null;
- $this->orchestra = ($row[$startcol + 36] !== null) ? (string) $row[$startcol + 36] : null;
- $this->conductor = ($row[$startcol + 37] !== null) ? (string) $row[$startcol + 37] : null;
- $this->lyricist = ($row[$startcol + 38] !== null) ? (string) $row[$startcol + 38] : null;
- $this->original_lyricist = ($row[$startcol + 39] !== null) ? (string) $row[$startcol + 39] : null;
- $this->radio_station_name = ($row[$startcol + 40] !== null) ? (string) $row[$startcol + 40] : null;
- $this->info_url = ($row[$startcol + 41] !== null) ? (string) $row[$startcol + 41] : null;
- $this->artist_url = ($row[$startcol + 42] !== null) ? (string) $row[$startcol + 42] : null;
- $this->audio_source_url = ($row[$startcol + 43] !== null) ? (string) $row[$startcol + 43] : null;
- $this->radio_station_url = ($row[$startcol + 44] !== null) ? (string) $row[$startcol + 44] : null;
- $this->buy_this_url = ($row[$startcol + 45] !== null) ? (string) $row[$startcol + 45] : null;
- $this->isrc_number = ($row[$startcol + 46] !== null) ? (string) $row[$startcol + 46] : null;
- $this->catalog_number = ($row[$startcol + 47] !== null) ? (string) $row[$startcol + 47] : null;
- $this->original_artist = ($row[$startcol + 48] !== null) ? (string) $row[$startcol + 48] : null;
- $this->copyright = ($row[$startcol + 49] !== null) ? (string) $row[$startcol + 49] : null;
- $this->report_datetime = ($row[$startcol + 50] !== null) ? (string) $row[$startcol + 50] : null;
- $this->report_location = ($row[$startcol + 51] !== null) ? (string) $row[$startcol + 51] : null;
- $this->report_organization = ($row[$startcol + 52] !== null) ? (string) $row[$startcol + 52] : null;
- $this->subject = ($row[$startcol + 53] !== null) ? (string) $row[$startcol + 53] : null;
- $this->contributor = ($row[$startcol + 54] !== null) ? (string) $row[$startcol + 54] : null;
- $this->language = ($row[$startcol + 55] !== null) ? (string) $row[$startcol + 55] : null;
- $this->file_exists = ($row[$startcol + 56] !== null) ? (boolean) $row[$startcol + 56] : null;
- $this->soundcloud_id = ($row[$startcol + 57] !== null) ? (int) $row[$startcol + 57] : null;
- $this->soundcloud_error_code = ($row[$startcol + 58] !== null) ? (int) $row[$startcol + 58] : null;
- $this->soundcloud_error_msg = ($row[$startcol + 59] !== null) ? (string) $row[$startcol + 59] : null;
- $this->soundcloud_link_to_file = ($row[$startcol + 60] !== null) ? (string) $row[$startcol + 60] : null;
- $this->soundcloud_upload_time = ($row[$startcol + 61] !== null) ? (string) $row[$startcol + 61] : null;
- $this->replay_gain = ($row[$startcol + 62] !== null) ? (string) $row[$startcol + 62] : null;
- $this->owner_id = ($row[$startcol + 63] !== null) ? (int) $row[$startcol + 63] : null;
- $this->cuein = ($row[$startcol + 64] !== null) ? (string) $row[$startcol + 64] : null;
- $this->cueout = ($row[$startcol + 65] !== null) ? (string) $row[$startcol + 65] : null;
- $this->silan_check = ($row[$startcol + 66] !== null) ? (boolean) $row[$startcol + 66] : null;
- $this->hidden = ($row[$startcol + 67] !== null) ? (boolean) $row[$startcol + 67] : null;
- $this->is_scheduled = ($row[$startcol + 68] !== null) ? (boolean) $row[$startcol + 68] : null;
- $this->is_playlist = ($row[$startcol + 69] !== null) ? (boolean) $row[$startcol + 69] : null;
- $this->resource_id = ($row[$startcol + 70] !== null) ? (string) $row[$startcol + 70] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 71; // 71 = 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->aCcSubjsRelatedByDbEditedby !== null && $this->editedby !== $this->aCcSubjsRelatedByDbEditedby->getDbId()) {
- $this->aCcSubjsRelatedByDbEditedby = null;
- }
- if ($this->aFkOwner !== null && $this->owner_id !== $this->aFkOwner->getDbId()) {
- $this->aFkOwner = 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->aFkOwner = null;
- $this->aCcSubjsRelatedByDbEditedby = null;
- $this->aCcMusicDirs = null;
- $this->collCcShowInstancess = null;
-
- $this->collCcPlaylistcontentss = null;
-
- $this->collCcBlockcontentss = null;
-
- $this->collCcSchedules = null;
-
- $this->collCcPlayoutHistorys = 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->aFkOwner !== null) {
- if ($this->aFkOwner->isModified() || $this->aFkOwner->isNew()) {
- $affectedRows += $this->aFkOwner->save($con);
- }
- $this->setFkOwner($this->aFkOwner);
- }
-
- if ($this->aCcSubjsRelatedByDbEditedby !== null) {
- if ($this->aCcSubjsRelatedByDbEditedby->isModified() || $this->aCcSubjsRelatedByDbEditedby->isNew()) {
- $affectedRows += $this->aCcSubjsRelatedByDbEditedby->save($con);
- }
- $this->setCcSubjsRelatedByDbEditedby($this->aCcSubjsRelatedByDbEditedby);
- }
-
- 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->collCcBlockcontentss !== null) {
- foreach ($this->collCcBlockcontentss 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);
- }
- }
- }
-
- if ($this->collCcPlayoutHistorys !== null) {
- foreach ($this->collCcPlayoutHistorys 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->aFkOwner !== null) {
- if (!$this->aFkOwner->validate($columns)) {
- $failureMap = array_merge($failureMap, $this->aFkOwner->getValidationFailures());
- }
- }
-
- if ($this->aCcSubjsRelatedByDbEditedby !== null) {
- if (!$this->aCcSubjsRelatedByDbEditedby->validate($columns)) {
- $failureMap = array_merge($failureMap, $this->aCcSubjsRelatedByDbEditedby->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->collCcBlockcontentss !== null) {
- foreach ($this->collCcBlockcontentss 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());
- }
- }
- }
-
- if ($this->collCcPlayoutHistorys !== null) {
- foreach ($this->collCcPlayoutHistorys 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->getDbName();
- break;
- case 2:
- return $this->getDbMime();
- break;
- case 3:
- return $this->getDbFtype();
- break;
- case 4:
- return $this->getDbDirectory();
- break;
- case 5:
- return $this->getDbFilepath();
- break;
- case 6:
- return $this->getDbImportStatus();
- break;
- case 7:
- return $this->getDbCurrentlyaccessing();
- break;
- case 8:
- return $this->getDbEditedby();
- break;
- case 9:
- return $this->getDbMtime();
- break;
- case 10:
- return $this->getDbUtime();
- break;
- case 11:
- return $this->getDbLPtime();
- break;
- case 12:
- return $this->getDbMd5();
- break;
- case 13:
- return $this->getDbTrackTitle();
- break;
- case 14:
- return $this->getDbArtistName();
- break;
- case 15:
- return $this->getDbBitRate();
- break;
- case 16:
- return $this->getDbSampleRate();
- break;
- case 17:
- return $this->getDbFormat();
- break;
- case 18:
- return $this->getDbLength();
- break;
- case 19:
- return $this->getDbAlbumTitle();
- break;
- case 20:
- return $this->getDbGenre();
- break;
- case 21:
- return $this->getDbComments();
- break;
- case 22:
- return $this->getDbYear();
- break;
- case 23:
- return $this->getDbTrackNumber();
- break;
- case 24:
- return $this->getDbChannels();
- break;
- case 25:
- return $this->getDbUrl();
- break;
- case 26:
- return $this->getDbBpm();
- break;
- case 27:
- return $this->getDbRating();
- break;
- case 28:
- return $this->getDbEncodedBy();
- break;
- case 29:
- return $this->getDbDiscNumber();
- break;
- case 30:
- return $this->getDbMood();
- break;
- case 31:
- return $this->getDbLabel();
- break;
- case 32:
- return $this->getDbComposer();
- break;
- case 33:
- return $this->getDbEncoder();
- break;
- case 34:
- return $this->getDbChecksum();
- break;
- case 35:
- return $this->getDbLyrics();
- break;
- case 36:
- return $this->getDbOrchestra();
- break;
- case 37:
- return $this->getDbConductor();
- break;
- case 38:
- return $this->getDbLyricist();
- break;
- case 39:
- return $this->getDbOriginalLyricist();
- break;
- case 40:
- return $this->getDbRadioStationName();
- break;
- case 41:
- return $this->getDbInfoUrl();
- break;
- case 42:
- return $this->getDbArtistUrl();
- break;
- case 43:
- return $this->getDbAudioSourceUrl();
- break;
- case 44:
- return $this->getDbRadioStationUrl();
- break;
- case 45:
- return $this->getDbBuyThisUrl();
- break;
- case 46:
- return $this->getDbIsrcNumber();
- break;
- case 47:
- return $this->getDbCatalogNumber();
- break;
- case 48:
- return $this->getDbOriginalArtist();
- break;
- case 49:
- return $this->getDbCopyright();
- break;
- case 50:
- return $this->getDbReportDatetime();
- break;
- case 51:
- return $this->getDbReportLocation();
- break;
- case 52:
- return $this->getDbReportOrganization();
- break;
- case 53:
- return $this->getDbSubject();
- break;
- case 54:
- return $this->getDbContributor();
- break;
- case 55:
- return $this->getDbLanguage();
- break;
- case 56:
- return $this->getDbFileExists();
- break;
- case 57:
- return $this->getDbSoundcloudId();
- break;
- case 58:
- return $this->getDbSoundcloudErrorCode();
- break;
- case 59:
- return $this->getDbSoundcloudErrorMsg();
- break;
- case 60:
- return $this->getDbSoundcloudLinkToFile();
- break;
- case 61:
- return $this->getDbSoundCloundUploadTime();
- break;
- case 62:
- return $this->getDbReplayGain();
- break;
- case 63:
- return $this->getDbOwnerId();
- break;
- case 64:
- return $this->getDbCuein();
- break;
- case 65:
- return $this->getDbCueout();
- break;
- case 66:
- return $this->getDbSilanCheck();
- break;
- case 67:
- return $this->getDbHidden();
- break;
- case 68:
- return $this->getDbIsScheduled();
- break;
- case 69:
- return $this->getDbIsPlaylist();
- break;
- case 70:
- return $this->getDbResourceId();
- 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->getDbName(),
- $keys[2] => $this->getDbMime(),
- $keys[3] => $this->getDbFtype(),
- $keys[4] => $this->getDbDirectory(),
- $keys[5] => $this->getDbFilepath(),
- $keys[6] => $this->getDbImportStatus(),
- $keys[7] => $this->getDbCurrentlyaccessing(),
- $keys[8] => $this->getDbEditedby(),
- $keys[9] => $this->getDbMtime(),
- $keys[10] => $this->getDbUtime(),
- $keys[11] => $this->getDbLPtime(),
- $keys[12] => $this->getDbMd5(),
- $keys[13] => $this->getDbTrackTitle(),
- $keys[14] => $this->getDbArtistName(),
- $keys[15] => $this->getDbBitRate(),
- $keys[16] => $this->getDbSampleRate(),
- $keys[17] => $this->getDbFormat(),
- $keys[18] => $this->getDbLength(),
- $keys[19] => $this->getDbAlbumTitle(),
- $keys[20] => $this->getDbGenre(),
- $keys[21] => $this->getDbComments(),
- $keys[22] => $this->getDbYear(),
- $keys[23] => $this->getDbTrackNumber(),
- $keys[24] => $this->getDbChannels(),
- $keys[25] => $this->getDbUrl(),
- $keys[26] => $this->getDbBpm(),
- $keys[27] => $this->getDbRating(),
- $keys[28] => $this->getDbEncodedBy(),
- $keys[29] => $this->getDbDiscNumber(),
- $keys[30] => $this->getDbMood(),
- $keys[31] => $this->getDbLabel(),
- $keys[32] => $this->getDbComposer(),
- $keys[33] => $this->getDbEncoder(),
- $keys[34] => $this->getDbChecksum(),
- $keys[35] => $this->getDbLyrics(),
- $keys[36] => $this->getDbOrchestra(),
- $keys[37] => $this->getDbConductor(),
- $keys[38] => $this->getDbLyricist(),
- $keys[39] => $this->getDbOriginalLyricist(),
- $keys[40] => $this->getDbRadioStationName(),
- $keys[41] => $this->getDbInfoUrl(),
- $keys[42] => $this->getDbArtistUrl(),
- $keys[43] => $this->getDbAudioSourceUrl(),
- $keys[44] => $this->getDbRadioStationUrl(),
- $keys[45] => $this->getDbBuyThisUrl(),
- $keys[46] => $this->getDbIsrcNumber(),
- $keys[47] => $this->getDbCatalogNumber(),
- $keys[48] => $this->getDbOriginalArtist(),
- $keys[49] => $this->getDbCopyright(),
- $keys[50] => $this->getDbReportDatetime(),
- $keys[51] => $this->getDbReportLocation(),
- $keys[52] => $this->getDbReportOrganization(),
- $keys[53] => $this->getDbSubject(),
- $keys[54] => $this->getDbContributor(),
- $keys[55] => $this->getDbLanguage(),
- $keys[56] => $this->getDbFileExists(),
- $keys[57] => $this->getDbSoundcloudId(),
- $keys[58] => $this->getDbSoundcloudErrorCode(),
- $keys[59] => $this->getDbSoundcloudErrorMsg(),
- $keys[60] => $this->getDbSoundcloudLinkToFile(),
- $keys[61] => $this->getDbSoundCloundUploadTime(),
- $keys[62] => $this->getDbReplayGain(),
- $keys[63] => $this->getDbOwnerId(),
- $keys[64] => $this->getDbCuein(),
- $keys[65] => $this->getDbCueout(),
- $keys[66] => $this->getDbSilanCheck(),
- $keys[67] => $this->getDbHidden(),
- $keys[68] => $this->getDbIsScheduled(),
- $keys[69] => $this->getDbIsPlaylist(),
- $keys[70] => $this->getDbResourceId(),
- );
- if ($includeForeignObjects) {
- if (null !== $this->aFkOwner) {
- $result['FkOwner'] = $this->aFkOwner->toArray($keyType, $includeLazyLoadColumns, true);
- }
- if (null !== $this->aCcSubjsRelatedByDbEditedby) {
- $result['CcSubjsRelatedByDbEditedby'] = $this->aCcSubjsRelatedByDbEditedby->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->setDbName($value);
- break;
- case 2:
- $this->setDbMime($value);
- break;
- case 3:
- $this->setDbFtype($value);
- break;
- case 4:
- $this->setDbDirectory($value);
- break;
- case 5:
- $this->setDbFilepath($value);
- break;
- case 6:
- $this->setDbImportStatus($value);
- break;
- case 7:
- $this->setDbCurrentlyaccessing($value);
- break;
- case 8:
- $this->setDbEditedby($value);
- break;
- case 9:
- $this->setDbMtime($value);
- break;
- case 10:
- $this->setDbUtime($value);
- break;
- case 11:
- $this->setDbLPtime($value);
- break;
- case 12:
- $this->setDbMd5($value);
- break;
- case 13:
- $this->setDbTrackTitle($value);
- break;
- case 14:
- $this->setDbArtistName($value);
- break;
- case 15:
- $this->setDbBitRate($value);
- break;
- case 16:
- $this->setDbSampleRate($value);
- break;
- case 17:
- $this->setDbFormat($value);
- break;
- case 18:
- $this->setDbLength($value);
- break;
- case 19:
- $this->setDbAlbumTitle($value);
- break;
- case 20:
- $this->setDbGenre($value);
- break;
- case 21:
- $this->setDbComments($value);
- break;
- case 22:
- $this->setDbYear($value);
- break;
- case 23:
- $this->setDbTrackNumber($value);
- break;
- case 24:
- $this->setDbChannels($value);
- break;
- case 25:
- $this->setDbUrl($value);
- break;
- case 26:
- $this->setDbBpm($value);
- break;
- case 27:
- $this->setDbRating($value);
- break;
- case 28:
- $this->setDbEncodedBy($value);
- break;
- case 29:
- $this->setDbDiscNumber($value);
- break;
- case 30:
- $this->setDbMood($value);
- break;
- case 31:
- $this->setDbLabel($value);
- break;
- case 32:
- $this->setDbComposer($value);
- break;
- case 33:
- $this->setDbEncoder($value);
- break;
- case 34:
- $this->setDbChecksum($value);
- break;
- case 35:
- $this->setDbLyrics($value);
- break;
- case 36:
- $this->setDbOrchestra($value);
- break;
- case 37:
- $this->setDbConductor($value);
- break;
- case 38:
- $this->setDbLyricist($value);
- break;
- case 39:
- $this->setDbOriginalLyricist($value);
- break;
- case 40:
- $this->setDbRadioStationName($value);
- break;
- case 41:
- $this->setDbInfoUrl($value);
- break;
- case 42:
- $this->setDbArtistUrl($value);
- break;
- case 43:
- $this->setDbAudioSourceUrl($value);
- break;
- case 44:
- $this->setDbRadioStationUrl($value);
- break;
- case 45:
- $this->setDbBuyThisUrl($value);
- break;
- case 46:
- $this->setDbIsrcNumber($value);
- break;
- case 47:
- $this->setDbCatalogNumber($value);
- break;
- case 48:
- $this->setDbOriginalArtist($value);
- break;
- case 49:
- $this->setDbCopyright($value);
- break;
- case 50:
- $this->setDbReportDatetime($value);
- break;
- case 51:
- $this->setDbReportLocation($value);
- break;
- case 52:
- $this->setDbReportOrganization($value);
- break;
- case 53:
- $this->setDbSubject($value);
- break;
- case 54:
- $this->setDbContributor($value);
- break;
- case 55:
- $this->setDbLanguage($value);
- break;
- case 56:
- $this->setDbFileExists($value);
- break;
- case 57:
- $this->setDbSoundcloudId($value);
- break;
- case 58:
- $this->setDbSoundcloudErrorCode($value);
- break;
- case 59:
- $this->setDbSoundcloudErrorMsg($value);
- break;
- case 60:
- $this->setDbSoundcloudLinkToFile($value);
- break;
- case 61:
- $this->setDbSoundCloundUploadTime($value);
- break;
- case 62:
- $this->setDbReplayGain($value);
- break;
- case 63:
- $this->setDbOwnerId($value);
- break;
- case 64:
- $this->setDbCuein($value);
- break;
- case 65:
- $this->setDbCueout($value);
- break;
- case 66:
- $this->setDbSilanCheck($value);
- break;
- case 67:
- $this->setDbHidden($value);
- break;
- case 68:
- $this->setDbIsScheduled($value);
- break;
- case 69:
- $this->setDbIsPlaylist($value);
- break;
- case 70:
- $this->setDbResourceId($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->setDbName($arr[$keys[1]]);
- if (array_key_exists($keys[2], $arr)) $this->setDbMime($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setDbFtype($arr[$keys[3]]);
- if (array_key_exists($keys[4], $arr)) $this->setDbDirectory($arr[$keys[4]]);
- if (array_key_exists($keys[5], $arr)) $this->setDbFilepath($arr[$keys[5]]);
- if (array_key_exists($keys[6], $arr)) $this->setDbImportStatus($arr[$keys[6]]);
- if (array_key_exists($keys[7], $arr)) $this->setDbCurrentlyaccessing($arr[$keys[7]]);
- if (array_key_exists($keys[8], $arr)) $this->setDbEditedby($arr[$keys[8]]);
- if (array_key_exists($keys[9], $arr)) $this->setDbMtime($arr[$keys[9]]);
- if (array_key_exists($keys[10], $arr)) $this->setDbUtime($arr[$keys[10]]);
- if (array_key_exists($keys[11], $arr)) $this->setDbLPtime($arr[$keys[11]]);
- if (array_key_exists($keys[12], $arr)) $this->setDbMd5($arr[$keys[12]]);
- if (array_key_exists($keys[13], $arr)) $this->setDbTrackTitle($arr[$keys[13]]);
- if (array_key_exists($keys[14], $arr)) $this->setDbArtistName($arr[$keys[14]]);
- if (array_key_exists($keys[15], $arr)) $this->setDbBitRate($arr[$keys[15]]);
- if (array_key_exists($keys[16], $arr)) $this->setDbSampleRate($arr[$keys[16]]);
- if (array_key_exists($keys[17], $arr)) $this->setDbFormat($arr[$keys[17]]);
- if (array_key_exists($keys[18], $arr)) $this->setDbLength($arr[$keys[18]]);
- if (array_key_exists($keys[19], $arr)) $this->setDbAlbumTitle($arr[$keys[19]]);
- if (array_key_exists($keys[20], $arr)) $this->setDbGenre($arr[$keys[20]]);
- if (array_key_exists($keys[21], $arr)) $this->setDbComments($arr[$keys[21]]);
- if (array_key_exists($keys[22], $arr)) $this->setDbYear($arr[$keys[22]]);
- if (array_key_exists($keys[23], $arr)) $this->setDbTrackNumber($arr[$keys[23]]);
- if (array_key_exists($keys[24], $arr)) $this->setDbChannels($arr[$keys[24]]);
- if (array_key_exists($keys[25], $arr)) $this->setDbUrl($arr[$keys[25]]);
- if (array_key_exists($keys[26], $arr)) $this->setDbBpm($arr[$keys[26]]);
- if (array_key_exists($keys[27], $arr)) $this->setDbRating($arr[$keys[27]]);
- if (array_key_exists($keys[28], $arr)) $this->setDbEncodedBy($arr[$keys[28]]);
- if (array_key_exists($keys[29], $arr)) $this->setDbDiscNumber($arr[$keys[29]]);
- if (array_key_exists($keys[30], $arr)) $this->setDbMood($arr[$keys[30]]);
- if (array_key_exists($keys[31], $arr)) $this->setDbLabel($arr[$keys[31]]);
- if (array_key_exists($keys[32], $arr)) $this->setDbComposer($arr[$keys[32]]);
- if (array_key_exists($keys[33], $arr)) $this->setDbEncoder($arr[$keys[33]]);
- if (array_key_exists($keys[34], $arr)) $this->setDbChecksum($arr[$keys[34]]);
- if (array_key_exists($keys[35], $arr)) $this->setDbLyrics($arr[$keys[35]]);
- if (array_key_exists($keys[36], $arr)) $this->setDbOrchestra($arr[$keys[36]]);
- if (array_key_exists($keys[37], $arr)) $this->setDbConductor($arr[$keys[37]]);
- if (array_key_exists($keys[38], $arr)) $this->setDbLyricist($arr[$keys[38]]);
- if (array_key_exists($keys[39], $arr)) $this->setDbOriginalLyricist($arr[$keys[39]]);
- if (array_key_exists($keys[40], $arr)) $this->setDbRadioStationName($arr[$keys[40]]);
- if (array_key_exists($keys[41], $arr)) $this->setDbInfoUrl($arr[$keys[41]]);
- if (array_key_exists($keys[42], $arr)) $this->setDbArtistUrl($arr[$keys[42]]);
- if (array_key_exists($keys[43], $arr)) $this->setDbAudioSourceUrl($arr[$keys[43]]);
- if (array_key_exists($keys[44], $arr)) $this->setDbRadioStationUrl($arr[$keys[44]]);
- if (array_key_exists($keys[45], $arr)) $this->setDbBuyThisUrl($arr[$keys[45]]);
- if (array_key_exists($keys[46], $arr)) $this->setDbIsrcNumber($arr[$keys[46]]);
- if (array_key_exists($keys[47], $arr)) $this->setDbCatalogNumber($arr[$keys[47]]);
- if (array_key_exists($keys[48], $arr)) $this->setDbOriginalArtist($arr[$keys[48]]);
- if (array_key_exists($keys[49], $arr)) $this->setDbCopyright($arr[$keys[49]]);
- if (array_key_exists($keys[50], $arr)) $this->setDbReportDatetime($arr[$keys[50]]);
- if (array_key_exists($keys[51], $arr)) $this->setDbReportLocation($arr[$keys[51]]);
- if (array_key_exists($keys[52], $arr)) $this->setDbReportOrganization($arr[$keys[52]]);
- if (array_key_exists($keys[53], $arr)) $this->setDbSubject($arr[$keys[53]]);
- if (array_key_exists($keys[54], $arr)) $this->setDbContributor($arr[$keys[54]]);
- if (array_key_exists($keys[55], $arr)) $this->setDbLanguage($arr[$keys[55]]);
- if (array_key_exists($keys[56], $arr)) $this->setDbFileExists($arr[$keys[56]]);
- if (array_key_exists($keys[57], $arr)) $this->setDbSoundcloudId($arr[$keys[57]]);
- if (array_key_exists($keys[58], $arr)) $this->setDbSoundcloudErrorCode($arr[$keys[58]]);
- if (array_key_exists($keys[59], $arr)) $this->setDbSoundcloudErrorMsg($arr[$keys[59]]);
- if (array_key_exists($keys[60], $arr)) $this->setDbSoundcloudLinkToFile($arr[$keys[60]]);
- if (array_key_exists($keys[61], $arr)) $this->setDbSoundCloundUploadTime($arr[$keys[61]]);
- if (array_key_exists($keys[62], $arr)) $this->setDbReplayGain($arr[$keys[62]]);
- if (array_key_exists($keys[63], $arr)) $this->setDbOwnerId($arr[$keys[63]]);
- if (array_key_exists($keys[64], $arr)) $this->setDbCuein($arr[$keys[64]]);
- if (array_key_exists($keys[65], $arr)) $this->setDbCueout($arr[$keys[65]]);
- if (array_key_exists($keys[66], $arr)) $this->setDbSilanCheck($arr[$keys[66]]);
- if (array_key_exists($keys[67], $arr)) $this->setDbHidden($arr[$keys[67]]);
- if (array_key_exists($keys[68], $arr)) $this->setDbIsScheduled($arr[$keys[68]]);
- if (array_key_exists($keys[69], $arr)) $this->setDbIsPlaylist($arr[$keys[69]]);
- if (array_key_exists($keys[70], $arr)) $this->setDbResourceId($arr[$keys[70]]);
- }
-
- /**
- * 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::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::IMPORT_STATUS)) $criteria->add(CcFilesPeer::IMPORT_STATUS, $this->import_status);
- 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::UTIME)) $criteria->add(CcFilesPeer::UTIME, $this->utime);
- if ($this->isColumnModified(CcFilesPeer::LPTIME)) $criteria->add(CcFilesPeer::LPTIME, $this->lptime);
- 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::FILE_EXISTS)) $criteria->add(CcFilesPeer::FILE_EXISTS, $this->file_exists);
- 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);
- if ($this->isColumnModified(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME)) $criteria->add(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME, $this->soundcloud_upload_time);
- if ($this->isColumnModified(CcFilesPeer::REPLAY_GAIN)) $criteria->add(CcFilesPeer::REPLAY_GAIN, $this->replay_gain);
- if ($this->isColumnModified(CcFilesPeer::OWNER_ID)) $criteria->add(CcFilesPeer::OWNER_ID, $this->owner_id);
- if ($this->isColumnModified(CcFilesPeer::CUEIN)) $criteria->add(CcFilesPeer::CUEIN, $this->cuein);
- if ($this->isColumnModified(CcFilesPeer::CUEOUT)) $criteria->add(CcFilesPeer::CUEOUT, $this->cueout);
- if ($this->isColumnModified(CcFilesPeer::SILAN_CHECK)) $criteria->add(CcFilesPeer::SILAN_CHECK, $this->silan_check);
- if ($this->isColumnModified(CcFilesPeer::HIDDEN)) $criteria->add(CcFilesPeer::HIDDEN, $this->hidden);
- if ($this->isColumnModified(CcFilesPeer::IS_SCHEDULED)) $criteria->add(CcFilesPeer::IS_SCHEDULED, $this->is_scheduled);
- if ($this->isColumnModified(CcFilesPeer::IS_PLAYLIST)) $criteria->add(CcFilesPeer::IS_PLAYLIST, $this->is_playlist);
- if ($this->isColumnModified(CcFilesPeer::RESOURCE_ID)) $criteria->add(CcFilesPeer::RESOURCE_ID, $this->resource_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(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->setDbName($this->name);
- $copyObj->setDbMime($this->mime);
- $copyObj->setDbFtype($this->ftype);
- $copyObj->setDbDirectory($this->directory);
- $copyObj->setDbFilepath($this->filepath);
- $copyObj->setDbImportStatus($this->import_status);
- $copyObj->setDbCurrentlyaccessing($this->currentlyaccessing);
- $copyObj->setDbEditedby($this->editedby);
- $copyObj->setDbMtime($this->mtime);
- $copyObj->setDbUtime($this->utime);
- $copyObj->setDbLPtime($this->lptime);
- $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->setDbFileExists($this->file_exists);
- $copyObj->setDbSoundcloudId($this->soundcloud_id);
- $copyObj->setDbSoundcloudErrorCode($this->soundcloud_error_code);
- $copyObj->setDbSoundcloudErrorMsg($this->soundcloud_error_msg);
- $copyObj->setDbSoundcloudLinkToFile($this->soundcloud_link_to_file);
- $copyObj->setDbSoundCloundUploadTime($this->soundcloud_upload_time);
- $copyObj->setDbReplayGain($this->replay_gain);
- $copyObj->setDbOwnerId($this->owner_id);
- $copyObj->setDbCuein($this->cuein);
- $copyObj->setDbCueout($this->cueout);
- $copyObj->setDbSilanCheck($this->silan_check);
- $copyObj->setDbHidden($this->hidden);
- $copyObj->setDbIsScheduled($this->is_scheduled);
- $copyObj->setDbIsPlaylist($this->is_playlist);
- $copyObj->setDbResourceId($this->resource_id);
-
- if ($deepCopy) {
- // important: temporarily setNew(false) because this affects the behavior of
- // the getter/setter methods for fkey referrer objects.
- $copyObj->setNew(false);
-
- foreach ($this->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->getCcBlockcontentss() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addCcBlockcontents($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));
- }
- }
-
- foreach ($this->getCcPlayoutHistorys() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addCcPlayoutHistory($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 setFkOwner(CcSubjs $v = null)
- {
- if ($v === null) {
- $this->setDbOwnerId(NULL);
- } else {
- $this->setDbOwnerId($v->getDbId());
- }
-
- $this->aFkOwner = $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->addCcFilesRelatedByDbOwnerId($this);
- }
-
- return $this;
- }
-
-
- /**
- * Get the associated CcSubjs object
- *
- * @param PropelPDO Optional Connection object.
- * @return CcSubjs The associated CcSubjs object.
- * @throws PropelException
- */
- public function getFkOwner(PropelPDO $con = null)
- {
- if ($this->aFkOwner === null && ($this->owner_id !== null)) {
- $this->aFkOwner = CcSubjsQuery::create()->findPk($this->owner_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->aFkOwner->addCcFilessRelatedByDbOwnerId($this);
- */
- }
- return $this->aFkOwner;
- }
-
- /**
- * 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 setCcSubjsRelatedByDbEditedby(CcSubjs $v = null)
- {
- if ($v === null) {
- $this->setDbEditedby(NULL);
- } else {
- $this->setDbEditedby($v->getDbId());
- }
-
- $this->aCcSubjsRelatedByDbEditedby = $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->addCcFilesRelatedByDbEditedby($this);
- }
-
- return $this;
- }
-
-
- /**
- * Get the associated CcSubjs object
- *
- * @param PropelPDO Optional Connection object.
- * @return CcSubjs The associated CcSubjs object.
- * @throws PropelException
- */
- public function getCcSubjsRelatedByDbEditedby(PropelPDO $con = null)
- {
- if ($this->aCcSubjsRelatedByDbEditedby === null && ($this->editedby !== null)) {
- $this->aCcSubjsRelatedByDbEditedby = 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->aCcSubjsRelatedByDbEditedby->addCcFilessRelatedByDbEditedby($this);
- */
- }
- return $this->aCcSubjsRelatedByDbEditedby;
- }
-
- /**
- * 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 getCcPlaylistcontentssJoinCcBlock($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
- {
- $query = CcPlaylistcontentsQuery::create(null, $criteria);
- $query->joinWith('CcBlock', $join_behavior);
-
- return $this->getCcPlaylistcontentss($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 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 collCcBlockcontentss 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 addCcBlockcontentss()
- */
- public function clearCcBlockcontentss()
- {
- $this->collCcBlockcontentss = null; // important to set this to NULL since that means it is uninitialized
- }
-
- /**
- * Initializes the collCcBlockcontentss collection.
- *
- * By default this just sets the collCcBlockcontentss collection to an empty array (like clearcollCcBlockcontentss());
- * 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 initCcBlockcontentss()
- {
- $this->collCcBlockcontentss = new PropelObjectCollection();
- $this->collCcBlockcontentss->setModel('CcBlockcontents');
- }
-
- /**
- * Gets an array of CcBlockcontents 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 CcBlockcontents[] List of CcBlockcontents objects
- * @throws PropelException
- */
- public function getCcBlockcontentss($criteria = null, PropelPDO $con = null)
- {
- if(null === $this->collCcBlockcontentss || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcBlockcontentss) {
- // return empty collection
- $this->initCcBlockcontentss();
- } else {
- $collCcBlockcontentss = CcBlockcontentsQuery::create(null, $criteria)
- ->filterByCcFiles($this)
- ->find($con);
- if (null !== $criteria) {
- return $collCcBlockcontentss;
- }
- $this->collCcBlockcontentss = $collCcBlockcontentss;
- }
- }
- return $this->collCcBlockcontentss;
- }
-
- /**
- * Returns the number of related CcBlockcontents objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related CcBlockcontents objects.
- * @throws PropelException
- */
- public function countCcBlockcontentss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- if(null === $this->collCcBlockcontentss || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcBlockcontentss) {
- return 0;
- } else {
- $query = CcBlockcontentsQuery::create(null, $criteria);
- if($distinct) {
- $query->distinct();
- }
- return $query
- ->filterByCcFiles($this)
- ->count($con);
- }
- } else {
- return count($this->collCcBlockcontentss);
- }
- }
-
- /**
- * Method called to associate a CcBlockcontents object to this object
- * through the CcBlockcontents foreign key attribute.
- *
- * @param CcBlockcontents $l CcBlockcontents
- * @return void
- * @throws PropelException
- */
- public function addCcBlockcontents(CcBlockcontents $l)
- {
- if ($this->collCcBlockcontentss === null) {
- $this->initCcBlockcontentss();
- }
- if (!$this->collCcBlockcontentss->contains($l)) { // only add it if the **same** object is not already associated
- $this->collCcBlockcontentss[]= $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 CcBlockcontentss 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 CcBlockcontents[] List of CcBlockcontents objects
- */
- public function getCcBlockcontentssJoinCcBlock($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
- {
- $query = CcBlockcontentsQuery::create(null, $criteria);
- $query->joinWith('CcBlock', $join_behavior);
-
- return $this->getCcBlockcontentss($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);
- }
-
-
- /**
- * 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 getCcSchedulesJoinCcWebstream($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
- {
- $query = CcScheduleQuery::create(null, $criteria);
- $query->joinWith('CcWebstream', $join_behavior);
-
- return $this->getCcSchedules($query, $con);
- }
-
- /**
- * Clears out the collCcPlayoutHistorys 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 addCcPlayoutHistorys()
- */
- public function clearCcPlayoutHistorys()
- {
- $this->collCcPlayoutHistorys = null; // important to set this to NULL since that means it is uninitialized
- }
-
- /**
- * Initializes the collCcPlayoutHistorys collection.
- *
- * By default this just sets the collCcPlayoutHistorys collection to an empty array (like clearcollCcPlayoutHistorys());
- * 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 initCcPlayoutHistorys()
- {
- $this->collCcPlayoutHistorys = new PropelObjectCollection();
- $this->collCcPlayoutHistorys->setModel('CcPlayoutHistory');
- }
-
- /**
- * Gets an array of CcPlayoutHistory 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 CcPlayoutHistory[] List of CcPlayoutHistory objects
- * @throws PropelException
- */
- public function getCcPlayoutHistorys($criteria = null, PropelPDO $con = null)
- {
- if(null === $this->collCcPlayoutHistorys || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcPlayoutHistorys) {
- // return empty collection
- $this->initCcPlayoutHistorys();
- } else {
- $collCcPlayoutHistorys = CcPlayoutHistoryQuery::create(null, $criteria)
- ->filterByCcFiles($this)
- ->find($con);
- if (null !== $criteria) {
- return $collCcPlayoutHistorys;
- }
- $this->collCcPlayoutHistorys = $collCcPlayoutHistorys;
- }
- }
- return $this->collCcPlayoutHistorys;
- }
-
- /**
- * Returns the number of related CcPlayoutHistory objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related CcPlayoutHistory objects.
- * @throws PropelException
- */
- public function countCcPlayoutHistorys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- if(null === $this->collCcPlayoutHistorys || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcPlayoutHistorys) {
- return 0;
- } else {
- $query = CcPlayoutHistoryQuery::create(null, $criteria);
- if($distinct) {
- $query->distinct();
- }
- return $query
- ->filterByCcFiles($this)
- ->count($con);
- }
- } else {
- return count($this->collCcPlayoutHistorys);
- }
- }
-
- /**
- * Method called to associate a CcPlayoutHistory object to this object
- * through the CcPlayoutHistory foreign key attribute.
- *
- * @param CcPlayoutHistory $l CcPlayoutHistory
- * @return void
- * @throws PropelException
- */
- public function addCcPlayoutHistory(CcPlayoutHistory $l)
- {
- if ($this->collCcPlayoutHistorys === null) {
- $this->initCcPlayoutHistorys();
- }
- if (!$this->collCcPlayoutHistorys->contains($l)) { // only add it if the **same** object is not already associated
- $this->collCcPlayoutHistorys[]= $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 CcPlayoutHistorys 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 CcPlayoutHistory[] List of CcPlayoutHistory objects
- */
- public function getCcPlayoutHistorysJoinCcShowInstances($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
- {
- $query = CcPlayoutHistoryQuery::create(null, $criteria);
- $query->joinWith('CcShowInstances', $join_behavior);
-
- return $this->getCcPlayoutHistorys($query, $con);
- }
-
- /**
- * Clears the current object and sets all attributes to their default values
- */
- public function clear()
- {
- $this->id = null;
- $this->name = null;
- $this->mime = null;
- $this->ftype = null;
- $this->directory = null;
- $this->filepath = null;
- $this->import_status = null;
- $this->currentlyaccessing = null;
- $this->editedby = null;
- $this->mtime = null;
- $this->utime = null;
- $this->lptime = 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->file_exists = null;
- $this->soundcloud_id = null;
- $this->soundcloud_error_code = null;
- $this->soundcloud_error_msg = null;
- $this->soundcloud_link_to_file = null;
- $this->soundcloud_upload_time = null;
- $this->replay_gain = null;
- $this->owner_id = null;
- $this->cuein = null;
- $this->cueout = null;
- $this->silan_check = null;
- $this->hidden = null;
- $this->is_scheduled = null;
- $this->is_playlist = null;
- $this->resource_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 ($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->collCcBlockcontentss) {
- foreach ((array) $this->collCcBlockcontentss as $o) {
- $o->clearAllReferences($deep);
- }
- }
- if ($this->collCcSchedules) {
- foreach ((array) $this->collCcSchedules as $o) {
- $o->clearAllReferences($deep);
- }
- }
- if ($this->collCcPlayoutHistorys) {
- foreach ((array) $this->collCcPlayoutHistorys as $o) {
- $o->clearAllReferences($deep);
- }
- }
- } // if ($deep)
-
- $this->collCcShowInstancess = null;
- $this->collCcPlaylistcontentss = null;
- $this->collCcBlockcontentss = null;
- $this->collCcSchedules = null;
- $this->collCcPlayoutHistorys = null;
- $this->aFkOwner = null;
- $this->aCcSubjsRelatedByDbEditedby = 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
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcFilesPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcFilesPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the name field.
+ * Note: this column has a database default value of: ''
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * The value for the mime field.
+ * Note: this column has a database default value of: ''
+ * @var string
+ */
+ protected $mime;
+
+ /**
+ * The value for the ftype field.
+ * Note: this column has a database default value of: ''
+ * @var string
+ */
+ protected $ftype;
+
+ /**
+ * The value for the directory field.
+ * @var int
+ */
+ protected $directory;
+
+ /**
+ * The value for the filepath field.
+ * Note: this column has a database default value of: ''
+ * @var string
+ */
+ protected $filepath;
+
+ /**
+ * The value for the import_status field.
+ * Note: this column has a database default value of: 1
+ * @var int
+ */
+ protected $import_status;
+
+ /**
+ * The value for the currentlyaccessing field.
+ * Note: this column has a database default value of: 0
+ * @var int
+ */
+ protected $currentlyaccessing;
+
+ /**
+ * The value for the editedby field.
+ * @var int
+ */
+ protected $editedby;
+
+ /**
+ * The value for the mtime field.
+ * @var string
+ */
+ protected $mtime;
+
+ /**
+ * The value for the utime field.
+ * @var string
+ */
+ protected $utime;
+
+ /**
+ * The value for the lptime field.
+ * @var string
+ */
+ protected $lptime;
+
+ /**
+ * The value for the md5 field.
+ * @var string
+ */
+ protected $md5;
+
+ /**
+ * The value for the track_title field.
+ * @var string
+ */
+ protected $track_title;
+
+ /**
+ * The value for the artist_name field.
+ * @var string
+ */
+ protected $artist_name;
+
+ /**
+ * The value for the bit_rate field.
+ * @var int
+ */
+ protected $bit_rate;
+
+ /**
+ * The value for the sample_rate field.
+ * @var int
+ */
+ protected $sample_rate;
+
+ /**
+ * The value for the format field.
+ * @var string
+ */
+ protected $format;
+
+ /**
+ * The value for the length field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $length;
+
+ /**
+ * The value for the album_title field.
+ * @var string
+ */
+ protected $album_title;
+
+ /**
+ * The value for the genre field.
+ * @var string
+ */
+ protected $genre;
+
+ /**
+ * The value for the comments field.
+ * @var string
+ */
+ protected $comments;
+
+ /**
+ * The value for the year field.
+ * @var string
+ */
+ protected $year;
+
+ /**
+ * The value for the track_number field.
+ * @var int
+ */
+ protected $track_number;
+
+ /**
+ * The value for the channels field.
+ * @var int
+ */
+ protected $channels;
+
+ /**
+ * The value for the url field.
+ * @var string
+ */
+ protected $url;
+
+ /**
+ * The value for the bpm field.
+ * @var int
+ */
+ protected $bpm;
+
+ /**
+ * The value for the rating field.
+ * @var string
+ */
+ protected $rating;
+
+ /**
+ * The value for the encoded_by field.
+ * @var string
+ */
+ protected $encoded_by;
+
+ /**
+ * The value for the disc_number field.
+ * @var string
+ */
+ protected $disc_number;
+
+ /**
+ * The value for the mood field.
+ * @var string
+ */
+ protected $mood;
+
+ /**
+ * The value for the label field.
+ * @var string
+ */
+ protected $label;
+
+ /**
+ * The value for the composer field.
+ * @var string
+ */
+ protected $composer;
+
+ /**
+ * The value for the encoder field.
+ * @var string
+ */
+ protected $encoder;
+
+ /**
+ * The value for the checksum field.
+ * @var string
+ */
+ protected $checksum;
+
+ /**
+ * The value for the lyrics field.
+ * @var string
+ */
+ protected $lyrics;
+
+ /**
+ * The value for the orchestra field.
+ * @var string
+ */
+ protected $orchestra;
+
+ /**
+ * The value for the conductor field.
+ * @var string
+ */
+ protected $conductor;
+
+ /**
+ * The value for the lyricist field.
+ * @var string
+ */
+ protected $lyricist;
+
+ /**
+ * The value for the original_lyricist field.
+ * @var string
+ */
+ protected $original_lyricist;
+
+ /**
+ * The value for the radio_station_name field.
+ * @var string
+ */
+ protected $radio_station_name;
+
+ /**
+ * The value for the info_url field.
+ * @var string
+ */
+ protected $info_url;
+
+ /**
+ * The value for the artist_url field.
+ * @var string
+ */
+ protected $artist_url;
+
+ /**
+ * The value for the audio_source_url field.
+ * @var string
+ */
+ protected $audio_source_url;
+
+ /**
+ * The value for the radio_station_url field.
+ * @var string
+ */
+ protected $radio_station_url;
+
+ /**
+ * The value for the buy_this_url field.
+ * @var string
+ */
+ protected $buy_this_url;
+
+ /**
+ * The value for the isrc_number field.
+ * @var string
+ */
+ protected $isrc_number;
+
+ /**
+ * The value for the catalog_number field.
+ * @var string
+ */
+ protected $catalog_number;
+
+ /**
+ * The value for the original_artist field.
+ * @var string
+ */
+ protected $original_artist;
+
+ /**
+ * The value for the copyright field.
+ * @var string
+ */
+ protected $copyright;
+
+ /**
+ * The value for the report_datetime field.
+ * @var string
+ */
+ protected $report_datetime;
+
+ /**
+ * The value for the report_location field.
+ * @var string
+ */
+ protected $report_location;
+
+ /**
+ * The value for the report_organization field.
+ * @var string
+ */
+ protected $report_organization;
+
+ /**
+ * The value for the subject field.
+ * @var string
+ */
+ protected $subject;
+
+ /**
+ * The value for the contributor field.
+ * @var string
+ */
+ protected $contributor;
+
+ /**
+ * The value for the language field.
+ * @var string
+ */
+ protected $language;
+
+ /**
+ * The value for the file_exists field.
+ * Note: this column has a database default value of: true
+ * @var boolean
+ */
+ protected $file_exists;
+
+ /**
+ * The value for the soundcloud_id field.
+ * @var int
+ */
+ protected $soundcloud_id;
+
+ /**
+ * The value for the soundcloud_error_code field.
+ * @var int
+ */
+ protected $soundcloud_error_code;
+
+ /**
+ * The value for the soundcloud_error_msg field.
+ * @var string
+ */
+ protected $soundcloud_error_msg;
+
+ /**
+ * The value for the soundcloud_link_to_file field.
+ * @var string
+ */
+ protected $soundcloud_link_to_file;
+
+ /**
+ * The value for the soundcloud_upload_time field.
+ * @var string
+ */
+ protected $soundcloud_upload_time;
+
+ /**
+ * The value for the replay_gain field.
+ * @var string
+ */
+ protected $replay_gain;
+
+ /**
+ * The value for the owner_id field.
+ * @var int
+ */
+ protected $owner_id;
+
+ /**
+ * The value for the cuein field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $cuein;
+
+ /**
+ * The value for the cueout field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $cueout;
+
+ /**
+ * The value for the silan_check field.
+ * Note: this column has a database default value of: false
+ * @var boolean
+ */
+ protected $silan_check;
+
+ /**
+ * The value for the hidden field.
+ * Note: this column has a database default value of: false
+ * @var boolean
+ */
+ protected $hidden;
+
+ /**
+ * The value for the is_scheduled field.
+ * Note: this column has a database default value of: false
+ * @var boolean
+ */
+ protected $is_scheduled;
+
+ /**
+ * The value for the is_playlist field.
+ * Note: this column has a database default value of: false
+ * @var boolean
+ */
+ protected $is_playlist;
+
+ /**
+ * The value for the resource_id field.
+ * @var string
+ */
+ protected $resource_id;
+
+ /**
+ * @var CcSubjs
+ */
+ protected $aFkOwner;
+
+ /**
+ * @var CcSubjs
+ */
+ protected $aCcSubjsRelatedByDbEditedby;
+
+ /**
+ * @var CcMusicDirs
+ */
+ protected $aCcMusicDirs;
+
+ /**
+ * @var PropelObjectCollection|CcShowInstances[] Collection to store aggregation of CcShowInstances objects.
+ */
+ protected $collCcShowInstancess;
+ protected $collCcShowInstancessPartial;
+
+ /**
+ * @var PropelObjectCollection|CcPlaylistcontents[] Collection to store aggregation of CcPlaylistcontents objects.
+ */
+ protected $collCcPlaylistcontentss;
+ protected $collCcPlaylistcontentssPartial;
+
+ /**
+ * @var PropelObjectCollection|CcBlockcontents[] Collection to store aggregation of CcBlockcontents objects.
+ */
+ protected $collCcBlockcontentss;
+ protected $collCcBlockcontentssPartial;
+
+ /**
+ * @var PropelObjectCollection|CcSchedule[] Collection to store aggregation of CcSchedule objects.
+ */
+ protected $collCcSchedules;
+ protected $collCcSchedulesPartial;
+
+ /**
+ * @var PropelObjectCollection|CcPlayoutHistory[] Collection to store aggregation of CcPlayoutHistory objects.
+ */
+ protected $collCcPlayoutHistorys;
+ protected $collCcPlayoutHistorysPartial;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccShowInstancessScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccPlaylistcontentssScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccBlockcontentssScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccSchedulesScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccPlayoutHistorysScheduledForDeletion = null;
+
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->name = '';
+ $this->mime = '';
+ $this->ftype = '';
+ $this->filepath = '';
+ $this->import_status = 1;
+ $this->currentlyaccessing = 0;
+ $this->length = '00:00:00';
+ $this->file_exists = true;
+ $this->cuein = '00:00:00';
+ $this->cueout = '00:00:00';
+ $this->silan_check = false;
+ $this->hidden = false;
+ $this->is_scheduled = false;
+ $this->is_playlist = false;
+ }
+
+ /**
+ * 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 [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 [import_status] column value.
+ *
+ * @return int
+ */
+ public function getDbImportStatus()
+ {
+
+ return $this->import_status;
+ }
+
+ /**
+ * 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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [utime] 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 getDbUtime($format = 'Y-m-d H:i:s')
+ {
+ if ($this->utime === null) {
+ return null;
+ }
+
+
+ try {
+ $dt = new DateTime($this->utime);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->utime, true), $x);
+ }
+
+ if ($format === null) {
+ // Because propel.useDateTimeClass is true, we return a DateTime object.
+ return $dt;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [lptime] 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 getDbLPtime($format = 'Y-m-d H:i:s')
+ {
+ if ($this->lptime === null) {
+ return null;
+ }
+
+
+ try {
+ $dt = new DateTime($this->lptime);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->lptime, true), $x);
+ }
+
+ if ($format === null) {
+ // Because propel.useDateTimeClass is true, we return a DateTime object.
+ return $dt;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ 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 int
+ */
+ public function getDbBitRate()
+ {
+
+ return $this->bit_rate;
+ }
+
+ /**
+ * Get the [sample_rate] column value.
+ *
+ * @return int
+ */
+ public function getDbSampleRate()
+ {
+
+ return $this->sample_rate;
+ }
+
+ /**
+ * Get the [format] column value.
+ *
+ * @return string
+ */
+ public function getDbFormat()
+ {
+
+ return $this->format;
+ }
+
+ /**
+ * Get the [length] column value.
+ *
+ * @return string
+ */
+ public function getDbLength()
+ {
+
+ return $this->length;
+ }
+
+ /**
+ * 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 int
+ */
+ 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 [file_exists] column value.
+ *
+ * @return boolean
+ */
+ public function getDbFileExists()
+ {
+
+ return $this->file_exists;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [soundcloud_upload_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 getDbSoundCloundUploadTime($format = 'Y-m-d H:i:s')
+ {
+ if ($this->soundcloud_upload_time === null) {
+ return null;
+ }
+
+
+ try {
+ $dt = new DateTime($this->soundcloud_upload_time);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->soundcloud_upload_time, true), $x);
+ }
+
+ if ($format === null) {
+ // Because propel.useDateTimeClass is true, we return a DateTime object.
+ return $dt;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Get the [replay_gain] column value.
+ *
+ * @return string
+ */
+ public function getDbReplayGain()
+ {
+
+ return $this->replay_gain;
+ }
+
+ /**
+ * Get the [owner_id] column value.
+ *
+ * @return int
+ */
+ public function getDbOwnerId()
+ {
+
+ return $this->owner_id;
+ }
+
+ /**
+ * Get the [cuein] column value.
+ *
+ * @return string
+ */
+ public function getDbCuein()
+ {
+
+ return $this->cuein;
+ }
+
+ /**
+ * Get the [cueout] column value.
+ *
+ * @return string
+ */
+ public function getDbCueout()
+ {
+
+ return $this->cueout;
+ }
+
+ /**
+ * Get the [silan_check] column value.
+ *
+ * @return boolean
+ */
+ public function getDbSilanCheck()
+ {
+
+ return $this->silan_check;
+ }
+
+ /**
+ * Get the [hidden] column value.
+ *
+ * @return boolean
+ */
+ public function getDbHidden()
+ {
+
+ return $this->hidden;
+ }
+
+ /**
+ * Get the [is_scheduled] column value.
+ *
+ * @return boolean
+ */
+ public function getDbIsScheduled()
+ {
+
+ return $this->is_scheduled;
+ }
+
+ /**
+ * Get the [is_playlist] column value.
+ *
+ * @return boolean
+ */
+ public function getDbIsPlaylist()
+ {
+
+ return $this->is_playlist;
+ }
+
+ /**
+ * Get the [resource_id] column value.
+ *
+ * @return string
+ */
+ public function getDbResourceId()
+ {
+
+ return $this->resource_id;
+ }
+
+ /**
+ * 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 && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcFilesPeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * 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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->name !== $v) {
+ $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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->mime !== $v) {
+ $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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->ftype !== $v) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->filepath !== $v) {
+ $this->filepath = $v;
+ $this->modifiedColumns[] = CcFilesPeer::FILEPATH;
+ }
+
+
+ return $this;
+ } // setDbFilepath()
+
+ /**
+ * Set the value of [import_status] column.
+ *
+ * @param int $v new value
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbImportStatus($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->import_status !== $v) {
+ $this->import_status = $v;
+ $this->modifiedColumns[] = CcFilesPeer::IMPORT_STATUS;
+ }
+
+
+ return $this;
+ } // setDbImportStatus()
+
+ /**
+ * 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 && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->currentlyaccessing !== $v) {
+ $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 && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->editedby !== $v) {
+ $this->editedby = $v;
+ $this->modifiedColumns[] = CcFilesPeer::EDITEDBY;
+ }
+
+ if ($this->aCcSubjsRelatedByDbEditedby !== null && $this->aCcSubjsRelatedByDbEditedby->getDbId() !== $v) {
+ $this->aCcSubjsRelatedByDbEditedby = 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 strings are treated as null.
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbMtime($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->mtime !== null || $dt !== null) {
+ $currentDateAsString = ($this->mtime !== null && $tmpDt = new DateTime($this->mtime)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->mtime = $newDateAsString;
+ $this->modifiedColumns[] = CcFilesPeer::MTIME;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbMtime()
+
+ /**
+ * Sets the value of [utime] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or DateTime value.
+ * Empty strings are treated as null.
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbUtime($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->utime !== null || $dt !== null) {
+ $currentDateAsString = ($this->utime !== null && $tmpDt = new DateTime($this->utime)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->utime = $newDateAsString;
+ $this->modifiedColumns[] = CcFilesPeer::UTIME;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbUtime()
+
+ /**
+ * Sets the value of [lptime] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or DateTime value.
+ * Empty strings are treated as null.
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbLPtime($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->lptime !== null || $dt !== null) {
+ $currentDateAsString = ($this->lptime !== null && $tmpDt = new DateTime($this->lptime)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->lptime = $newDateAsString;
+ $this->modifiedColumns[] = CcFilesPeer::LPTIME;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbLPtime()
+
+ /**
+ * 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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 int $v new value
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbBitRate($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $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 int $v new value
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbSampleRate($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->format !== $v) {
+ $this->format = $v;
+ $this->modifiedColumns[] = CcFilesPeer::FORMAT;
+ }
+
+
+ return $this;
+ } // setDbFormat()
+
+ /**
+ * Set the value of [length] column.
+ *
+ * @param string $v new value
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbLength($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->length !== $v) {
+ $this->length = $v;
+ $this->modifiedColumns[] = CcFilesPeer::LENGTH;
+ }
+
+
+ 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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->url !== $v) {
+ $this->url = $v;
+ $this->modifiedColumns[] = CcFilesPeer::URL;
+ }
+
+
+ return $this;
+ } // setDbUrl()
+
+ /**
+ * Set the value of [bpm] column.
+ *
+ * @param int $v new value
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbBpm($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->language !== $v) {
+ $this->language = $v;
+ $this->modifiedColumns[] = CcFilesPeer::LANGUAGE;
+ }
+
+
+ return $this;
+ } // setDbLanguage()
+
+ /**
+ * Sets the value of the [file_exists] column.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ *
+ * @param boolean|integer|string $v The new value
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbFileExists($v)
+ {
+ if ($v !== null) {
+ if (is_string($v)) {
+ $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ } else {
+ $v = (boolean) $v;
+ }
+ }
+
+ if ($this->file_exists !== $v) {
+ $this->file_exists = $v;
+ $this->modifiedColumns[] = CcFilesPeer::FILE_EXISTS;
+ }
+
+
+ return $this;
+ } // setDbFileExists()
+
+ /**
+ * 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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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()
+
+ /**
+ * Sets the value of [soundcloud_upload_time] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or DateTime value.
+ * Empty strings are treated as null.
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbSoundCloundUploadTime($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->soundcloud_upload_time !== null || $dt !== null) {
+ $currentDateAsString = ($this->soundcloud_upload_time !== null && $tmpDt = new DateTime($this->soundcloud_upload_time)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->soundcloud_upload_time = $newDateAsString;
+ $this->modifiedColumns[] = CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbSoundCloundUploadTime()
+
+ /**
+ * Set the value of [replay_gain] column.
+ *
+ * @param string $v new value
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbReplayGain($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->replay_gain !== $v) {
+ $this->replay_gain = $v;
+ $this->modifiedColumns[] = CcFilesPeer::REPLAY_GAIN;
+ }
+
+
+ return $this;
+ } // setDbReplayGain()
+
+ /**
+ * Set the value of [owner_id] column.
+ *
+ * @param int $v new value
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbOwnerId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->owner_id !== $v) {
+ $this->owner_id = $v;
+ $this->modifiedColumns[] = CcFilesPeer::OWNER_ID;
+ }
+
+ if ($this->aFkOwner !== null && $this->aFkOwner->getDbId() !== $v) {
+ $this->aFkOwner = null;
+ }
+
+
+ return $this;
+ } // setDbOwnerId()
+
+ /**
+ * Set the value of [cuein] column.
+ *
+ * @param string $v new value
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbCuein($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->cuein !== $v) {
+ $this->cuein = $v;
+ $this->modifiedColumns[] = CcFilesPeer::CUEIN;
+ }
+
+
+ return $this;
+ } // setDbCuein()
+
+ /**
+ * Set the value of [cueout] column.
+ *
+ * @param string $v new value
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbCueout($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->cueout !== $v) {
+ $this->cueout = $v;
+ $this->modifiedColumns[] = CcFilesPeer::CUEOUT;
+ }
+
+
+ return $this;
+ } // setDbCueout()
+
+ /**
+ * Sets the value of the [silan_check] column.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ *
+ * @param boolean|integer|string $v The new value
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbSilanCheck($v)
+ {
+ if ($v !== null) {
+ if (is_string($v)) {
+ $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ } else {
+ $v = (boolean) $v;
+ }
+ }
+
+ if ($this->silan_check !== $v) {
+ $this->silan_check = $v;
+ $this->modifiedColumns[] = CcFilesPeer::SILAN_CHECK;
+ }
+
+
+ return $this;
+ } // setDbSilanCheck()
+
+ /**
+ * Sets the value of the [hidden] column.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ *
+ * @param boolean|integer|string $v The new value
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbHidden($v)
+ {
+ if ($v !== null) {
+ if (is_string($v)) {
+ $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ } else {
+ $v = (boolean) $v;
+ }
+ }
+
+ if ($this->hidden !== $v) {
+ $this->hidden = $v;
+ $this->modifiedColumns[] = CcFilesPeer::HIDDEN;
+ }
+
+
+ return $this;
+ } // setDbHidden()
+
+ /**
+ * Sets the value of the [is_scheduled] column.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ *
+ * @param boolean|integer|string $v The new value
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbIsScheduled($v)
+ {
+ if ($v !== null) {
+ if (is_string($v)) {
+ $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ } else {
+ $v = (boolean) $v;
+ }
+ }
+
+ if ($this->is_scheduled !== $v) {
+ $this->is_scheduled = $v;
+ $this->modifiedColumns[] = CcFilesPeer::IS_SCHEDULED;
+ }
+
+
+ return $this;
+ } // setDbIsScheduled()
+
+ /**
+ * Sets the value of the [is_playlist] column.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ *
+ * @param boolean|integer|string $v The new value
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbIsPlaylist($v)
+ {
+ if ($v !== null) {
+ if (is_string($v)) {
+ $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ } else {
+ $v = (boolean) $v;
+ }
+ }
+
+ if ($this->is_playlist !== $v) {
+ $this->is_playlist = $v;
+ $this->modifiedColumns[] = CcFilesPeer::IS_PLAYLIST;
+ }
+
+
+ return $this;
+ } // setDbIsPlaylist()
+
+ /**
+ * Set the value of [resource_id] column.
+ *
+ * @param string $v new value
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setDbResourceId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->resource_id !== $v) {
+ $this->resource_id = $v;
+ $this->modifiedColumns[] = CcFilesPeer::RESOURCE_ID;
+ }
+
+
+ return $this;
+ } // setDbResourceId()
+
+ /**
+ * 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->import_status !== 1) {
+ return false;
+ }
+
+ if ($this->currentlyaccessing !== 0) {
+ return false;
+ }
+
+ if ($this->length !== '00:00:00') {
+ return false;
+ }
+
+ if ($this->file_exists !== true) {
+ return false;
+ }
+
+ if ($this->cuein !== '00:00:00') {
+ return false;
+ }
+
+ if ($this->cueout !== '00:00:00') {
+ return false;
+ }
+
+ if ($this->silan_check !== false) {
+ return false;
+ }
+
+ if ($this->hidden !== false) {
+ return false;
+ }
+
+ if ($this->is_scheduled !== false) {
+ return false;
+ }
+
+ if ($this->is_playlist !== 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 resultset 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->mime = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->ftype = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->directory = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
+ $this->filepath = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->import_status = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
+ $this->currentlyaccessing = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null;
+ $this->editedby = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null;
+ $this->mtime = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
+ $this->utime = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
+ $this->lptime = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
+ $this->md5 = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null;
+ $this->track_title = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null;
+ $this->artist_name = ($row[$startcol + 14] !== null) ? (string) $row[$startcol + 14] : null;
+ $this->bit_rate = ($row[$startcol + 15] !== null) ? (int) $row[$startcol + 15] : null;
+ $this->sample_rate = ($row[$startcol + 16] !== null) ? (int) $row[$startcol + 16] : null;
+ $this->format = ($row[$startcol + 17] !== null) ? (string) $row[$startcol + 17] : null;
+ $this->length = ($row[$startcol + 18] !== null) ? (string) $row[$startcol + 18] : null;
+ $this->album_title = ($row[$startcol + 19] !== null) ? (string) $row[$startcol + 19] : null;
+ $this->genre = ($row[$startcol + 20] !== null) ? (string) $row[$startcol + 20] : null;
+ $this->comments = ($row[$startcol + 21] !== null) ? (string) $row[$startcol + 21] : null;
+ $this->year = ($row[$startcol + 22] !== null) ? (string) $row[$startcol + 22] : null;
+ $this->track_number = ($row[$startcol + 23] !== null) ? (int) $row[$startcol + 23] : null;
+ $this->channels = ($row[$startcol + 24] !== null) ? (int) $row[$startcol + 24] : null;
+ $this->url = ($row[$startcol + 25] !== null) ? (string) $row[$startcol + 25] : null;
+ $this->bpm = ($row[$startcol + 26] !== null) ? (int) $row[$startcol + 26] : null;
+ $this->rating = ($row[$startcol + 27] !== null) ? (string) $row[$startcol + 27] : null;
+ $this->encoded_by = ($row[$startcol + 28] !== null) ? (string) $row[$startcol + 28] : null;
+ $this->disc_number = ($row[$startcol + 29] !== null) ? (string) $row[$startcol + 29] : null;
+ $this->mood = ($row[$startcol + 30] !== null) ? (string) $row[$startcol + 30] : null;
+ $this->label = ($row[$startcol + 31] !== null) ? (string) $row[$startcol + 31] : null;
+ $this->composer = ($row[$startcol + 32] !== null) ? (string) $row[$startcol + 32] : null;
+ $this->encoder = ($row[$startcol + 33] !== null) ? (string) $row[$startcol + 33] : null;
+ $this->checksum = ($row[$startcol + 34] !== null) ? (string) $row[$startcol + 34] : null;
+ $this->lyrics = ($row[$startcol + 35] !== null) ? (string) $row[$startcol + 35] : null;
+ $this->orchestra = ($row[$startcol + 36] !== null) ? (string) $row[$startcol + 36] : null;
+ $this->conductor = ($row[$startcol + 37] !== null) ? (string) $row[$startcol + 37] : null;
+ $this->lyricist = ($row[$startcol + 38] !== null) ? (string) $row[$startcol + 38] : null;
+ $this->original_lyricist = ($row[$startcol + 39] !== null) ? (string) $row[$startcol + 39] : null;
+ $this->radio_station_name = ($row[$startcol + 40] !== null) ? (string) $row[$startcol + 40] : null;
+ $this->info_url = ($row[$startcol + 41] !== null) ? (string) $row[$startcol + 41] : null;
+ $this->artist_url = ($row[$startcol + 42] !== null) ? (string) $row[$startcol + 42] : null;
+ $this->audio_source_url = ($row[$startcol + 43] !== null) ? (string) $row[$startcol + 43] : null;
+ $this->radio_station_url = ($row[$startcol + 44] !== null) ? (string) $row[$startcol + 44] : null;
+ $this->buy_this_url = ($row[$startcol + 45] !== null) ? (string) $row[$startcol + 45] : null;
+ $this->isrc_number = ($row[$startcol + 46] !== null) ? (string) $row[$startcol + 46] : null;
+ $this->catalog_number = ($row[$startcol + 47] !== null) ? (string) $row[$startcol + 47] : null;
+ $this->original_artist = ($row[$startcol + 48] !== null) ? (string) $row[$startcol + 48] : null;
+ $this->copyright = ($row[$startcol + 49] !== null) ? (string) $row[$startcol + 49] : null;
+ $this->report_datetime = ($row[$startcol + 50] !== null) ? (string) $row[$startcol + 50] : null;
+ $this->report_location = ($row[$startcol + 51] !== null) ? (string) $row[$startcol + 51] : null;
+ $this->report_organization = ($row[$startcol + 52] !== null) ? (string) $row[$startcol + 52] : null;
+ $this->subject = ($row[$startcol + 53] !== null) ? (string) $row[$startcol + 53] : null;
+ $this->contributor = ($row[$startcol + 54] !== null) ? (string) $row[$startcol + 54] : null;
+ $this->language = ($row[$startcol + 55] !== null) ? (string) $row[$startcol + 55] : null;
+ $this->file_exists = ($row[$startcol + 56] !== null) ? (boolean) $row[$startcol + 56] : null;
+ $this->soundcloud_id = ($row[$startcol + 57] !== null) ? (int) $row[$startcol + 57] : null;
+ $this->soundcloud_error_code = ($row[$startcol + 58] !== null) ? (int) $row[$startcol + 58] : null;
+ $this->soundcloud_error_msg = ($row[$startcol + 59] !== null) ? (string) $row[$startcol + 59] : null;
+ $this->soundcloud_link_to_file = ($row[$startcol + 60] !== null) ? (string) $row[$startcol + 60] : null;
+ $this->soundcloud_upload_time = ($row[$startcol + 61] !== null) ? (string) $row[$startcol + 61] : null;
+ $this->replay_gain = ($row[$startcol + 62] !== null) ? (string) $row[$startcol + 62] : null;
+ $this->owner_id = ($row[$startcol + 63] !== null) ? (int) $row[$startcol + 63] : null;
+ $this->cuein = ($row[$startcol + 64] !== null) ? (string) $row[$startcol + 64] : null;
+ $this->cueout = ($row[$startcol + 65] !== null) ? (string) $row[$startcol + 65] : null;
+ $this->silan_check = ($row[$startcol + 66] !== null) ? (boolean) $row[$startcol + 66] : null;
+ $this->hidden = ($row[$startcol + 67] !== null) ? (boolean) $row[$startcol + 67] : null;
+ $this->is_scheduled = ($row[$startcol + 68] !== null) ? (boolean) $row[$startcol + 68] : null;
+ $this->is_playlist = ($row[$startcol + 69] !== null) ? (boolean) $row[$startcol + 69] : null;
+ $this->resource_id = ($row[$startcol + 70] !== null) ? (string) $row[$startcol + 70] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 71; // 71 = CcFilesPeer::NUM_HYDRATE_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->aCcSubjsRelatedByDbEditedby !== null && $this->editedby !== $this->aCcSubjsRelatedByDbEditedby->getDbId()) {
+ $this->aCcSubjsRelatedByDbEditedby = null;
+ }
+ if ($this->aFkOwner !== null && $this->owner_id !== $this->aFkOwner->getDbId()) {
+ $this->aFkOwner = 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->aFkOwner = null;
+ $this->aCcSubjsRelatedByDbEditedby = null;
+ $this->aCcMusicDirs = null;
+ $this->collCcShowInstancess = null;
+
+ $this->collCcPlaylistcontentss = null;
+
+ $this->collCcBlockcontentss = null;
+
+ $this->collCcSchedules = null;
+
+ $this->collCcPlayoutHistorys = null;
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcFilesQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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 (Exception $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 corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aFkOwner !== null) {
+ if ($this->aFkOwner->isModified() || $this->aFkOwner->isNew()) {
+ $affectedRows += $this->aFkOwner->save($con);
+ }
+ $this->setFkOwner($this->aFkOwner);
+ }
+
+ if ($this->aCcSubjsRelatedByDbEditedby !== null) {
+ if ($this->aCcSubjsRelatedByDbEditedby->isModified() || $this->aCcSubjsRelatedByDbEditedby->isNew()) {
+ $affectedRows += $this->aCcSubjsRelatedByDbEditedby->save($con);
+ }
+ $this->setCcSubjsRelatedByDbEditedby($this->aCcSubjsRelatedByDbEditedby);
+ }
+
+ if ($this->aCcMusicDirs !== null) {
+ if ($this->aCcMusicDirs->isModified() || $this->aCcMusicDirs->isNew()) {
+ $affectedRows += $this->aCcMusicDirs->save($con);
+ }
+ $this->setCcMusicDirs($this->aCcMusicDirs);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ if ($this->ccShowInstancessScheduledForDeletion !== null) {
+ if (!$this->ccShowInstancessScheduledForDeletion->isEmpty()) {
+ CcShowInstancesQuery::create()
+ ->filterByPrimaryKeys($this->ccShowInstancessScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccShowInstancessScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcShowInstancess !== null) {
+ foreach ($this->collCcShowInstancess as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccPlaylistcontentssScheduledForDeletion !== null) {
+ if (!$this->ccPlaylistcontentssScheduledForDeletion->isEmpty()) {
+ CcPlaylistcontentsQuery::create()
+ ->filterByPrimaryKeys($this->ccPlaylistcontentssScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccPlaylistcontentssScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcPlaylistcontentss !== null) {
+ foreach ($this->collCcPlaylistcontentss as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccBlockcontentssScheduledForDeletion !== null) {
+ if (!$this->ccBlockcontentssScheduledForDeletion->isEmpty()) {
+ CcBlockcontentsQuery::create()
+ ->filterByPrimaryKeys($this->ccBlockcontentssScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccBlockcontentssScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcBlockcontentss !== null) {
+ foreach ($this->collCcBlockcontentss as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccSchedulesScheduledForDeletion !== null) {
+ if (!$this->ccSchedulesScheduledForDeletion->isEmpty()) {
+ CcScheduleQuery::create()
+ ->filterByPrimaryKeys($this->ccSchedulesScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccSchedulesScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcSchedules !== null) {
+ foreach ($this->collCcSchedules as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccPlayoutHistorysScheduledForDeletion !== null) {
+ if (!$this->ccPlayoutHistorysScheduledForDeletion->isEmpty()) {
+ CcPlayoutHistoryQuery::create()
+ ->filterByPrimaryKeys($this->ccPlayoutHistorysScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccPlayoutHistorysScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcPlayoutHistorys !== null) {
+ foreach ($this->collCcPlayoutHistorys as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcFilesPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcFilesPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_files_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcFilesPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::NAME)) {
+ $modifiedColumns[':p' . $index++] = '"name"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::MIME)) {
+ $modifiedColumns[':p' . $index++] = '"mime"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::FTYPE)) {
+ $modifiedColumns[':p' . $index++] = '"ftype"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::DIRECTORY)) {
+ $modifiedColumns[':p' . $index++] = '"directory"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::FILEPATH)) {
+ $modifiedColumns[':p' . $index++] = '"filepath"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::IMPORT_STATUS)) {
+ $modifiedColumns[':p' . $index++] = '"import_status"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::CURRENTLYACCESSING)) {
+ $modifiedColumns[':p' . $index++] = '"currentlyaccessing"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::EDITEDBY)) {
+ $modifiedColumns[':p' . $index++] = '"editedby"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::MTIME)) {
+ $modifiedColumns[':p' . $index++] = '"mtime"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::UTIME)) {
+ $modifiedColumns[':p' . $index++] = '"utime"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::LPTIME)) {
+ $modifiedColumns[':p' . $index++] = '"lptime"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::MD5)) {
+ $modifiedColumns[':p' . $index++] = '"md5"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::TRACK_TITLE)) {
+ $modifiedColumns[':p' . $index++] = '"track_title"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::ARTIST_NAME)) {
+ $modifiedColumns[':p' . $index++] = '"artist_name"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::BIT_RATE)) {
+ $modifiedColumns[':p' . $index++] = '"bit_rate"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::SAMPLE_RATE)) {
+ $modifiedColumns[':p' . $index++] = '"sample_rate"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::FORMAT)) {
+ $modifiedColumns[':p' . $index++] = '"format"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::LENGTH)) {
+ $modifiedColumns[':p' . $index++] = '"length"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::ALBUM_TITLE)) {
+ $modifiedColumns[':p' . $index++] = '"album_title"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::GENRE)) {
+ $modifiedColumns[':p' . $index++] = '"genre"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::COMMENTS)) {
+ $modifiedColumns[':p' . $index++] = '"comments"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::YEAR)) {
+ $modifiedColumns[':p' . $index++] = '"year"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::TRACK_NUMBER)) {
+ $modifiedColumns[':p' . $index++] = '"track_number"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::CHANNELS)) {
+ $modifiedColumns[':p' . $index++] = '"channels"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::URL)) {
+ $modifiedColumns[':p' . $index++] = '"url"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::BPM)) {
+ $modifiedColumns[':p' . $index++] = '"bpm"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::RATING)) {
+ $modifiedColumns[':p' . $index++] = '"rating"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::ENCODED_BY)) {
+ $modifiedColumns[':p' . $index++] = '"encoded_by"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::DISC_NUMBER)) {
+ $modifiedColumns[':p' . $index++] = '"disc_number"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::MOOD)) {
+ $modifiedColumns[':p' . $index++] = '"mood"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::LABEL)) {
+ $modifiedColumns[':p' . $index++] = '"label"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::COMPOSER)) {
+ $modifiedColumns[':p' . $index++] = '"composer"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::ENCODER)) {
+ $modifiedColumns[':p' . $index++] = '"encoder"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::CHECKSUM)) {
+ $modifiedColumns[':p' . $index++] = '"checksum"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::LYRICS)) {
+ $modifiedColumns[':p' . $index++] = '"lyrics"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::ORCHESTRA)) {
+ $modifiedColumns[':p' . $index++] = '"orchestra"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::CONDUCTOR)) {
+ $modifiedColumns[':p' . $index++] = '"conductor"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::LYRICIST)) {
+ $modifiedColumns[':p' . $index++] = '"lyricist"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::ORIGINAL_LYRICIST)) {
+ $modifiedColumns[':p' . $index++] = '"original_lyricist"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::RADIO_STATION_NAME)) {
+ $modifiedColumns[':p' . $index++] = '"radio_station_name"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::INFO_URL)) {
+ $modifiedColumns[':p' . $index++] = '"info_url"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::ARTIST_URL)) {
+ $modifiedColumns[':p' . $index++] = '"artist_url"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::AUDIO_SOURCE_URL)) {
+ $modifiedColumns[':p' . $index++] = '"audio_source_url"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::RADIO_STATION_URL)) {
+ $modifiedColumns[':p' . $index++] = '"radio_station_url"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::BUY_THIS_URL)) {
+ $modifiedColumns[':p' . $index++] = '"buy_this_url"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::ISRC_NUMBER)) {
+ $modifiedColumns[':p' . $index++] = '"isrc_number"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::CATALOG_NUMBER)) {
+ $modifiedColumns[':p' . $index++] = '"catalog_number"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::ORIGINAL_ARTIST)) {
+ $modifiedColumns[':p' . $index++] = '"original_artist"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::COPYRIGHT)) {
+ $modifiedColumns[':p' . $index++] = '"copyright"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::REPORT_DATETIME)) {
+ $modifiedColumns[':p' . $index++] = '"report_datetime"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::REPORT_LOCATION)) {
+ $modifiedColumns[':p' . $index++] = '"report_location"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::REPORT_ORGANIZATION)) {
+ $modifiedColumns[':p' . $index++] = '"report_organization"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::SUBJECT)) {
+ $modifiedColumns[':p' . $index++] = '"subject"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::CONTRIBUTOR)) {
+ $modifiedColumns[':p' . $index++] = '"contributor"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::LANGUAGE)) {
+ $modifiedColumns[':p' . $index++] = '"language"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::FILE_EXISTS)) {
+ $modifiedColumns[':p' . $index++] = '"file_exists"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::SOUNDCLOUD_ID)) {
+ $modifiedColumns[':p' . $index++] = '"soundcloud_id"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::SOUNDCLOUD_ERROR_CODE)) {
+ $modifiedColumns[':p' . $index++] = '"soundcloud_error_code"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::SOUNDCLOUD_ERROR_MSG)) {
+ $modifiedColumns[':p' . $index++] = '"soundcloud_error_msg"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE)) {
+ $modifiedColumns[':p' . $index++] = '"soundcloud_link_to_file"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME)) {
+ $modifiedColumns[':p' . $index++] = '"soundcloud_upload_time"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::REPLAY_GAIN)) {
+ $modifiedColumns[':p' . $index++] = '"replay_gain"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::OWNER_ID)) {
+ $modifiedColumns[':p' . $index++] = '"owner_id"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::CUEIN)) {
+ $modifiedColumns[':p' . $index++] = '"cuein"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::CUEOUT)) {
+ $modifiedColumns[':p' . $index++] = '"cueout"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::SILAN_CHECK)) {
+ $modifiedColumns[':p' . $index++] = '"silan_check"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::HIDDEN)) {
+ $modifiedColumns[':p' . $index++] = '"hidden"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::IS_SCHEDULED)) {
+ $modifiedColumns[':p' . $index++] = '"is_scheduled"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::IS_PLAYLIST)) {
+ $modifiedColumns[':p' . $index++] = '"is_playlist"';
+ }
+ if ($this->isColumnModified(CcFilesPeer::RESOURCE_ID)) {
+ $modifiedColumns[':p' . $index++] = '"resource_id"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_files" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"name"':
+ $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
+ break;
+ case '"mime"':
+ $stmt->bindValue($identifier, $this->mime, PDO::PARAM_STR);
+ break;
+ case '"ftype"':
+ $stmt->bindValue($identifier, $this->ftype, PDO::PARAM_STR);
+ break;
+ case '"directory"':
+ $stmt->bindValue($identifier, $this->directory, PDO::PARAM_INT);
+ break;
+ case '"filepath"':
+ $stmt->bindValue($identifier, $this->filepath, PDO::PARAM_STR);
+ break;
+ case '"import_status"':
+ $stmt->bindValue($identifier, $this->import_status, PDO::PARAM_INT);
+ break;
+ case '"currentlyaccessing"':
+ $stmt->bindValue($identifier, $this->currentlyaccessing, PDO::PARAM_INT);
+ break;
+ case '"editedby"':
+ $stmt->bindValue($identifier, $this->editedby, PDO::PARAM_INT);
+ break;
+ case '"mtime"':
+ $stmt->bindValue($identifier, $this->mtime, PDO::PARAM_STR);
+ break;
+ case '"utime"':
+ $stmt->bindValue($identifier, $this->utime, PDO::PARAM_STR);
+ break;
+ case '"lptime"':
+ $stmt->bindValue($identifier, $this->lptime, PDO::PARAM_STR);
+ break;
+ case '"md5"':
+ $stmt->bindValue($identifier, $this->md5, PDO::PARAM_STR);
+ break;
+ case '"track_title"':
+ $stmt->bindValue($identifier, $this->track_title, PDO::PARAM_STR);
+ break;
+ case '"artist_name"':
+ $stmt->bindValue($identifier, $this->artist_name, PDO::PARAM_STR);
+ break;
+ case '"bit_rate"':
+ $stmt->bindValue($identifier, $this->bit_rate, PDO::PARAM_INT);
+ break;
+ case '"sample_rate"':
+ $stmt->bindValue($identifier, $this->sample_rate, PDO::PARAM_INT);
+ break;
+ case '"format"':
+ $stmt->bindValue($identifier, $this->format, PDO::PARAM_STR);
+ break;
+ case '"length"':
+ $stmt->bindValue($identifier, $this->length, PDO::PARAM_STR);
+ break;
+ case '"album_title"':
+ $stmt->bindValue($identifier, $this->album_title, PDO::PARAM_STR);
+ break;
+ case '"genre"':
+ $stmt->bindValue($identifier, $this->genre, PDO::PARAM_STR);
+ break;
+ case '"comments"':
+ $stmt->bindValue($identifier, $this->comments, PDO::PARAM_STR);
+ break;
+ case '"year"':
+ $stmt->bindValue($identifier, $this->year, PDO::PARAM_STR);
+ break;
+ case '"track_number"':
+ $stmt->bindValue($identifier, $this->track_number, PDO::PARAM_INT);
+ break;
+ case '"channels"':
+ $stmt->bindValue($identifier, $this->channels, PDO::PARAM_INT);
+ break;
+ case '"url"':
+ $stmt->bindValue($identifier, $this->url, PDO::PARAM_STR);
+ break;
+ case '"bpm"':
+ $stmt->bindValue($identifier, $this->bpm, PDO::PARAM_INT);
+ break;
+ case '"rating"':
+ $stmt->bindValue($identifier, $this->rating, PDO::PARAM_STR);
+ break;
+ case '"encoded_by"':
+ $stmt->bindValue($identifier, $this->encoded_by, PDO::PARAM_STR);
+ break;
+ case '"disc_number"':
+ $stmt->bindValue($identifier, $this->disc_number, PDO::PARAM_STR);
+ break;
+ case '"mood"':
+ $stmt->bindValue($identifier, $this->mood, PDO::PARAM_STR);
+ break;
+ case '"label"':
+ $stmt->bindValue($identifier, $this->label, PDO::PARAM_STR);
+ break;
+ case '"composer"':
+ $stmt->bindValue($identifier, $this->composer, PDO::PARAM_STR);
+ break;
+ case '"encoder"':
+ $stmt->bindValue($identifier, $this->encoder, PDO::PARAM_STR);
+ break;
+ case '"checksum"':
+ $stmt->bindValue($identifier, $this->checksum, PDO::PARAM_STR);
+ break;
+ case '"lyrics"':
+ $stmt->bindValue($identifier, $this->lyrics, PDO::PARAM_STR);
+ break;
+ case '"orchestra"':
+ $stmt->bindValue($identifier, $this->orchestra, PDO::PARAM_STR);
+ break;
+ case '"conductor"':
+ $stmt->bindValue($identifier, $this->conductor, PDO::PARAM_STR);
+ break;
+ case '"lyricist"':
+ $stmt->bindValue($identifier, $this->lyricist, PDO::PARAM_STR);
+ break;
+ case '"original_lyricist"':
+ $stmt->bindValue($identifier, $this->original_lyricist, PDO::PARAM_STR);
+ break;
+ case '"radio_station_name"':
+ $stmt->bindValue($identifier, $this->radio_station_name, PDO::PARAM_STR);
+ break;
+ case '"info_url"':
+ $stmt->bindValue($identifier, $this->info_url, PDO::PARAM_STR);
+ break;
+ case '"artist_url"':
+ $stmt->bindValue($identifier, $this->artist_url, PDO::PARAM_STR);
+ break;
+ case '"audio_source_url"':
+ $stmt->bindValue($identifier, $this->audio_source_url, PDO::PARAM_STR);
+ break;
+ case '"radio_station_url"':
+ $stmt->bindValue($identifier, $this->radio_station_url, PDO::PARAM_STR);
+ break;
+ case '"buy_this_url"':
+ $stmt->bindValue($identifier, $this->buy_this_url, PDO::PARAM_STR);
+ break;
+ case '"isrc_number"':
+ $stmt->bindValue($identifier, $this->isrc_number, PDO::PARAM_STR);
+ break;
+ case '"catalog_number"':
+ $stmt->bindValue($identifier, $this->catalog_number, PDO::PARAM_STR);
+ break;
+ case '"original_artist"':
+ $stmt->bindValue($identifier, $this->original_artist, PDO::PARAM_STR);
+ break;
+ case '"copyright"':
+ $stmt->bindValue($identifier, $this->copyright, PDO::PARAM_STR);
+ break;
+ case '"report_datetime"':
+ $stmt->bindValue($identifier, $this->report_datetime, PDO::PARAM_STR);
+ break;
+ case '"report_location"':
+ $stmt->bindValue($identifier, $this->report_location, PDO::PARAM_STR);
+ break;
+ case '"report_organization"':
+ $stmt->bindValue($identifier, $this->report_organization, PDO::PARAM_STR);
+ break;
+ case '"subject"':
+ $stmt->bindValue($identifier, $this->subject, PDO::PARAM_STR);
+ break;
+ case '"contributor"':
+ $stmt->bindValue($identifier, $this->contributor, PDO::PARAM_STR);
+ break;
+ case '"language"':
+ $stmt->bindValue($identifier, $this->language, PDO::PARAM_STR);
+ break;
+ case '"file_exists"':
+ $stmt->bindValue($identifier, $this->file_exists, PDO::PARAM_BOOL);
+ break;
+ case '"soundcloud_id"':
+ $stmt->bindValue($identifier, $this->soundcloud_id, PDO::PARAM_INT);
+ break;
+ case '"soundcloud_error_code"':
+ $stmt->bindValue($identifier, $this->soundcloud_error_code, PDO::PARAM_INT);
+ break;
+ case '"soundcloud_error_msg"':
+ $stmt->bindValue($identifier, $this->soundcloud_error_msg, PDO::PARAM_STR);
+ break;
+ case '"soundcloud_link_to_file"':
+ $stmt->bindValue($identifier, $this->soundcloud_link_to_file, PDO::PARAM_STR);
+ break;
+ case '"soundcloud_upload_time"':
+ $stmt->bindValue($identifier, $this->soundcloud_upload_time, PDO::PARAM_STR);
+ break;
+ case '"replay_gain"':
+ $stmt->bindValue($identifier, $this->replay_gain, PDO::PARAM_INT);
+ break;
+ case '"owner_id"':
+ $stmt->bindValue($identifier, $this->owner_id, PDO::PARAM_INT);
+ break;
+ case '"cuein"':
+ $stmt->bindValue($identifier, $this->cuein, PDO::PARAM_STR);
+ break;
+ case '"cueout"':
+ $stmt->bindValue($identifier, $this->cueout, PDO::PARAM_STR);
+ break;
+ case '"silan_check"':
+ $stmt->bindValue($identifier, $this->silan_check, PDO::PARAM_BOOL);
+ break;
+ case '"hidden"':
+ $stmt->bindValue($identifier, $this->hidden, PDO::PARAM_BOOL);
+ break;
+ case '"is_scheduled"':
+ $stmt->bindValue($identifier, $this->is_scheduled, PDO::PARAM_BOOL);
+ break;
+ case '"is_playlist"':
+ $stmt->bindValue($identifier, $this->is_playlist, PDO::PARAM_BOOL);
+ break;
+ case '"resource_id"':
+ $stmt->bindValue($identifier, $this->resource_id, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aFkOwner !== null) {
+ if (!$this->aFkOwner->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aFkOwner->getValidationFailures());
+ }
+ }
+
+ if ($this->aCcSubjsRelatedByDbEditedby !== null) {
+ if (!$this->aCcSubjsRelatedByDbEditedby->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcSubjsRelatedByDbEditedby->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->collCcBlockcontentss !== null) {
+ foreach ($this->collCcBlockcontentss 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());
+ }
+ }
+ }
+
+ if ($this->collCcPlayoutHistorys !== null) {
+ foreach ($this->collCcPlayoutHistorys 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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->getDbName();
+ break;
+ case 2:
+ return $this->getDbMime();
+ break;
+ case 3:
+ return $this->getDbFtype();
+ break;
+ case 4:
+ return $this->getDbDirectory();
+ break;
+ case 5:
+ return $this->getDbFilepath();
+ break;
+ case 6:
+ return $this->getDbImportStatus();
+ break;
+ case 7:
+ return $this->getDbCurrentlyaccessing();
+ break;
+ case 8:
+ return $this->getDbEditedby();
+ break;
+ case 9:
+ return $this->getDbMtime();
+ break;
+ case 10:
+ return $this->getDbUtime();
+ break;
+ case 11:
+ return $this->getDbLPtime();
+ break;
+ case 12:
+ return $this->getDbMd5();
+ break;
+ case 13:
+ return $this->getDbTrackTitle();
+ break;
+ case 14:
+ return $this->getDbArtistName();
+ break;
+ case 15:
+ return $this->getDbBitRate();
+ break;
+ case 16:
+ return $this->getDbSampleRate();
+ break;
+ case 17:
+ return $this->getDbFormat();
+ break;
+ case 18:
+ return $this->getDbLength();
+ break;
+ case 19:
+ return $this->getDbAlbumTitle();
+ break;
+ case 20:
+ return $this->getDbGenre();
+ break;
+ case 21:
+ return $this->getDbComments();
+ break;
+ case 22:
+ return $this->getDbYear();
+ break;
+ case 23:
+ return $this->getDbTrackNumber();
+ break;
+ case 24:
+ return $this->getDbChannels();
+ break;
+ case 25:
+ return $this->getDbUrl();
+ break;
+ case 26:
+ return $this->getDbBpm();
+ break;
+ case 27:
+ return $this->getDbRating();
+ break;
+ case 28:
+ return $this->getDbEncodedBy();
+ break;
+ case 29:
+ return $this->getDbDiscNumber();
+ break;
+ case 30:
+ return $this->getDbMood();
+ break;
+ case 31:
+ return $this->getDbLabel();
+ break;
+ case 32:
+ return $this->getDbComposer();
+ break;
+ case 33:
+ return $this->getDbEncoder();
+ break;
+ case 34:
+ return $this->getDbChecksum();
+ break;
+ case 35:
+ return $this->getDbLyrics();
+ break;
+ case 36:
+ return $this->getDbOrchestra();
+ break;
+ case 37:
+ return $this->getDbConductor();
+ break;
+ case 38:
+ return $this->getDbLyricist();
+ break;
+ case 39:
+ return $this->getDbOriginalLyricist();
+ break;
+ case 40:
+ return $this->getDbRadioStationName();
+ break;
+ case 41:
+ return $this->getDbInfoUrl();
+ break;
+ case 42:
+ return $this->getDbArtistUrl();
+ break;
+ case 43:
+ return $this->getDbAudioSourceUrl();
+ break;
+ case 44:
+ return $this->getDbRadioStationUrl();
+ break;
+ case 45:
+ return $this->getDbBuyThisUrl();
+ break;
+ case 46:
+ return $this->getDbIsrcNumber();
+ break;
+ case 47:
+ return $this->getDbCatalogNumber();
+ break;
+ case 48:
+ return $this->getDbOriginalArtist();
+ break;
+ case 49:
+ return $this->getDbCopyright();
+ break;
+ case 50:
+ return $this->getDbReportDatetime();
+ break;
+ case 51:
+ return $this->getDbReportLocation();
+ break;
+ case 52:
+ return $this->getDbReportOrganization();
+ break;
+ case 53:
+ return $this->getDbSubject();
+ break;
+ case 54:
+ return $this->getDbContributor();
+ break;
+ case 55:
+ return $this->getDbLanguage();
+ break;
+ case 56:
+ return $this->getDbFileExists();
+ break;
+ case 57:
+ return $this->getDbSoundcloudId();
+ break;
+ case 58:
+ return $this->getDbSoundcloudErrorCode();
+ break;
+ case 59:
+ return $this->getDbSoundcloudErrorMsg();
+ break;
+ case 60:
+ return $this->getDbSoundcloudLinkToFile();
+ break;
+ case 61:
+ return $this->getDbSoundCloundUploadTime();
+ break;
+ case 62:
+ return $this->getDbReplayGain();
+ break;
+ case 63:
+ return $this->getDbOwnerId();
+ break;
+ case 64:
+ return $this->getDbCuein();
+ break;
+ case 65:
+ return $this->getDbCueout();
+ break;
+ case 66:
+ return $this->getDbSilanCheck();
+ break;
+ case 67:
+ return $this->getDbHidden();
+ break;
+ case 68:
+ return $this->getDbIsScheduled();
+ break;
+ case 69:
+ return $this->getDbIsPlaylist();
+ break;
+ case 70:
+ return $this->getDbResourceId();
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcFiles'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcFiles'][$this->getPrimaryKey()] = true;
+ $keys = CcFilesPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbName(),
+ $keys[2] => $this->getDbMime(),
+ $keys[3] => $this->getDbFtype(),
+ $keys[4] => $this->getDbDirectory(),
+ $keys[5] => $this->getDbFilepath(),
+ $keys[6] => $this->getDbImportStatus(),
+ $keys[7] => $this->getDbCurrentlyaccessing(),
+ $keys[8] => $this->getDbEditedby(),
+ $keys[9] => $this->getDbMtime(),
+ $keys[10] => $this->getDbUtime(),
+ $keys[11] => $this->getDbLPtime(),
+ $keys[12] => $this->getDbMd5(),
+ $keys[13] => $this->getDbTrackTitle(),
+ $keys[14] => $this->getDbArtistName(),
+ $keys[15] => $this->getDbBitRate(),
+ $keys[16] => $this->getDbSampleRate(),
+ $keys[17] => $this->getDbFormat(),
+ $keys[18] => $this->getDbLength(),
+ $keys[19] => $this->getDbAlbumTitle(),
+ $keys[20] => $this->getDbGenre(),
+ $keys[21] => $this->getDbComments(),
+ $keys[22] => $this->getDbYear(),
+ $keys[23] => $this->getDbTrackNumber(),
+ $keys[24] => $this->getDbChannels(),
+ $keys[25] => $this->getDbUrl(),
+ $keys[26] => $this->getDbBpm(),
+ $keys[27] => $this->getDbRating(),
+ $keys[28] => $this->getDbEncodedBy(),
+ $keys[29] => $this->getDbDiscNumber(),
+ $keys[30] => $this->getDbMood(),
+ $keys[31] => $this->getDbLabel(),
+ $keys[32] => $this->getDbComposer(),
+ $keys[33] => $this->getDbEncoder(),
+ $keys[34] => $this->getDbChecksum(),
+ $keys[35] => $this->getDbLyrics(),
+ $keys[36] => $this->getDbOrchestra(),
+ $keys[37] => $this->getDbConductor(),
+ $keys[38] => $this->getDbLyricist(),
+ $keys[39] => $this->getDbOriginalLyricist(),
+ $keys[40] => $this->getDbRadioStationName(),
+ $keys[41] => $this->getDbInfoUrl(),
+ $keys[42] => $this->getDbArtistUrl(),
+ $keys[43] => $this->getDbAudioSourceUrl(),
+ $keys[44] => $this->getDbRadioStationUrl(),
+ $keys[45] => $this->getDbBuyThisUrl(),
+ $keys[46] => $this->getDbIsrcNumber(),
+ $keys[47] => $this->getDbCatalogNumber(),
+ $keys[48] => $this->getDbOriginalArtist(),
+ $keys[49] => $this->getDbCopyright(),
+ $keys[50] => $this->getDbReportDatetime(),
+ $keys[51] => $this->getDbReportLocation(),
+ $keys[52] => $this->getDbReportOrganization(),
+ $keys[53] => $this->getDbSubject(),
+ $keys[54] => $this->getDbContributor(),
+ $keys[55] => $this->getDbLanguage(),
+ $keys[56] => $this->getDbFileExists(),
+ $keys[57] => $this->getDbSoundcloudId(),
+ $keys[58] => $this->getDbSoundcloudErrorCode(),
+ $keys[59] => $this->getDbSoundcloudErrorMsg(),
+ $keys[60] => $this->getDbSoundcloudLinkToFile(),
+ $keys[61] => $this->getDbSoundCloundUploadTime(),
+ $keys[62] => $this->getDbReplayGain(),
+ $keys[63] => $this->getDbOwnerId(),
+ $keys[64] => $this->getDbCuein(),
+ $keys[65] => $this->getDbCueout(),
+ $keys[66] => $this->getDbSilanCheck(),
+ $keys[67] => $this->getDbHidden(),
+ $keys[68] => $this->getDbIsScheduled(),
+ $keys[69] => $this->getDbIsPlaylist(),
+ $keys[70] => $this->getDbResourceId(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aFkOwner) {
+ $result['FkOwner'] = $this->aFkOwner->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->aCcSubjsRelatedByDbEditedby) {
+ $result['CcSubjsRelatedByDbEditedby'] = $this->aCcSubjsRelatedByDbEditedby->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->aCcMusicDirs) {
+ $result['CcMusicDirs'] = $this->aCcMusicDirs->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->collCcShowInstancess) {
+ $result['CcShowInstancess'] = $this->collCcShowInstancess->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcPlaylistcontentss) {
+ $result['CcPlaylistcontentss'] = $this->collCcPlaylistcontentss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcBlockcontentss) {
+ $result['CcBlockcontentss'] = $this->collCcBlockcontentss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcSchedules) {
+ $result['CcSchedules'] = $this->collCcSchedules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcPlayoutHistorys) {
+ $result['CcPlayoutHistorys'] = $this->collCcPlayoutHistorys->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ }
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcFilesPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbMime($value);
+ break;
+ case 3:
+ $this->setDbFtype($value);
+ break;
+ case 4:
+ $this->setDbDirectory($value);
+ break;
+ case 5:
+ $this->setDbFilepath($value);
+ break;
+ case 6:
+ $this->setDbImportStatus($value);
+ break;
+ case 7:
+ $this->setDbCurrentlyaccessing($value);
+ break;
+ case 8:
+ $this->setDbEditedby($value);
+ break;
+ case 9:
+ $this->setDbMtime($value);
+ break;
+ case 10:
+ $this->setDbUtime($value);
+ break;
+ case 11:
+ $this->setDbLPtime($value);
+ break;
+ case 12:
+ $this->setDbMd5($value);
+ break;
+ case 13:
+ $this->setDbTrackTitle($value);
+ break;
+ case 14:
+ $this->setDbArtistName($value);
+ break;
+ case 15:
+ $this->setDbBitRate($value);
+ break;
+ case 16:
+ $this->setDbSampleRate($value);
+ break;
+ case 17:
+ $this->setDbFormat($value);
+ break;
+ case 18:
+ $this->setDbLength($value);
+ break;
+ case 19:
+ $this->setDbAlbumTitle($value);
+ break;
+ case 20:
+ $this->setDbGenre($value);
+ break;
+ case 21:
+ $this->setDbComments($value);
+ break;
+ case 22:
+ $this->setDbYear($value);
+ break;
+ case 23:
+ $this->setDbTrackNumber($value);
+ break;
+ case 24:
+ $this->setDbChannels($value);
+ break;
+ case 25:
+ $this->setDbUrl($value);
+ break;
+ case 26:
+ $this->setDbBpm($value);
+ break;
+ case 27:
+ $this->setDbRating($value);
+ break;
+ case 28:
+ $this->setDbEncodedBy($value);
+ break;
+ case 29:
+ $this->setDbDiscNumber($value);
+ break;
+ case 30:
+ $this->setDbMood($value);
+ break;
+ case 31:
+ $this->setDbLabel($value);
+ break;
+ case 32:
+ $this->setDbComposer($value);
+ break;
+ case 33:
+ $this->setDbEncoder($value);
+ break;
+ case 34:
+ $this->setDbChecksum($value);
+ break;
+ case 35:
+ $this->setDbLyrics($value);
+ break;
+ case 36:
+ $this->setDbOrchestra($value);
+ break;
+ case 37:
+ $this->setDbConductor($value);
+ break;
+ case 38:
+ $this->setDbLyricist($value);
+ break;
+ case 39:
+ $this->setDbOriginalLyricist($value);
+ break;
+ case 40:
+ $this->setDbRadioStationName($value);
+ break;
+ case 41:
+ $this->setDbInfoUrl($value);
+ break;
+ case 42:
+ $this->setDbArtistUrl($value);
+ break;
+ case 43:
+ $this->setDbAudioSourceUrl($value);
+ break;
+ case 44:
+ $this->setDbRadioStationUrl($value);
+ break;
+ case 45:
+ $this->setDbBuyThisUrl($value);
+ break;
+ case 46:
+ $this->setDbIsrcNumber($value);
+ break;
+ case 47:
+ $this->setDbCatalogNumber($value);
+ break;
+ case 48:
+ $this->setDbOriginalArtist($value);
+ break;
+ case 49:
+ $this->setDbCopyright($value);
+ break;
+ case 50:
+ $this->setDbReportDatetime($value);
+ break;
+ case 51:
+ $this->setDbReportLocation($value);
+ break;
+ case 52:
+ $this->setDbReportOrganization($value);
+ break;
+ case 53:
+ $this->setDbSubject($value);
+ break;
+ case 54:
+ $this->setDbContributor($value);
+ break;
+ case 55:
+ $this->setDbLanguage($value);
+ break;
+ case 56:
+ $this->setDbFileExists($value);
+ break;
+ case 57:
+ $this->setDbSoundcloudId($value);
+ break;
+ case 58:
+ $this->setDbSoundcloudErrorCode($value);
+ break;
+ case 59:
+ $this->setDbSoundcloudErrorMsg($value);
+ break;
+ case 60:
+ $this->setDbSoundcloudLinkToFile($value);
+ break;
+ case 61:
+ $this->setDbSoundCloundUploadTime($value);
+ break;
+ case 62:
+ $this->setDbReplayGain($value);
+ break;
+ case 63:
+ $this->setDbOwnerId($value);
+ break;
+ case 64:
+ $this->setDbCuein($value);
+ break;
+ case 65:
+ $this->setDbCueout($value);
+ break;
+ case 66:
+ $this->setDbSilanCheck($value);
+ break;
+ case 67:
+ $this->setDbHidden($value);
+ break;
+ case 68:
+ $this->setDbIsScheduled($value);
+ break;
+ case 69:
+ $this->setDbIsPlaylist($value);
+ break;
+ case 70:
+ $this->setDbResourceId($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 BasePeer::TYPE_PHPNAME
+ *
+ * @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->setDbName($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbMime($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbFtype($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbDirectory($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDbFilepath($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setDbImportStatus($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setDbCurrentlyaccessing($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setDbEditedby($arr[$keys[8]]);
+ if (array_key_exists($keys[9], $arr)) $this->setDbMtime($arr[$keys[9]]);
+ if (array_key_exists($keys[10], $arr)) $this->setDbUtime($arr[$keys[10]]);
+ if (array_key_exists($keys[11], $arr)) $this->setDbLPtime($arr[$keys[11]]);
+ if (array_key_exists($keys[12], $arr)) $this->setDbMd5($arr[$keys[12]]);
+ if (array_key_exists($keys[13], $arr)) $this->setDbTrackTitle($arr[$keys[13]]);
+ if (array_key_exists($keys[14], $arr)) $this->setDbArtistName($arr[$keys[14]]);
+ if (array_key_exists($keys[15], $arr)) $this->setDbBitRate($arr[$keys[15]]);
+ if (array_key_exists($keys[16], $arr)) $this->setDbSampleRate($arr[$keys[16]]);
+ if (array_key_exists($keys[17], $arr)) $this->setDbFormat($arr[$keys[17]]);
+ if (array_key_exists($keys[18], $arr)) $this->setDbLength($arr[$keys[18]]);
+ if (array_key_exists($keys[19], $arr)) $this->setDbAlbumTitle($arr[$keys[19]]);
+ if (array_key_exists($keys[20], $arr)) $this->setDbGenre($arr[$keys[20]]);
+ if (array_key_exists($keys[21], $arr)) $this->setDbComments($arr[$keys[21]]);
+ if (array_key_exists($keys[22], $arr)) $this->setDbYear($arr[$keys[22]]);
+ if (array_key_exists($keys[23], $arr)) $this->setDbTrackNumber($arr[$keys[23]]);
+ if (array_key_exists($keys[24], $arr)) $this->setDbChannels($arr[$keys[24]]);
+ if (array_key_exists($keys[25], $arr)) $this->setDbUrl($arr[$keys[25]]);
+ if (array_key_exists($keys[26], $arr)) $this->setDbBpm($arr[$keys[26]]);
+ if (array_key_exists($keys[27], $arr)) $this->setDbRating($arr[$keys[27]]);
+ if (array_key_exists($keys[28], $arr)) $this->setDbEncodedBy($arr[$keys[28]]);
+ if (array_key_exists($keys[29], $arr)) $this->setDbDiscNumber($arr[$keys[29]]);
+ if (array_key_exists($keys[30], $arr)) $this->setDbMood($arr[$keys[30]]);
+ if (array_key_exists($keys[31], $arr)) $this->setDbLabel($arr[$keys[31]]);
+ if (array_key_exists($keys[32], $arr)) $this->setDbComposer($arr[$keys[32]]);
+ if (array_key_exists($keys[33], $arr)) $this->setDbEncoder($arr[$keys[33]]);
+ if (array_key_exists($keys[34], $arr)) $this->setDbChecksum($arr[$keys[34]]);
+ if (array_key_exists($keys[35], $arr)) $this->setDbLyrics($arr[$keys[35]]);
+ if (array_key_exists($keys[36], $arr)) $this->setDbOrchestra($arr[$keys[36]]);
+ if (array_key_exists($keys[37], $arr)) $this->setDbConductor($arr[$keys[37]]);
+ if (array_key_exists($keys[38], $arr)) $this->setDbLyricist($arr[$keys[38]]);
+ if (array_key_exists($keys[39], $arr)) $this->setDbOriginalLyricist($arr[$keys[39]]);
+ if (array_key_exists($keys[40], $arr)) $this->setDbRadioStationName($arr[$keys[40]]);
+ if (array_key_exists($keys[41], $arr)) $this->setDbInfoUrl($arr[$keys[41]]);
+ if (array_key_exists($keys[42], $arr)) $this->setDbArtistUrl($arr[$keys[42]]);
+ if (array_key_exists($keys[43], $arr)) $this->setDbAudioSourceUrl($arr[$keys[43]]);
+ if (array_key_exists($keys[44], $arr)) $this->setDbRadioStationUrl($arr[$keys[44]]);
+ if (array_key_exists($keys[45], $arr)) $this->setDbBuyThisUrl($arr[$keys[45]]);
+ if (array_key_exists($keys[46], $arr)) $this->setDbIsrcNumber($arr[$keys[46]]);
+ if (array_key_exists($keys[47], $arr)) $this->setDbCatalogNumber($arr[$keys[47]]);
+ if (array_key_exists($keys[48], $arr)) $this->setDbOriginalArtist($arr[$keys[48]]);
+ if (array_key_exists($keys[49], $arr)) $this->setDbCopyright($arr[$keys[49]]);
+ if (array_key_exists($keys[50], $arr)) $this->setDbReportDatetime($arr[$keys[50]]);
+ if (array_key_exists($keys[51], $arr)) $this->setDbReportLocation($arr[$keys[51]]);
+ if (array_key_exists($keys[52], $arr)) $this->setDbReportOrganization($arr[$keys[52]]);
+ if (array_key_exists($keys[53], $arr)) $this->setDbSubject($arr[$keys[53]]);
+ if (array_key_exists($keys[54], $arr)) $this->setDbContributor($arr[$keys[54]]);
+ if (array_key_exists($keys[55], $arr)) $this->setDbLanguage($arr[$keys[55]]);
+ if (array_key_exists($keys[56], $arr)) $this->setDbFileExists($arr[$keys[56]]);
+ if (array_key_exists($keys[57], $arr)) $this->setDbSoundcloudId($arr[$keys[57]]);
+ if (array_key_exists($keys[58], $arr)) $this->setDbSoundcloudErrorCode($arr[$keys[58]]);
+ if (array_key_exists($keys[59], $arr)) $this->setDbSoundcloudErrorMsg($arr[$keys[59]]);
+ if (array_key_exists($keys[60], $arr)) $this->setDbSoundcloudLinkToFile($arr[$keys[60]]);
+ if (array_key_exists($keys[61], $arr)) $this->setDbSoundCloundUploadTime($arr[$keys[61]]);
+ if (array_key_exists($keys[62], $arr)) $this->setDbReplayGain($arr[$keys[62]]);
+ if (array_key_exists($keys[63], $arr)) $this->setDbOwnerId($arr[$keys[63]]);
+ if (array_key_exists($keys[64], $arr)) $this->setDbCuein($arr[$keys[64]]);
+ if (array_key_exists($keys[65], $arr)) $this->setDbCueout($arr[$keys[65]]);
+ if (array_key_exists($keys[66], $arr)) $this->setDbSilanCheck($arr[$keys[66]]);
+ if (array_key_exists($keys[67], $arr)) $this->setDbHidden($arr[$keys[67]]);
+ if (array_key_exists($keys[68], $arr)) $this->setDbIsScheduled($arr[$keys[68]]);
+ if (array_key_exists($keys[69], $arr)) $this->setDbIsPlaylist($arr[$keys[69]]);
+ if (array_key_exists($keys[70], $arr)) $this->setDbResourceId($arr[$keys[70]]);
+ }
+
+ /**
+ * 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::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::IMPORT_STATUS)) $criteria->add(CcFilesPeer::IMPORT_STATUS, $this->import_status);
+ 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::UTIME)) $criteria->add(CcFilesPeer::UTIME, $this->utime);
+ if ($this->isColumnModified(CcFilesPeer::LPTIME)) $criteria->add(CcFilesPeer::LPTIME, $this->lptime);
+ 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::FILE_EXISTS)) $criteria->add(CcFilesPeer::FILE_EXISTS, $this->file_exists);
+ 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);
+ if ($this->isColumnModified(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME)) $criteria->add(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME, $this->soundcloud_upload_time);
+ if ($this->isColumnModified(CcFilesPeer::REPLAY_GAIN)) $criteria->add(CcFilesPeer::REPLAY_GAIN, $this->replay_gain);
+ if ($this->isColumnModified(CcFilesPeer::OWNER_ID)) $criteria->add(CcFilesPeer::OWNER_ID, $this->owner_id);
+ if ($this->isColumnModified(CcFilesPeer::CUEIN)) $criteria->add(CcFilesPeer::CUEIN, $this->cuein);
+ if ($this->isColumnModified(CcFilesPeer::CUEOUT)) $criteria->add(CcFilesPeer::CUEOUT, $this->cueout);
+ if ($this->isColumnModified(CcFilesPeer::SILAN_CHECK)) $criteria->add(CcFilesPeer::SILAN_CHECK, $this->silan_check);
+ if ($this->isColumnModified(CcFilesPeer::HIDDEN)) $criteria->add(CcFilesPeer::HIDDEN, $this->hidden);
+ if ($this->isColumnModified(CcFilesPeer::IS_SCHEDULED)) $criteria->add(CcFilesPeer::IS_SCHEDULED, $this->is_scheduled);
+ if ($this->isColumnModified(CcFilesPeer::IS_PLAYLIST)) $criteria->add(CcFilesPeer::IS_PLAYLIST, $this->is_playlist);
+ if ($this->isColumnModified(CcFilesPeer::RESOURCE_ID)) $criteria->add(CcFilesPeer::RESOURCE_ID, $this->resource_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(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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbName($this->getDbName());
+ $copyObj->setDbMime($this->getDbMime());
+ $copyObj->setDbFtype($this->getDbFtype());
+ $copyObj->setDbDirectory($this->getDbDirectory());
+ $copyObj->setDbFilepath($this->getDbFilepath());
+ $copyObj->setDbImportStatus($this->getDbImportStatus());
+ $copyObj->setDbCurrentlyaccessing($this->getDbCurrentlyaccessing());
+ $copyObj->setDbEditedby($this->getDbEditedby());
+ $copyObj->setDbMtime($this->getDbMtime());
+ $copyObj->setDbUtime($this->getDbUtime());
+ $copyObj->setDbLPtime($this->getDbLPtime());
+ $copyObj->setDbMd5($this->getDbMd5());
+ $copyObj->setDbTrackTitle($this->getDbTrackTitle());
+ $copyObj->setDbArtistName($this->getDbArtistName());
+ $copyObj->setDbBitRate($this->getDbBitRate());
+ $copyObj->setDbSampleRate($this->getDbSampleRate());
+ $copyObj->setDbFormat($this->getDbFormat());
+ $copyObj->setDbLength($this->getDbLength());
+ $copyObj->setDbAlbumTitle($this->getDbAlbumTitle());
+ $copyObj->setDbGenre($this->getDbGenre());
+ $copyObj->setDbComments($this->getDbComments());
+ $copyObj->setDbYear($this->getDbYear());
+ $copyObj->setDbTrackNumber($this->getDbTrackNumber());
+ $copyObj->setDbChannels($this->getDbChannels());
+ $copyObj->setDbUrl($this->getDbUrl());
+ $copyObj->setDbBpm($this->getDbBpm());
+ $copyObj->setDbRating($this->getDbRating());
+ $copyObj->setDbEncodedBy($this->getDbEncodedBy());
+ $copyObj->setDbDiscNumber($this->getDbDiscNumber());
+ $copyObj->setDbMood($this->getDbMood());
+ $copyObj->setDbLabel($this->getDbLabel());
+ $copyObj->setDbComposer($this->getDbComposer());
+ $copyObj->setDbEncoder($this->getDbEncoder());
+ $copyObj->setDbChecksum($this->getDbChecksum());
+ $copyObj->setDbLyrics($this->getDbLyrics());
+ $copyObj->setDbOrchestra($this->getDbOrchestra());
+ $copyObj->setDbConductor($this->getDbConductor());
+ $copyObj->setDbLyricist($this->getDbLyricist());
+ $copyObj->setDbOriginalLyricist($this->getDbOriginalLyricist());
+ $copyObj->setDbRadioStationName($this->getDbRadioStationName());
+ $copyObj->setDbInfoUrl($this->getDbInfoUrl());
+ $copyObj->setDbArtistUrl($this->getDbArtistUrl());
+ $copyObj->setDbAudioSourceUrl($this->getDbAudioSourceUrl());
+ $copyObj->setDbRadioStationUrl($this->getDbRadioStationUrl());
+ $copyObj->setDbBuyThisUrl($this->getDbBuyThisUrl());
+ $copyObj->setDbIsrcNumber($this->getDbIsrcNumber());
+ $copyObj->setDbCatalogNumber($this->getDbCatalogNumber());
+ $copyObj->setDbOriginalArtist($this->getDbOriginalArtist());
+ $copyObj->setDbCopyright($this->getDbCopyright());
+ $copyObj->setDbReportDatetime($this->getDbReportDatetime());
+ $copyObj->setDbReportLocation($this->getDbReportLocation());
+ $copyObj->setDbReportOrganization($this->getDbReportOrganization());
+ $copyObj->setDbSubject($this->getDbSubject());
+ $copyObj->setDbContributor($this->getDbContributor());
+ $copyObj->setDbLanguage($this->getDbLanguage());
+ $copyObj->setDbFileExists($this->getDbFileExists());
+ $copyObj->setDbSoundcloudId($this->getDbSoundcloudId());
+ $copyObj->setDbSoundcloudErrorCode($this->getDbSoundcloudErrorCode());
+ $copyObj->setDbSoundcloudErrorMsg($this->getDbSoundcloudErrorMsg());
+ $copyObj->setDbSoundcloudLinkToFile($this->getDbSoundcloudLinkToFile());
+ $copyObj->setDbSoundCloundUploadTime($this->getDbSoundCloundUploadTime());
+ $copyObj->setDbReplayGain($this->getDbReplayGain());
+ $copyObj->setDbOwnerId($this->getDbOwnerId());
+ $copyObj->setDbCuein($this->getDbCuein());
+ $copyObj->setDbCueout($this->getDbCueout());
+ $copyObj->setDbSilanCheck($this->getDbSilanCheck());
+ $copyObj->setDbHidden($this->getDbHidden());
+ $copyObj->setDbIsScheduled($this->getDbIsScheduled());
+ $copyObj->setDbIsPlaylist($this->getDbIsPlaylist());
+ $copyObj->setDbResourceId($this->getDbResourceId());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ 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->getCcBlockcontentss() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcBlockcontents($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));
+ }
+ }
+
+ foreach ($this->getCcPlayoutHistorys() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcPlayoutHistory($relObj->copy($deepCopy));
+ }
+ }
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 setFkOwner(CcSubjs $v = null)
+ {
+ if ($v === null) {
+ $this->setDbOwnerId(NULL);
+ } else {
+ $this->setDbOwnerId($v->getDbId());
+ }
+
+ $this->aFkOwner = $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->addCcFilesRelatedByDbOwnerId($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcSubjs object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcSubjs The associated CcSubjs object.
+ * @throws PropelException
+ */
+ public function getFkOwner(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aFkOwner === null && ($this->owner_id !== null) && $doQuery) {
+ $this->aFkOwner = CcSubjsQuery::create()->findPk($this->owner_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->aFkOwner->addCcFilessRelatedByDbOwnerId($this);
+ */
+ }
+
+ return $this->aFkOwner;
+ }
+
+ /**
+ * 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 setCcSubjsRelatedByDbEditedby(CcSubjs $v = null)
+ {
+ if ($v === null) {
+ $this->setDbEditedby(NULL);
+ } else {
+ $this->setDbEditedby($v->getDbId());
+ }
+
+ $this->aCcSubjsRelatedByDbEditedby = $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->addCcFilesRelatedByDbEditedby($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcSubjs object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcSubjs The associated CcSubjs object.
+ * @throws PropelException
+ */
+ public function getCcSubjsRelatedByDbEditedby(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcSubjsRelatedByDbEditedby === null && ($this->editedby !== null) && $doQuery) {
+ $this->aCcSubjsRelatedByDbEditedby = 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->aCcSubjsRelatedByDbEditedby->addCcFilessRelatedByDbEditedby($this);
+ */
+ }
+
+ return $this->aCcSubjsRelatedByDbEditedby;
+ }
+
+ /**
+ * 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 $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcMusicDirs The associated CcMusicDirs object.
+ * @throws PropelException
+ */
+ public function getCcMusicDirs(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcMusicDirs === null && ($this->directory !== null) && $doQuery) {
+ $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;
+ }
+
+
+ /**
+ * Initializes a collection based on the name of a relation.
+ * Avoids crafting an 'init[$relationName]s' method name
+ * that wouldn't work when StandardEnglishPluralizer is used.
+ *
+ * @param string $relationName The name of the relation to initialize
+ * @return void
+ */
+ public function initRelation($relationName)
+ {
+ if ('CcShowInstances' == $relationName) {
+ $this->initCcShowInstancess();
+ }
+ if ('CcPlaylistcontents' == $relationName) {
+ $this->initCcPlaylistcontentss();
+ }
+ if ('CcBlockcontents' == $relationName) {
+ $this->initCcBlockcontentss();
+ }
+ if ('CcSchedule' == $relationName) {
+ $this->initCcSchedules();
+ }
+ if ('CcPlayoutHistory' == $relationName) {
+ $this->initCcPlayoutHistorys();
+ }
+ }
+
+ /**
+ * 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 CcFiles The current object (for fluent API support)
+ * @see addCcShowInstancess()
+ */
+ public function clearCcShowInstancess()
+ {
+ $this->collCcShowInstancess = null; // important to set this to null since that means it is uninitialized
+ $this->collCcShowInstancessPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcShowInstancess collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcShowInstancess($v = true)
+ {
+ $this->collCcShowInstancessPartial = $v;
+ }
+
+ /**
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcShowInstancess($overrideExisting = true)
+ {
+ if (null !== $this->collCcShowInstancess && !$overrideExisting) {
+ return;
+ }
+ $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 PropelObjectCollection|CcShowInstances[] List of CcShowInstances objects
+ * @throws PropelException
+ */
+ public function getCcShowInstancess($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcShowInstancessPartial && !$this->isNew();
+ if (null === $this->collCcShowInstancess || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcShowInstancess) {
+ // return empty collection
+ $this->initCcShowInstancess();
+ } else {
+ $collCcShowInstancess = CcShowInstancesQuery::create(null, $criteria)
+ ->filterByCcFiles($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcShowInstancessPartial && count($collCcShowInstancess)) {
+ $this->initCcShowInstancess(false);
+
+ foreach ($collCcShowInstancess as $obj) {
+ if (false == $this->collCcShowInstancess->contains($obj)) {
+ $this->collCcShowInstancess->append($obj);
+ }
+ }
+
+ $this->collCcShowInstancessPartial = true;
+ }
+
+ $collCcShowInstancess->getInternalIterator()->rewind();
+
+ return $collCcShowInstancess;
+ }
+
+ if ($partial && $this->collCcShowInstancess) {
+ foreach ($this->collCcShowInstancess as $obj) {
+ if ($obj->isNew()) {
+ $collCcShowInstancess[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcShowInstancess = $collCcShowInstancess;
+ $this->collCcShowInstancessPartial = false;
+ }
+ }
+
+ return $this->collCcShowInstancess;
+ }
+
+ /**
+ * Sets a collection of CcShowInstances objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccShowInstancess A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setCcShowInstancess(PropelCollection $ccShowInstancess, PropelPDO $con = null)
+ {
+ $ccShowInstancessToDelete = $this->getCcShowInstancess(new Criteria(), $con)->diff($ccShowInstancess);
+
+
+ $this->ccShowInstancessScheduledForDeletion = $ccShowInstancessToDelete;
+
+ foreach ($ccShowInstancessToDelete as $ccShowInstancesRemoved) {
+ $ccShowInstancesRemoved->setCcFiles(null);
+ }
+
+ $this->collCcShowInstancess = null;
+ foreach ($ccShowInstancess as $ccShowInstances) {
+ $this->addCcShowInstances($ccShowInstances);
+ }
+
+ $this->collCcShowInstancess = $ccShowInstancess;
+ $this->collCcShowInstancessPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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)
+ {
+ $partial = $this->collCcShowInstancessPartial && !$this->isNew();
+ if (null === $this->collCcShowInstancess || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcShowInstancess) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcShowInstancess());
+ }
+ $query = CcShowInstancesQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcFiles($this)
+ ->count($con);
+ }
+
+ 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 CcFiles The current object (for fluent API support)
+ */
+ public function addCcShowInstances(CcShowInstances $l)
+ {
+ if ($this->collCcShowInstancess === null) {
+ $this->initCcShowInstancess();
+ $this->collCcShowInstancessPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcShowInstancess->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcShowInstances($l);
+
+ if ($this->ccShowInstancessScheduledForDeletion and $this->ccShowInstancessScheduledForDeletion->contains($l)) {
+ $this->ccShowInstancessScheduledForDeletion->remove($this->ccShowInstancessScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcShowInstances $ccShowInstances The ccShowInstances object to add.
+ */
+ protected function doAddCcShowInstances($ccShowInstances)
+ {
+ $this->collCcShowInstancess[]= $ccShowInstances;
+ $ccShowInstances->setCcFiles($this);
+ }
+
+ /**
+ * @param CcShowInstances $ccShowInstances The ccShowInstances object to remove.
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function removeCcShowInstances($ccShowInstances)
+ {
+ if ($this->getCcShowInstancess()->contains($ccShowInstances)) {
+ $this->collCcShowInstancess->remove($this->collCcShowInstancess->search($ccShowInstances));
+ if (null === $this->ccShowInstancessScheduledForDeletion) {
+ $this->ccShowInstancessScheduledForDeletion = clone $this->collCcShowInstancess;
+ $this->ccShowInstancessScheduledForDeletion->clear();
+ }
+ $this->ccShowInstancessScheduledForDeletion[]= $ccShowInstances;
+ $ccShowInstances->setCcFiles(null);
+ }
+
+ return $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 PropelObjectCollection|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 PropelObjectCollection|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 CcFiles The current object (for fluent API support)
+ * @see addCcPlaylistcontentss()
+ */
+ public function clearCcPlaylistcontentss()
+ {
+ $this->collCcPlaylistcontentss = null; // important to set this to null since that means it is uninitialized
+ $this->collCcPlaylistcontentssPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcPlaylistcontentss collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcPlaylistcontentss($v = true)
+ {
+ $this->collCcPlaylistcontentssPartial = $v;
+ }
+
+ /**
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcPlaylistcontentss($overrideExisting = true)
+ {
+ if (null !== $this->collCcPlaylistcontentss && !$overrideExisting) {
+ return;
+ }
+ $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 PropelObjectCollection|CcPlaylistcontents[] List of CcPlaylistcontents objects
+ * @throws PropelException
+ */
+ public function getCcPlaylistcontentss($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcPlaylistcontentssPartial && !$this->isNew();
+ if (null === $this->collCcPlaylistcontentss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPlaylistcontentss) {
+ // return empty collection
+ $this->initCcPlaylistcontentss();
+ } else {
+ $collCcPlaylistcontentss = CcPlaylistcontentsQuery::create(null, $criteria)
+ ->filterByCcFiles($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcPlaylistcontentssPartial && count($collCcPlaylistcontentss)) {
+ $this->initCcPlaylistcontentss(false);
+
+ foreach ($collCcPlaylistcontentss as $obj) {
+ if (false == $this->collCcPlaylistcontentss->contains($obj)) {
+ $this->collCcPlaylistcontentss->append($obj);
+ }
+ }
+
+ $this->collCcPlaylistcontentssPartial = true;
+ }
+
+ $collCcPlaylistcontentss->getInternalIterator()->rewind();
+
+ return $collCcPlaylistcontentss;
+ }
+
+ if ($partial && $this->collCcPlaylistcontentss) {
+ foreach ($this->collCcPlaylistcontentss as $obj) {
+ if ($obj->isNew()) {
+ $collCcPlaylistcontentss[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcPlaylistcontentss = $collCcPlaylistcontentss;
+ $this->collCcPlaylistcontentssPartial = false;
+ }
+ }
+
+ return $this->collCcPlaylistcontentss;
+ }
+
+ /**
+ * Sets a collection of CcPlaylistcontents objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccPlaylistcontentss A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setCcPlaylistcontentss(PropelCollection $ccPlaylistcontentss, PropelPDO $con = null)
+ {
+ $ccPlaylistcontentssToDelete = $this->getCcPlaylistcontentss(new Criteria(), $con)->diff($ccPlaylistcontentss);
+
+
+ $this->ccPlaylistcontentssScheduledForDeletion = $ccPlaylistcontentssToDelete;
+
+ foreach ($ccPlaylistcontentssToDelete as $ccPlaylistcontentsRemoved) {
+ $ccPlaylistcontentsRemoved->setCcFiles(null);
+ }
+
+ $this->collCcPlaylistcontentss = null;
+ foreach ($ccPlaylistcontentss as $ccPlaylistcontents) {
+ $this->addCcPlaylistcontents($ccPlaylistcontents);
+ }
+
+ $this->collCcPlaylistcontentss = $ccPlaylistcontentss;
+ $this->collCcPlaylistcontentssPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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)
+ {
+ $partial = $this->collCcPlaylistcontentssPartial && !$this->isNew();
+ if (null === $this->collCcPlaylistcontentss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPlaylistcontentss) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcPlaylistcontentss());
+ }
+ $query = CcPlaylistcontentsQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcFiles($this)
+ ->count($con);
+ }
+
+ 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 CcFiles The current object (for fluent API support)
+ */
+ public function addCcPlaylistcontents(CcPlaylistcontents $l)
+ {
+ if ($this->collCcPlaylistcontentss === null) {
+ $this->initCcPlaylistcontentss();
+ $this->collCcPlaylistcontentssPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcPlaylistcontentss->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcPlaylistcontents($l);
+
+ if ($this->ccPlaylistcontentssScheduledForDeletion and $this->ccPlaylistcontentssScheduledForDeletion->contains($l)) {
+ $this->ccPlaylistcontentssScheduledForDeletion->remove($this->ccPlaylistcontentssScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcPlaylistcontents $ccPlaylistcontents The ccPlaylistcontents object to add.
+ */
+ protected function doAddCcPlaylistcontents($ccPlaylistcontents)
+ {
+ $this->collCcPlaylistcontentss[]= $ccPlaylistcontents;
+ $ccPlaylistcontents->setCcFiles($this);
+ }
+
+ /**
+ * @param CcPlaylistcontents $ccPlaylistcontents The ccPlaylistcontents object to remove.
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function removeCcPlaylistcontents($ccPlaylistcontents)
+ {
+ if ($this->getCcPlaylistcontentss()->contains($ccPlaylistcontents)) {
+ $this->collCcPlaylistcontentss->remove($this->collCcPlaylistcontentss->search($ccPlaylistcontents));
+ if (null === $this->ccPlaylistcontentssScheduledForDeletion) {
+ $this->ccPlaylistcontentssScheduledForDeletion = clone $this->collCcPlaylistcontentss;
+ $this->ccPlaylistcontentssScheduledForDeletion->clear();
+ }
+ $this->ccPlaylistcontentssScheduledForDeletion[]= $ccPlaylistcontents;
+ $ccPlaylistcontents->setCcFiles(null);
+ }
+
+ return $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 PropelObjectCollection|CcPlaylistcontents[] List of CcPlaylistcontents objects
+ */
+ public function getCcPlaylistcontentssJoinCcBlock($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcPlaylistcontentsQuery::create(null, $criteria);
+ $query->joinWith('CcBlock', $join_behavior);
+
+ return $this->getCcPlaylistcontentss($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 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 PropelObjectCollection|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 collCcBlockcontentss 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 CcFiles The current object (for fluent API support)
+ * @see addCcBlockcontentss()
+ */
+ public function clearCcBlockcontentss()
+ {
+ $this->collCcBlockcontentss = null; // important to set this to null since that means it is uninitialized
+ $this->collCcBlockcontentssPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcBlockcontentss collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcBlockcontentss($v = true)
+ {
+ $this->collCcBlockcontentssPartial = $v;
+ }
+
+ /**
+ * Initializes the collCcBlockcontentss collection.
+ *
+ * By default this just sets the collCcBlockcontentss collection to an empty array (like clearcollCcBlockcontentss());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcBlockcontentss($overrideExisting = true)
+ {
+ if (null !== $this->collCcBlockcontentss && !$overrideExisting) {
+ return;
+ }
+ $this->collCcBlockcontentss = new PropelObjectCollection();
+ $this->collCcBlockcontentss->setModel('CcBlockcontents');
+ }
+
+ /**
+ * Gets an array of CcBlockcontents 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 PropelObjectCollection|CcBlockcontents[] List of CcBlockcontents objects
+ * @throws PropelException
+ */
+ public function getCcBlockcontentss($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcBlockcontentssPartial && !$this->isNew();
+ if (null === $this->collCcBlockcontentss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcBlockcontentss) {
+ // return empty collection
+ $this->initCcBlockcontentss();
+ } else {
+ $collCcBlockcontentss = CcBlockcontentsQuery::create(null, $criteria)
+ ->filterByCcFiles($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcBlockcontentssPartial && count($collCcBlockcontentss)) {
+ $this->initCcBlockcontentss(false);
+
+ foreach ($collCcBlockcontentss as $obj) {
+ if (false == $this->collCcBlockcontentss->contains($obj)) {
+ $this->collCcBlockcontentss->append($obj);
+ }
+ }
+
+ $this->collCcBlockcontentssPartial = true;
+ }
+
+ $collCcBlockcontentss->getInternalIterator()->rewind();
+
+ return $collCcBlockcontentss;
+ }
+
+ if ($partial && $this->collCcBlockcontentss) {
+ foreach ($this->collCcBlockcontentss as $obj) {
+ if ($obj->isNew()) {
+ $collCcBlockcontentss[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcBlockcontentss = $collCcBlockcontentss;
+ $this->collCcBlockcontentssPartial = false;
+ }
+ }
+
+ return $this->collCcBlockcontentss;
+ }
+
+ /**
+ * Sets a collection of CcBlockcontents objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccBlockcontentss A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setCcBlockcontentss(PropelCollection $ccBlockcontentss, PropelPDO $con = null)
+ {
+ $ccBlockcontentssToDelete = $this->getCcBlockcontentss(new Criteria(), $con)->diff($ccBlockcontentss);
+
+
+ $this->ccBlockcontentssScheduledForDeletion = $ccBlockcontentssToDelete;
+
+ foreach ($ccBlockcontentssToDelete as $ccBlockcontentsRemoved) {
+ $ccBlockcontentsRemoved->setCcFiles(null);
+ }
+
+ $this->collCcBlockcontentss = null;
+ foreach ($ccBlockcontentss as $ccBlockcontents) {
+ $this->addCcBlockcontents($ccBlockcontents);
+ }
+
+ $this->collCcBlockcontentss = $ccBlockcontentss;
+ $this->collCcBlockcontentssPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related CcBlockcontents objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcBlockcontents objects.
+ * @throws PropelException
+ */
+ public function countCcBlockcontentss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collCcBlockcontentssPartial && !$this->isNew();
+ if (null === $this->collCcBlockcontentss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcBlockcontentss) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcBlockcontentss());
+ }
+ $query = CcBlockcontentsQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcFiles($this)
+ ->count($con);
+ }
+
+ return count($this->collCcBlockcontentss);
+ }
+
+ /**
+ * Method called to associate a CcBlockcontents object to this object
+ * through the CcBlockcontents foreign key attribute.
+ *
+ * @param CcBlockcontents $l CcBlockcontents
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function addCcBlockcontents(CcBlockcontents $l)
+ {
+ if ($this->collCcBlockcontentss === null) {
+ $this->initCcBlockcontentss();
+ $this->collCcBlockcontentssPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcBlockcontentss->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcBlockcontents($l);
+
+ if ($this->ccBlockcontentssScheduledForDeletion and $this->ccBlockcontentssScheduledForDeletion->contains($l)) {
+ $this->ccBlockcontentssScheduledForDeletion->remove($this->ccBlockcontentssScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcBlockcontents $ccBlockcontents The ccBlockcontents object to add.
+ */
+ protected function doAddCcBlockcontents($ccBlockcontents)
+ {
+ $this->collCcBlockcontentss[]= $ccBlockcontents;
+ $ccBlockcontents->setCcFiles($this);
+ }
+
+ /**
+ * @param CcBlockcontents $ccBlockcontents The ccBlockcontents object to remove.
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function removeCcBlockcontents($ccBlockcontents)
+ {
+ if ($this->getCcBlockcontentss()->contains($ccBlockcontents)) {
+ $this->collCcBlockcontentss->remove($this->collCcBlockcontentss->search($ccBlockcontents));
+ if (null === $this->ccBlockcontentssScheduledForDeletion) {
+ $this->ccBlockcontentssScheduledForDeletion = clone $this->collCcBlockcontentss;
+ $this->ccBlockcontentssScheduledForDeletion->clear();
+ }
+ $this->ccBlockcontentssScheduledForDeletion[]= $ccBlockcontents;
+ $ccBlockcontents->setCcFiles(null);
+ }
+
+ return $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 CcBlockcontentss 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 PropelObjectCollection|CcBlockcontents[] List of CcBlockcontents objects
+ */
+ public function getCcBlockcontentssJoinCcBlock($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcBlockcontentsQuery::create(null, $criteria);
+ $query->joinWith('CcBlock', $join_behavior);
+
+ return $this->getCcBlockcontentss($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 CcFiles The current object (for fluent API support)
+ * @see addCcSchedules()
+ */
+ public function clearCcSchedules()
+ {
+ $this->collCcSchedules = null; // important to set this to null since that means it is uninitialized
+ $this->collCcSchedulesPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcSchedules collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcSchedules($v = true)
+ {
+ $this->collCcSchedulesPartial = $v;
+ }
+
+ /**
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcSchedules($overrideExisting = true)
+ {
+ if (null !== $this->collCcSchedules && !$overrideExisting) {
+ return;
+ }
+ $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 PropelObjectCollection|CcSchedule[] List of CcSchedule objects
+ * @throws PropelException
+ */
+ public function getCcSchedules($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcSchedulesPartial && !$this->isNew();
+ if (null === $this->collCcSchedules || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcSchedules) {
+ // return empty collection
+ $this->initCcSchedules();
+ } else {
+ $collCcSchedules = CcScheduleQuery::create(null, $criteria)
+ ->filterByCcFiles($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcSchedulesPartial && count($collCcSchedules)) {
+ $this->initCcSchedules(false);
+
+ foreach ($collCcSchedules as $obj) {
+ if (false == $this->collCcSchedules->contains($obj)) {
+ $this->collCcSchedules->append($obj);
+ }
+ }
+
+ $this->collCcSchedulesPartial = true;
+ }
+
+ $collCcSchedules->getInternalIterator()->rewind();
+
+ return $collCcSchedules;
+ }
+
+ if ($partial && $this->collCcSchedules) {
+ foreach ($this->collCcSchedules as $obj) {
+ if ($obj->isNew()) {
+ $collCcSchedules[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcSchedules = $collCcSchedules;
+ $this->collCcSchedulesPartial = false;
+ }
+ }
+
+ return $this->collCcSchedules;
+ }
+
+ /**
+ * Sets a collection of CcSchedule objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccSchedules A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setCcSchedules(PropelCollection $ccSchedules, PropelPDO $con = null)
+ {
+ $ccSchedulesToDelete = $this->getCcSchedules(new Criteria(), $con)->diff($ccSchedules);
+
+
+ $this->ccSchedulesScheduledForDeletion = $ccSchedulesToDelete;
+
+ foreach ($ccSchedulesToDelete as $ccScheduleRemoved) {
+ $ccScheduleRemoved->setCcFiles(null);
+ }
+
+ $this->collCcSchedules = null;
+ foreach ($ccSchedules as $ccSchedule) {
+ $this->addCcSchedule($ccSchedule);
+ }
+
+ $this->collCcSchedules = $ccSchedules;
+ $this->collCcSchedulesPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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)
+ {
+ $partial = $this->collCcSchedulesPartial && !$this->isNew();
+ if (null === $this->collCcSchedules || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcSchedules) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcSchedules());
+ }
+ $query = CcScheduleQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcFiles($this)
+ ->count($con);
+ }
+
+ 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 CcFiles The current object (for fluent API support)
+ */
+ public function addCcSchedule(CcSchedule $l)
+ {
+ if ($this->collCcSchedules === null) {
+ $this->initCcSchedules();
+ $this->collCcSchedulesPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcSchedules->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcSchedule($l);
+
+ if ($this->ccSchedulesScheduledForDeletion and $this->ccSchedulesScheduledForDeletion->contains($l)) {
+ $this->ccSchedulesScheduledForDeletion->remove($this->ccSchedulesScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcSchedule $ccSchedule The ccSchedule object to add.
+ */
+ protected function doAddCcSchedule($ccSchedule)
+ {
+ $this->collCcSchedules[]= $ccSchedule;
+ $ccSchedule->setCcFiles($this);
+ }
+
+ /**
+ * @param CcSchedule $ccSchedule The ccSchedule object to remove.
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function removeCcSchedule($ccSchedule)
+ {
+ if ($this->getCcSchedules()->contains($ccSchedule)) {
+ $this->collCcSchedules->remove($this->collCcSchedules->search($ccSchedule));
+ if (null === $this->ccSchedulesScheduledForDeletion) {
+ $this->ccSchedulesScheduledForDeletion = clone $this->collCcSchedules;
+ $this->ccSchedulesScheduledForDeletion->clear();
+ }
+ $this->ccSchedulesScheduledForDeletion[]= $ccSchedule;
+ $ccSchedule->setCcFiles(null);
+ }
+
+ return $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 PropelObjectCollection|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);
+ }
+
+
+ /**
+ * 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 PropelObjectCollection|CcSchedule[] List of CcSchedule objects
+ */
+ public function getCcSchedulesJoinCcWebstream($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcScheduleQuery::create(null, $criteria);
+ $query->joinWith('CcWebstream', $join_behavior);
+
+ return $this->getCcSchedules($query, $con);
+ }
+
+ /**
+ * Clears out the collCcPlayoutHistorys 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 CcFiles The current object (for fluent API support)
+ * @see addCcPlayoutHistorys()
+ */
+ public function clearCcPlayoutHistorys()
+ {
+ $this->collCcPlayoutHistorys = null; // important to set this to null since that means it is uninitialized
+ $this->collCcPlayoutHistorysPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcPlayoutHistorys collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcPlayoutHistorys($v = true)
+ {
+ $this->collCcPlayoutHistorysPartial = $v;
+ }
+
+ /**
+ * Initializes the collCcPlayoutHistorys collection.
+ *
+ * By default this just sets the collCcPlayoutHistorys collection to an empty array (like clearcollCcPlayoutHistorys());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcPlayoutHistorys($overrideExisting = true)
+ {
+ if (null !== $this->collCcPlayoutHistorys && !$overrideExisting) {
+ return;
+ }
+ $this->collCcPlayoutHistorys = new PropelObjectCollection();
+ $this->collCcPlayoutHistorys->setModel('CcPlayoutHistory');
+ }
+
+ /**
+ * Gets an array of CcPlayoutHistory 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 PropelObjectCollection|CcPlayoutHistory[] List of CcPlayoutHistory objects
+ * @throws PropelException
+ */
+ public function getCcPlayoutHistorys($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcPlayoutHistorysPartial && !$this->isNew();
+ if (null === $this->collCcPlayoutHistorys || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistorys) {
+ // return empty collection
+ $this->initCcPlayoutHistorys();
+ } else {
+ $collCcPlayoutHistorys = CcPlayoutHistoryQuery::create(null, $criteria)
+ ->filterByCcFiles($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcPlayoutHistorysPartial && count($collCcPlayoutHistorys)) {
+ $this->initCcPlayoutHistorys(false);
+
+ foreach ($collCcPlayoutHistorys as $obj) {
+ if (false == $this->collCcPlayoutHistorys->contains($obj)) {
+ $this->collCcPlayoutHistorys->append($obj);
+ }
+ }
+
+ $this->collCcPlayoutHistorysPartial = true;
+ }
+
+ $collCcPlayoutHistorys->getInternalIterator()->rewind();
+
+ return $collCcPlayoutHistorys;
+ }
+
+ if ($partial && $this->collCcPlayoutHistorys) {
+ foreach ($this->collCcPlayoutHistorys as $obj) {
+ if ($obj->isNew()) {
+ $collCcPlayoutHistorys[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcPlayoutHistorys = $collCcPlayoutHistorys;
+ $this->collCcPlayoutHistorysPartial = false;
+ }
+ }
+
+ return $this->collCcPlayoutHistorys;
+ }
+
+ /**
+ * Sets a collection of CcPlayoutHistory objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccPlayoutHistorys A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function setCcPlayoutHistorys(PropelCollection $ccPlayoutHistorys, PropelPDO $con = null)
+ {
+ $ccPlayoutHistorysToDelete = $this->getCcPlayoutHistorys(new Criteria(), $con)->diff($ccPlayoutHistorys);
+
+
+ $this->ccPlayoutHistorysScheduledForDeletion = $ccPlayoutHistorysToDelete;
+
+ foreach ($ccPlayoutHistorysToDelete as $ccPlayoutHistoryRemoved) {
+ $ccPlayoutHistoryRemoved->setCcFiles(null);
+ }
+
+ $this->collCcPlayoutHistorys = null;
+ foreach ($ccPlayoutHistorys as $ccPlayoutHistory) {
+ $this->addCcPlayoutHistory($ccPlayoutHistory);
+ }
+
+ $this->collCcPlayoutHistorys = $ccPlayoutHistorys;
+ $this->collCcPlayoutHistorysPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related CcPlayoutHistory objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcPlayoutHistory objects.
+ * @throws PropelException
+ */
+ public function countCcPlayoutHistorys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collCcPlayoutHistorysPartial && !$this->isNew();
+ if (null === $this->collCcPlayoutHistorys || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistorys) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcPlayoutHistorys());
+ }
+ $query = CcPlayoutHistoryQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcFiles($this)
+ ->count($con);
+ }
+
+ return count($this->collCcPlayoutHistorys);
+ }
+
+ /**
+ * Method called to associate a CcPlayoutHistory object to this object
+ * through the CcPlayoutHistory foreign key attribute.
+ *
+ * @param CcPlayoutHistory $l CcPlayoutHistory
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function addCcPlayoutHistory(CcPlayoutHistory $l)
+ {
+ if ($this->collCcPlayoutHistorys === null) {
+ $this->initCcPlayoutHistorys();
+ $this->collCcPlayoutHistorysPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcPlayoutHistorys->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcPlayoutHistory($l);
+
+ if ($this->ccPlayoutHistorysScheduledForDeletion and $this->ccPlayoutHistorysScheduledForDeletion->contains($l)) {
+ $this->ccPlayoutHistorysScheduledForDeletion->remove($this->ccPlayoutHistorysScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcPlayoutHistory $ccPlayoutHistory The ccPlayoutHistory object to add.
+ */
+ protected function doAddCcPlayoutHistory($ccPlayoutHistory)
+ {
+ $this->collCcPlayoutHistorys[]= $ccPlayoutHistory;
+ $ccPlayoutHistory->setCcFiles($this);
+ }
+
+ /**
+ * @param CcPlayoutHistory $ccPlayoutHistory The ccPlayoutHistory object to remove.
+ * @return CcFiles The current object (for fluent API support)
+ */
+ public function removeCcPlayoutHistory($ccPlayoutHistory)
+ {
+ if ($this->getCcPlayoutHistorys()->contains($ccPlayoutHistory)) {
+ $this->collCcPlayoutHistorys->remove($this->collCcPlayoutHistorys->search($ccPlayoutHistory));
+ if (null === $this->ccPlayoutHistorysScheduledForDeletion) {
+ $this->ccPlayoutHistorysScheduledForDeletion = clone $this->collCcPlayoutHistorys;
+ $this->ccPlayoutHistorysScheduledForDeletion->clear();
+ }
+ $this->ccPlayoutHistorysScheduledForDeletion[]= $ccPlayoutHistory;
+ $ccPlayoutHistory->setCcFiles(null);
+ }
+
+ return $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 CcPlayoutHistorys 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 PropelObjectCollection|CcPlayoutHistory[] List of CcPlayoutHistory objects
+ */
+ public function getCcPlayoutHistorysJoinCcShowInstances($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcPlayoutHistoryQuery::create(null, $criteria);
+ $query->joinWith('CcShowInstances', $join_behavior);
+
+ return $this->getCcPlayoutHistorys($query, $con);
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->name = null;
+ $this->mime = null;
+ $this->ftype = null;
+ $this->directory = null;
+ $this->filepath = null;
+ $this->import_status = null;
+ $this->currentlyaccessing = null;
+ $this->editedby = null;
+ $this->mtime = null;
+ $this->utime = null;
+ $this->lptime = 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->file_exists = null;
+ $this->soundcloud_id = null;
+ $this->soundcloud_error_code = null;
+ $this->soundcloud_error_msg = null;
+ $this->soundcloud_link_to_file = null;
+ $this->soundcloud_upload_time = null;
+ $this->replay_gain = null;
+ $this->owner_id = null;
+ $this->cuein = null;
+ $this->cueout = null;
+ $this->silan_check = null;
+ $this->hidden = null;
+ $this->is_scheduled = null;
+ $this->is_playlist = null;
+ $this->resource_id = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->collCcShowInstancess) {
+ foreach ($this->collCcShowInstancess as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcPlaylistcontentss) {
+ foreach ($this->collCcPlaylistcontentss as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcBlockcontentss) {
+ foreach ($this->collCcBlockcontentss as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcSchedules) {
+ foreach ($this->collCcSchedules as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcPlayoutHistorys) {
+ foreach ($this->collCcPlayoutHistorys as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->aFkOwner instanceof Persistent) {
+ $this->aFkOwner->clearAllReferences($deep);
+ }
+ if ($this->aCcSubjsRelatedByDbEditedby instanceof Persistent) {
+ $this->aCcSubjsRelatedByDbEditedby->clearAllReferences($deep);
+ }
+ if ($this->aCcMusicDirs instanceof Persistent) {
+ $this->aCcMusicDirs->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ if ($this->collCcShowInstancess instanceof PropelCollection) {
+ $this->collCcShowInstancess->clearIterator();
+ }
+ $this->collCcShowInstancess = null;
+ if ($this->collCcPlaylistcontentss instanceof PropelCollection) {
+ $this->collCcPlaylistcontentss->clearIterator();
+ }
+ $this->collCcPlaylistcontentss = null;
+ if ($this->collCcBlockcontentss instanceof PropelCollection) {
+ $this->collCcBlockcontentss->clearIterator();
+ }
+ $this->collCcBlockcontentss = null;
+ if ($this->collCcSchedules instanceof PropelCollection) {
+ $this->collCcSchedules->clearIterator();
+ }
+ $this->collCcSchedules = null;
+ if ($this->collCcPlayoutHistorys instanceof PropelCollection) {
+ $this->collCcPlayoutHistorys->clearIterator();
+ }
+ $this->collCcPlayoutHistorys = null;
+ $this->aFkOwner = null;
+ $this->aCcSubjsRelatedByDbEditedby = null;
+ $this->aCcMusicDirs = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcFilesPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php
index faa6af559..f13be0d7f 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php
@@ -4,2003 +4,2039 @@
/**
* Base static class for performing query and update operations on the 'cc_files' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcFilesPeer {
+abstract class BaseCcFilesPeer
+{
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
- /** the table name for this class */
- const TABLE_NAME = 'cc_files';
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_files';
- /** the related Propel class for this table */
- const OM_CLASS = 'CcFiles';
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcFiles';
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcFiles';
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcFilesTableMap';
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcFilesTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 71;
+ /** The total number of columns. */
+ const NUM_COLUMNS = 71;
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
- /** the column name for the ID field */
- const ID = 'cc_files.ID';
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 71;
- /** the column name for the NAME field */
- const NAME = 'cc_files.NAME';
+ /** the column name for the id field */
+ const ID = 'cc_files.id';
- /** the column name for the MIME field */
- const MIME = 'cc_files.MIME';
+ /** the column name for the name field */
+ const NAME = 'cc_files.name';
- /** the column name for the FTYPE field */
- const FTYPE = 'cc_files.FTYPE';
+ /** the column name for the mime field */
+ const MIME = 'cc_files.mime';
- /** the column name for the DIRECTORY field */
- const DIRECTORY = 'cc_files.DIRECTORY';
+ /** the column name for the ftype field */
+ const FTYPE = 'cc_files.ftype';
- /** the column name for the FILEPATH field */
- const FILEPATH = 'cc_files.FILEPATH';
+ /** the column name for the directory field */
+ const DIRECTORY = 'cc_files.directory';
- /** the column name for the IMPORT_STATUS field */
- const IMPORT_STATUS = 'cc_files.IMPORT_STATUS';
+ /** the column name for the filepath field */
+ const FILEPATH = 'cc_files.filepath';
- /** the column name for the CURRENTLYACCESSING field */
- const CURRENTLYACCESSING = 'cc_files.CURRENTLYACCESSING';
+ /** the column name for the import_status field */
+ const IMPORT_STATUS = 'cc_files.import_status';
- /** the column name for the EDITEDBY field */
- const EDITEDBY = 'cc_files.EDITEDBY';
+ /** the column name for the currentlyaccessing field */
+ const CURRENTLYACCESSING = 'cc_files.currentlyaccessing';
- /** the column name for the MTIME field */
- const MTIME = 'cc_files.MTIME';
+ /** the column name for the editedby field */
+ const EDITEDBY = 'cc_files.editedby';
- /** the column name for the UTIME field */
- const UTIME = 'cc_files.UTIME';
+ /** the column name for the mtime field */
+ const MTIME = 'cc_files.mtime';
- /** the column name for the LPTIME field */
- const LPTIME = 'cc_files.LPTIME';
+ /** the column name for the utime field */
+ const UTIME = 'cc_files.utime';
- /** the column name for the MD5 field */
- const MD5 = 'cc_files.MD5';
+ /** the column name for the lptime field */
+ const LPTIME = 'cc_files.lptime';
- /** the column name for the TRACK_TITLE field */
- const TRACK_TITLE = 'cc_files.TRACK_TITLE';
+ /** the column name for the md5 field */
+ const MD5 = 'cc_files.md5';
- /** the column name for the ARTIST_NAME field */
- const ARTIST_NAME = 'cc_files.ARTIST_NAME';
+ /** the column name for the track_title field */
+ const TRACK_TITLE = 'cc_files.track_title';
- /** the column name for the BIT_RATE field */
- const BIT_RATE = 'cc_files.BIT_RATE';
+ /** the column name for the artist_name field */
+ const ARTIST_NAME = 'cc_files.artist_name';
- /** the column name for the SAMPLE_RATE field */
- const SAMPLE_RATE = 'cc_files.SAMPLE_RATE';
+ /** the column name for the bit_rate field */
+ const BIT_RATE = 'cc_files.bit_rate';
- /** the column name for the FORMAT field */
- const FORMAT = 'cc_files.FORMAT';
+ /** the column name for the sample_rate field */
+ const SAMPLE_RATE = 'cc_files.sample_rate';
- /** the column name for the LENGTH field */
- const LENGTH = 'cc_files.LENGTH';
+ /** the column name for the format field */
+ const FORMAT = 'cc_files.format';
- /** the column name for the ALBUM_TITLE field */
- const ALBUM_TITLE = 'cc_files.ALBUM_TITLE';
+ /** the column name for the length field */
+ const LENGTH = 'cc_files.length';
- /** the column name for the GENRE field */
- const GENRE = 'cc_files.GENRE';
+ /** the column name for the album_title field */
+ const ALBUM_TITLE = 'cc_files.album_title';
- /** the column name for the COMMENTS field */
- const COMMENTS = 'cc_files.COMMENTS';
+ /** the column name for the genre field */
+ const GENRE = 'cc_files.genre';
- /** the column name for the YEAR field */
- const YEAR = 'cc_files.YEAR';
+ /** the column name for the comments field */
+ const COMMENTS = 'cc_files.comments';
- /** the column name for the TRACK_NUMBER field */
- const TRACK_NUMBER = 'cc_files.TRACK_NUMBER';
+ /** the column name for the year field */
+ const YEAR = 'cc_files.year';
- /** the column name for the CHANNELS field */
- const CHANNELS = 'cc_files.CHANNELS';
+ /** the column name for the track_number field */
+ const TRACK_NUMBER = 'cc_files.track_number';
- /** the column name for the URL field */
- const URL = 'cc_files.URL';
+ /** the column name for the channels field */
+ const CHANNELS = 'cc_files.channels';
- /** the column name for the BPM field */
- const BPM = 'cc_files.BPM';
+ /** the column name for the url field */
+ const URL = 'cc_files.url';
- /** the column name for the RATING field */
- const RATING = 'cc_files.RATING';
+ /** the column name for the bpm field */
+ const BPM = 'cc_files.bpm';
- /** the column name for the ENCODED_BY field */
- const ENCODED_BY = 'cc_files.ENCODED_BY';
+ /** the column name for the rating field */
+ const RATING = 'cc_files.rating';
- /** the column name for the DISC_NUMBER field */
- const DISC_NUMBER = 'cc_files.DISC_NUMBER';
+ /** the column name for the encoded_by field */
+ const ENCODED_BY = 'cc_files.encoded_by';
- /** the column name for the MOOD field */
- const MOOD = 'cc_files.MOOD';
+ /** the column name for the disc_number field */
+ const DISC_NUMBER = 'cc_files.disc_number';
- /** the column name for the LABEL field */
- const LABEL = 'cc_files.LABEL';
+ /** the column name for the mood field */
+ const MOOD = 'cc_files.mood';
- /** the column name for the COMPOSER field */
- const COMPOSER = 'cc_files.COMPOSER';
+ /** the column name for the label field */
+ const LABEL = 'cc_files.label';
- /** the column name for the ENCODER field */
- const ENCODER = 'cc_files.ENCODER';
+ /** the column name for the composer field */
+ const COMPOSER = 'cc_files.composer';
- /** the column name for the CHECKSUM field */
- const CHECKSUM = 'cc_files.CHECKSUM';
+ /** the column name for the encoder field */
+ const ENCODER = 'cc_files.encoder';
- /** the column name for the LYRICS field */
- const LYRICS = 'cc_files.LYRICS';
+ /** the column name for the checksum field */
+ const CHECKSUM = 'cc_files.checksum';
- /** the column name for the ORCHESTRA field */
- const ORCHESTRA = 'cc_files.ORCHESTRA';
+ /** the column name for the lyrics field */
+ const LYRICS = 'cc_files.lyrics';
- /** the column name for the CONDUCTOR field */
- const CONDUCTOR = 'cc_files.CONDUCTOR';
+ /** the column name for the orchestra field */
+ const ORCHESTRA = 'cc_files.orchestra';
- /** the column name for the LYRICIST field */
- const LYRICIST = 'cc_files.LYRICIST';
+ /** the column name for the conductor field */
+ const CONDUCTOR = 'cc_files.conductor';
- /** the column name for the ORIGINAL_LYRICIST field */
- const ORIGINAL_LYRICIST = 'cc_files.ORIGINAL_LYRICIST';
+ /** the column name for the lyricist field */
+ const LYRICIST = 'cc_files.lyricist';
- /** the column name for the RADIO_STATION_NAME field */
- const RADIO_STATION_NAME = 'cc_files.RADIO_STATION_NAME';
+ /** the column name for the original_lyricist field */
+ const ORIGINAL_LYRICIST = 'cc_files.original_lyricist';
- /** the column name for the INFO_URL field */
- const INFO_URL = 'cc_files.INFO_URL';
+ /** the column name for the radio_station_name field */
+ const RADIO_STATION_NAME = 'cc_files.radio_station_name';
- /** the column name for the ARTIST_URL field */
- const ARTIST_URL = 'cc_files.ARTIST_URL';
+ /** the column name for the info_url field */
+ const INFO_URL = 'cc_files.info_url';
- /** the column name for the AUDIO_SOURCE_URL field */
- const AUDIO_SOURCE_URL = 'cc_files.AUDIO_SOURCE_URL';
+ /** the column name for the artist_url field */
+ const ARTIST_URL = 'cc_files.artist_url';
- /** the column name for the RADIO_STATION_URL field */
- const RADIO_STATION_URL = 'cc_files.RADIO_STATION_URL';
+ /** the column name for the audio_source_url field */
+ const AUDIO_SOURCE_URL = 'cc_files.audio_source_url';
- /** the column name for the BUY_THIS_URL field */
- const BUY_THIS_URL = 'cc_files.BUY_THIS_URL';
+ /** the column name for the radio_station_url field */
+ const RADIO_STATION_URL = 'cc_files.radio_station_url';
- /** the column name for the ISRC_NUMBER field */
- const ISRC_NUMBER = 'cc_files.ISRC_NUMBER';
+ /** the column name for the buy_this_url field */
+ const BUY_THIS_URL = 'cc_files.buy_this_url';
- /** the column name for the CATALOG_NUMBER field */
- const CATALOG_NUMBER = 'cc_files.CATALOG_NUMBER';
+ /** the column name for the isrc_number field */
+ const ISRC_NUMBER = 'cc_files.isrc_number';
- /** the column name for the ORIGINAL_ARTIST field */
- const ORIGINAL_ARTIST = 'cc_files.ORIGINAL_ARTIST';
+ /** the column name for the catalog_number field */
+ const CATALOG_NUMBER = 'cc_files.catalog_number';
- /** the column name for the COPYRIGHT field */
- const COPYRIGHT = 'cc_files.COPYRIGHT';
+ /** the column name for the original_artist field */
+ const ORIGINAL_ARTIST = 'cc_files.original_artist';
- /** the column name for the REPORT_DATETIME field */
- const REPORT_DATETIME = 'cc_files.REPORT_DATETIME';
+ /** the column name for the copyright field */
+ const COPYRIGHT = 'cc_files.copyright';
- /** the column name for the REPORT_LOCATION field */
- const REPORT_LOCATION = 'cc_files.REPORT_LOCATION';
+ /** the column name for the report_datetime field */
+ const REPORT_DATETIME = 'cc_files.report_datetime';
- /** the column name for the REPORT_ORGANIZATION field */
- const REPORT_ORGANIZATION = 'cc_files.REPORT_ORGANIZATION';
+ /** the column name for the report_location field */
+ const REPORT_LOCATION = 'cc_files.report_location';
- /** the column name for the SUBJECT field */
- const SUBJECT = 'cc_files.SUBJECT';
+ /** the column name for the report_organization field */
+ const REPORT_ORGANIZATION = 'cc_files.report_organization';
- /** the column name for the CONTRIBUTOR field */
- const CONTRIBUTOR = 'cc_files.CONTRIBUTOR';
+ /** the column name for the subject field */
+ const SUBJECT = 'cc_files.subject';
- /** the column name for the LANGUAGE field */
- const LANGUAGE = 'cc_files.LANGUAGE';
+ /** the column name for the contributor field */
+ const CONTRIBUTOR = 'cc_files.contributor';
- /** the column name for the FILE_EXISTS field */
- const FILE_EXISTS = 'cc_files.FILE_EXISTS';
+ /** the column name for the language field */
+ const LANGUAGE = 'cc_files.language';
- /** the column name for the SOUNDCLOUD_ID field */
- const SOUNDCLOUD_ID = 'cc_files.SOUNDCLOUD_ID';
+ /** the column name for the file_exists field */
+ const FILE_EXISTS = 'cc_files.file_exists';
- /** the column name for the SOUNDCLOUD_ERROR_CODE field */
- const SOUNDCLOUD_ERROR_CODE = 'cc_files.SOUNDCLOUD_ERROR_CODE';
+ /** the column name for the soundcloud_id field */
+ const SOUNDCLOUD_ID = 'cc_files.soundcloud_id';
- /** the column name for the SOUNDCLOUD_ERROR_MSG field */
- const SOUNDCLOUD_ERROR_MSG = 'cc_files.SOUNDCLOUD_ERROR_MSG';
+ /** the column name for the soundcloud_error_code field */
+ const SOUNDCLOUD_ERROR_CODE = 'cc_files.soundcloud_error_code';
- /** the column name for the SOUNDCLOUD_LINK_TO_FILE field */
- const SOUNDCLOUD_LINK_TO_FILE = 'cc_files.SOUNDCLOUD_LINK_TO_FILE';
+ /** the column name for the soundcloud_error_msg field */
+ const SOUNDCLOUD_ERROR_MSG = 'cc_files.soundcloud_error_msg';
- /** the column name for the SOUNDCLOUD_UPLOAD_TIME field */
- const SOUNDCLOUD_UPLOAD_TIME = 'cc_files.SOUNDCLOUD_UPLOAD_TIME';
-
- /** the column name for the REPLAY_GAIN field */
- const REPLAY_GAIN = 'cc_files.REPLAY_GAIN';
-
- /** the column name for the OWNER_ID field */
- const OWNER_ID = 'cc_files.OWNER_ID';
-
- /** the column name for the CUEIN field */
- const CUEIN = 'cc_files.CUEIN';
-
- /** the column name for the CUEOUT field */
- const CUEOUT = 'cc_files.CUEOUT';
-
- /** the column name for the SILAN_CHECK field */
- const SILAN_CHECK = 'cc_files.SILAN_CHECK';
-
- /** the column name for the HIDDEN field */
- const HIDDEN = 'cc_files.HIDDEN';
-
- /** the column name for the IS_SCHEDULED field */
- const IS_SCHEDULED = 'cc_files.IS_SCHEDULED';
-
- /** the column name for the IS_PLAYLIST field */
- const IS_PLAYLIST = 'cc_files.IS_PLAYLIST';
-
- /** the column name for the RESOURCE_ID field */
- const RESOURCE_ID = 'cc_files.RESOURCE_ID';
-
- /**
- * An identiy map to hold any loaded instances of CcFiles objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcFiles[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMime', 'DbFtype', 'DbDirectory', 'DbFilepath', 'DbImportStatus', 'DbCurrentlyaccessing', 'DbEditedby', 'DbMtime', 'DbUtime', 'DbLPtime', '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', 'DbFileExists', 'DbSoundcloudId', 'DbSoundcloudErrorCode', 'DbSoundcloudErrorMsg', 'DbSoundcloudLinkToFile', 'DbSoundCloundUploadTime', 'DbReplayGain', 'DbOwnerId', 'DbCuein', 'DbCueout', 'DbSilanCheck', 'DbHidden', 'DbIsScheduled', 'DbIsPlaylist', 'DbResourceId', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMime', 'dbFtype', 'dbDirectory', 'dbFilepath', 'dbImportStatus', 'dbCurrentlyaccessing', 'dbEditedby', 'dbMtime', 'dbUtime', 'dbLPtime', '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', 'dbFileExists', 'dbSoundcloudId', 'dbSoundcloudErrorCode', 'dbSoundcloudErrorMsg', 'dbSoundcloudLinkToFile', 'dbSoundCloundUploadTime', 'dbReplayGain', 'dbOwnerId', 'dbCuein', 'dbCueout', 'dbSilanCheck', 'dbHidden', 'dbIsScheduled', 'dbIsPlaylist', 'dbResourceId', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::MIME, self::FTYPE, self::DIRECTORY, self::FILEPATH, self::IMPORT_STATUS, self::CURRENTLYACCESSING, self::EDITEDBY, self::MTIME, self::UTIME, self::LPTIME, 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::FILE_EXISTS, self::SOUNDCLOUD_ID, self::SOUNDCLOUD_ERROR_CODE, self::SOUNDCLOUD_ERROR_MSG, self::SOUNDCLOUD_LINK_TO_FILE, self::SOUNDCLOUD_UPLOAD_TIME, self::REPLAY_GAIN, self::OWNER_ID, self::CUEIN, self::CUEOUT, self::SILAN_CHECK, self::HIDDEN, self::IS_SCHEDULED, self::IS_PLAYLIST, self::RESOURCE_ID, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MIME', 'FTYPE', 'DIRECTORY', 'FILEPATH', 'IMPORT_STATUS', 'CURRENTLYACCESSING', 'EDITEDBY', 'MTIME', 'UTIME', 'LPTIME', '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', 'FILE_EXISTS', 'SOUNDCLOUD_ID', 'SOUNDCLOUD_ERROR_CODE', 'SOUNDCLOUD_ERROR_MSG', 'SOUNDCLOUD_LINK_TO_FILE', 'SOUNDCLOUD_UPLOAD_TIME', 'REPLAY_GAIN', 'OWNER_ID', 'CUEIN', 'CUEOUT', 'SILAN_CHECK', 'HIDDEN', 'IS_SCHEDULED', 'IS_PLAYLIST', 'RESOURCE_ID', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mime', 'ftype', 'directory', 'filepath', 'import_status', 'currentlyaccessing', 'editedby', 'mtime', 'utime', 'lptime', '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', 'file_exists', 'soundcloud_id', 'soundcloud_error_code', 'soundcloud_error_msg', 'soundcloud_link_to_file', 'soundcloud_upload_time', 'replay_gain', 'owner_id', 'cuein', 'cueout', 'silan_check', 'hidden', 'is_scheduled', 'is_playlist', 'resource_id', ),
- 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, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, )
- );
-
- /**
- * 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, 'DbMime' => 2, 'DbFtype' => 3, 'DbDirectory' => 4, 'DbFilepath' => 5, 'DbImportStatus' => 6, 'DbCurrentlyaccessing' => 7, 'DbEditedby' => 8, 'DbMtime' => 9, 'DbUtime' => 10, 'DbLPtime' => 11, 'DbMd5' => 12, 'DbTrackTitle' => 13, 'DbArtistName' => 14, 'DbBitRate' => 15, 'DbSampleRate' => 16, 'DbFormat' => 17, 'DbLength' => 18, 'DbAlbumTitle' => 19, 'DbGenre' => 20, 'DbComments' => 21, 'DbYear' => 22, 'DbTrackNumber' => 23, 'DbChannels' => 24, 'DbUrl' => 25, 'DbBpm' => 26, 'DbRating' => 27, 'DbEncodedBy' => 28, 'DbDiscNumber' => 29, 'DbMood' => 30, 'DbLabel' => 31, 'DbComposer' => 32, 'DbEncoder' => 33, 'DbChecksum' => 34, 'DbLyrics' => 35, 'DbOrchestra' => 36, 'DbConductor' => 37, 'DbLyricist' => 38, 'DbOriginalLyricist' => 39, 'DbRadioStationName' => 40, 'DbInfoUrl' => 41, 'DbArtistUrl' => 42, 'DbAudioSourceUrl' => 43, 'DbRadioStationUrl' => 44, 'DbBuyThisUrl' => 45, 'DbIsrcNumber' => 46, 'DbCatalogNumber' => 47, 'DbOriginalArtist' => 48, 'DbCopyright' => 49, 'DbReportDatetime' => 50, 'DbReportLocation' => 51, 'DbReportOrganization' => 52, 'DbSubject' => 53, 'DbContributor' => 54, 'DbLanguage' => 55, 'DbFileExists' => 56, 'DbSoundcloudId' => 57, 'DbSoundcloudErrorCode' => 58, 'DbSoundcloudErrorMsg' => 59, 'DbSoundcloudLinkToFile' => 60, 'DbSoundCloundUploadTime' => 61, 'DbReplayGain' => 62, 'DbOwnerId' => 63, 'DbCuein' => 64, 'DbCueout' => 65, 'DbSilanCheck' => 66, 'DbHidden' => 67, 'DbIsScheduled' => 68, 'DbIsPlaylist' => 69, 'DbResourceId' => 70, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMime' => 2, 'dbFtype' => 3, 'dbDirectory' => 4, 'dbFilepath' => 5, 'dbImportStatus' => 6, 'dbCurrentlyaccessing' => 7, 'dbEditedby' => 8, 'dbMtime' => 9, 'dbUtime' => 10, 'dbLPtime' => 11, 'dbMd5' => 12, 'dbTrackTitle' => 13, 'dbArtistName' => 14, 'dbBitRate' => 15, 'dbSampleRate' => 16, 'dbFormat' => 17, 'dbLength' => 18, 'dbAlbumTitle' => 19, 'dbGenre' => 20, 'dbComments' => 21, 'dbYear' => 22, 'dbTrackNumber' => 23, 'dbChannels' => 24, 'dbUrl' => 25, 'dbBpm' => 26, 'dbRating' => 27, 'dbEncodedBy' => 28, 'dbDiscNumber' => 29, 'dbMood' => 30, 'dbLabel' => 31, 'dbComposer' => 32, 'dbEncoder' => 33, 'dbChecksum' => 34, 'dbLyrics' => 35, 'dbOrchestra' => 36, 'dbConductor' => 37, 'dbLyricist' => 38, 'dbOriginalLyricist' => 39, 'dbRadioStationName' => 40, 'dbInfoUrl' => 41, 'dbArtistUrl' => 42, 'dbAudioSourceUrl' => 43, 'dbRadioStationUrl' => 44, 'dbBuyThisUrl' => 45, 'dbIsrcNumber' => 46, 'dbCatalogNumber' => 47, 'dbOriginalArtist' => 48, 'dbCopyright' => 49, 'dbReportDatetime' => 50, 'dbReportLocation' => 51, 'dbReportOrganization' => 52, 'dbSubject' => 53, 'dbContributor' => 54, 'dbLanguage' => 55, 'dbFileExists' => 56, 'dbSoundcloudId' => 57, 'dbSoundcloudErrorCode' => 58, 'dbSoundcloudErrorMsg' => 59, 'dbSoundcloudLinkToFile' => 60, 'dbSoundCloundUploadTime' => 61, 'dbReplayGain' => 62, 'dbOwnerId' => 63, 'dbCuein' => 64, 'dbCueout' => 65, 'dbSilanCheck' => 66, 'dbHidden' => 67, 'dbIsScheduled' => 68, 'dbIsPlaylist' => 69, 'dbResourceId' => 70, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::MIME => 2, self::FTYPE => 3, self::DIRECTORY => 4, self::FILEPATH => 5, self::IMPORT_STATUS => 6, self::CURRENTLYACCESSING => 7, self::EDITEDBY => 8, self::MTIME => 9, self::UTIME => 10, self::LPTIME => 11, self::MD5 => 12, self::TRACK_TITLE => 13, self::ARTIST_NAME => 14, self::BIT_RATE => 15, self::SAMPLE_RATE => 16, self::FORMAT => 17, self::LENGTH => 18, self::ALBUM_TITLE => 19, self::GENRE => 20, self::COMMENTS => 21, self::YEAR => 22, self::TRACK_NUMBER => 23, self::CHANNELS => 24, self::URL => 25, self::BPM => 26, self::RATING => 27, self::ENCODED_BY => 28, self::DISC_NUMBER => 29, self::MOOD => 30, self::LABEL => 31, self::COMPOSER => 32, self::ENCODER => 33, self::CHECKSUM => 34, self::LYRICS => 35, self::ORCHESTRA => 36, self::CONDUCTOR => 37, self::LYRICIST => 38, self::ORIGINAL_LYRICIST => 39, self::RADIO_STATION_NAME => 40, self::INFO_URL => 41, self::ARTIST_URL => 42, self::AUDIO_SOURCE_URL => 43, self::RADIO_STATION_URL => 44, self::BUY_THIS_URL => 45, self::ISRC_NUMBER => 46, self::CATALOG_NUMBER => 47, self::ORIGINAL_ARTIST => 48, self::COPYRIGHT => 49, self::REPORT_DATETIME => 50, self::REPORT_LOCATION => 51, self::REPORT_ORGANIZATION => 52, self::SUBJECT => 53, self::CONTRIBUTOR => 54, self::LANGUAGE => 55, self::FILE_EXISTS => 56, self::SOUNDCLOUD_ID => 57, self::SOUNDCLOUD_ERROR_CODE => 58, self::SOUNDCLOUD_ERROR_MSG => 59, self::SOUNDCLOUD_LINK_TO_FILE => 60, self::SOUNDCLOUD_UPLOAD_TIME => 61, self::REPLAY_GAIN => 62, self::OWNER_ID => 63, self::CUEIN => 64, self::CUEOUT => 65, self::SILAN_CHECK => 66, self::HIDDEN => 67, self::IS_SCHEDULED => 68, self::IS_PLAYLIST => 69, self::RESOURCE_ID => 70, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MIME' => 2, 'FTYPE' => 3, 'DIRECTORY' => 4, 'FILEPATH' => 5, 'IMPORT_STATUS' => 6, 'CURRENTLYACCESSING' => 7, 'EDITEDBY' => 8, 'MTIME' => 9, 'UTIME' => 10, 'LPTIME' => 11, 'MD5' => 12, 'TRACK_TITLE' => 13, 'ARTIST_NAME' => 14, 'BIT_RATE' => 15, 'SAMPLE_RATE' => 16, 'FORMAT' => 17, 'LENGTH' => 18, 'ALBUM_TITLE' => 19, 'GENRE' => 20, 'COMMENTS' => 21, 'YEAR' => 22, 'TRACK_NUMBER' => 23, 'CHANNELS' => 24, 'URL' => 25, 'BPM' => 26, 'RATING' => 27, 'ENCODED_BY' => 28, 'DISC_NUMBER' => 29, 'MOOD' => 30, 'LABEL' => 31, 'COMPOSER' => 32, 'ENCODER' => 33, 'CHECKSUM' => 34, 'LYRICS' => 35, 'ORCHESTRA' => 36, 'CONDUCTOR' => 37, 'LYRICIST' => 38, 'ORIGINAL_LYRICIST' => 39, 'RADIO_STATION_NAME' => 40, 'INFO_URL' => 41, 'ARTIST_URL' => 42, 'AUDIO_SOURCE_URL' => 43, 'RADIO_STATION_URL' => 44, 'BUY_THIS_URL' => 45, 'ISRC_NUMBER' => 46, 'CATALOG_NUMBER' => 47, 'ORIGINAL_ARTIST' => 48, 'COPYRIGHT' => 49, 'REPORT_DATETIME' => 50, 'REPORT_LOCATION' => 51, 'REPORT_ORGANIZATION' => 52, 'SUBJECT' => 53, 'CONTRIBUTOR' => 54, 'LANGUAGE' => 55, 'FILE_EXISTS' => 56, 'SOUNDCLOUD_ID' => 57, 'SOUNDCLOUD_ERROR_CODE' => 58, 'SOUNDCLOUD_ERROR_MSG' => 59, 'SOUNDCLOUD_LINK_TO_FILE' => 60, 'SOUNDCLOUD_UPLOAD_TIME' => 61, 'REPLAY_GAIN' => 62, 'OWNER_ID' => 63, 'CUEIN' => 64, 'CUEOUT' => 65, 'SILAN_CHECK' => 66, 'HIDDEN' => 67, 'IS_SCHEDULED' => 68, 'IS_PLAYLIST' => 69, 'RESOURCE_ID' => 70, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mime' => 2, 'ftype' => 3, 'directory' => 4, 'filepath' => 5, 'import_status' => 6, 'currentlyaccessing' => 7, 'editedby' => 8, 'mtime' => 9, 'utime' => 10, 'lptime' => 11, 'md5' => 12, 'track_title' => 13, 'artist_name' => 14, 'bit_rate' => 15, 'sample_rate' => 16, 'format' => 17, 'length' => 18, 'album_title' => 19, 'genre' => 20, 'comments' => 21, 'year' => 22, 'track_number' => 23, 'channels' => 24, 'url' => 25, 'bpm' => 26, 'rating' => 27, 'encoded_by' => 28, 'disc_number' => 29, 'mood' => 30, 'label' => 31, 'composer' => 32, 'encoder' => 33, 'checksum' => 34, 'lyrics' => 35, 'orchestra' => 36, 'conductor' => 37, 'lyricist' => 38, 'original_lyricist' => 39, 'radio_station_name' => 40, 'info_url' => 41, 'artist_url' => 42, 'audio_source_url' => 43, 'radio_station_url' => 44, 'buy_this_url' => 45, 'isrc_number' => 46, 'catalog_number' => 47, 'original_artist' => 48, 'copyright' => 49, 'report_datetime' => 50, 'report_location' => 51, 'report_organization' => 52, 'subject' => 53, 'contributor' => 54, 'language' => 55, 'file_exists' => 56, 'soundcloud_id' => 57, 'soundcloud_error_code' => 58, 'soundcloud_error_msg' => 59, 'soundcloud_link_to_file' => 60, 'soundcloud_upload_time' => 61, 'replay_gain' => 62, 'owner_id' => 63, 'cuein' => 64, 'cueout' => 65, 'silan_check' => 66, 'hidden' => 67, 'is_scheduled' => 68, 'is_playlist' => 69, 'resource_id' => 70, ),
- 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, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, )
- );
-
- /**
- * 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::NAME);
- $criteria->addSelectColumn(CcFilesPeer::MIME);
- $criteria->addSelectColumn(CcFilesPeer::FTYPE);
- $criteria->addSelectColumn(CcFilesPeer::DIRECTORY);
- $criteria->addSelectColumn(CcFilesPeer::FILEPATH);
- $criteria->addSelectColumn(CcFilesPeer::IMPORT_STATUS);
- $criteria->addSelectColumn(CcFilesPeer::CURRENTLYACCESSING);
- $criteria->addSelectColumn(CcFilesPeer::EDITEDBY);
- $criteria->addSelectColumn(CcFilesPeer::MTIME);
- $criteria->addSelectColumn(CcFilesPeer::UTIME);
- $criteria->addSelectColumn(CcFilesPeer::LPTIME);
- $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::FILE_EXISTS);
- $criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_ID);
- $criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_ERROR_CODE);
- $criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_ERROR_MSG);
- $criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE);
- $criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME);
- $criteria->addSelectColumn(CcFilesPeer::REPLAY_GAIN);
- $criteria->addSelectColumn(CcFilesPeer::OWNER_ID);
- $criteria->addSelectColumn(CcFilesPeer::CUEIN);
- $criteria->addSelectColumn(CcFilesPeer::CUEOUT);
- $criteria->addSelectColumn(CcFilesPeer::SILAN_CHECK);
- $criteria->addSelectColumn(CcFilesPeer::HIDDEN);
- $criteria->addSelectColumn(CcFilesPeer::IS_SCHEDULED);
- $criteria->addSelectColumn(CcFilesPeer::IS_PLAYLIST);
- $criteria->addSelectColumn(CcFilesPeer::RESOURCE_ID);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.NAME');
- $criteria->addSelectColumn($alias . '.MIME');
- $criteria->addSelectColumn($alias . '.FTYPE');
- $criteria->addSelectColumn($alias . '.DIRECTORY');
- $criteria->addSelectColumn($alias . '.FILEPATH');
- $criteria->addSelectColumn($alias . '.IMPORT_STATUS');
- $criteria->addSelectColumn($alias . '.CURRENTLYACCESSING');
- $criteria->addSelectColumn($alias . '.EDITEDBY');
- $criteria->addSelectColumn($alias . '.MTIME');
- $criteria->addSelectColumn($alias . '.UTIME');
- $criteria->addSelectColumn($alias . '.LPTIME');
- $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 . '.FILE_EXISTS');
- $criteria->addSelectColumn($alias . '.SOUNDCLOUD_ID');
- $criteria->addSelectColumn($alias . '.SOUNDCLOUD_ERROR_CODE');
- $criteria->addSelectColumn($alias . '.SOUNDCLOUD_ERROR_MSG');
- $criteria->addSelectColumn($alias . '.SOUNDCLOUD_LINK_TO_FILE');
- $criteria->addSelectColumn($alias . '.SOUNDCLOUD_UPLOAD_TIME');
- $criteria->addSelectColumn($alias . '.REPLAY_GAIN');
- $criteria->addSelectColumn($alias . '.OWNER_ID');
- $criteria->addSelectColumn($alias . '.CUEIN');
- $criteria->addSelectColumn($alias . '.CUEOUT');
- $criteria->addSelectColumn($alias . '.SILAN_CHECK');
- $criteria->addSelectColumn($alias . '.HIDDEN');
- $criteria->addSelectColumn($alias . '.IS_SCHEDULED');
- $criteria->addSelectColumn($alias . '.IS_PLAYLIST');
- $criteria->addSelectColumn($alias . '.RESOURCE_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(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 CcBlockcontentsPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CcBlockcontentsPeer::clearInstancePool();
- // Invalidate objects in CcSchedulePeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CcSchedulePeer::clearInstancePool();
- // Invalidate objects in CcPlayoutHistoryPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CcPlayoutHistoryPeer::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 FkOwner 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 doCountJoinFkOwner(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::OWNER_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 CcSubjsRelatedByDbEditedby 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 doCountJoinCcSubjsRelatedByDbEditedby(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 doSelectJoinFkOwner(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::OWNER_ID, 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->addCcFilesRelatedByDbOwnerId($obj1);
-
- } // if joined row was not null
-
- $results[] = $obj1;
- }
- $stmt->closeCursor();
- return $results;
- }
-
-
- /**
- * 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 doSelectJoinCcSubjsRelatedByDbEditedby(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->addCcFilesRelatedByDbEditedby($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::OWNER_ID, CcSubjsPeer::ID, $join_behavior);
-
- $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);
-
- CcSubjsPeer::addSelectColumns($criteria);
- $startcol4 = $startcol3 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcMusicDirsPeer::addSelectColumns($criteria);
- $startcol5 = $startcol4 + (CcMusicDirsPeer::NUM_COLUMNS - CcMusicDirsPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcFilesPeer::OWNER_ID, CcSubjsPeer::ID, $join_behavior);
-
- $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->addCcFilesRelatedByDbOwnerId($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 (CcFiles) to the collection in $obj3 (CcSubjs)
- $obj3->addCcFilesRelatedByDbEditedby($obj1);
- } // if joined row not null
-
- // Add objects for joined CcMusicDirs rows
-
- $key4 = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, $startcol4);
- if ($key4 !== null) {
- $obj4 = CcMusicDirsPeer::getInstanceFromPool($key4);
- if (!$obj4) {
-
- $cls = CcMusicDirsPeer::getOMClass(false);
-
- $obj4 = new $cls();
- $obj4->hydrate($row, $startcol4);
- CcMusicDirsPeer::addInstanceToPool($obj4, $key4);
- } // if obj4 loaded
-
- // Add the $obj1 (CcFiles) to the collection in $obj4 (CcMusicDirs)
- $obj4->addCcFiles($obj1);
- } // if joined row not null
-
- $results[] = $obj1;
- }
- $stmt->closeCursor();
- return $results;
- }
-
-
- /**
- * Returns the number of rows matching criteria, joining the related FkOwner 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 doCountJoinAllExceptFkOwner(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 CcSubjsRelatedByDbEditedby 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 doCountJoinAllExceptCcSubjsRelatedByDbEditedby(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::OWNER_ID, CcSubjsPeer::ID, $join_behavior);
-
- $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 FkOwner.
- *
- * @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 doSelectJoinAllExceptFkOwner(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 CcSubjsRelatedByDbEditedby.
- *
- * @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 doSelectJoinAllExceptCcSubjsRelatedByDbEditedby(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);
-
- CcSubjsPeer::addSelectColumns($criteria);
- $startcol4 = $startcol3 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcFilesPeer::OWNER_ID, CcSubjsPeer::ID, $join_behavior);
-
- $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->addCcFilesRelatedByDbOwnerId($obj1);
-
- } // if joined row is 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 already loaded
-
- // Add the $obj1 (CcFiles) to the collection in $obj3 (CcSubjs)
- $obj3->addCcFilesRelatedByDbEditedby($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;
- }
+ /** the column name for the soundcloud_link_to_file field */
+ const SOUNDCLOUD_LINK_TO_FILE = 'cc_files.soundcloud_link_to_file';
+
+ /** the column name for the soundcloud_upload_time field */
+ const SOUNDCLOUD_UPLOAD_TIME = 'cc_files.soundcloud_upload_time';
+
+ /** the column name for the replay_gain field */
+ const REPLAY_GAIN = 'cc_files.replay_gain';
+
+ /** the column name for the owner_id field */
+ const OWNER_ID = 'cc_files.owner_id';
+
+ /** the column name for the cuein field */
+ const CUEIN = 'cc_files.cuein';
+
+ /** the column name for the cueout field */
+ const CUEOUT = 'cc_files.cueout';
+
+ /** the column name for the silan_check field */
+ const SILAN_CHECK = 'cc_files.silan_check';
+
+ /** the column name for the hidden field */
+ const HIDDEN = 'cc_files.hidden';
+
+ /** the column name for the is_scheduled field */
+ const IS_SCHEDULED = 'cc_files.is_scheduled';
+
+ /** the column name for the is_playlist field */
+ const IS_PLAYLIST = 'cc_files.is_playlist';
+
+ /** the column name for the resource_id field */
+ const RESOURCE_ID = 'cc_files.resource_id';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcFiles objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcFiles[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcFilesPeer::$fieldNames[CcFilesPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMime', 'DbFtype', 'DbDirectory', 'DbFilepath', 'DbImportStatus', 'DbCurrentlyaccessing', 'DbEditedby', 'DbMtime', 'DbUtime', 'DbLPtime', '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', 'DbFileExists', 'DbSoundcloudId', 'DbSoundcloudErrorCode', 'DbSoundcloudErrorMsg', 'DbSoundcloudLinkToFile', 'DbSoundCloundUploadTime', 'DbReplayGain', 'DbOwnerId', 'DbCuein', 'DbCueout', 'DbSilanCheck', 'DbHidden', 'DbIsScheduled', 'DbIsPlaylist', 'DbResourceId', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMime', 'dbFtype', 'dbDirectory', 'dbFilepath', 'dbImportStatus', 'dbCurrentlyaccessing', 'dbEditedby', 'dbMtime', 'dbUtime', 'dbLPtime', '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', 'dbFileExists', 'dbSoundcloudId', 'dbSoundcloudErrorCode', 'dbSoundcloudErrorMsg', 'dbSoundcloudLinkToFile', 'dbSoundCloundUploadTime', 'dbReplayGain', 'dbOwnerId', 'dbCuein', 'dbCueout', 'dbSilanCheck', 'dbHidden', 'dbIsScheduled', 'dbIsPlaylist', 'dbResourceId', ),
+ BasePeer::TYPE_COLNAME => array (CcFilesPeer::ID, CcFilesPeer::NAME, CcFilesPeer::MIME, CcFilesPeer::FTYPE, CcFilesPeer::DIRECTORY, CcFilesPeer::FILEPATH, CcFilesPeer::IMPORT_STATUS, CcFilesPeer::CURRENTLYACCESSING, CcFilesPeer::EDITEDBY, CcFilesPeer::MTIME, CcFilesPeer::UTIME, CcFilesPeer::LPTIME, CcFilesPeer::MD5, CcFilesPeer::TRACK_TITLE, CcFilesPeer::ARTIST_NAME, CcFilesPeer::BIT_RATE, CcFilesPeer::SAMPLE_RATE, CcFilesPeer::FORMAT, CcFilesPeer::LENGTH, CcFilesPeer::ALBUM_TITLE, CcFilesPeer::GENRE, CcFilesPeer::COMMENTS, CcFilesPeer::YEAR, CcFilesPeer::TRACK_NUMBER, CcFilesPeer::CHANNELS, CcFilesPeer::URL, CcFilesPeer::BPM, CcFilesPeer::RATING, CcFilesPeer::ENCODED_BY, CcFilesPeer::DISC_NUMBER, CcFilesPeer::MOOD, CcFilesPeer::LABEL, CcFilesPeer::COMPOSER, CcFilesPeer::ENCODER, CcFilesPeer::CHECKSUM, CcFilesPeer::LYRICS, CcFilesPeer::ORCHESTRA, CcFilesPeer::CONDUCTOR, CcFilesPeer::LYRICIST, CcFilesPeer::ORIGINAL_LYRICIST, CcFilesPeer::RADIO_STATION_NAME, CcFilesPeer::INFO_URL, CcFilesPeer::ARTIST_URL, CcFilesPeer::AUDIO_SOURCE_URL, CcFilesPeer::RADIO_STATION_URL, CcFilesPeer::BUY_THIS_URL, CcFilesPeer::ISRC_NUMBER, CcFilesPeer::CATALOG_NUMBER, CcFilesPeer::ORIGINAL_ARTIST, CcFilesPeer::COPYRIGHT, CcFilesPeer::REPORT_DATETIME, CcFilesPeer::REPORT_LOCATION, CcFilesPeer::REPORT_ORGANIZATION, CcFilesPeer::SUBJECT, CcFilesPeer::CONTRIBUTOR, CcFilesPeer::LANGUAGE, CcFilesPeer::FILE_EXISTS, CcFilesPeer::SOUNDCLOUD_ID, CcFilesPeer::SOUNDCLOUD_ERROR_CODE, CcFilesPeer::SOUNDCLOUD_ERROR_MSG, CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE, CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME, CcFilesPeer::REPLAY_GAIN, CcFilesPeer::OWNER_ID, CcFilesPeer::CUEIN, CcFilesPeer::CUEOUT, CcFilesPeer::SILAN_CHECK, CcFilesPeer::HIDDEN, CcFilesPeer::IS_SCHEDULED, CcFilesPeer::IS_PLAYLIST, CcFilesPeer::RESOURCE_ID, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MIME', 'FTYPE', 'DIRECTORY', 'FILEPATH', 'IMPORT_STATUS', 'CURRENTLYACCESSING', 'EDITEDBY', 'MTIME', 'UTIME', 'LPTIME', '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', 'FILE_EXISTS', 'SOUNDCLOUD_ID', 'SOUNDCLOUD_ERROR_CODE', 'SOUNDCLOUD_ERROR_MSG', 'SOUNDCLOUD_LINK_TO_FILE', 'SOUNDCLOUD_UPLOAD_TIME', 'REPLAY_GAIN', 'OWNER_ID', 'CUEIN', 'CUEOUT', 'SILAN_CHECK', 'HIDDEN', 'IS_SCHEDULED', 'IS_PLAYLIST', 'RESOURCE_ID', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mime', 'ftype', 'directory', 'filepath', 'import_status', 'currentlyaccessing', 'editedby', 'mtime', 'utime', 'lptime', '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', 'file_exists', 'soundcloud_id', 'soundcloud_error_code', 'soundcloud_error_msg', 'soundcloud_link_to_file', 'soundcloud_upload_time', 'replay_gain', 'owner_id', 'cuein', 'cueout', 'silan_check', 'hidden', 'is_scheduled', 'is_playlist', 'resource_id', ),
+ 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, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. CcFilesPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMime' => 2, 'DbFtype' => 3, 'DbDirectory' => 4, 'DbFilepath' => 5, 'DbImportStatus' => 6, 'DbCurrentlyaccessing' => 7, 'DbEditedby' => 8, 'DbMtime' => 9, 'DbUtime' => 10, 'DbLPtime' => 11, 'DbMd5' => 12, 'DbTrackTitle' => 13, 'DbArtistName' => 14, 'DbBitRate' => 15, 'DbSampleRate' => 16, 'DbFormat' => 17, 'DbLength' => 18, 'DbAlbumTitle' => 19, 'DbGenre' => 20, 'DbComments' => 21, 'DbYear' => 22, 'DbTrackNumber' => 23, 'DbChannels' => 24, 'DbUrl' => 25, 'DbBpm' => 26, 'DbRating' => 27, 'DbEncodedBy' => 28, 'DbDiscNumber' => 29, 'DbMood' => 30, 'DbLabel' => 31, 'DbComposer' => 32, 'DbEncoder' => 33, 'DbChecksum' => 34, 'DbLyrics' => 35, 'DbOrchestra' => 36, 'DbConductor' => 37, 'DbLyricist' => 38, 'DbOriginalLyricist' => 39, 'DbRadioStationName' => 40, 'DbInfoUrl' => 41, 'DbArtistUrl' => 42, 'DbAudioSourceUrl' => 43, 'DbRadioStationUrl' => 44, 'DbBuyThisUrl' => 45, 'DbIsrcNumber' => 46, 'DbCatalogNumber' => 47, 'DbOriginalArtist' => 48, 'DbCopyright' => 49, 'DbReportDatetime' => 50, 'DbReportLocation' => 51, 'DbReportOrganization' => 52, 'DbSubject' => 53, 'DbContributor' => 54, 'DbLanguage' => 55, 'DbFileExists' => 56, 'DbSoundcloudId' => 57, 'DbSoundcloudErrorCode' => 58, 'DbSoundcloudErrorMsg' => 59, 'DbSoundcloudLinkToFile' => 60, 'DbSoundCloundUploadTime' => 61, 'DbReplayGain' => 62, 'DbOwnerId' => 63, 'DbCuein' => 64, 'DbCueout' => 65, 'DbSilanCheck' => 66, 'DbHidden' => 67, 'DbIsScheduled' => 68, 'DbIsPlaylist' => 69, 'DbResourceId' => 70, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMime' => 2, 'dbFtype' => 3, 'dbDirectory' => 4, 'dbFilepath' => 5, 'dbImportStatus' => 6, 'dbCurrentlyaccessing' => 7, 'dbEditedby' => 8, 'dbMtime' => 9, 'dbUtime' => 10, 'dbLPtime' => 11, 'dbMd5' => 12, 'dbTrackTitle' => 13, 'dbArtistName' => 14, 'dbBitRate' => 15, 'dbSampleRate' => 16, 'dbFormat' => 17, 'dbLength' => 18, 'dbAlbumTitle' => 19, 'dbGenre' => 20, 'dbComments' => 21, 'dbYear' => 22, 'dbTrackNumber' => 23, 'dbChannels' => 24, 'dbUrl' => 25, 'dbBpm' => 26, 'dbRating' => 27, 'dbEncodedBy' => 28, 'dbDiscNumber' => 29, 'dbMood' => 30, 'dbLabel' => 31, 'dbComposer' => 32, 'dbEncoder' => 33, 'dbChecksum' => 34, 'dbLyrics' => 35, 'dbOrchestra' => 36, 'dbConductor' => 37, 'dbLyricist' => 38, 'dbOriginalLyricist' => 39, 'dbRadioStationName' => 40, 'dbInfoUrl' => 41, 'dbArtistUrl' => 42, 'dbAudioSourceUrl' => 43, 'dbRadioStationUrl' => 44, 'dbBuyThisUrl' => 45, 'dbIsrcNumber' => 46, 'dbCatalogNumber' => 47, 'dbOriginalArtist' => 48, 'dbCopyright' => 49, 'dbReportDatetime' => 50, 'dbReportLocation' => 51, 'dbReportOrganization' => 52, 'dbSubject' => 53, 'dbContributor' => 54, 'dbLanguage' => 55, 'dbFileExists' => 56, 'dbSoundcloudId' => 57, 'dbSoundcloudErrorCode' => 58, 'dbSoundcloudErrorMsg' => 59, 'dbSoundcloudLinkToFile' => 60, 'dbSoundCloundUploadTime' => 61, 'dbReplayGain' => 62, 'dbOwnerId' => 63, 'dbCuein' => 64, 'dbCueout' => 65, 'dbSilanCheck' => 66, 'dbHidden' => 67, 'dbIsScheduled' => 68, 'dbIsPlaylist' => 69, 'dbResourceId' => 70, ),
+ BasePeer::TYPE_COLNAME => array (CcFilesPeer::ID => 0, CcFilesPeer::NAME => 1, CcFilesPeer::MIME => 2, CcFilesPeer::FTYPE => 3, CcFilesPeer::DIRECTORY => 4, CcFilesPeer::FILEPATH => 5, CcFilesPeer::IMPORT_STATUS => 6, CcFilesPeer::CURRENTLYACCESSING => 7, CcFilesPeer::EDITEDBY => 8, CcFilesPeer::MTIME => 9, CcFilesPeer::UTIME => 10, CcFilesPeer::LPTIME => 11, CcFilesPeer::MD5 => 12, CcFilesPeer::TRACK_TITLE => 13, CcFilesPeer::ARTIST_NAME => 14, CcFilesPeer::BIT_RATE => 15, CcFilesPeer::SAMPLE_RATE => 16, CcFilesPeer::FORMAT => 17, CcFilesPeer::LENGTH => 18, CcFilesPeer::ALBUM_TITLE => 19, CcFilesPeer::GENRE => 20, CcFilesPeer::COMMENTS => 21, CcFilesPeer::YEAR => 22, CcFilesPeer::TRACK_NUMBER => 23, CcFilesPeer::CHANNELS => 24, CcFilesPeer::URL => 25, CcFilesPeer::BPM => 26, CcFilesPeer::RATING => 27, CcFilesPeer::ENCODED_BY => 28, CcFilesPeer::DISC_NUMBER => 29, CcFilesPeer::MOOD => 30, CcFilesPeer::LABEL => 31, CcFilesPeer::COMPOSER => 32, CcFilesPeer::ENCODER => 33, CcFilesPeer::CHECKSUM => 34, CcFilesPeer::LYRICS => 35, CcFilesPeer::ORCHESTRA => 36, CcFilesPeer::CONDUCTOR => 37, CcFilesPeer::LYRICIST => 38, CcFilesPeer::ORIGINAL_LYRICIST => 39, CcFilesPeer::RADIO_STATION_NAME => 40, CcFilesPeer::INFO_URL => 41, CcFilesPeer::ARTIST_URL => 42, CcFilesPeer::AUDIO_SOURCE_URL => 43, CcFilesPeer::RADIO_STATION_URL => 44, CcFilesPeer::BUY_THIS_URL => 45, CcFilesPeer::ISRC_NUMBER => 46, CcFilesPeer::CATALOG_NUMBER => 47, CcFilesPeer::ORIGINAL_ARTIST => 48, CcFilesPeer::COPYRIGHT => 49, CcFilesPeer::REPORT_DATETIME => 50, CcFilesPeer::REPORT_LOCATION => 51, CcFilesPeer::REPORT_ORGANIZATION => 52, CcFilesPeer::SUBJECT => 53, CcFilesPeer::CONTRIBUTOR => 54, CcFilesPeer::LANGUAGE => 55, CcFilesPeer::FILE_EXISTS => 56, CcFilesPeer::SOUNDCLOUD_ID => 57, CcFilesPeer::SOUNDCLOUD_ERROR_CODE => 58, CcFilesPeer::SOUNDCLOUD_ERROR_MSG => 59, CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE => 60, CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME => 61, CcFilesPeer::REPLAY_GAIN => 62, CcFilesPeer::OWNER_ID => 63, CcFilesPeer::CUEIN => 64, CcFilesPeer::CUEOUT => 65, CcFilesPeer::SILAN_CHECK => 66, CcFilesPeer::HIDDEN => 67, CcFilesPeer::IS_SCHEDULED => 68, CcFilesPeer::IS_PLAYLIST => 69, CcFilesPeer::RESOURCE_ID => 70, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MIME' => 2, 'FTYPE' => 3, 'DIRECTORY' => 4, 'FILEPATH' => 5, 'IMPORT_STATUS' => 6, 'CURRENTLYACCESSING' => 7, 'EDITEDBY' => 8, 'MTIME' => 9, 'UTIME' => 10, 'LPTIME' => 11, 'MD5' => 12, 'TRACK_TITLE' => 13, 'ARTIST_NAME' => 14, 'BIT_RATE' => 15, 'SAMPLE_RATE' => 16, 'FORMAT' => 17, 'LENGTH' => 18, 'ALBUM_TITLE' => 19, 'GENRE' => 20, 'COMMENTS' => 21, 'YEAR' => 22, 'TRACK_NUMBER' => 23, 'CHANNELS' => 24, 'URL' => 25, 'BPM' => 26, 'RATING' => 27, 'ENCODED_BY' => 28, 'DISC_NUMBER' => 29, 'MOOD' => 30, 'LABEL' => 31, 'COMPOSER' => 32, 'ENCODER' => 33, 'CHECKSUM' => 34, 'LYRICS' => 35, 'ORCHESTRA' => 36, 'CONDUCTOR' => 37, 'LYRICIST' => 38, 'ORIGINAL_LYRICIST' => 39, 'RADIO_STATION_NAME' => 40, 'INFO_URL' => 41, 'ARTIST_URL' => 42, 'AUDIO_SOURCE_URL' => 43, 'RADIO_STATION_URL' => 44, 'BUY_THIS_URL' => 45, 'ISRC_NUMBER' => 46, 'CATALOG_NUMBER' => 47, 'ORIGINAL_ARTIST' => 48, 'COPYRIGHT' => 49, 'REPORT_DATETIME' => 50, 'REPORT_LOCATION' => 51, 'REPORT_ORGANIZATION' => 52, 'SUBJECT' => 53, 'CONTRIBUTOR' => 54, 'LANGUAGE' => 55, 'FILE_EXISTS' => 56, 'SOUNDCLOUD_ID' => 57, 'SOUNDCLOUD_ERROR_CODE' => 58, 'SOUNDCLOUD_ERROR_MSG' => 59, 'SOUNDCLOUD_LINK_TO_FILE' => 60, 'SOUNDCLOUD_UPLOAD_TIME' => 61, 'REPLAY_GAIN' => 62, 'OWNER_ID' => 63, 'CUEIN' => 64, 'CUEOUT' => 65, 'SILAN_CHECK' => 66, 'HIDDEN' => 67, 'IS_SCHEDULED' => 68, 'IS_PLAYLIST' => 69, 'RESOURCE_ID' => 70, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mime' => 2, 'ftype' => 3, 'directory' => 4, 'filepath' => 5, 'import_status' => 6, 'currentlyaccessing' => 7, 'editedby' => 8, 'mtime' => 9, 'utime' => 10, 'lptime' => 11, 'md5' => 12, 'track_title' => 13, 'artist_name' => 14, 'bit_rate' => 15, 'sample_rate' => 16, 'format' => 17, 'length' => 18, 'album_title' => 19, 'genre' => 20, 'comments' => 21, 'year' => 22, 'track_number' => 23, 'channels' => 24, 'url' => 25, 'bpm' => 26, 'rating' => 27, 'encoded_by' => 28, 'disc_number' => 29, 'mood' => 30, 'label' => 31, 'composer' => 32, 'encoder' => 33, 'checksum' => 34, 'lyrics' => 35, 'orchestra' => 36, 'conductor' => 37, 'lyricist' => 38, 'original_lyricist' => 39, 'radio_station_name' => 40, 'info_url' => 41, 'artist_url' => 42, 'audio_source_url' => 43, 'radio_station_url' => 44, 'buy_this_url' => 45, 'isrc_number' => 46, 'catalog_number' => 47, 'original_artist' => 48, 'copyright' => 49, 'report_datetime' => 50, 'report_location' => 51, 'report_organization' => 52, 'subject' => 53, 'contributor' => 54, 'language' => 55, 'file_exists' => 56, 'soundcloud_id' => 57, 'soundcloud_error_code' => 58, 'soundcloud_error_msg' => 59, 'soundcloud_link_to_file' => 60, 'soundcloud_upload_time' => 61, 'replay_gain' => 62, 'owner_id' => 63, 'cuein' => 64, 'cueout' => 65, 'silan_check' => 66, 'hidden' => 67, 'is_scheduled' => 68, 'is_playlist' => 69, 'resource_id' => 70, ),
+ 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, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, )
+ );
+
+ /**
+ * 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcFilesPeer::getFieldNames($toType);
+ $key = isset(CcFilesPeer::$fieldKeys[$fromType][$name]) ? CcFilesPeer::$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(CcFilesPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcFilesPeer::$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 CcFilesPeer::$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::NAME);
+ $criteria->addSelectColumn(CcFilesPeer::MIME);
+ $criteria->addSelectColumn(CcFilesPeer::FTYPE);
+ $criteria->addSelectColumn(CcFilesPeer::DIRECTORY);
+ $criteria->addSelectColumn(CcFilesPeer::FILEPATH);
+ $criteria->addSelectColumn(CcFilesPeer::IMPORT_STATUS);
+ $criteria->addSelectColumn(CcFilesPeer::CURRENTLYACCESSING);
+ $criteria->addSelectColumn(CcFilesPeer::EDITEDBY);
+ $criteria->addSelectColumn(CcFilesPeer::MTIME);
+ $criteria->addSelectColumn(CcFilesPeer::UTIME);
+ $criteria->addSelectColumn(CcFilesPeer::LPTIME);
+ $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::FILE_EXISTS);
+ $criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_ID);
+ $criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_ERROR_CODE);
+ $criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_ERROR_MSG);
+ $criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_LINK_TO_FILE);
+ $criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME);
+ $criteria->addSelectColumn(CcFilesPeer::REPLAY_GAIN);
+ $criteria->addSelectColumn(CcFilesPeer::OWNER_ID);
+ $criteria->addSelectColumn(CcFilesPeer::CUEIN);
+ $criteria->addSelectColumn(CcFilesPeer::CUEOUT);
+ $criteria->addSelectColumn(CcFilesPeer::SILAN_CHECK);
+ $criteria->addSelectColumn(CcFilesPeer::HIDDEN);
+ $criteria->addSelectColumn(CcFilesPeer::IS_SCHEDULED);
+ $criteria->addSelectColumn(CcFilesPeer::IS_PLAYLIST);
+ $criteria->addSelectColumn(CcFilesPeer::RESOURCE_ID);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.name');
+ $criteria->addSelectColumn($alias . '.mime');
+ $criteria->addSelectColumn($alias . '.ftype');
+ $criteria->addSelectColumn($alias . '.directory');
+ $criteria->addSelectColumn($alias . '.filepath');
+ $criteria->addSelectColumn($alias . '.import_status');
+ $criteria->addSelectColumn($alias . '.currentlyaccessing');
+ $criteria->addSelectColumn($alias . '.editedby');
+ $criteria->addSelectColumn($alias . '.mtime');
+ $criteria->addSelectColumn($alias . '.utime');
+ $criteria->addSelectColumn($alias . '.lptime');
+ $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 . '.file_exists');
+ $criteria->addSelectColumn($alias . '.soundcloud_id');
+ $criteria->addSelectColumn($alias . '.soundcloud_error_code');
+ $criteria->addSelectColumn($alias . '.soundcloud_error_msg');
+ $criteria->addSelectColumn($alias . '.soundcloud_link_to_file');
+ $criteria->addSelectColumn($alias . '.soundcloud_upload_time');
+ $criteria->addSelectColumn($alias . '.replay_gain');
+ $criteria->addSelectColumn($alias . '.owner_id');
+ $criteria->addSelectColumn($alias . '.cuein');
+ $criteria->addSelectColumn($alias . '.cueout');
+ $criteria->addSelectColumn($alias . '.silan_check');
+ $criteria->addSelectColumn($alias . '.hidden');
+ $criteria->addSelectColumn($alias . '.is_scheduled');
+ $criteria->addSelectColumn($alias . '.is_playlist');
+ $criteria->addSelectColumn($alias . '.resource_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(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(CcFilesPeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcFilesPeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcFilesPeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcFilesPeer::$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(CcFilesPeer::$instances[$key])) {
+ return CcFilesPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcFilesPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcFilesPeer::$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 CcBlockcontentsPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcBlockcontentsPeer::clearInstancePool();
+ // Invalidate objects in CcSchedulePeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcSchedulePeer::clearInstancePool();
+ // Invalidate objects in CcPlayoutHistoryPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcPlayoutHistoryPeer::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();
+ // 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_HYDRATE_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 FkOwner 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 doCountJoinFkOwner(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(CcFilesPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcFilesPeer::OWNER_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 CcSubjsRelatedByDbEditedby 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 doCountJoinCcSubjsRelatedByDbEditedby(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(CcFilesPeer::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(CcFilesPeer::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 doSelectJoinFkOwner(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(CcFilesPeer::DATABASE_NAME);
+ }
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol = CcFilesPeer::NUM_HYDRATE_COLUMNS;
+ CcSubjsPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcFilesPeer::OWNER_ID, 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();
+
+ $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();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcSubjsPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcFiles) to $obj2 (CcSubjs)
+ $obj2->addCcFilesRelatedByDbOwnerId($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * 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 doSelectJoinCcSubjsRelatedByDbEditedby(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(CcFilesPeer::DATABASE_NAME);
+ }
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol = CcFilesPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcSubjsPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcFiles) to $obj2 (CcSubjs)
+ $obj2->addCcFilesRelatedByDbEditedby($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(CcFilesPeer::DATABASE_NAME);
+ }
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol = CcFilesPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcFilesPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcFilesPeer::OWNER_ID, CcSubjsPeer::ID, $join_behavior);
+
+ $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(CcFilesPeer::DATABASE_NAME);
+ }
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol2 = CcFilesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcSubjsPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcSubjsPeer::NUM_HYDRATE_COLUMNS;
+
+ CcSubjsPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + CcSubjsPeer::NUM_HYDRATE_COLUMNS;
+
+ CcMusicDirsPeer::addSelectColumns($criteria);
+ $startcol5 = $startcol4 + CcMusicDirsPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcFilesPeer::OWNER_ID, CcSubjsPeer::ID, $join_behavior);
+
+ $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();
+
+ $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();
+
+ $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->addCcFilesRelatedByDbOwnerId($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();
+
+ $obj3 = new $cls();
+ $obj3->hydrate($row, $startcol3);
+ CcSubjsPeer::addInstanceToPool($obj3, $key3);
+ } // if obj3 loaded
+
+ // Add the $obj1 (CcFiles) to the collection in $obj3 (CcSubjs)
+ $obj3->addCcFilesRelatedByDbEditedby($obj1);
+ } // if joined row not null
+
+ // Add objects for joined CcMusicDirs rows
+
+ $key4 = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, $startcol4);
+ if ($key4 !== null) {
+ $obj4 = CcMusicDirsPeer::getInstanceFromPool($key4);
+ if (!$obj4) {
+
+ $cls = CcMusicDirsPeer::getOMClass();
+
+ $obj4 = new $cls();
+ $obj4->hydrate($row, $startcol4);
+ CcMusicDirsPeer::addInstanceToPool($obj4, $key4);
+ } // if obj4 loaded
+
+ // Add the $obj1 (CcFiles) to the collection in $obj4 (CcMusicDirs)
+ $obj4->addCcFiles($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related FkOwner 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 doCountJoinAllExceptFkOwner(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(CcFilesPeer::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 CcSubjsRelatedByDbEditedby 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 doCountJoinAllExceptCcSubjsRelatedByDbEditedby(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(CcFilesPeer::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(CcFilesPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcFilesPeer::OWNER_ID, CcSubjsPeer::ID, $join_behavior);
+
+ $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 FkOwner.
+ *
+ * @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 doSelectJoinAllExceptFkOwner(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(CcFilesPeer::DATABASE_NAME);
+ }
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol2 = CcFilesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcMusicDirsPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcMusicDirsPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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 CcSubjsRelatedByDbEditedby.
+ *
+ * @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 doSelectJoinAllExceptCcSubjsRelatedByDbEditedby(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(CcFilesPeer::DATABASE_NAME);
+ }
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol2 = CcFilesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcMusicDirsPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcMusicDirsPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcFilesPeer::DATABASE_NAME);
+ }
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol2 = CcFilesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcSubjsPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcSubjsPeer::NUM_HYDRATE_COLUMNS;
+
+ CcSubjsPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + CcSubjsPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcFilesPeer::OWNER_ID, CcSubjsPeer::ID, $join_behavior);
+
+ $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();
+
+ $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();
+
+ $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->addCcFilesRelatedByDbOwnerId($obj1);
+
+ } // if joined row is 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();
+
+ $obj3 = new $cls();
+ $obj3->hydrate($row, $startcol3);
+ CcSubjsPeer::addInstanceToPool($obj3, $key3);
+ } // if $obj3 already loaded
+
+ // Add the $obj1 (CcFiles) to the collection in $obj3 (CcSubjs)
+ $obj3->addCcFilesRelatedByDbEditedby($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(CcFilesPeer::DATABASE_NAME)->getTable(CcFilesPeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcFilesPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcFilesPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcFilesPeer::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(CcFilesPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_files table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcFilesPeer::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(CcFilesPeer::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 (Exception $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($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->hasColumn($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
+ * @return CcFiles[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php
index dbac410a4..648dd4b1d 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php
@@ -4,2654 +4,3434 @@
/**
* Base class that represents a query for the 'cc_files' table.
*
- *
*
- * @method CcFilesQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcFilesQuery orderByDbName($order = Criteria::ASC) Order by the name column
- * @method CcFilesQuery orderByDbMime($order = Criteria::ASC) Order by the mime column
- * @method CcFilesQuery orderByDbFtype($order = Criteria::ASC) Order by the ftype column
- * @method CcFilesQuery orderByDbDirectory($order = Criteria::ASC) Order by the directory column
- * @method CcFilesQuery orderByDbFilepath($order = Criteria::ASC) Order by the filepath column
- * @method CcFilesQuery orderByDbImportStatus($order = Criteria::ASC) Order by the import_status column
- * @method CcFilesQuery orderByDbCurrentlyaccessing($order = Criteria::ASC) Order by the currentlyaccessing column
- * @method CcFilesQuery orderByDbEditedby($order = Criteria::ASC) Order by the editedby column
- * @method CcFilesQuery orderByDbMtime($order = Criteria::ASC) Order by the mtime column
- * @method CcFilesQuery orderByDbUtime($order = Criteria::ASC) Order by the utime column
- * @method CcFilesQuery orderByDbLPtime($order = Criteria::ASC) Order by the lptime column
- * @method CcFilesQuery orderByDbMd5($order = Criteria::ASC) Order by the md5 column
- * @method CcFilesQuery orderByDbTrackTitle($order = Criteria::ASC) Order by the track_title column
- * @method CcFilesQuery orderByDbArtistName($order = Criteria::ASC) Order by the artist_name column
- * @method CcFilesQuery orderByDbBitRate($order = Criteria::ASC) Order by the bit_rate column
- * @method CcFilesQuery orderByDbSampleRate($order = Criteria::ASC) Order by the sample_rate column
- * @method CcFilesQuery orderByDbFormat($order = Criteria::ASC) Order by the format column
- * @method CcFilesQuery orderByDbLength($order = Criteria::ASC) Order by the length column
- * @method CcFilesQuery orderByDbAlbumTitle($order = Criteria::ASC) Order by the album_title column
- * @method CcFilesQuery orderByDbGenre($order = Criteria::ASC) Order by the genre column
- * @method CcFilesQuery orderByDbComments($order = Criteria::ASC) Order by the comments column
- * @method CcFilesQuery orderByDbYear($order = Criteria::ASC) Order by the year column
- * @method CcFilesQuery orderByDbTrackNumber($order = Criteria::ASC) Order by the track_number column
- * @method CcFilesQuery orderByDbChannels($order = Criteria::ASC) Order by the channels column
- * @method CcFilesQuery orderByDbUrl($order = Criteria::ASC) Order by the url column
- * @method CcFilesQuery orderByDbBpm($order = Criteria::ASC) Order by the bpm column
- * @method CcFilesQuery orderByDbRating($order = Criteria::ASC) Order by the rating column
- * @method CcFilesQuery orderByDbEncodedBy($order = Criteria::ASC) Order by the encoded_by column
- * @method CcFilesQuery orderByDbDiscNumber($order = Criteria::ASC) Order by the disc_number column
- * @method CcFilesQuery orderByDbMood($order = Criteria::ASC) Order by the mood column
- * @method CcFilesQuery orderByDbLabel($order = Criteria::ASC) Order by the label column
- * @method CcFilesQuery orderByDbComposer($order = Criteria::ASC) Order by the composer column
- * @method CcFilesQuery orderByDbEncoder($order = Criteria::ASC) Order by the encoder column
- * @method CcFilesQuery orderByDbChecksum($order = Criteria::ASC) Order by the checksum column
- * @method CcFilesQuery orderByDbLyrics($order = Criteria::ASC) Order by the lyrics column
- * @method CcFilesQuery orderByDbOrchestra($order = Criteria::ASC) Order by the orchestra column
- * @method CcFilesQuery orderByDbConductor($order = Criteria::ASC) Order by the conductor column
- * @method CcFilesQuery orderByDbLyricist($order = Criteria::ASC) Order by the lyricist column
- * @method CcFilesQuery orderByDbOriginalLyricist($order = Criteria::ASC) Order by the original_lyricist column
- * @method CcFilesQuery orderByDbRadioStationName($order = Criteria::ASC) Order by the radio_station_name column
- * @method CcFilesQuery orderByDbInfoUrl($order = Criteria::ASC) Order by the info_url column
- * @method CcFilesQuery orderByDbArtistUrl($order = Criteria::ASC) Order by the artist_url column
- * @method CcFilesQuery orderByDbAudioSourceUrl($order = Criteria::ASC) Order by the audio_source_url column
- * @method CcFilesQuery orderByDbRadioStationUrl($order = Criteria::ASC) Order by the radio_station_url column
- * @method CcFilesQuery orderByDbBuyThisUrl($order = Criteria::ASC) Order by the buy_this_url column
- * @method CcFilesQuery orderByDbIsrcNumber($order = Criteria::ASC) Order by the isrc_number column
- * @method CcFilesQuery orderByDbCatalogNumber($order = Criteria::ASC) Order by the catalog_number column
- * @method CcFilesQuery orderByDbOriginalArtist($order = Criteria::ASC) Order by the original_artist column
- * @method CcFilesQuery orderByDbCopyright($order = Criteria::ASC) Order by the copyright column
- * @method CcFilesQuery orderByDbReportDatetime($order = Criteria::ASC) Order by the report_datetime column
- * @method CcFilesQuery orderByDbReportLocation($order = Criteria::ASC) Order by the report_location column
- * @method CcFilesQuery orderByDbReportOrganization($order = Criteria::ASC) Order by the report_organization column
- * @method CcFilesQuery orderByDbSubject($order = Criteria::ASC) Order by the subject column
- * @method CcFilesQuery orderByDbContributor($order = Criteria::ASC) Order by the contributor column
- * @method CcFilesQuery orderByDbLanguage($order = Criteria::ASC) Order by the language column
- * @method CcFilesQuery orderByDbFileExists($order = Criteria::ASC) Order by the file_exists column
- * @method CcFilesQuery orderByDbSoundcloudId($order = Criteria::ASC) Order by the soundcloud_id column
- * @method CcFilesQuery orderByDbSoundcloudErrorCode($order = Criteria::ASC) Order by the soundcloud_error_code column
- * @method CcFilesQuery orderByDbSoundcloudErrorMsg($order = Criteria::ASC) Order by the soundcloud_error_msg column
- * @method CcFilesQuery orderByDbSoundcloudLinkToFile($order = Criteria::ASC) Order by the soundcloud_link_to_file column
- * @method CcFilesQuery orderByDbSoundCloundUploadTime($order = Criteria::ASC) Order by the soundcloud_upload_time column
- * @method CcFilesQuery orderByDbReplayGain($order = Criteria::ASC) Order by the replay_gain column
- * @method CcFilesQuery orderByDbOwnerId($order = Criteria::ASC) Order by the owner_id column
- * @method CcFilesQuery orderByDbCuein($order = Criteria::ASC) Order by the cuein column
- * @method CcFilesQuery orderByDbCueout($order = Criteria::ASC) Order by the cueout column
- * @method CcFilesQuery orderByDbSilanCheck($order = Criteria::ASC) Order by the silan_check column
- * @method CcFilesQuery orderByDbHidden($order = Criteria::ASC) Order by the hidden column
- * @method CcFilesQuery orderByDbIsScheduled($order = Criteria::ASC) Order by the is_scheduled column
- * @method CcFilesQuery orderByDbIsPlaylist($order = Criteria::ASC) Order by the is_playlist column
- * @method CcFilesQuery orderByDbResourceId($order = Criteria::ASC) Order by the resource_id column
*
- * @method CcFilesQuery groupByDbId() Group by the id column
- * @method CcFilesQuery groupByDbName() Group by the name column
- * @method CcFilesQuery groupByDbMime() Group by the mime column
- * @method CcFilesQuery groupByDbFtype() Group by the ftype column
- * @method CcFilesQuery groupByDbDirectory() Group by the directory column
- * @method CcFilesQuery groupByDbFilepath() Group by the filepath column
- * @method CcFilesQuery groupByDbImportStatus() Group by the import_status column
- * @method CcFilesQuery groupByDbCurrentlyaccessing() Group by the currentlyaccessing column
- * @method CcFilesQuery groupByDbEditedby() Group by the editedby column
- * @method CcFilesQuery groupByDbMtime() Group by the mtime column
- * @method CcFilesQuery groupByDbUtime() Group by the utime column
- * @method CcFilesQuery groupByDbLPtime() Group by the lptime column
- * @method CcFilesQuery groupByDbMd5() Group by the md5 column
- * @method CcFilesQuery groupByDbTrackTitle() Group by the track_title column
- * @method CcFilesQuery groupByDbArtistName() Group by the artist_name column
- * @method CcFilesQuery groupByDbBitRate() Group by the bit_rate column
- * @method CcFilesQuery groupByDbSampleRate() Group by the sample_rate column
- * @method CcFilesQuery groupByDbFormat() Group by the format column
- * @method CcFilesQuery groupByDbLength() Group by the length column
- * @method CcFilesQuery groupByDbAlbumTitle() Group by the album_title column
- * @method CcFilesQuery groupByDbGenre() Group by the genre column
- * @method CcFilesQuery groupByDbComments() Group by the comments column
- * @method CcFilesQuery groupByDbYear() Group by the year column
- * @method CcFilesQuery groupByDbTrackNumber() Group by the track_number column
- * @method CcFilesQuery groupByDbChannels() Group by the channels column
- * @method CcFilesQuery groupByDbUrl() Group by the url column
- * @method CcFilesQuery groupByDbBpm() Group by the bpm column
- * @method CcFilesQuery groupByDbRating() Group by the rating column
- * @method CcFilesQuery groupByDbEncodedBy() Group by the encoded_by column
- * @method CcFilesQuery groupByDbDiscNumber() Group by the disc_number column
- * @method CcFilesQuery groupByDbMood() Group by the mood column
- * @method CcFilesQuery groupByDbLabel() Group by the label column
- * @method CcFilesQuery groupByDbComposer() Group by the composer column
- * @method CcFilesQuery groupByDbEncoder() Group by the encoder column
- * @method CcFilesQuery groupByDbChecksum() Group by the checksum column
- * @method CcFilesQuery groupByDbLyrics() Group by the lyrics column
- * @method CcFilesQuery groupByDbOrchestra() Group by the orchestra column
- * @method CcFilesQuery groupByDbConductor() Group by the conductor column
- * @method CcFilesQuery groupByDbLyricist() Group by the lyricist column
- * @method CcFilesQuery groupByDbOriginalLyricist() Group by the original_lyricist column
- * @method CcFilesQuery groupByDbRadioStationName() Group by the radio_station_name column
- * @method CcFilesQuery groupByDbInfoUrl() Group by the info_url column
- * @method CcFilesQuery groupByDbArtistUrl() Group by the artist_url column
- * @method CcFilesQuery groupByDbAudioSourceUrl() Group by the audio_source_url column
- * @method CcFilesQuery groupByDbRadioStationUrl() Group by the radio_station_url column
- * @method CcFilesQuery groupByDbBuyThisUrl() Group by the buy_this_url column
- * @method CcFilesQuery groupByDbIsrcNumber() Group by the isrc_number column
- * @method CcFilesQuery groupByDbCatalogNumber() Group by the catalog_number column
- * @method CcFilesQuery groupByDbOriginalArtist() Group by the original_artist column
- * @method CcFilesQuery groupByDbCopyright() Group by the copyright column
- * @method CcFilesQuery groupByDbReportDatetime() Group by the report_datetime column
- * @method CcFilesQuery groupByDbReportLocation() Group by the report_location column
- * @method CcFilesQuery groupByDbReportOrganization() Group by the report_organization column
- * @method CcFilesQuery groupByDbSubject() Group by the subject column
- * @method CcFilesQuery groupByDbContributor() Group by the contributor column
- * @method CcFilesQuery groupByDbLanguage() Group by the language column
- * @method CcFilesQuery groupByDbFileExists() Group by the file_exists column
- * @method CcFilesQuery groupByDbSoundcloudId() Group by the soundcloud_id column
- * @method CcFilesQuery groupByDbSoundcloudErrorCode() Group by the soundcloud_error_code column
- * @method CcFilesQuery groupByDbSoundcloudErrorMsg() Group by the soundcloud_error_msg column
- * @method CcFilesQuery groupByDbSoundcloudLinkToFile() Group by the soundcloud_link_to_file column
- * @method CcFilesQuery groupByDbSoundCloundUploadTime() Group by the soundcloud_upload_time column
- * @method CcFilesQuery groupByDbReplayGain() Group by the replay_gain column
- * @method CcFilesQuery groupByDbOwnerId() Group by the owner_id column
- * @method CcFilesQuery groupByDbCuein() Group by the cuein column
- * @method CcFilesQuery groupByDbCueout() Group by the cueout column
- * @method CcFilesQuery groupByDbSilanCheck() Group by the silan_check column
- * @method CcFilesQuery groupByDbHidden() Group by the hidden column
- * @method CcFilesQuery groupByDbIsScheduled() Group by the is_scheduled column
- * @method CcFilesQuery groupByDbIsPlaylist() Group by the is_playlist column
- * @method CcFilesQuery groupByDbResourceId() Group by the resource_id column
+ * @method CcFilesQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcFilesQuery orderByDbName($order = Criteria::ASC) Order by the name column
+ * @method CcFilesQuery orderByDbMime($order = Criteria::ASC) Order by the mime column
+ * @method CcFilesQuery orderByDbFtype($order = Criteria::ASC) Order by the ftype column
+ * @method CcFilesQuery orderByDbDirectory($order = Criteria::ASC) Order by the directory column
+ * @method CcFilesQuery orderByDbFilepath($order = Criteria::ASC) Order by the filepath column
+ * @method CcFilesQuery orderByDbImportStatus($order = Criteria::ASC) Order by the import_status column
+ * @method CcFilesQuery orderByDbCurrentlyaccessing($order = Criteria::ASC) Order by the currentlyaccessing column
+ * @method CcFilesQuery orderByDbEditedby($order = Criteria::ASC) Order by the editedby column
+ * @method CcFilesQuery orderByDbMtime($order = Criteria::ASC) Order by the mtime column
+ * @method CcFilesQuery orderByDbUtime($order = Criteria::ASC) Order by the utime column
+ * @method CcFilesQuery orderByDbLPtime($order = Criteria::ASC) Order by the lptime column
+ * @method CcFilesQuery orderByDbMd5($order = Criteria::ASC) Order by the md5 column
+ * @method CcFilesQuery orderByDbTrackTitle($order = Criteria::ASC) Order by the track_title column
+ * @method CcFilesQuery orderByDbArtistName($order = Criteria::ASC) Order by the artist_name column
+ * @method CcFilesQuery orderByDbBitRate($order = Criteria::ASC) Order by the bit_rate column
+ * @method CcFilesQuery orderByDbSampleRate($order = Criteria::ASC) Order by the sample_rate column
+ * @method CcFilesQuery orderByDbFormat($order = Criteria::ASC) Order by the format column
+ * @method CcFilesQuery orderByDbLength($order = Criteria::ASC) Order by the length column
+ * @method CcFilesQuery orderByDbAlbumTitle($order = Criteria::ASC) Order by the album_title column
+ * @method CcFilesQuery orderByDbGenre($order = Criteria::ASC) Order by the genre column
+ * @method CcFilesQuery orderByDbComments($order = Criteria::ASC) Order by the comments column
+ * @method CcFilesQuery orderByDbYear($order = Criteria::ASC) Order by the year column
+ * @method CcFilesQuery orderByDbTrackNumber($order = Criteria::ASC) Order by the track_number column
+ * @method CcFilesQuery orderByDbChannels($order = Criteria::ASC) Order by the channels column
+ * @method CcFilesQuery orderByDbUrl($order = Criteria::ASC) Order by the url column
+ * @method CcFilesQuery orderByDbBpm($order = Criteria::ASC) Order by the bpm column
+ * @method CcFilesQuery orderByDbRating($order = Criteria::ASC) Order by the rating column
+ * @method CcFilesQuery orderByDbEncodedBy($order = Criteria::ASC) Order by the encoded_by column
+ * @method CcFilesQuery orderByDbDiscNumber($order = Criteria::ASC) Order by the disc_number column
+ * @method CcFilesQuery orderByDbMood($order = Criteria::ASC) Order by the mood column
+ * @method CcFilesQuery orderByDbLabel($order = Criteria::ASC) Order by the label column
+ * @method CcFilesQuery orderByDbComposer($order = Criteria::ASC) Order by the composer column
+ * @method CcFilesQuery orderByDbEncoder($order = Criteria::ASC) Order by the encoder column
+ * @method CcFilesQuery orderByDbChecksum($order = Criteria::ASC) Order by the checksum column
+ * @method CcFilesQuery orderByDbLyrics($order = Criteria::ASC) Order by the lyrics column
+ * @method CcFilesQuery orderByDbOrchestra($order = Criteria::ASC) Order by the orchestra column
+ * @method CcFilesQuery orderByDbConductor($order = Criteria::ASC) Order by the conductor column
+ * @method CcFilesQuery orderByDbLyricist($order = Criteria::ASC) Order by the lyricist column
+ * @method CcFilesQuery orderByDbOriginalLyricist($order = Criteria::ASC) Order by the original_lyricist column
+ * @method CcFilesQuery orderByDbRadioStationName($order = Criteria::ASC) Order by the radio_station_name column
+ * @method CcFilesQuery orderByDbInfoUrl($order = Criteria::ASC) Order by the info_url column
+ * @method CcFilesQuery orderByDbArtistUrl($order = Criteria::ASC) Order by the artist_url column
+ * @method CcFilesQuery orderByDbAudioSourceUrl($order = Criteria::ASC) Order by the audio_source_url column
+ * @method CcFilesQuery orderByDbRadioStationUrl($order = Criteria::ASC) Order by the radio_station_url column
+ * @method CcFilesQuery orderByDbBuyThisUrl($order = Criteria::ASC) Order by the buy_this_url column
+ * @method CcFilesQuery orderByDbIsrcNumber($order = Criteria::ASC) Order by the isrc_number column
+ * @method CcFilesQuery orderByDbCatalogNumber($order = Criteria::ASC) Order by the catalog_number column
+ * @method CcFilesQuery orderByDbOriginalArtist($order = Criteria::ASC) Order by the original_artist column
+ * @method CcFilesQuery orderByDbCopyright($order = Criteria::ASC) Order by the copyright column
+ * @method CcFilesQuery orderByDbReportDatetime($order = Criteria::ASC) Order by the report_datetime column
+ * @method CcFilesQuery orderByDbReportLocation($order = Criteria::ASC) Order by the report_location column
+ * @method CcFilesQuery orderByDbReportOrganization($order = Criteria::ASC) Order by the report_organization column
+ * @method CcFilesQuery orderByDbSubject($order = Criteria::ASC) Order by the subject column
+ * @method CcFilesQuery orderByDbContributor($order = Criteria::ASC) Order by the contributor column
+ * @method CcFilesQuery orderByDbLanguage($order = Criteria::ASC) Order by the language column
+ * @method CcFilesQuery orderByDbFileExists($order = Criteria::ASC) Order by the file_exists column
+ * @method CcFilesQuery orderByDbSoundcloudId($order = Criteria::ASC) Order by the soundcloud_id column
+ * @method CcFilesQuery orderByDbSoundcloudErrorCode($order = Criteria::ASC) Order by the soundcloud_error_code column
+ * @method CcFilesQuery orderByDbSoundcloudErrorMsg($order = Criteria::ASC) Order by the soundcloud_error_msg column
+ * @method CcFilesQuery orderByDbSoundcloudLinkToFile($order = Criteria::ASC) Order by the soundcloud_link_to_file column
+ * @method CcFilesQuery orderByDbSoundCloundUploadTime($order = Criteria::ASC) Order by the soundcloud_upload_time column
+ * @method CcFilesQuery orderByDbReplayGain($order = Criteria::ASC) Order by the replay_gain column
+ * @method CcFilesQuery orderByDbOwnerId($order = Criteria::ASC) Order by the owner_id column
+ * @method CcFilesQuery orderByDbCuein($order = Criteria::ASC) Order by the cuein column
+ * @method CcFilesQuery orderByDbCueout($order = Criteria::ASC) Order by the cueout column
+ * @method CcFilesQuery orderByDbSilanCheck($order = Criteria::ASC) Order by the silan_check column
+ * @method CcFilesQuery orderByDbHidden($order = Criteria::ASC) Order by the hidden column
+ * @method CcFilesQuery orderByDbIsScheduled($order = Criteria::ASC) Order by the is_scheduled column
+ * @method CcFilesQuery orderByDbIsPlaylist($order = Criteria::ASC) Order by the is_playlist column
+ * @method CcFilesQuery orderByDbResourceId($order = Criteria::ASC) Order by the resource_id column
*
- * @method CcFilesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcFilesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcFilesQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcFilesQuery groupByDbId() Group by the id column
+ * @method CcFilesQuery groupByDbName() Group by the name column
+ * @method CcFilesQuery groupByDbMime() Group by the mime column
+ * @method CcFilesQuery groupByDbFtype() Group by the ftype column
+ * @method CcFilesQuery groupByDbDirectory() Group by the directory column
+ * @method CcFilesQuery groupByDbFilepath() Group by the filepath column
+ * @method CcFilesQuery groupByDbImportStatus() Group by the import_status column
+ * @method CcFilesQuery groupByDbCurrentlyaccessing() Group by the currentlyaccessing column
+ * @method CcFilesQuery groupByDbEditedby() Group by the editedby column
+ * @method CcFilesQuery groupByDbMtime() Group by the mtime column
+ * @method CcFilesQuery groupByDbUtime() Group by the utime column
+ * @method CcFilesQuery groupByDbLPtime() Group by the lptime column
+ * @method CcFilesQuery groupByDbMd5() Group by the md5 column
+ * @method CcFilesQuery groupByDbTrackTitle() Group by the track_title column
+ * @method CcFilesQuery groupByDbArtistName() Group by the artist_name column
+ * @method CcFilesQuery groupByDbBitRate() Group by the bit_rate column
+ * @method CcFilesQuery groupByDbSampleRate() Group by the sample_rate column
+ * @method CcFilesQuery groupByDbFormat() Group by the format column
+ * @method CcFilesQuery groupByDbLength() Group by the length column
+ * @method CcFilesQuery groupByDbAlbumTitle() Group by the album_title column
+ * @method CcFilesQuery groupByDbGenre() Group by the genre column
+ * @method CcFilesQuery groupByDbComments() Group by the comments column
+ * @method CcFilesQuery groupByDbYear() Group by the year column
+ * @method CcFilesQuery groupByDbTrackNumber() Group by the track_number column
+ * @method CcFilesQuery groupByDbChannels() Group by the channels column
+ * @method CcFilesQuery groupByDbUrl() Group by the url column
+ * @method CcFilesQuery groupByDbBpm() Group by the bpm column
+ * @method CcFilesQuery groupByDbRating() Group by the rating column
+ * @method CcFilesQuery groupByDbEncodedBy() Group by the encoded_by column
+ * @method CcFilesQuery groupByDbDiscNumber() Group by the disc_number column
+ * @method CcFilesQuery groupByDbMood() Group by the mood column
+ * @method CcFilesQuery groupByDbLabel() Group by the label column
+ * @method CcFilesQuery groupByDbComposer() Group by the composer column
+ * @method CcFilesQuery groupByDbEncoder() Group by the encoder column
+ * @method CcFilesQuery groupByDbChecksum() Group by the checksum column
+ * @method CcFilesQuery groupByDbLyrics() Group by the lyrics column
+ * @method CcFilesQuery groupByDbOrchestra() Group by the orchestra column
+ * @method CcFilesQuery groupByDbConductor() Group by the conductor column
+ * @method CcFilesQuery groupByDbLyricist() Group by the lyricist column
+ * @method CcFilesQuery groupByDbOriginalLyricist() Group by the original_lyricist column
+ * @method CcFilesQuery groupByDbRadioStationName() Group by the radio_station_name column
+ * @method CcFilesQuery groupByDbInfoUrl() Group by the info_url column
+ * @method CcFilesQuery groupByDbArtistUrl() Group by the artist_url column
+ * @method CcFilesQuery groupByDbAudioSourceUrl() Group by the audio_source_url column
+ * @method CcFilesQuery groupByDbRadioStationUrl() Group by the radio_station_url column
+ * @method CcFilesQuery groupByDbBuyThisUrl() Group by the buy_this_url column
+ * @method CcFilesQuery groupByDbIsrcNumber() Group by the isrc_number column
+ * @method CcFilesQuery groupByDbCatalogNumber() Group by the catalog_number column
+ * @method CcFilesQuery groupByDbOriginalArtist() Group by the original_artist column
+ * @method CcFilesQuery groupByDbCopyright() Group by the copyright column
+ * @method CcFilesQuery groupByDbReportDatetime() Group by the report_datetime column
+ * @method CcFilesQuery groupByDbReportLocation() Group by the report_location column
+ * @method CcFilesQuery groupByDbReportOrganization() Group by the report_organization column
+ * @method CcFilesQuery groupByDbSubject() Group by the subject column
+ * @method CcFilesQuery groupByDbContributor() Group by the contributor column
+ * @method CcFilesQuery groupByDbLanguage() Group by the language column
+ * @method CcFilesQuery groupByDbFileExists() Group by the file_exists column
+ * @method CcFilesQuery groupByDbSoundcloudId() Group by the soundcloud_id column
+ * @method CcFilesQuery groupByDbSoundcloudErrorCode() Group by the soundcloud_error_code column
+ * @method CcFilesQuery groupByDbSoundcloudErrorMsg() Group by the soundcloud_error_msg column
+ * @method CcFilesQuery groupByDbSoundcloudLinkToFile() Group by the soundcloud_link_to_file column
+ * @method CcFilesQuery groupByDbSoundCloundUploadTime() Group by the soundcloud_upload_time column
+ * @method CcFilesQuery groupByDbReplayGain() Group by the replay_gain column
+ * @method CcFilesQuery groupByDbOwnerId() Group by the owner_id column
+ * @method CcFilesQuery groupByDbCuein() Group by the cuein column
+ * @method CcFilesQuery groupByDbCueout() Group by the cueout column
+ * @method CcFilesQuery groupByDbSilanCheck() Group by the silan_check column
+ * @method CcFilesQuery groupByDbHidden() Group by the hidden column
+ * @method CcFilesQuery groupByDbIsScheduled() Group by the is_scheduled column
+ * @method CcFilesQuery groupByDbIsPlaylist() Group by the is_playlist column
+ * @method CcFilesQuery groupByDbResourceId() Group by the resource_id column
*
- * @method CcFilesQuery leftJoinFkOwner($relationAlias = '') Adds a LEFT JOIN clause to the query using the FkOwner relation
- * @method CcFilesQuery rightJoinFkOwner($relationAlias = '') Adds a RIGHT JOIN clause to the query using the FkOwner relation
- * @method CcFilesQuery innerJoinFkOwner($relationAlias = '') Adds a INNER JOIN clause to the query using the FkOwner relation
+ * @method CcFilesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcFilesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcFilesQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcFilesQuery leftJoinCcSubjsRelatedByDbEditedby($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation
- * @method CcFilesQuery rightJoinCcSubjsRelatedByDbEditedby($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation
- * @method CcFilesQuery innerJoinCcSubjsRelatedByDbEditedby($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation
+ * @method CcFilesQuery leftJoinFkOwner($relationAlias = null) Adds a LEFT JOIN clause to the query using the FkOwner relation
+ * @method CcFilesQuery rightJoinFkOwner($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FkOwner relation
+ * @method CcFilesQuery innerJoinFkOwner($relationAlias = null) Adds a INNER JOIN clause to the query using the FkOwner relation
*
- * @method CcFilesQuery leftJoinCcMusicDirs($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcMusicDirs relation
- * @method CcFilesQuery rightJoinCcMusicDirs($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcMusicDirs relation
- * @method CcFilesQuery innerJoinCcMusicDirs($relationAlias = '') Adds a INNER JOIN clause to the query using the CcMusicDirs relation
+ * @method CcFilesQuery leftJoinCcSubjsRelatedByDbEditedby($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation
+ * @method CcFilesQuery rightJoinCcSubjsRelatedByDbEditedby($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation
+ * @method CcFilesQuery innerJoinCcSubjsRelatedByDbEditedby($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjsRelatedByDbEditedby relation
*
- * @method CcFilesQuery leftJoinCcShowInstances($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowInstances relation
- * @method CcFilesQuery rightJoinCcShowInstances($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowInstances relation
- * @method CcFilesQuery innerJoinCcShowInstances($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowInstances relation
+ * @method CcFilesQuery leftJoinCcMusicDirs($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcMusicDirs relation
+ * @method CcFilesQuery rightJoinCcMusicDirs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcMusicDirs relation
+ * @method CcFilesQuery innerJoinCcMusicDirs($relationAlias = null) Adds a INNER JOIN clause to the query using the CcMusicDirs relation
*
- * @method CcFilesQuery leftJoinCcPlaylistcontents($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlaylistcontents relation
- * @method CcFilesQuery rightJoinCcPlaylistcontents($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlaylistcontents relation
- * @method CcFilesQuery innerJoinCcPlaylistcontents($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlaylistcontents relation
+ * @method CcFilesQuery leftJoinCcShowInstances($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcShowInstances relation
+ * @method CcFilesQuery rightJoinCcShowInstances($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcShowInstances relation
+ * @method CcFilesQuery innerJoinCcShowInstances($relationAlias = null) Adds a INNER JOIN clause to the query using the CcShowInstances relation
*
- * @method CcFilesQuery leftJoinCcBlockcontents($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcBlockcontents relation
- * @method CcFilesQuery rightJoinCcBlockcontents($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcBlockcontents relation
- * @method CcFilesQuery innerJoinCcBlockcontents($relationAlias = '') Adds a INNER JOIN clause to the query using the CcBlockcontents relation
+ * @method CcFilesQuery leftJoinCcPlaylistcontents($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPlaylistcontents relation
+ * @method CcFilesQuery rightJoinCcPlaylistcontents($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPlaylistcontents relation
+ * @method CcFilesQuery innerJoinCcPlaylistcontents($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPlaylistcontents relation
*
- * @method CcFilesQuery leftJoinCcSchedule($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSchedule relation
- * @method CcFilesQuery rightJoinCcSchedule($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSchedule relation
- * @method CcFilesQuery innerJoinCcSchedule($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSchedule relation
+ * @method CcFilesQuery leftJoinCcBlockcontents($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcBlockcontents relation
+ * @method CcFilesQuery rightJoinCcBlockcontents($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcBlockcontents relation
+ * @method CcFilesQuery innerJoinCcBlockcontents($relationAlias = null) Adds a INNER JOIN clause to the query using the CcBlockcontents relation
*
- * @method CcFilesQuery leftJoinCcPlayoutHistory($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistory relation
- * @method CcFilesQuery rightJoinCcPlayoutHistory($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistory relation
- * @method CcFilesQuery innerJoinCcPlayoutHistory($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistory relation
+ * @method CcFilesQuery leftJoinCcSchedule($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSchedule relation
+ * @method CcFilesQuery rightJoinCcSchedule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSchedule relation
+ * @method CcFilesQuery innerJoinCcSchedule($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSchedule relation
*
- * @method CcFiles findOne(PropelPDO $con = null) Return the first CcFiles matching the query
- * @method CcFiles findOneOrCreate(PropelPDO $con = null) Return the first CcFiles matching the query, or a new CcFiles object populated from the query conditions when no match is found
+ * @method CcFilesQuery leftJoinCcPlayoutHistory($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPlayoutHistory relation
+ * @method CcFilesQuery rightJoinCcPlayoutHistory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPlayoutHistory relation
+ * @method CcFilesQuery innerJoinCcPlayoutHistory($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPlayoutHistory relation
*
- * @method CcFiles findOneByDbId(int $id) Return the first CcFiles filtered by the id column
- * @method CcFiles findOneByDbName(string $name) Return the first CcFiles filtered by the name column
- * @method CcFiles findOneByDbMime(string $mime) Return the first CcFiles filtered by the mime column
- * @method CcFiles findOneByDbFtype(string $ftype) Return the first CcFiles filtered by the ftype column
- * @method CcFiles findOneByDbDirectory(int $directory) Return the first CcFiles filtered by the directory column
- * @method CcFiles findOneByDbFilepath(string $filepath) Return the first CcFiles filtered by the filepath column
- * @method CcFiles findOneByDbImportStatus(int $import_status) Return the first CcFiles filtered by the import_status column
- * @method CcFiles findOneByDbCurrentlyaccessing(int $currentlyaccessing) Return the first CcFiles filtered by the currentlyaccessing column
- * @method CcFiles findOneByDbEditedby(int $editedby) Return the first CcFiles filtered by the editedby column
- * @method CcFiles findOneByDbMtime(string $mtime) Return the first CcFiles filtered by the mtime column
- * @method CcFiles findOneByDbUtime(string $utime) Return the first CcFiles filtered by the utime column
- * @method CcFiles findOneByDbLPtime(string $lptime) Return the first CcFiles filtered by the lptime column
- * @method CcFiles findOneByDbMd5(string $md5) Return the first CcFiles filtered by the md5 column
- * @method CcFiles findOneByDbTrackTitle(string $track_title) Return the first CcFiles filtered by the track_title column
- * @method CcFiles findOneByDbArtistName(string $artist_name) Return the first CcFiles filtered by the artist_name column
- * @method CcFiles findOneByDbBitRate(int $bit_rate) Return the first CcFiles filtered by the bit_rate column
- * @method CcFiles findOneByDbSampleRate(int $sample_rate) Return the first CcFiles filtered by the sample_rate column
- * @method CcFiles findOneByDbFormat(string $format) Return the first CcFiles filtered by the format column
- * @method CcFiles findOneByDbLength(string $length) Return the first CcFiles filtered by the length column
- * @method CcFiles findOneByDbAlbumTitle(string $album_title) Return the first CcFiles filtered by the album_title column
- * @method CcFiles findOneByDbGenre(string $genre) Return the first CcFiles filtered by the genre column
- * @method CcFiles findOneByDbComments(string $comments) Return the first CcFiles filtered by the comments column
- * @method CcFiles findOneByDbYear(string $year) Return the first CcFiles filtered by the year column
- * @method CcFiles findOneByDbTrackNumber(int $track_number) Return the first CcFiles filtered by the track_number column
- * @method CcFiles findOneByDbChannels(int $channels) Return the first CcFiles filtered by the channels column
- * @method CcFiles findOneByDbUrl(string $url) Return the first CcFiles filtered by the url column
- * @method CcFiles findOneByDbBpm(int $bpm) Return the first CcFiles filtered by the bpm column
- * @method CcFiles findOneByDbRating(string $rating) Return the first CcFiles filtered by the rating column
- * @method CcFiles findOneByDbEncodedBy(string $encoded_by) Return the first CcFiles filtered by the encoded_by column
- * @method CcFiles findOneByDbDiscNumber(string $disc_number) Return the first CcFiles filtered by the disc_number column
- * @method CcFiles findOneByDbMood(string $mood) Return the first CcFiles filtered by the mood column
- * @method CcFiles findOneByDbLabel(string $label) Return the first CcFiles filtered by the label column
- * @method CcFiles findOneByDbComposer(string $composer) Return the first CcFiles filtered by the composer column
- * @method CcFiles findOneByDbEncoder(string $encoder) Return the first CcFiles filtered by the encoder column
- * @method CcFiles findOneByDbChecksum(string $checksum) Return the first CcFiles filtered by the checksum column
- * @method CcFiles findOneByDbLyrics(string $lyrics) Return the first CcFiles filtered by the lyrics column
- * @method CcFiles findOneByDbOrchestra(string $orchestra) Return the first CcFiles filtered by the orchestra column
- * @method CcFiles findOneByDbConductor(string $conductor) Return the first CcFiles filtered by the conductor column
- * @method CcFiles findOneByDbLyricist(string $lyricist) Return the first CcFiles filtered by the lyricist column
- * @method CcFiles findOneByDbOriginalLyricist(string $original_lyricist) Return the first CcFiles filtered by the original_lyricist column
- * @method CcFiles findOneByDbRadioStationName(string $radio_station_name) Return the first CcFiles filtered by the radio_station_name column
- * @method CcFiles findOneByDbInfoUrl(string $info_url) Return the first CcFiles filtered by the info_url column
- * @method CcFiles findOneByDbArtistUrl(string $artist_url) Return the first CcFiles filtered by the artist_url column
- * @method CcFiles findOneByDbAudioSourceUrl(string $audio_source_url) Return the first CcFiles filtered by the audio_source_url column
- * @method CcFiles findOneByDbRadioStationUrl(string $radio_station_url) Return the first CcFiles filtered by the radio_station_url column
- * @method CcFiles findOneByDbBuyThisUrl(string $buy_this_url) Return the first CcFiles filtered by the buy_this_url column
- * @method CcFiles findOneByDbIsrcNumber(string $isrc_number) Return the first CcFiles filtered by the isrc_number column
- * @method CcFiles findOneByDbCatalogNumber(string $catalog_number) Return the first CcFiles filtered by the catalog_number column
- * @method CcFiles findOneByDbOriginalArtist(string $original_artist) Return the first CcFiles filtered by the original_artist column
- * @method CcFiles findOneByDbCopyright(string $copyright) Return the first CcFiles filtered by the copyright column
- * @method CcFiles findOneByDbReportDatetime(string $report_datetime) Return the first CcFiles filtered by the report_datetime column
- * @method CcFiles findOneByDbReportLocation(string $report_location) Return the first CcFiles filtered by the report_location column
- * @method CcFiles findOneByDbReportOrganization(string $report_organization) Return the first CcFiles filtered by the report_organization column
- * @method CcFiles findOneByDbSubject(string $subject) Return the first CcFiles filtered by the subject column
- * @method CcFiles findOneByDbContributor(string $contributor) Return the first CcFiles filtered by the contributor column
- * @method CcFiles findOneByDbLanguage(string $language) Return the first CcFiles filtered by the language column
- * @method CcFiles findOneByDbFileExists(boolean $file_exists) Return the first CcFiles filtered by the file_exists column
- * @method CcFiles findOneByDbSoundcloudId(int $soundcloud_id) Return the first CcFiles filtered by the soundcloud_id column
- * @method CcFiles findOneByDbSoundcloudErrorCode(int $soundcloud_error_code) Return the first CcFiles filtered by the soundcloud_error_code column
- * @method CcFiles findOneByDbSoundcloudErrorMsg(string $soundcloud_error_msg) Return the first CcFiles filtered by the soundcloud_error_msg column
- * @method CcFiles findOneByDbSoundcloudLinkToFile(string $soundcloud_link_to_file) Return the first CcFiles filtered by the soundcloud_link_to_file column
- * @method CcFiles findOneByDbSoundCloundUploadTime(string $soundcloud_upload_time) Return the first CcFiles filtered by the soundcloud_upload_time column
- * @method CcFiles findOneByDbReplayGain(string $replay_gain) Return the first CcFiles filtered by the replay_gain column
- * @method CcFiles findOneByDbOwnerId(int $owner_id) Return the first CcFiles filtered by the owner_id column
- * @method CcFiles findOneByDbCuein(string $cuein) Return the first CcFiles filtered by the cuein column
- * @method CcFiles findOneByDbCueout(string $cueout) Return the first CcFiles filtered by the cueout column
- * @method CcFiles findOneByDbSilanCheck(boolean $silan_check) Return the first CcFiles filtered by the silan_check column
- * @method CcFiles findOneByDbHidden(boolean $hidden) Return the first CcFiles filtered by the hidden column
- * @method CcFiles findOneByDbIsScheduled(boolean $is_scheduled) Return the first CcFiles filtered by the is_scheduled column
- * @method CcFiles findOneByDbIsPlaylist(boolean $is_playlist) Return the first CcFiles filtered by the is_playlist column
- * @method CcFiles findOneByDbResourceId(string $resource_id) Return the first CcFiles filtered by the resource_id column
+ * @method CcFiles findOne(PropelPDO $con = null) Return the first CcFiles matching the query
+ * @method CcFiles findOneOrCreate(PropelPDO $con = null) Return the first CcFiles matching the query, or a new CcFiles object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcFiles objects filtered by the id column
- * @method array findByDbName(string $name) Return CcFiles objects filtered by the name column
- * @method array findByDbMime(string $mime) Return CcFiles objects filtered by the mime column
- * @method array findByDbFtype(string $ftype) Return CcFiles objects filtered by the ftype column
- * @method array findByDbDirectory(int $directory) Return CcFiles objects filtered by the directory column
- * @method array findByDbFilepath(string $filepath) Return CcFiles objects filtered by the filepath column
- * @method array findByDbImportStatus(int $import_status) Return CcFiles objects filtered by the import_status column
- * @method array findByDbCurrentlyaccessing(int $currentlyaccessing) Return CcFiles objects filtered by the currentlyaccessing column
- * @method array findByDbEditedby(int $editedby) Return CcFiles objects filtered by the editedby column
- * @method array findByDbMtime(string $mtime) Return CcFiles objects filtered by the mtime column
- * @method array findByDbUtime(string $utime) Return CcFiles objects filtered by the utime column
- * @method array findByDbLPtime(string $lptime) Return CcFiles objects filtered by the lptime column
- * @method array findByDbMd5(string $md5) Return CcFiles objects filtered by the md5 column
- * @method array findByDbTrackTitle(string $track_title) Return CcFiles objects filtered by the track_title column
- * @method array findByDbArtistName(string $artist_name) Return CcFiles objects filtered by the artist_name column
- * @method array findByDbBitRate(int $bit_rate) Return CcFiles objects filtered by the bit_rate column
- * @method array findByDbSampleRate(int $sample_rate) Return CcFiles objects filtered by the sample_rate column
- * @method array findByDbFormat(string $format) Return CcFiles objects filtered by the format column
- * @method array findByDbLength(string $length) Return CcFiles objects filtered by the length column
- * @method array findByDbAlbumTitle(string $album_title) Return CcFiles objects filtered by the album_title column
- * @method array findByDbGenre(string $genre) Return CcFiles objects filtered by the genre column
- * @method array findByDbComments(string $comments) Return CcFiles objects filtered by the comments column
- * @method array findByDbYear(string $year) Return CcFiles objects filtered by the year column
- * @method array findByDbTrackNumber(int $track_number) Return CcFiles objects filtered by the track_number column
- * @method array findByDbChannels(int $channels) Return CcFiles objects filtered by the channels column
- * @method array findByDbUrl(string $url) Return CcFiles objects filtered by the url column
- * @method array findByDbBpm(int $bpm) Return CcFiles objects filtered by the bpm column
- * @method array findByDbRating(string $rating) Return CcFiles objects filtered by the rating column
- * @method array findByDbEncodedBy(string $encoded_by) Return CcFiles objects filtered by the encoded_by column
- * @method array findByDbDiscNumber(string $disc_number) Return CcFiles objects filtered by the disc_number column
- * @method array findByDbMood(string $mood) Return CcFiles objects filtered by the mood column
- * @method array findByDbLabel(string $label) Return CcFiles objects filtered by the label column
- * @method array findByDbComposer(string $composer) Return CcFiles objects filtered by the composer column
- * @method array findByDbEncoder(string $encoder) Return CcFiles objects filtered by the encoder column
- * @method array findByDbChecksum(string $checksum) Return CcFiles objects filtered by the checksum column
- * @method array findByDbLyrics(string $lyrics) Return CcFiles objects filtered by the lyrics column
- * @method array findByDbOrchestra(string $orchestra) Return CcFiles objects filtered by the orchestra column
- * @method array findByDbConductor(string $conductor) Return CcFiles objects filtered by the conductor column
- * @method array findByDbLyricist(string $lyricist) Return CcFiles objects filtered by the lyricist column
- * @method array findByDbOriginalLyricist(string $original_lyricist) Return CcFiles objects filtered by the original_lyricist column
- * @method array findByDbRadioStationName(string $radio_station_name) Return CcFiles objects filtered by the radio_station_name column
- * @method array findByDbInfoUrl(string $info_url) Return CcFiles objects filtered by the info_url column
- * @method array findByDbArtistUrl(string $artist_url) Return CcFiles objects filtered by the artist_url column
- * @method array findByDbAudioSourceUrl(string $audio_source_url) Return CcFiles objects filtered by the audio_source_url column
- * @method array findByDbRadioStationUrl(string $radio_station_url) Return CcFiles objects filtered by the radio_station_url column
- * @method array findByDbBuyThisUrl(string $buy_this_url) Return CcFiles objects filtered by the buy_this_url column
- * @method array findByDbIsrcNumber(string $isrc_number) Return CcFiles objects filtered by the isrc_number column
- * @method array findByDbCatalogNumber(string $catalog_number) Return CcFiles objects filtered by the catalog_number column
- * @method array findByDbOriginalArtist(string $original_artist) Return CcFiles objects filtered by the original_artist column
- * @method array findByDbCopyright(string $copyright) Return CcFiles objects filtered by the copyright column
- * @method array findByDbReportDatetime(string $report_datetime) Return CcFiles objects filtered by the report_datetime column
- * @method array findByDbReportLocation(string $report_location) Return CcFiles objects filtered by the report_location column
- * @method array findByDbReportOrganization(string $report_organization) Return CcFiles objects filtered by the report_organization column
- * @method array findByDbSubject(string $subject) Return CcFiles objects filtered by the subject column
- * @method array findByDbContributor(string $contributor) Return CcFiles objects filtered by the contributor column
- * @method array findByDbLanguage(string $language) Return CcFiles objects filtered by the language column
- * @method array findByDbFileExists(boolean $file_exists) Return CcFiles objects filtered by the file_exists column
- * @method array findByDbSoundcloudId(int $soundcloud_id) Return CcFiles objects filtered by the soundcloud_id column
- * @method array findByDbSoundcloudErrorCode(int $soundcloud_error_code) Return CcFiles objects filtered by the soundcloud_error_code column
- * @method array findByDbSoundcloudErrorMsg(string $soundcloud_error_msg) Return CcFiles objects filtered by the soundcloud_error_msg column
- * @method array findByDbSoundcloudLinkToFile(string $soundcloud_link_to_file) Return CcFiles objects filtered by the soundcloud_link_to_file column
- * @method array findByDbSoundCloundUploadTime(string $soundcloud_upload_time) Return CcFiles objects filtered by the soundcloud_upload_time column
- * @method array findByDbReplayGain(string $replay_gain) Return CcFiles objects filtered by the replay_gain column
- * @method array findByDbOwnerId(int $owner_id) Return CcFiles objects filtered by the owner_id column
- * @method array findByDbCuein(string $cuein) Return CcFiles objects filtered by the cuein column
- * @method array findByDbCueout(string $cueout) Return CcFiles objects filtered by the cueout column
- * @method array findByDbSilanCheck(boolean $silan_check) Return CcFiles objects filtered by the silan_check column
- * @method array findByDbHidden(boolean $hidden) Return CcFiles objects filtered by the hidden column
- * @method array findByDbIsScheduled(boolean $is_scheduled) Return CcFiles objects filtered by the is_scheduled column
- * @method array findByDbIsPlaylist(boolean $is_playlist) Return CcFiles objects filtered by the is_playlist column
- * @method array findByDbResourceId(string $resource_id) Return CcFiles objects filtered by the resource_id column
+ * @method CcFiles findOneByDbName(string $name) Return the first CcFiles filtered by the name column
+ * @method CcFiles findOneByDbMime(string $mime) Return the first CcFiles filtered by the mime column
+ * @method CcFiles findOneByDbFtype(string $ftype) Return the first CcFiles filtered by the ftype column
+ * @method CcFiles findOneByDbDirectory(int $directory) Return the first CcFiles filtered by the directory column
+ * @method CcFiles findOneByDbFilepath(string $filepath) Return the first CcFiles filtered by the filepath column
+ * @method CcFiles findOneByDbImportStatus(int $import_status) Return the first CcFiles filtered by the import_status column
+ * @method CcFiles findOneByDbCurrentlyaccessing(int $currentlyaccessing) Return the first CcFiles filtered by the currentlyaccessing column
+ * @method CcFiles findOneByDbEditedby(int $editedby) Return the first CcFiles filtered by the editedby column
+ * @method CcFiles findOneByDbMtime(string $mtime) Return the first CcFiles filtered by the mtime column
+ * @method CcFiles findOneByDbUtime(string $utime) Return the first CcFiles filtered by the utime column
+ * @method CcFiles findOneByDbLPtime(string $lptime) Return the first CcFiles filtered by the lptime column
+ * @method CcFiles findOneByDbMd5(string $md5) Return the first CcFiles filtered by the md5 column
+ * @method CcFiles findOneByDbTrackTitle(string $track_title) Return the first CcFiles filtered by the track_title column
+ * @method CcFiles findOneByDbArtistName(string $artist_name) Return the first CcFiles filtered by the artist_name column
+ * @method CcFiles findOneByDbBitRate(int $bit_rate) Return the first CcFiles filtered by the bit_rate column
+ * @method CcFiles findOneByDbSampleRate(int $sample_rate) Return the first CcFiles filtered by the sample_rate column
+ * @method CcFiles findOneByDbFormat(string $format) Return the first CcFiles filtered by the format column
+ * @method CcFiles findOneByDbLength(string $length) Return the first CcFiles filtered by the length column
+ * @method CcFiles findOneByDbAlbumTitle(string $album_title) Return the first CcFiles filtered by the album_title column
+ * @method CcFiles findOneByDbGenre(string $genre) Return the first CcFiles filtered by the genre column
+ * @method CcFiles findOneByDbComments(string $comments) Return the first CcFiles filtered by the comments column
+ * @method CcFiles findOneByDbYear(string $year) Return the first CcFiles filtered by the year column
+ * @method CcFiles findOneByDbTrackNumber(int $track_number) Return the first CcFiles filtered by the track_number column
+ * @method CcFiles findOneByDbChannels(int $channels) Return the first CcFiles filtered by the channels column
+ * @method CcFiles findOneByDbUrl(string $url) Return the first CcFiles filtered by the url column
+ * @method CcFiles findOneByDbBpm(int $bpm) Return the first CcFiles filtered by the bpm column
+ * @method CcFiles findOneByDbRating(string $rating) Return the first CcFiles filtered by the rating column
+ * @method CcFiles findOneByDbEncodedBy(string $encoded_by) Return the first CcFiles filtered by the encoded_by column
+ * @method CcFiles findOneByDbDiscNumber(string $disc_number) Return the first CcFiles filtered by the disc_number column
+ * @method CcFiles findOneByDbMood(string $mood) Return the first CcFiles filtered by the mood column
+ * @method CcFiles findOneByDbLabel(string $label) Return the first CcFiles filtered by the label column
+ * @method CcFiles findOneByDbComposer(string $composer) Return the first CcFiles filtered by the composer column
+ * @method CcFiles findOneByDbEncoder(string $encoder) Return the first CcFiles filtered by the encoder column
+ * @method CcFiles findOneByDbChecksum(string $checksum) Return the first CcFiles filtered by the checksum column
+ * @method CcFiles findOneByDbLyrics(string $lyrics) Return the first CcFiles filtered by the lyrics column
+ * @method CcFiles findOneByDbOrchestra(string $orchestra) Return the first CcFiles filtered by the orchestra column
+ * @method CcFiles findOneByDbConductor(string $conductor) Return the first CcFiles filtered by the conductor column
+ * @method CcFiles findOneByDbLyricist(string $lyricist) Return the first CcFiles filtered by the lyricist column
+ * @method CcFiles findOneByDbOriginalLyricist(string $original_lyricist) Return the first CcFiles filtered by the original_lyricist column
+ * @method CcFiles findOneByDbRadioStationName(string $radio_station_name) Return the first CcFiles filtered by the radio_station_name column
+ * @method CcFiles findOneByDbInfoUrl(string $info_url) Return the first CcFiles filtered by the info_url column
+ * @method CcFiles findOneByDbArtistUrl(string $artist_url) Return the first CcFiles filtered by the artist_url column
+ * @method CcFiles findOneByDbAudioSourceUrl(string $audio_source_url) Return the first CcFiles filtered by the audio_source_url column
+ * @method CcFiles findOneByDbRadioStationUrl(string $radio_station_url) Return the first CcFiles filtered by the radio_station_url column
+ * @method CcFiles findOneByDbBuyThisUrl(string $buy_this_url) Return the first CcFiles filtered by the buy_this_url column
+ * @method CcFiles findOneByDbIsrcNumber(string $isrc_number) Return the first CcFiles filtered by the isrc_number column
+ * @method CcFiles findOneByDbCatalogNumber(string $catalog_number) Return the first CcFiles filtered by the catalog_number column
+ * @method CcFiles findOneByDbOriginalArtist(string $original_artist) Return the first CcFiles filtered by the original_artist column
+ * @method CcFiles findOneByDbCopyright(string $copyright) Return the first CcFiles filtered by the copyright column
+ * @method CcFiles findOneByDbReportDatetime(string $report_datetime) Return the first CcFiles filtered by the report_datetime column
+ * @method CcFiles findOneByDbReportLocation(string $report_location) Return the first CcFiles filtered by the report_location column
+ * @method CcFiles findOneByDbReportOrganization(string $report_organization) Return the first CcFiles filtered by the report_organization column
+ * @method CcFiles findOneByDbSubject(string $subject) Return the first CcFiles filtered by the subject column
+ * @method CcFiles findOneByDbContributor(string $contributor) Return the first CcFiles filtered by the contributor column
+ * @method CcFiles findOneByDbLanguage(string $language) Return the first CcFiles filtered by the language column
+ * @method CcFiles findOneByDbFileExists(boolean $file_exists) Return the first CcFiles filtered by the file_exists column
+ * @method CcFiles findOneByDbSoundcloudId(int $soundcloud_id) Return the first CcFiles filtered by the soundcloud_id column
+ * @method CcFiles findOneByDbSoundcloudErrorCode(int $soundcloud_error_code) Return the first CcFiles filtered by the soundcloud_error_code column
+ * @method CcFiles findOneByDbSoundcloudErrorMsg(string $soundcloud_error_msg) Return the first CcFiles filtered by the soundcloud_error_msg column
+ * @method CcFiles findOneByDbSoundcloudLinkToFile(string $soundcloud_link_to_file) Return the first CcFiles filtered by the soundcloud_link_to_file column
+ * @method CcFiles findOneByDbSoundCloundUploadTime(string $soundcloud_upload_time) Return the first CcFiles filtered by the soundcloud_upload_time column
+ * @method CcFiles findOneByDbReplayGain(string $replay_gain) Return the first CcFiles filtered by the replay_gain column
+ * @method CcFiles findOneByDbOwnerId(int $owner_id) Return the first CcFiles filtered by the owner_id column
+ * @method CcFiles findOneByDbCuein(string $cuein) Return the first CcFiles filtered by the cuein column
+ * @method CcFiles findOneByDbCueout(string $cueout) Return the first CcFiles filtered by the cueout column
+ * @method CcFiles findOneByDbSilanCheck(boolean $silan_check) Return the first CcFiles filtered by the silan_check column
+ * @method CcFiles findOneByDbHidden(boolean $hidden) Return the first CcFiles filtered by the hidden column
+ * @method CcFiles findOneByDbIsScheduled(boolean $is_scheduled) Return the first CcFiles filtered by the is_scheduled column
+ * @method CcFiles findOneByDbIsPlaylist(boolean $is_playlist) Return the first CcFiles filtered by the is_playlist column
+ * @method CcFiles findOneByDbResourceId(string $resource_id) Return the first CcFiles filtered by the resource_id column
+ *
+ * @method array findByDbId(int $id) Return CcFiles objects filtered by the id column
+ * @method array findByDbName(string $name) Return CcFiles objects filtered by the name column
+ * @method array findByDbMime(string $mime) Return CcFiles objects filtered by the mime column
+ * @method array findByDbFtype(string $ftype) Return CcFiles objects filtered by the ftype column
+ * @method array findByDbDirectory(int $directory) Return CcFiles objects filtered by the directory column
+ * @method array findByDbFilepath(string $filepath) Return CcFiles objects filtered by the filepath column
+ * @method array findByDbImportStatus(int $import_status) Return CcFiles objects filtered by the import_status column
+ * @method array findByDbCurrentlyaccessing(int $currentlyaccessing) Return CcFiles objects filtered by the currentlyaccessing column
+ * @method array findByDbEditedby(int $editedby) Return CcFiles objects filtered by the editedby column
+ * @method array findByDbMtime(string $mtime) Return CcFiles objects filtered by the mtime column
+ * @method array findByDbUtime(string $utime) Return CcFiles objects filtered by the utime column
+ * @method array findByDbLPtime(string $lptime) Return CcFiles objects filtered by the lptime column
+ * @method array findByDbMd5(string $md5) Return CcFiles objects filtered by the md5 column
+ * @method array findByDbTrackTitle(string $track_title) Return CcFiles objects filtered by the track_title column
+ * @method array findByDbArtistName(string $artist_name) Return CcFiles objects filtered by the artist_name column
+ * @method array findByDbBitRate(int $bit_rate) Return CcFiles objects filtered by the bit_rate column
+ * @method array findByDbSampleRate(int $sample_rate) Return CcFiles objects filtered by the sample_rate column
+ * @method array findByDbFormat(string $format) Return CcFiles objects filtered by the format column
+ * @method array findByDbLength(string $length) Return CcFiles objects filtered by the length column
+ * @method array findByDbAlbumTitle(string $album_title) Return CcFiles objects filtered by the album_title column
+ * @method array findByDbGenre(string $genre) Return CcFiles objects filtered by the genre column
+ * @method array findByDbComments(string $comments) Return CcFiles objects filtered by the comments column
+ * @method array findByDbYear(string $year) Return CcFiles objects filtered by the year column
+ * @method array findByDbTrackNumber(int $track_number) Return CcFiles objects filtered by the track_number column
+ * @method array findByDbChannels(int $channels) Return CcFiles objects filtered by the channels column
+ * @method array findByDbUrl(string $url) Return CcFiles objects filtered by the url column
+ * @method array findByDbBpm(int $bpm) Return CcFiles objects filtered by the bpm column
+ * @method array findByDbRating(string $rating) Return CcFiles objects filtered by the rating column
+ * @method array findByDbEncodedBy(string $encoded_by) Return CcFiles objects filtered by the encoded_by column
+ * @method array findByDbDiscNumber(string $disc_number) Return CcFiles objects filtered by the disc_number column
+ * @method array findByDbMood(string $mood) Return CcFiles objects filtered by the mood column
+ * @method array findByDbLabel(string $label) Return CcFiles objects filtered by the label column
+ * @method array findByDbComposer(string $composer) Return CcFiles objects filtered by the composer column
+ * @method array findByDbEncoder(string $encoder) Return CcFiles objects filtered by the encoder column
+ * @method array findByDbChecksum(string $checksum) Return CcFiles objects filtered by the checksum column
+ * @method array findByDbLyrics(string $lyrics) Return CcFiles objects filtered by the lyrics column
+ * @method array findByDbOrchestra(string $orchestra) Return CcFiles objects filtered by the orchestra column
+ * @method array findByDbConductor(string $conductor) Return CcFiles objects filtered by the conductor column
+ * @method array findByDbLyricist(string $lyricist) Return CcFiles objects filtered by the lyricist column
+ * @method array findByDbOriginalLyricist(string $original_lyricist) Return CcFiles objects filtered by the original_lyricist column
+ * @method array findByDbRadioStationName(string $radio_station_name) Return CcFiles objects filtered by the radio_station_name column
+ * @method array findByDbInfoUrl(string $info_url) Return CcFiles objects filtered by the info_url column
+ * @method array findByDbArtistUrl(string $artist_url) Return CcFiles objects filtered by the artist_url column
+ * @method array findByDbAudioSourceUrl(string $audio_source_url) Return CcFiles objects filtered by the audio_source_url column
+ * @method array findByDbRadioStationUrl(string $radio_station_url) Return CcFiles objects filtered by the radio_station_url column
+ * @method array findByDbBuyThisUrl(string $buy_this_url) Return CcFiles objects filtered by the buy_this_url column
+ * @method array findByDbIsrcNumber(string $isrc_number) Return CcFiles objects filtered by the isrc_number column
+ * @method array findByDbCatalogNumber(string $catalog_number) Return CcFiles objects filtered by the catalog_number column
+ * @method array findByDbOriginalArtist(string $original_artist) Return CcFiles objects filtered by the original_artist column
+ * @method array findByDbCopyright(string $copyright) Return CcFiles objects filtered by the copyright column
+ * @method array findByDbReportDatetime(string $report_datetime) Return CcFiles objects filtered by the report_datetime column
+ * @method array findByDbReportLocation(string $report_location) Return CcFiles objects filtered by the report_location column
+ * @method array findByDbReportOrganization(string $report_organization) Return CcFiles objects filtered by the report_organization column
+ * @method array findByDbSubject(string $subject) Return CcFiles objects filtered by the subject column
+ * @method array findByDbContributor(string $contributor) Return CcFiles objects filtered by the contributor column
+ * @method array findByDbLanguage(string $language) Return CcFiles objects filtered by the language column
+ * @method array findByDbFileExists(boolean $file_exists) Return CcFiles objects filtered by the file_exists column
+ * @method array findByDbSoundcloudId(int $soundcloud_id) Return CcFiles objects filtered by the soundcloud_id column
+ * @method array findByDbSoundcloudErrorCode(int $soundcloud_error_code) Return CcFiles objects filtered by the soundcloud_error_code column
+ * @method array findByDbSoundcloudErrorMsg(string $soundcloud_error_msg) Return CcFiles objects filtered by the soundcloud_error_msg column
+ * @method array findByDbSoundcloudLinkToFile(string $soundcloud_link_to_file) Return CcFiles objects filtered by the soundcloud_link_to_file column
+ * @method array findByDbSoundCloundUploadTime(string $soundcloud_upload_time) Return CcFiles objects filtered by the soundcloud_upload_time column
+ * @method array findByDbReplayGain(string $replay_gain) Return CcFiles objects filtered by the replay_gain column
+ * @method array findByDbOwnerId(int $owner_id) Return CcFiles objects filtered by the owner_id column
+ * @method array findByDbCuein(string $cuein) Return CcFiles objects filtered by the cuein column
+ * @method array findByDbCueout(string $cueout) Return CcFiles objects filtered by the cueout column
+ * @method array findByDbSilanCheck(boolean $silan_check) Return CcFiles objects filtered by the silan_check column
+ * @method array findByDbHidden(boolean $hidden) Return CcFiles objects filtered by the hidden column
+ * @method array findByDbIsScheduled(boolean $is_scheduled) Return CcFiles objects filtered by the is_scheduled column
+ * @method array findByDbIsPlaylist(boolean $is_playlist) Return CcFiles objects filtered by the is_playlist column
+ * @method array findByDbResourceId(string $resource_id) Return CcFiles objects filtered by the resource_id column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcFilesQuery extends ModelCriteria
{
-
- /**
- * Initializes internal state of BaseCcFilesQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcFiles', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
-
- /**
- * Returns a new CcFilesQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcFilesQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcFilesQuery) {
- return $criteria;
- }
- $query = new CcFilesQuery();
- if (null !== $modelAlias) {
- $query->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 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 import_status column
- *
- * @param int|array $dbImportStatus 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 filterByDbImportStatus($dbImportStatus = null, $comparison = null)
- {
- if (is_array($dbImportStatus)) {
- $useMinMax = false;
- if (isset($dbImportStatus['min'])) {
- $this->addUsingAlias(CcFilesPeer::IMPORT_STATUS, $dbImportStatus['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbImportStatus['max'])) {
- $this->addUsingAlias(CcFilesPeer::IMPORT_STATUS, $dbImportStatus['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcFilesPeer::IMPORT_STATUS, $dbImportStatus, $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 utime column
- *
- * @param string|array $dbUtime 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 filterByDbUtime($dbUtime = null, $comparison = null)
- {
- if (is_array($dbUtime)) {
- $useMinMax = false;
- if (isset($dbUtime['min'])) {
- $this->addUsingAlias(CcFilesPeer::UTIME, $dbUtime['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbUtime['max'])) {
- $this->addUsingAlias(CcFilesPeer::UTIME, $dbUtime['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcFilesPeer::UTIME, $dbUtime, $comparison);
- }
-
- /**
- * Filter the query on the lptime column
- *
- * @param string|array $dbLPtime 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 filterByDbLPtime($dbLPtime = null, $comparison = null)
- {
- if (is_array($dbLPtime)) {
- $useMinMax = false;
- if (isset($dbLPtime['min'])) {
- $this->addUsingAlias(CcFilesPeer::LPTIME, $dbLPtime['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbLPtime['max'])) {
- $this->addUsingAlias(CcFilesPeer::LPTIME, $dbLPtime['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcFilesPeer::LPTIME, $dbLPtime, $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 int|array $dbBitRate 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 filterByDbBitRate($dbBitRate = null, $comparison = null)
- {
- if (is_array($dbBitRate)) {
- $useMinMax = false;
- if (isset($dbBitRate['min'])) {
- $this->addUsingAlias(CcFilesPeer::BIT_RATE, $dbBitRate['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbBitRate['max'])) {
- $this->addUsingAlias(CcFilesPeer::BIT_RATE, $dbBitRate['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcFilesPeer::BIT_RATE, $dbBitRate, $comparison);
- }
-
- /**
- * Filter the query on the sample_rate column
- *
- * @param int|array $dbSampleRate 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 filterByDbSampleRate($dbSampleRate = null, $comparison = null)
- {
- if (is_array($dbSampleRate)) {
- $useMinMax = false;
- if (isset($dbSampleRate['min'])) {
- $this->addUsingAlias(CcFilesPeer::SAMPLE_RATE, $dbSampleRate['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbSampleRate['max'])) {
- $this->addUsingAlias(CcFilesPeer::SAMPLE_RATE, $dbSampleRate['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- 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 $dbLength 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 filterByDbLength($dbLength = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbLength)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbLength)) {
- $dbLength = str_replace('*', '%', $dbLength);
- $comparison = Criteria::LIKE;
- }
- }
- 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 int|array $dbBpm 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 filterByDbBpm($dbBpm = null, $comparison = null)
- {
- if (is_array($dbBpm)) {
- $useMinMax = false;
- if (isset($dbBpm['min'])) {
- $this->addUsingAlias(CcFilesPeer::BPM, $dbBpm['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbBpm['max'])) {
- $this->addUsingAlias(CcFilesPeer::BPM, $dbBpm['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- 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 file_exists column
- *
- * @param boolean|string $dbFileExists 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 CcFilesQuery The current query, for fluid interface
- */
- public function filterByDbFileExists($dbFileExists = null, $comparison = null)
- {
- if (is_string($dbFileExists)) {
- $file_exists = in_array(strtolower($dbFileExists), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
- }
- return $this->addUsingAlias(CcFilesPeer::FILE_EXISTS, $dbFileExists, $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 on the soundcloud_upload_time column
- *
- * @param string|array $dbSoundCloundUploadTime 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 filterByDbSoundCloundUploadTime($dbSoundCloundUploadTime = null, $comparison = null)
- {
- if (is_array($dbSoundCloundUploadTime)) {
- $useMinMax = false;
- if (isset($dbSoundCloundUploadTime['min'])) {
- $this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME, $dbSoundCloundUploadTime['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbSoundCloundUploadTime['max'])) {
- $this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME, $dbSoundCloundUploadTime['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME, $dbSoundCloundUploadTime, $comparison);
- }
-
- /**
- * Filter the query on the replay_gain column
- *
- * @param string|array $dbReplayGain 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 filterByDbReplayGain($dbReplayGain = null, $comparison = null)
- {
- if (is_array($dbReplayGain)) {
- $useMinMax = false;
- if (isset($dbReplayGain['min'])) {
- $this->addUsingAlias(CcFilesPeer::REPLAY_GAIN, $dbReplayGain['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbReplayGain['max'])) {
- $this->addUsingAlias(CcFilesPeer::REPLAY_GAIN, $dbReplayGain['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcFilesPeer::REPLAY_GAIN, $dbReplayGain, $comparison);
- }
-
- /**
- * Filter the query on the owner_id column
- *
- * @param int|array $dbOwnerId 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 filterByDbOwnerId($dbOwnerId = null, $comparison = null)
- {
- if (is_array($dbOwnerId)) {
- $useMinMax = false;
- if (isset($dbOwnerId['min'])) {
- $this->addUsingAlias(CcFilesPeer::OWNER_ID, $dbOwnerId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbOwnerId['max'])) {
- $this->addUsingAlias(CcFilesPeer::OWNER_ID, $dbOwnerId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcFilesPeer::OWNER_ID, $dbOwnerId, $comparison);
- }
-
- /**
- * Filter the query on the cuein column
- *
- * @param string $dbCuein 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 filterByDbCuein($dbCuein = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbCuein)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbCuein)) {
- $dbCuein = str_replace('*', '%', $dbCuein);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcFilesPeer::CUEIN, $dbCuein, $comparison);
- }
-
- /**
- * Filter the query on the cueout column
- *
- * @param string $dbCueout 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 filterByDbCueout($dbCueout = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbCueout)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbCueout)) {
- $dbCueout = str_replace('*', '%', $dbCueout);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcFilesPeer::CUEOUT, $dbCueout, $comparison);
- }
-
- /**
- * Filter the query on the silan_check column
- *
- * @param boolean|string $dbSilanCheck 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 CcFilesQuery The current query, for fluid interface
- */
- public function filterByDbSilanCheck($dbSilanCheck = null, $comparison = null)
- {
- if (is_string($dbSilanCheck)) {
- $silan_check = in_array(strtolower($dbSilanCheck), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
- }
- return $this->addUsingAlias(CcFilesPeer::SILAN_CHECK, $dbSilanCheck, $comparison);
- }
-
- /**
- * Filter the query on the hidden column
- *
- * @param boolean|string $dbHidden 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 CcFilesQuery The current query, for fluid interface
- */
- public function filterByDbHidden($dbHidden = null, $comparison = null)
- {
- if (is_string($dbHidden)) {
- $hidden = in_array(strtolower($dbHidden), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
- }
- return $this->addUsingAlias(CcFilesPeer::HIDDEN, $dbHidden, $comparison);
- }
-
- /**
- * Filter the query on the is_scheduled column
- *
- * @param boolean|string $dbIsScheduled 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 CcFilesQuery The current query, for fluid interface
- */
- public function filterByDbIsScheduled($dbIsScheduled = null, $comparison = null)
- {
- if (is_string($dbIsScheduled)) {
- $is_scheduled = in_array(strtolower($dbIsScheduled), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
- }
- return $this->addUsingAlias(CcFilesPeer::IS_SCHEDULED, $dbIsScheduled, $comparison);
- }
-
- /**
- * Filter the query on the is_playlist column
- *
- * @param boolean|string $dbIsPlaylist 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 CcFilesQuery The current query, for fluid interface
- */
- public function filterByDbIsPlaylist($dbIsPlaylist = null, $comparison = null)
- {
- if (is_string($dbIsPlaylist)) {
- $is_playlist = in_array(strtolower($dbIsPlaylist), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
- }
- return $this->addUsingAlias(CcFilesPeer::IS_PLAYLIST, $dbIsPlaylist, $comparison);
- }
-
- /**
- * Filter the query on the resource_id column
- *
- * @param string $dbResourceId 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 filterByDbResourceId($dbResourceId = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbResourceId)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbResourceId)) {
- $dbResourceId = str_replace('*', '%', $dbResourceId);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcFilesPeer::RESOURCE_ID, $dbResourceId, $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 filterByFkOwner($ccSubjs, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcFilesPeer::OWNER_ID, $ccSubjs->getDbId(), $comparison);
- }
-
- /**
- * Adds a JOIN clause to the query using the FkOwner 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 joinFkOwner($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('FkOwner');
-
- // 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, 'FkOwner');
- }
-
- return $this;
- }
-
- /**
- * Use the FkOwner 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 useFkOwnerQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- return $this
- ->joinFkOwner($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'FkOwner', 'CcSubjsQuery');
- }
-
- /**
- * 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 filterByCcSubjsRelatedByDbEditedby($ccSubjs, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcFilesPeer::EDITEDBY, $ccSubjs->getDbId(), $comparison);
- }
-
- /**
- * Adds a JOIN clause to the query using the CcSubjsRelatedByDbEditedby 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 joinCcSubjsRelatedByDbEditedby($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcSubjsRelatedByDbEditedby');
-
- // 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, 'CcSubjsRelatedByDbEditedby');
- }
-
- return $this;
- }
-
- /**
- * Use the CcSubjsRelatedByDbEditedby 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 useCcSubjsRelatedByDbEditedbyQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- return $this
- ->joinCcSubjsRelatedByDbEditedby($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcSubjsRelatedByDbEditedby', '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 CcBlockcontents object
- *
- * @param CcBlockcontents $ccBlockcontents 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 filterByCcBlockcontents($ccBlockcontents, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcFilesPeer::ID, $ccBlockcontents->getDbFileId(), $comparison);
- }
-
- /**
- * Adds a JOIN clause to the query using the CcBlockcontents 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 joinCcBlockcontents($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcBlockcontents');
-
- // 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, 'CcBlockcontents');
- }
-
- return $this;
- }
-
- /**
- * Use the CcBlockcontents relation CcBlockcontents 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 CcBlockcontentsQuery A secondary query class using the current class as primary query
- */
- public function useCcBlockcontentsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- return $this
- ->joinCcBlockcontents($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcBlockcontents', 'CcBlockcontentsQuery');
- }
-
- /**
- * 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');
- }
-
- /**
- * Filter the query by a related CcPlayoutHistory object
- *
- * @param CcPlayoutHistory $ccPlayoutHistory 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 filterByCcPlayoutHistory($ccPlayoutHistory, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcFilesPeer::ID, $ccPlayoutHistory->getDbFileId(), $comparison);
- }
-
- /**
- * Adds a JOIN clause to the query using the CcPlayoutHistory 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 joinCcPlayoutHistory($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcPlayoutHistory');
-
- // 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, 'CcPlayoutHistory');
- }
-
- return $this;
- }
-
- /**
- * Use the CcPlayoutHistory relation CcPlayoutHistory 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 CcPlayoutHistoryQuery A secondary query class using the current class as primary query
- */
- public function useCcPlayoutHistoryQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- return $this
- ->joinCcPlayoutHistory($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistory', 'CcPlayoutHistoryQuery');
- }
-
- /**
- * 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
+ /**
+ * Initializes internal state of BaseCcFilesQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcFiles';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
+
+ /**
+ * Returns a new CcFilesQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcFilesQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcFilesQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcFilesQuery) {
+ return $criteria;
+ }
+ $query = new CcFilesQuery(null, null, $modelAlias);
+
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcFiles|CcFiles[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcFilesPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcFiles A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcFiles A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "name", "mime", "ftype", "directory", "filepath", "import_status", "currentlyaccessing", "editedby", "mtime", "utime", "lptime", "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", "file_exists", "soundcloud_id", "soundcloud_error_code", "soundcloud_error_msg", "soundcloud_link_to_file", "soundcloud_upload_time", "replay_gain", "owner_id", "cuein", "cueout", "silan_check", "hidden", "is_scheduled", "is_playlist", "resource_id" FROM "cc_files" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcFiles();
+ $obj->hydrate($row);
+ CcFilesPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcFiles|CcFiles[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($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|CcFiles[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * 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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcFilesPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcFilesPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the name column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbName('fooValue'); // WHERE name = 'fooValue'
+ * $query->filterByDbName('%fooValue%'); // WHERE name LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbMime('fooValue'); // WHERE mime = 'fooValue'
+ * $query->filterByDbMime('%fooValue%'); // WHERE mime LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbFtype('fooValue'); // WHERE ftype = 'fooValue'
+ * $query->filterByDbFtype('%fooValue%'); // WHERE ftype LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbDirectory(1234); // WHERE directory = 1234
+ * $query->filterByDbDirectory(array(12, 34)); // WHERE directory IN (12, 34)
+ * $query->filterByDbDirectory(array('min' => 12)); // WHERE directory >= 12
+ * $query->filterByDbDirectory(array('max' => 12)); // WHERE directory <= 12
+ *
+ *
+ * @see filterByCcMusicDirs()
+ *
+ * @param mixed $dbDirectory The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbFilepath('fooValue'); // WHERE filepath = 'fooValue'
+ * $query->filterByDbFilepath('%fooValue%'); // WHERE filepath LIKE '%fooValue%'
+ *
+ *
+ * @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 import_status column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbImportStatus(1234); // WHERE import_status = 1234
+ * $query->filterByDbImportStatus(array(12, 34)); // WHERE import_status IN (12, 34)
+ * $query->filterByDbImportStatus(array('min' => 12)); // WHERE import_status >= 12
+ * $query->filterByDbImportStatus(array('max' => 12)); // WHERE import_status <= 12
+ *
+ *
+ * @param mixed $dbImportStatus The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcFilesQuery The current query, for fluid interface
+ */
+ public function filterByDbImportStatus($dbImportStatus = null, $comparison = null)
+ {
+ if (is_array($dbImportStatus)) {
+ $useMinMax = false;
+ if (isset($dbImportStatus['min'])) {
+ $this->addUsingAlias(CcFilesPeer::IMPORT_STATUS, $dbImportStatus['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbImportStatus['max'])) {
+ $this->addUsingAlias(CcFilesPeer::IMPORT_STATUS, $dbImportStatus['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::IMPORT_STATUS, $dbImportStatus, $comparison);
+ }
+
+ /**
+ * Filter the query on the currentlyaccessing column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCurrentlyaccessing(1234); // WHERE currentlyaccessing = 1234
+ * $query->filterByDbCurrentlyaccessing(array(12, 34)); // WHERE currentlyaccessing IN (12, 34)
+ * $query->filterByDbCurrentlyaccessing(array('min' => 12)); // WHERE currentlyaccessing >= 12
+ * $query->filterByDbCurrentlyaccessing(array('max' => 12)); // WHERE currentlyaccessing <= 12
+ *
+ *
+ * @param mixed $dbCurrentlyaccessing The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbEditedby(1234); // WHERE editedby = 1234
+ * $query->filterByDbEditedby(array(12, 34)); // WHERE editedby IN (12, 34)
+ * $query->filterByDbEditedby(array('min' => 12)); // WHERE editedby >= 12
+ * $query->filterByDbEditedby(array('max' => 12)); // WHERE editedby <= 12
+ *
+ *
+ * @see filterByCcSubjsRelatedByDbEditedby()
+ *
+ * @param mixed $dbEditedby The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbMtime('2011-03-14'); // WHERE mtime = '2011-03-14'
+ * $query->filterByDbMtime('now'); // WHERE mtime = '2011-03-14'
+ * $query->filterByDbMtime(array('max' => 'yesterday')); // WHERE mtime < '2011-03-13'
+ *
+ *
+ * @param mixed $dbMtime The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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 utime column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbUtime('2011-03-14'); // WHERE utime = '2011-03-14'
+ * $query->filterByDbUtime('now'); // WHERE utime = '2011-03-14'
+ * $query->filterByDbUtime(array('max' => 'yesterday')); // WHERE utime < '2011-03-13'
+ *
+ *
+ * @param mixed $dbUtime The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcFilesQuery The current query, for fluid interface
+ */
+ public function filterByDbUtime($dbUtime = null, $comparison = null)
+ {
+ if (is_array($dbUtime)) {
+ $useMinMax = false;
+ if (isset($dbUtime['min'])) {
+ $this->addUsingAlias(CcFilesPeer::UTIME, $dbUtime['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbUtime['max'])) {
+ $this->addUsingAlias(CcFilesPeer::UTIME, $dbUtime['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::UTIME, $dbUtime, $comparison);
+ }
+
+ /**
+ * Filter the query on the lptime column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLPtime('2011-03-14'); // WHERE lptime = '2011-03-14'
+ * $query->filterByDbLPtime('now'); // WHERE lptime = '2011-03-14'
+ * $query->filterByDbLPtime(array('max' => 'yesterday')); // WHERE lptime < '2011-03-13'
+ *
+ *
+ * @param mixed $dbLPtime The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcFilesQuery The current query, for fluid interface
+ */
+ public function filterByDbLPtime($dbLPtime = null, $comparison = null)
+ {
+ if (is_array($dbLPtime)) {
+ $useMinMax = false;
+ if (isset($dbLPtime['min'])) {
+ $this->addUsingAlias(CcFilesPeer::LPTIME, $dbLPtime['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbLPtime['max'])) {
+ $this->addUsingAlias(CcFilesPeer::LPTIME, $dbLPtime['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::LPTIME, $dbLPtime, $comparison);
+ }
+
+ /**
+ * Filter the query on the md5 column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbMd5('fooValue'); // WHERE md5 = 'fooValue'
+ * $query->filterByDbMd5('%fooValue%'); // WHERE md5 LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbTrackTitle('fooValue'); // WHERE track_title = 'fooValue'
+ * $query->filterByDbTrackTitle('%fooValue%'); // WHERE track_title LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbArtistName('fooValue'); // WHERE artist_name = 'fooValue'
+ * $query->filterByDbArtistName('%fooValue%'); // WHERE artist_name LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbBitRate(1234); // WHERE bit_rate = 1234
+ * $query->filterByDbBitRate(array(12, 34)); // WHERE bit_rate IN (12, 34)
+ * $query->filterByDbBitRate(array('min' => 12)); // WHERE bit_rate >= 12
+ * $query->filterByDbBitRate(array('max' => 12)); // WHERE bit_rate <= 12
+ *
+ *
+ * @param mixed $dbBitRate The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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 (is_array($dbBitRate)) {
+ $useMinMax = false;
+ if (isset($dbBitRate['min'])) {
+ $this->addUsingAlias(CcFilesPeer::BIT_RATE, $dbBitRate['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbBitRate['max'])) {
+ $this->addUsingAlias(CcFilesPeer::BIT_RATE, $dbBitRate['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::BIT_RATE, $dbBitRate, $comparison);
+ }
+
+ /**
+ * Filter the query on the sample_rate column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbSampleRate(1234); // WHERE sample_rate = 1234
+ * $query->filterByDbSampleRate(array(12, 34)); // WHERE sample_rate IN (12, 34)
+ * $query->filterByDbSampleRate(array('min' => 12)); // WHERE sample_rate >= 12
+ * $query->filterByDbSampleRate(array('max' => 12)); // WHERE sample_rate <= 12
+ *
+ *
+ * @param mixed $dbSampleRate The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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 (is_array($dbSampleRate)) {
+ $useMinMax = false;
+ if (isset($dbSampleRate['min'])) {
+ $this->addUsingAlias(CcFilesPeer::SAMPLE_RATE, $dbSampleRate['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbSampleRate['max'])) {
+ $this->addUsingAlias(CcFilesPeer::SAMPLE_RATE, $dbSampleRate['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::SAMPLE_RATE, $dbSampleRate, $comparison);
+ }
+
+ /**
+ * Filter the query on the format column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbFormat('fooValue'); // WHERE format = 'fooValue'
+ * $query->filterByDbFormat('%fooValue%'); // WHERE format LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLength('fooValue'); // WHERE length = 'fooValue'
+ * $query->filterByDbLength('%fooValue%'); // WHERE length LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbLength 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 filterByDbLength($dbLength = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbLength)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbLength)) {
+ $dbLength = str_replace('*', '%', $dbLength);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength, $comparison);
+ }
+
+ /**
+ * Filter the query on the album_title column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbAlbumTitle('fooValue'); // WHERE album_title = 'fooValue'
+ * $query->filterByDbAlbumTitle('%fooValue%'); // WHERE album_title LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbGenre('fooValue'); // WHERE genre = 'fooValue'
+ * $query->filterByDbGenre('%fooValue%'); // WHERE genre LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbComments('fooValue'); // WHERE comments = 'fooValue'
+ * $query->filterByDbComments('%fooValue%'); // WHERE comments LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbYear('fooValue'); // WHERE year = 'fooValue'
+ * $query->filterByDbYear('%fooValue%'); // WHERE year LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbTrackNumber(1234); // WHERE track_number = 1234
+ * $query->filterByDbTrackNumber(array(12, 34)); // WHERE track_number IN (12, 34)
+ * $query->filterByDbTrackNumber(array('min' => 12)); // WHERE track_number >= 12
+ * $query->filterByDbTrackNumber(array('max' => 12)); // WHERE track_number <= 12
+ *
+ *
+ * @param mixed $dbTrackNumber The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbChannels(1234); // WHERE channels = 1234
+ * $query->filterByDbChannels(array(12, 34)); // WHERE channels IN (12, 34)
+ * $query->filterByDbChannels(array('min' => 12)); // WHERE channels >= 12
+ * $query->filterByDbChannels(array('max' => 12)); // WHERE channels <= 12
+ *
+ *
+ * @param mixed $dbChannels The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbUrl('fooValue'); // WHERE url = 'fooValue'
+ * $query->filterByDbUrl('%fooValue%'); // WHERE url LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbBpm(1234); // WHERE bpm = 1234
+ * $query->filterByDbBpm(array(12, 34)); // WHERE bpm IN (12, 34)
+ * $query->filterByDbBpm(array('min' => 12)); // WHERE bpm >= 12
+ * $query->filterByDbBpm(array('max' => 12)); // WHERE bpm <= 12
+ *
+ *
+ * @param mixed $dbBpm The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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 (is_array($dbBpm)) {
+ $useMinMax = false;
+ if (isset($dbBpm['min'])) {
+ $this->addUsingAlias(CcFilesPeer::BPM, $dbBpm['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbBpm['max'])) {
+ $this->addUsingAlias(CcFilesPeer::BPM, $dbBpm['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::BPM, $dbBpm, $comparison);
+ }
+
+ /**
+ * Filter the query on the rating column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbRating('fooValue'); // WHERE rating = 'fooValue'
+ * $query->filterByDbRating('%fooValue%'); // WHERE rating LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbEncodedBy('fooValue'); // WHERE encoded_by = 'fooValue'
+ * $query->filterByDbEncodedBy('%fooValue%'); // WHERE encoded_by LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbDiscNumber('fooValue'); // WHERE disc_number = 'fooValue'
+ * $query->filterByDbDiscNumber('%fooValue%'); // WHERE disc_number LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbMood('fooValue'); // WHERE mood = 'fooValue'
+ * $query->filterByDbMood('%fooValue%'); // WHERE mood LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLabel('fooValue'); // WHERE label = 'fooValue'
+ * $query->filterByDbLabel('%fooValue%'); // WHERE label LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbComposer('fooValue'); // WHERE composer = 'fooValue'
+ * $query->filterByDbComposer('%fooValue%'); // WHERE composer LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbEncoder('fooValue'); // WHERE encoder = 'fooValue'
+ * $query->filterByDbEncoder('%fooValue%'); // WHERE encoder LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbChecksum('fooValue'); // WHERE checksum = 'fooValue'
+ * $query->filterByDbChecksum('%fooValue%'); // WHERE checksum LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLyrics('fooValue'); // WHERE lyrics = 'fooValue'
+ * $query->filterByDbLyrics('%fooValue%'); // WHERE lyrics LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbOrchestra('fooValue'); // WHERE orchestra = 'fooValue'
+ * $query->filterByDbOrchestra('%fooValue%'); // WHERE orchestra LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbConductor('fooValue'); // WHERE conductor = 'fooValue'
+ * $query->filterByDbConductor('%fooValue%'); // WHERE conductor LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLyricist('fooValue'); // WHERE lyricist = 'fooValue'
+ * $query->filterByDbLyricist('%fooValue%'); // WHERE lyricist LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbOriginalLyricist('fooValue'); // WHERE original_lyricist = 'fooValue'
+ * $query->filterByDbOriginalLyricist('%fooValue%'); // WHERE original_lyricist LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbRadioStationName('fooValue'); // WHERE radio_station_name = 'fooValue'
+ * $query->filterByDbRadioStationName('%fooValue%'); // WHERE radio_station_name LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbInfoUrl('fooValue'); // WHERE info_url = 'fooValue'
+ * $query->filterByDbInfoUrl('%fooValue%'); // WHERE info_url LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbArtistUrl('fooValue'); // WHERE artist_url = 'fooValue'
+ * $query->filterByDbArtistUrl('%fooValue%'); // WHERE artist_url LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbAudioSourceUrl('fooValue'); // WHERE audio_source_url = 'fooValue'
+ * $query->filterByDbAudioSourceUrl('%fooValue%'); // WHERE audio_source_url LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbRadioStationUrl('fooValue'); // WHERE radio_station_url = 'fooValue'
+ * $query->filterByDbRadioStationUrl('%fooValue%'); // WHERE radio_station_url LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbBuyThisUrl('fooValue'); // WHERE buy_this_url = 'fooValue'
+ * $query->filterByDbBuyThisUrl('%fooValue%'); // WHERE buy_this_url LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbIsrcNumber('fooValue'); // WHERE isrc_number = 'fooValue'
+ * $query->filterByDbIsrcNumber('%fooValue%'); // WHERE isrc_number LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCatalogNumber('fooValue'); // WHERE catalog_number = 'fooValue'
+ * $query->filterByDbCatalogNumber('%fooValue%'); // WHERE catalog_number LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbOriginalArtist('fooValue'); // WHERE original_artist = 'fooValue'
+ * $query->filterByDbOriginalArtist('%fooValue%'); // WHERE original_artist LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCopyright('fooValue'); // WHERE copyright = 'fooValue'
+ * $query->filterByDbCopyright('%fooValue%'); // WHERE copyright LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbReportDatetime('fooValue'); // WHERE report_datetime = 'fooValue'
+ * $query->filterByDbReportDatetime('%fooValue%'); // WHERE report_datetime LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbReportLocation('fooValue'); // WHERE report_location = 'fooValue'
+ * $query->filterByDbReportLocation('%fooValue%'); // WHERE report_location LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbReportOrganization('fooValue'); // WHERE report_organization = 'fooValue'
+ * $query->filterByDbReportOrganization('%fooValue%'); // WHERE report_organization LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbSubject('fooValue'); // WHERE subject = 'fooValue'
+ * $query->filterByDbSubject('%fooValue%'); // WHERE subject LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbContributor('fooValue'); // WHERE contributor = 'fooValue'
+ * $query->filterByDbContributor('%fooValue%'); // WHERE contributor LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLanguage('fooValue'); // WHERE language = 'fooValue'
+ * $query->filterByDbLanguage('%fooValue%'); // WHERE language LIKE '%fooValue%'
+ *
+ *
+ * @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 file_exists column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbFileExists(true); // WHERE file_exists = true
+ * $query->filterByDbFileExists('yes'); // WHERE file_exists = true
+ *
+ *
+ * @param boolean|string $dbFileExists The value to use as filter.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcFilesQuery The current query, for fluid interface
+ */
+ public function filterByDbFileExists($dbFileExists = null, $comparison = null)
+ {
+ if (is_string($dbFileExists)) {
+ $dbFileExists = in_array(strtolower($dbFileExists), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::FILE_EXISTS, $dbFileExists, $comparison);
+ }
+
+ /**
+ * Filter the query on the soundcloud_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbSoundcloudId(1234); // WHERE soundcloud_id = 1234
+ * $query->filterByDbSoundcloudId(array(12, 34)); // WHERE soundcloud_id IN (12, 34)
+ * $query->filterByDbSoundcloudId(array('min' => 12)); // WHERE soundcloud_id >= 12
+ * $query->filterByDbSoundcloudId(array('max' => 12)); // WHERE soundcloud_id <= 12
+ *
+ *
+ * @param mixed $dbSoundcloudId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbSoundcloudErrorCode(1234); // WHERE soundcloud_error_code = 1234
+ * $query->filterByDbSoundcloudErrorCode(array(12, 34)); // WHERE soundcloud_error_code IN (12, 34)
+ * $query->filterByDbSoundcloudErrorCode(array('min' => 12)); // WHERE soundcloud_error_code >= 12
+ * $query->filterByDbSoundcloudErrorCode(array('max' => 12)); // WHERE soundcloud_error_code <= 12
+ *
+ *
+ * @param mixed $dbSoundcloudErrorCode The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbSoundcloudErrorMsg('fooValue'); // WHERE soundcloud_error_msg = 'fooValue'
+ * $query->filterByDbSoundcloudErrorMsg('%fooValue%'); // WHERE soundcloud_error_msg LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbSoundcloudLinkToFile('fooValue'); // WHERE soundcloud_link_to_file = 'fooValue'
+ * $query->filterByDbSoundcloudLinkToFile('%fooValue%'); // WHERE soundcloud_link_to_file LIKE '%fooValue%'
+ *
+ *
+ * @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 on the soundcloud_upload_time column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbSoundCloundUploadTime('2011-03-14'); // WHERE soundcloud_upload_time = '2011-03-14'
+ * $query->filterByDbSoundCloundUploadTime('now'); // WHERE soundcloud_upload_time = '2011-03-14'
+ * $query->filterByDbSoundCloundUploadTime(array('max' => 'yesterday')); // WHERE soundcloud_upload_time < '2011-03-13'
+ *
+ *
+ * @param mixed $dbSoundCloundUploadTime The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcFilesQuery The current query, for fluid interface
+ */
+ public function filterByDbSoundCloundUploadTime($dbSoundCloundUploadTime = null, $comparison = null)
+ {
+ if (is_array($dbSoundCloundUploadTime)) {
+ $useMinMax = false;
+ if (isset($dbSoundCloundUploadTime['min'])) {
+ $this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME, $dbSoundCloundUploadTime['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbSoundCloundUploadTime['max'])) {
+ $this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME, $dbSoundCloundUploadTime['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME, $dbSoundCloundUploadTime, $comparison);
+ }
+
+ /**
+ * Filter the query on the replay_gain column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbReplayGain(1234); // WHERE replay_gain = 1234
+ * $query->filterByDbReplayGain(array(12, 34)); // WHERE replay_gain IN (12, 34)
+ * $query->filterByDbReplayGain(array('min' => 12)); // WHERE replay_gain >= 12
+ * $query->filterByDbReplayGain(array('max' => 12)); // WHERE replay_gain <= 12
+ *
+ *
+ * @param mixed $dbReplayGain The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcFilesQuery The current query, for fluid interface
+ */
+ public function filterByDbReplayGain($dbReplayGain = null, $comparison = null)
+ {
+ if (is_array($dbReplayGain)) {
+ $useMinMax = false;
+ if (isset($dbReplayGain['min'])) {
+ $this->addUsingAlias(CcFilesPeer::REPLAY_GAIN, $dbReplayGain['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbReplayGain['max'])) {
+ $this->addUsingAlias(CcFilesPeer::REPLAY_GAIN, $dbReplayGain['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::REPLAY_GAIN, $dbReplayGain, $comparison);
+ }
+
+ /**
+ * Filter the query on the owner_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbOwnerId(1234); // WHERE owner_id = 1234
+ * $query->filterByDbOwnerId(array(12, 34)); // WHERE owner_id IN (12, 34)
+ * $query->filterByDbOwnerId(array('min' => 12)); // WHERE owner_id >= 12
+ * $query->filterByDbOwnerId(array('max' => 12)); // WHERE owner_id <= 12
+ *
+ *
+ * @see filterByFkOwner()
+ *
+ * @param mixed $dbOwnerId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcFilesQuery The current query, for fluid interface
+ */
+ public function filterByDbOwnerId($dbOwnerId = null, $comparison = null)
+ {
+ if (is_array($dbOwnerId)) {
+ $useMinMax = false;
+ if (isset($dbOwnerId['min'])) {
+ $this->addUsingAlias(CcFilesPeer::OWNER_ID, $dbOwnerId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbOwnerId['max'])) {
+ $this->addUsingAlias(CcFilesPeer::OWNER_ID, $dbOwnerId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::OWNER_ID, $dbOwnerId, $comparison);
+ }
+
+ /**
+ * Filter the query on the cuein column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCuein('fooValue'); // WHERE cuein = 'fooValue'
+ * $query->filterByDbCuein('%fooValue%'); // WHERE cuein LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbCuein 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 filterByDbCuein($dbCuein = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbCuein)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCuein)) {
+ $dbCuein = str_replace('*', '%', $dbCuein);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::CUEIN, $dbCuein, $comparison);
+ }
+
+ /**
+ * Filter the query on the cueout column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCueout('fooValue'); // WHERE cueout = 'fooValue'
+ * $query->filterByDbCueout('%fooValue%'); // WHERE cueout LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbCueout 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 filterByDbCueout($dbCueout = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbCueout)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCueout)) {
+ $dbCueout = str_replace('*', '%', $dbCueout);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::CUEOUT, $dbCueout, $comparison);
+ }
+
+ /**
+ * Filter the query on the silan_check column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbSilanCheck(true); // WHERE silan_check = true
+ * $query->filterByDbSilanCheck('yes'); // WHERE silan_check = true
+ *
+ *
+ * @param boolean|string $dbSilanCheck The value to use as filter.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcFilesQuery The current query, for fluid interface
+ */
+ public function filterByDbSilanCheck($dbSilanCheck = null, $comparison = null)
+ {
+ if (is_string($dbSilanCheck)) {
+ $dbSilanCheck = in_array(strtolower($dbSilanCheck), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::SILAN_CHECK, $dbSilanCheck, $comparison);
+ }
+
+ /**
+ * Filter the query on the hidden column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbHidden(true); // WHERE hidden = true
+ * $query->filterByDbHidden('yes'); // WHERE hidden = true
+ *
+ *
+ * @param boolean|string $dbHidden The value to use as filter.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcFilesQuery The current query, for fluid interface
+ */
+ public function filterByDbHidden($dbHidden = null, $comparison = null)
+ {
+ if (is_string($dbHidden)) {
+ $dbHidden = in_array(strtolower($dbHidden), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::HIDDEN, $dbHidden, $comparison);
+ }
+
+ /**
+ * Filter the query on the is_scheduled column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbIsScheduled(true); // WHERE is_scheduled = true
+ * $query->filterByDbIsScheduled('yes'); // WHERE is_scheduled = true
+ *
+ *
+ * @param boolean|string $dbIsScheduled The value to use as filter.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcFilesQuery The current query, for fluid interface
+ */
+ public function filterByDbIsScheduled($dbIsScheduled = null, $comparison = null)
+ {
+ if (is_string($dbIsScheduled)) {
+ $dbIsScheduled = in_array(strtolower($dbIsScheduled), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::IS_SCHEDULED, $dbIsScheduled, $comparison);
+ }
+
+ /**
+ * Filter the query on the is_playlist column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbIsPlaylist(true); // WHERE is_playlist = true
+ * $query->filterByDbIsPlaylist('yes'); // WHERE is_playlist = true
+ *
+ *
+ * @param boolean|string $dbIsPlaylist The value to use as filter.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcFilesQuery The current query, for fluid interface
+ */
+ public function filterByDbIsPlaylist($dbIsPlaylist = null, $comparison = null)
+ {
+ if (is_string($dbIsPlaylist)) {
+ $dbIsPlaylist = in_array(strtolower($dbIsPlaylist), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::IS_PLAYLIST, $dbIsPlaylist, $comparison);
+ }
+
+ /**
+ * Filter the query on the resource_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbResourceId('fooValue'); // WHERE resource_id = 'fooValue'
+ * $query->filterByDbResourceId('%fooValue%'); // WHERE resource_id LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbResourceId 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 filterByDbResourceId($dbResourceId = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbResourceId)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbResourceId)) {
+ $dbResourceId = str_replace('*', '%', $dbResourceId);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcFilesPeer::RESOURCE_ID, $dbResourceId, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcSubjs object
+ *
+ * @param CcSubjs|PropelObjectCollection $ccSubjs The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByFkOwner($ccSubjs, $comparison = null)
+ {
+ if ($ccSubjs instanceof CcSubjs) {
+ return $this
+ ->addUsingAlias(CcFilesPeer::OWNER_ID, $ccSubjs->getDbId(), $comparison);
+ } elseif ($ccSubjs instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcFilesPeer::OWNER_ID, $ccSubjs->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByFkOwner() only accepts arguments of type CcSubjs or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the FkOwner 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 joinFkOwner($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('FkOwner');
+
+ // 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, 'FkOwner');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the FkOwner 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 useFkOwnerQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinFkOwner($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'FkOwner', 'CcSubjsQuery');
+ }
+
+ /**
+ * Filter the query by a related CcSubjs object
+ *
+ * @param CcSubjs|PropelObjectCollection $ccSubjs The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcSubjsRelatedByDbEditedby($ccSubjs, $comparison = null)
+ {
+ if ($ccSubjs instanceof CcSubjs) {
+ return $this
+ ->addUsingAlias(CcFilesPeer::EDITEDBY, $ccSubjs->getDbId(), $comparison);
+ } elseif ($ccSubjs instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcFilesPeer::EDITEDBY, $ccSubjs->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcSubjsRelatedByDbEditedby() only accepts arguments of type CcSubjs or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcSubjsRelatedByDbEditedby 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 joinCcSubjsRelatedByDbEditedby($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcSubjsRelatedByDbEditedby');
+
+ // 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, 'CcSubjsRelatedByDbEditedby');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcSubjsRelatedByDbEditedby 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 useCcSubjsRelatedByDbEditedbyQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcSubjsRelatedByDbEditedby($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcSubjsRelatedByDbEditedby', 'CcSubjsQuery');
+ }
+
+ /**
+ * Filter the query by a related CcMusicDirs object
+ *
+ * @param CcMusicDirs|PropelObjectCollection $ccMusicDirs The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcMusicDirs($ccMusicDirs, $comparison = null)
+ {
+ if ($ccMusicDirs instanceof CcMusicDirs) {
+ return $this
+ ->addUsingAlias(CcFilesPeer::DIRECTORY, $ccMusicDirs->getId(), $comparison);
+ } elseif ($ccMusicDirs instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcFilesPeer::DIRECTORY, $ccMusicDirs->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByCcMusicDirs() only accepts arguments of type CcMusicDirs or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcMusicDirs($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcMusicDirs', 'CcMusicDirsQuery');
+ }
+
+ /**
+ * Filter the query by a related CcShowInstances object
+ *
+ * @param CcShowInstances|PropelObjectCollection $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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcShowInstances($ccShowInstances, $comparison = null)
+ {
+ if ($ccShowInstances instanceof CcShowInstances) {
+ return $this
+ ->addUsingAlias(CcFilesPeer::ID, $ccShowInstances->getDbRecordedFile(), $comparison);
+ } elseif ($ccShowInstances instanceof PropelObjectCollection) {
+ return $this
+ ->useCcShowInstancesQuery()
+ ->filterByPrimaryKeys($ccShowInstances->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcShowInstances() only accepts arguments of type CcShowInstances or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcShowInstances($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcShowInstances', 'CcShowInstancesQuery');
+ }
+
+ /**
+ * Filter the query by a related CcPlaylistcontents object
+ *
+ * @param CcPlaylistcontents|PropelObjectCollection $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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcPlaylistcontents($ccPlaylistcontents, $comparison = null)
+ {
+ if ($ccPlaylistcontents instanceof CcPlaylistcontents) {
+ return $this
+ ->addUsingAlias(CcFilesPeer::ID, $ccPlaylistcontents->getDbFileId(), $comparison);
+ } elseif ($ccPlaylistcontents instanceof PropelObjectCollection) {
+ return $this
+ ->useCcPlaylistcontentsQuery()
+ ->filterByPrimaryKeys($ccPlaylistcontents->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcPlaylistcontents() only accepts arguments of type CcPlaylistcontents or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcPlaylistcontents($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlaylistcontents', 'CcPlaylistcontentsQuery');
+ }
+
+ /**
+ * Filter the query by a related CcBlockcontents object
+ *
+ * @param CcBlockcontents|PropelObjectCollection $ccBlockcontents 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcBlockcontents($ccBlockcontents, $comparison = null)
+ {
+ if ($ccBlockcontents instanceof CcBlockcontents) {
+ return $this
+ ->addUsingAlias(CcFilesPeer::ID, $ccBlockcontents->getDbFileId(), $comparison);
+ } elseif ($ccBlockcontents instanceof PropelObjectCollection) {
+ return $this
+ ->useCcBlockcontentsQuery()
+ ->filterByPrimaryKeys($ccBlockcontents->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcBlockcontents() only accepts arguments of type CcBlockcontents or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcBlockcontents 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 joinCcBlockcontents($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcBlockcontents');
+
+ // 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, 'CcBlockcontents');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcBlockcontents relation CcBlockcontents 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 CcBlockcontentsQuery A secondary query class using the current class as primary query
+ */
+ public function useCcBlockcontentsQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcBlockcontents($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcBlockcontents', 'CcBlockcontentsQuery');
+ }
+
+ /**
+ * Filter the query by a related CcSchedule object
+ *
+ * @param CcSchedule|PropelObjectCollection $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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcSchedule($ccSchedule, $comparison = null)
+ {
+ if ($ccSchedule instanceof CcSchedule) {
+ return $this
+ ->addUsingAlias(CcFilesPeer::ID, $ccSchedule->getDbFileId(), $comparison);
+ } elseif ($ccSchedule instanceof PropelObjectCollection) {
+ return $this
+ ->useCcScheduleQuery()
+ ->filterByPrimaryKeys($ccSchedule->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcSchedule() only accepts arguments of type CcSchedule or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcSchedule($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery');
+ }
+
+ /**
+ * Filter the query by a related CcPlayoutHistory object
+ *
+ * @param CcPlayoutHistory|PropelObjectCollection $ccPlayoutHistory 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcPlayoutHistory($ccPlayoutHistory, $comparison = null)
+ {
+ if ($ccPlayoutHistory instanceof CcPlayoutHistory) {
+ return $this
+ ->addUsingAlias(CcFilesPeer::ID, $ccPlayoutHistory->getDbFileId(), $comparison);
+ } elseif ($ccPlayoutHistory instanceof PropelObjectCollection) {
+ return $this
+ ->useCcPlayoutHistoryQuery()
+ ->filterByPrimaryKeys($ccPlayoutHistory->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcPlayoutHistory() only accepts arguments of type CcPlayoutHistory or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcPlayoutHistory 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 joinCcPlayoutHistory($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcPlayoutHistory');
+
+ // 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, 'CcPlayoutHistory');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcPlayoutHistory relation CcPlayoutHistory 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 CcPlayoutHistoryQuery A secondary query class using the current class as primary query
+ */
+ public function useCcPlayoutHistoryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcPlayoutHistory($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistory', 'CcPlayoutHistoryQuery');
+ }
+
+ /**
+ * 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;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcListenerCount.php b/airtime_mvc/application/models/airtime/om/BaseCcListenerCount.php
index 42c435123..bd6044c33 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcListenerCount.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcListenerCount.php
@@ -4,981 +4,1133 @@
/**
* Base class that represents a row from the 'cc_listener_count' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcListenerCount extends BaseObject implements Persistent
+abstract class BaseCcListenerCount extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcListenerCountPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcListenerCountPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the timestamp_id field.
- * @var int
- */
- protected $timestamp_id;
-
- /**
- * The value for the mount_name_id field.
- * @var int
- */
- protected $mount_name_id;
-
- /**
- * The value for the listener_count field.
- * @var int
- */
- protected $listener_count;
-
- /**
- * @var CcTimestamp
- */
- protected $aCcTimestamp;
-
- /**
- * @var CcMountName
- */
- protected $aCcMountName;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Get the [id] column value.
- *
- * @return int
- */
- public function getDbId()
- {
- return $this->id;
- }
-
- /**
- * Get the [timestamp_id] column value.
- *
- * @return int
- */
- public function getDbTimestampId()
- {
- return $this->timestamp_id;
- }
-
- /**
- * Get the [mount_name_id] column value.
- *
- * @return int
- */
- public function getDbMountNameId()
- {
- return $this->mount_name_id;
- }
-
- /**
- * Get the [listener_count] column value.
- *
- * @return int
- */
- public function getDbListenerCount()
- {
- return $this->listener_count;
- }
-
- /**
- * Set the value of [id] column.
- *
- * @param int $v new value
- * @return CcListenerCount 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[] = CcListenerCountPeer::ID;
- }
-
- return $this;
- } // setDbId()
-
- /**
- * Set the value of [timestamp_id] column.
- *
- * @param int $v new value
- * @return CcListenerCount The current object (for fluent API support)
- */
- public function setDbTimestampId($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->timestamp_id !== $v) {
- $this->timestamp_id = $v;
- $this->modifiedColumns[] = CcListenerCountPeer::TIMESTAMP_ID;
- }
-
- if ($this->aCcTimestamp !== null && $this->aCcTimestamp->getDbId() !== $v) {
- $this->aCcTimestamp = null;
- }
-
- return $this;
- } // setDbTimestampId()
-
- /**
- * Set the value of [mount_name_id] column.
- *
- * @param int $v new value
- * @return CcListenerCount The current object (for fluent API support)
- */
- public function setDbMountNameId($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->mount_name_id !== $v) {
- $this->mount_name_id = $v;
- $this->modifiedColumns[] = CcListenerCountPeer::MOUNT_NAME_ID;
- }
-
- if ($this->aCcMountName !== null && $this->aCcMountName->getDbId() !== $v) {
- $this->aCcMountName = null;
- }
-
- return $this;
- } // setDbMountNameId()
-
- /**
- * Set the value of [listener_count] column.
- *
- * @param int $v new value
- * @return CcListenerCount The current object (for fluent API support)
- */
- public function setDbListenerCount($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->listener_count !== $v) {
- $this->listener_count = $v;
- $this->modifiedColumns[] = CcListenerCountPeer::LISTENER_COUNT;
- }
-
- return $this;
- } // setDbListenerCount()
-
- /**
- * 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->timestamp_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
- $this->mount_name_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
- $this->listener_count = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 4; // 4 = CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS).
-
- } catch (Exception $e) {
- throw new PropelException("Error populating CcListenerCount 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->aCcTimestamp !== null && $this->timestamp_id !== $this->aCcTimestamp->getDbId()) {
- $this->aCcTimestamp = null;
- }
- if ($this->aCcMountName !== null && $this->mount_name_id !== $this->aCcMountName->getDbId()) {
- $this->aCcMountName = 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(CcListenerCountPeer::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 = CcListenerCountPeer::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->aCcTimestamp = null;
- $this->aCcMountName = 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(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $con->beginTransaction();
- try {
- $ret = $this->preDelete($con);
- if ($ret) {
- CcListenerCountQuery::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(CcListenerCountPeer::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);
- CcListenerCountPeer::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->aCcTimestamp !== null) {
- if ($this->aCcTimestamp->isModified() || $this->aCcTimestamp->isNew()) {
- $affectedRows += $this->aCcTimestamp->save($con);
- }
- $this->setCcTimestamp($this->aCcTimestamp);
- }
-
- if ($this->aCcMountName !== null) {
- if ($this->aCcMountName->isModified() || $this->aCcMountName->isNew()) {
- $affectedRows += $this->aCcMountName->save($con);
- }
- $this->setCcMountName($this->aCcMountName);
- }
-
- if ($this->isNew() ) {
- $this->modifiedColumns[] = CcListenerCountPeer::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(CcListenerCountPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcListenerCountPeer::ID.')');
- }
-
- $pk = BasePeer::doInsert($criteria, $con);
- $affectedRows += 1;
- $this->setDbId($pk); //[IMV] update autoincrement primary key
- $this->setNew(false);
- } else {
- $affectedRows += CcListenerCountPeer::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->aCcTimestamp !== null) {
- if (!$this->aCcTimestamp->validate($columns)) {
- $failureMap = array_merge($failureMap, $this->aCcTimestamp->getValidationFailures());
- }
- }
-
- if ($this->aCcMountName !== null) {
- if (!$this->aCcMountName->validate($columns)) {
- $failureMap = array_merge($failureMap, $this->aCcMountName->getValidationFailures());
- }
- }
-
-
- if (($retval = CcListenerCountPeer::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 = CcListenerCountPeer::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->getDbTimestampId();
- break;
- case 2:
- return $this->getDbMountNameId();
- break;
- case 3:
- return $this->getDbListenerCount();
- 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 = CcListenerCountPeer::getFieldNames($keyType);
- $result = array(
- $keys[0] => $this->getDbId(),
- $keys[1] => $this->getDbTimestampId(),
- $keys[2] => $this->getDbMountNameId(),
- $keys[3] => $this->getDbListenerCount(),
- );
- if ($includeForeignObjects) {
- if (null !== $this->aCcTimestamp) {
- $result['CcTimestamp'] = $this->aCcTimestamp->toArray($keyType, $includeLazyLoadColumns, true);
- }
- if (null !== $this->aCcMountName) {
- $result['CcMountName'] = $this->aCcMountName->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 = CcListenerCountPeer::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->setDbTimestampId($value);
- break;
- case 2:
- $this->setDbMountNameId($value);
- break;
- case 3:
- $this->setDbListenerCount($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 = CcListenerCountPeer::getFieldNames($keyType);
-
- if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
- if (array_key_exists($keys[1], $arr)) $this->setDbTimestampId($arr[$keys[1]]);
- if (array_key_exists($keys[2], $arr)) $this->setDbMountNameId($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setDbListenerCount($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(CcListenerCountPeer::DATABASE_NAME);
-
- if ($this->isColumnModified(CcListenerCountPeer::ID)) $criteria->add(CcListenerCountPeer::ID, $this->id);
- if ($this->isColumnModified(CcListenerCountPeer::TIMESTAMP_ID)) $criteria->add(CcListenerCountPeer::TIMESTAMP_ID, $this->timestamp_id);
- if ($this->isColumnModified(CcListenerCountPeer::MOUNT_NAME_ID)) $criteria->add(CcListenerCountPeer::MOUNT_NAME_ID, $this->mount_name_id);
- if ($this->isColumnModified(CcListenerCountPeer::LISTENER_COUNT)) $criteria->add(CcListenerCountPeer::LISTENER_COUNT, $this->listener_count);
-
- 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(CcListenerCountPeer::DATABASE_NAME);
- $criteria->add(CcListenerCountPeer::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 CcListenerCount (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->setDbTimestampId($this->timestamp_id);
- $copyObj->setDbMountNameId($this->mount_name_id);
- $copyObj->setDbListenerCount($this->listener_count);
-
- $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 CcListenerCount 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 CcListenerCountPeer
- */
- public function getPeer()
- {
- if (self::$peer === null) {
- self::$peer = new CcListenerCountPeer();
- }
- return self::$peer;
- }
-
- /**
- * Declares an association between this object and a CcTimestamp object.
- *
- * @param CcTimestamp $v
- * @return CcListenerCount The current object (for fluent API support)
- * @throws PropelException
- */
- public function setCcTimestamp(CcTimestamp $v = null)
- {
- if ($v === null) {
- $this->setDbTimestampId(NULL);
- } else {
- $this->setDbTimestampId($v->getDbId());
- }
-
- $this->aCcTimestamp = $v;
-
- // Add binding for other direction of this n:n relationship.
- // If this object has already been added to the CcTimestamp object, it will not be re-added.
- if ($v !== null) {
- $v->addCcListenerCount($this);
- }
-
- return $this;
- }
-
-
- /**
- * Get the associated CcTimestamp object
- *
- * @param PropelPDO Optional Connection object.
- * @return CcTimestamp The associated CcTimestamp object.
- * @throws PropelException
- */
- public function getCcTimestamp(PropelPDO $con = null)
- {
- if ($this->aCcTimestamp === null && ($this->timestamp_id !== null)) {
- $this->aCcTimestamp = CcTimestampQuery::create()->findPk($this->timestamp_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->aCcTimestamp->addCcListenerCounts($this);
- */
- }
- return $this->aCcTimestamp;
- }
-
- /**
- * Declares an association between this object and a CcMountName object.
- *
- * @param CcMountName $v
- * @return CcListenerCount The current object (for fluent API support)
- * @throws PropelException
- */
- public function setCcMountName(CcMountName $v = null)
- {
- if ($v === null) {
- $this->setDbMountNameId(NULL);
- } else {
- $this->setDbMountNameId($v->getDbId());
- }
-
- $this->aCcMountName = $v;
-
- // Add binding for other direction of this n:n relationship.
- // If this object has already been added to the CcMountName object, it will not be re-added.
- if ($v !== null) {
- $v->addCcListenerCount($this);
- }
-
- return $this;
- }
-
-
- /**
- * Get the associated CcMountName object
- *
- * @param PropelPDO Optional Connection object.
- * @return CcMountName The associated CcMountName object.
- * @throws PropelException
- */
- public function getCcMountName(PropelPDO $con = null)
- {
- if ($this->aCcMountName === null && ($this->mount_name_id !== null)) {
- $this->aCcMountName = CcMountNameQuery::create()->findPk($this->mount_name_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->aCcMountName->addCcListenerCounts($this);
- */
- }
- return $this->aCcMountName;
- }
-
- /**
- * Clears the current object and sets all attributes to their default values
- */
- public function clear()
- {
- $this->id = null;
- $this->timestamp_id = null;
- $this->mount_name_id = null;
- $this->listener_count = 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->aCcTimestamp = null;
- $this->aCcMountName = 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);
- }
-
-} // BaseCcListenerCount
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcListenerCountPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcListenerCountPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the timestamp_id field.
+ * @var int
+ */
+ protected $timestamp_id;
+
+ /**
+ * The value for the mount_name_id field.
+ * @var int
+ */
+ protected $mount_name_id;
+
+ /**
+ * The value for the listener_count field.
+ * @var int
+ */
+ protected $listener_count;
+
+ /**
+ * @var CcTimestamp
+ */
+ protected $aCcTimestamp;
+
+ /**
+ * @var CcMountName
+ */
+ protected $aCcMountName;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getDbId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [timestamp_id] column value.
+ *
+ * @return int
+ */
+ public function getDbTimestampId()
+ {
+
+ return $this->timestamp_id;
+ }
+
+ /**
+ * Get the [mount_name_id] column value.
+ *
+ * @return int
+ */
+ public function getDbMountNameId()
+ {
+
+ return $this->mount_name_id;
+ }
+
+ /**
+ * Get the [listener_count] column value.
+ *
+ * @return int
+ */
+ public function getDbListenerCount()
+ {
+
+ return $this->listener_count;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcListenerCount The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcListenerCountPeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [timestamp_id] column.
+ *
+ * @param int $v new value
+ * @return CcListenerCount The current object (for fluent API support)
+ */
+ public function setDbTimestampId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->timestamp_id !== $v) {
+ $this->timestamp_id = $v;
+ $this->modifiedColumns[] = CcListenerCountPeer::TIMESTAMP_ID;
+ }
+
+ if ($this->aCcTimestamp !== null && $this->aCcTimestamp->getDbId() !== $v) {
+ $this->aCcTimestamp = null;
+ }
+
+
+ return $this;
+ } // setDbTimestampId()
+
+ /**
+ * Set the value of [mount_name_id] column.
+ *
+ * @param int $v new value
+ * @return CcListenerCount The current object (for fluent API support)
+ */
+ public function setDbMountNameId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->mount_name_id !== $v) {
+ $this->mount_name_id = $v;
+ $this->modifiedColumns[] = CcListenerCountPeer::MOUNT_NAME_ID;
+ }
+
+ if ($this->aCcMountName !== null && $this->aCcMountName->getDbId() !== $v) {
+ $this->aCcMountName = null;
+ }
+
+
+ return $this;
+ } // setDbMountNameId()
+
+ /**
+ * Set the value of [listener_count] column.
+ *
+ * @param int $v new value
+ * @return CcListenerCount The current object (for fluent API support)
+ */
+ public function setDbListenerCount($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->listener_count !== $v) {
+ $this->listener_count = $v;
+ $this->modifiedColumns[] = CcListenerCountPeer::LISTENER_COUNT;
+ }
+
+
+ return $this;
+ } // setDbListenerCount()
+
+ /**
+ * 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 resultset 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->timestamp_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
+ $this->mount_name_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
+ $this->listener_count = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 4; // 4 = CcListenerCountPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcListenerCount 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->aCcTimestamp !== null && $this->timestamp_id !== $this->aCcTimestamp->getDbId()) {
+ $this->aCcTimestamp = null;
+ }
+ if ($this->aCcMountName !== null && $this->mount_name_id !== $this->aCcMountName->getDbId()) {
+ $this->aCcMountName = 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(CcListenerCountPeer::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 = CcListenerCountPeer::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->aCcTimestamp = null;
+ $this->aCcMountName = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @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(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = CcListenerCountQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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(CcListenerCountPeer::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);
+ CcListenerCountPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $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 corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcTimestamp !== null) {
+ if ($this->aCcTimestamp->isModified() || $this->aCcTimestamp->isNew()) {
+ $affectedRows += $this->aCcTimestamp->save($con);
+ }
+ $this->setCcTimestamp($this->aCcTimestamp);
+ }
+
+ if ($this->aCcMountName !== null) {
+ if ($this->aCcMountName->isModified() || $this->aCcMountName->isNew()) {
+ $affectedRows += $this->aCcMountName->save($con);
+ }
+ $this->setCcMountName($this->aCcMountName);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcListenerCountPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcListenerCountPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_listener_count_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcListenerCountPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcListenerCountPeer::TIMESTAMP_ID)) {
+ $modifiedColumns[':p' . $index++] = '"timestamp_id"';
+ }
+ if ($this->isColumnModified(CcListenerCountPeer::MOUNT_NAME_ID)) {
+ $modifiedColumns[':p' . $index++] = '"mount_name_id"';
+ }
+ if ($this->isColumnModified(CcListenerCountPeer::LISTENER_COUNT)) {
+ $modifiedColumns[':p' . $index++] = '"listener_count"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_listener_count" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"timestamp_id"':
+ $stmt->bindValue($identifier, $this->timestamp_id, PDO::PARAM_INT);
+ break;
+ case '"mount_name_id"':
+ $stmt->bindValue($identifier, $this->mount_name_id, PDO::PARAM_INT);
+ break;
+ case '"listener_count"':
+ $stmt->bindValue($identifier, $this->listener_count, PDO::PARAM_INT);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcTimestamp !== null) {
+ if (!$this->aCcTimestamp->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcTimestamp->getValidationFailures());
+ }
+ }
+
+ if ($this->aCcMountName !== null) {
+ if (!$this->aCcMountName->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcMountName->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CcListenerCountPeer::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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcListenerCountPeer::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->getDbTimestampId();
+ break;
+ case 2:
+ return $this->getDbMountNameId();
+ break;
+ case 3:
+ return $this->getDbListenerCount();
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcListenerCount'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcListenerCount'][$this->getPrimaryKey()] = true;
+ $keys = CcListenerCountPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbTimestampId(),
+ $keys[2] => $this->getDbMountNameId(),
+ $keys[3] => $this->getDbListenerCount(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcTimestamp) {
+ $result['CcTimestamp'] = $this->aCcTimestamp->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->aCcMountName) {
+ $result['CcMountName'] = $this->aCcMountName->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcListenerCountPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbTimestampId($value);
+ break;
+ case 2:
+ $this->setDbMountNameId($value);
+ break;
+ case 3:
+ $this->setDbListenerCount($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 BasePeer::TYPE_PHPNAME
+ *
+ * @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 = CcListenerCountPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbTimestampId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbMountNameId($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbListenerCount($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(CcListenerCountPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcListenerCountPeer::ID)) $criteria->add(CcListenerCountPeer::ID, $this->id);
+ if ($this->isColumnModified(CcListenerCountPeer::TIMESTAMP_ID)) $criteria->add(CcListenerCountPeer::TIMESTAMP_ID, $this->timestamp_id);
+ if ($this->isColumnModified(CcListenerCountPeer::MOUNT_NAME_ID)) $criteria->add(CcListenerCountPeer::MOUNT_NAME_ID, $this->mount_name_id);
+ if ($this->isColumnModified(CcListenerCountPeer::LISTENER_COUNT)) $criteria->add(CcListenerCountPeer::LISTENER_COUNT, $this->listener_count);
+
+ 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(CcListenerCountPeer::DATABASE_NAME);
+ $criteria->add(CcListenerCountPeer::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 CcListenerCount (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbTimestampId($this->getDbTimestampId());
+ $copyObj->setDbMountNameId($this->getDbMountNameId());
+ $copyObj->setDbListenerCount($this->getDbListenerCount());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 CcListenerCount 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 CcListenerCountPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcListenerCountPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcTimestamp object.
+ *
+ * @param CcTimestamp $v
+ * @return CcListenerCount The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcTimestamp(CcTimestamp $v = null)
+ {
+ if ($v === null) {
+ $this->setDbTimestampId(NULL);
+ } else {
+ $this->setDbTimestampId($v->getDbId());
+ }
+
+ $this->aCcTimestamp = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcTimestamp object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcListenerCount($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcTimestamp object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcTimestamp The associated CcTimestamp object.
+ * @throws PropelException
+ */
+ public function getCcTimestamp(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcTimestamp === null && ($this->timestamp_id !== null) && $doQuery) {
+ $this->aCcTimestamp = CcTimestampQuery::create()->findPk($this->timestamp_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->aCcTimestamp->addCcListenerCounts($this);
+ */
+ }
+
+ return $this->aCcTimestamp;
+ }
+
+ /**
+ * Declares an association between this object and a CcMountName object.
+ *
+ * @param CcMountName $v
+ * @return CcListenerCount The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcMountName(CcMountName $v = null)
+ {
+ if ($v === null) {
+ $this->setDbMountNameId(NULL);
+ } else {
+ $this->setDbMountNameId($v->getDbId());
+ }
+
+ $this->aCcMountName = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcMountName object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcListenerCount($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcMountName object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcMountName The associated CcMountName object.
+ * @throws PropelException
+ */
+ public function getCcMountName(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcMountName === null && ($this->mount_name_id !== null) && $doQuery) {
+ $this->aCcMountName = CcMountNameQuery::create()->findPk($this->mount_name_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->aCcMountName->addCcListenerCounts($this);
+ */
+ }
+
+ return $this->aCcMountName;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->timestamp_id = null;
+ $this->mount_name_id = null;
+ $this->listener_count = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->aCcTimestamp instanceof Persistent) {
+ $this->aCcTimestamp->clearAllReferences($deep);
+ }
+ if ($this->aCcMountName instanceof Persistent) {
+ $this->aCcMountName->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ $this->aCcTimestamp = null;
+ $this->aCcMountName = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcListenerCountPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcListenerCountPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcListenerCountPeer.php
index dad3a53b9..22898a8dd 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcListenerCountPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcListenerCountPeer.php
@@ -4,1363 +4,1395 @@
/**
* Base static class for performing query and update operations on the 'cc_listener_count' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcListenerCountPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_listener_count';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcListenerCount';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcListenerCount';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcListenerCountTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 4;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_listener_count.ID';
-
- /** the column name for the TIMESTAMP_ID field */
- const TIMESTAMP_ID = 'cc_listener_count.TIMESTAMP_ID';
-
- /** the column name for the MOUNT_NAME_ID field */
- const MOUNT_NAME_ID = 'cc_listener_count.MOUNT_NAME_ID';
-
- /** the column name for the LISTENER_COUNT field */
- const LISTENER_COUNT = 'cc_listener_count.LISTENER_COUNT';
-
- /**
- * An identiy map to hold any loaded instances of CcListenerCount objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcListenerCount[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbTimestampId', 'DbMountNameId', 'DbListenerCount', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTimestampId', 'dbMountNameId', 'dbListenerCount', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::TIMESTAMP_ID, self::MOUNT_NAME_ID, self::LISTENER_COUNT, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TIMESTAMP_ID', 'MOUNT_NAME_ID', 'LISTENER_COUNT', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'timestamp_id', 'mount_name_id', 'listener_count', ),
- 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, 'DbTimestampId' => 1, 'DbMountNameId' => 2, 'DbListenerCount' => 3, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTimestampId' => 1, 'dbMountNameId' => 2, 'dbListenerCount' => 3, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TIMESTAMP_ID => 1, self::MOUNT_NAME_ID => 2, self::LISTENER_COUNT => 3, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TIMESTAMP_ID' => 1, 'MOUNT_NAME_ID' => 2, 'LISTENER_COUNT' => 3, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'timestamp_id' => 1, 'mount_name_id' => 2, 'listener_count' => 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. CcListenerCountPeer::COLUMN_NAME).
- * @return string
- */
- public static function alias($alias, $column)
- {
- return str_replace(CcListenerCountPeer::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(CcListenerCountPeer::ID);
- $criteria->addSelectColumn(CcListenerCountPeer::TIMESTAMP_ID);
- $criteria->addSelectColumn(CcListenerCountPeer::MOUNT_NAME_ID);
- $criteria->addSelectColumn(CcListenerCountPeer::LISTENER_COUNT);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.TIMESTAMP_ID');
- $criteria->addSelectColumn($alias . '.MOUNT_NAME_ID');
- $criteria->addSelectColumn($alias . '.LISTENER_COUNT');
- }
- }
-
- /**
- * 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(CcListenerCountPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcListenerCountPeer::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(CcListenerCountPeer::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 CcListenerCount
- * @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 = CcListenerCountPeer::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 CcListenerCountPeer::populateObjects(CcListenerCountPeer::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(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- if (!$criteria->hasSelectClause()) {
- $criteria = clone $criteria;
- CcListenerCountPeer::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 CcListenerCount $value A CcListenerCount object.
- * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
- */
- public static function addInstanceToPool(CcListenerCount $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 CcListenerCount object or a primary key value.
- */
- public static function removeInstanceFromPool($value)
- {
- if (Propel::isInstancePoolingEnabled() && $value !== null) {
- if (is_object($value) && $value instanceof CcListenerCount) {
- $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 CcListenerCount 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 CcListenerCount 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_listener_count
- * 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 = CcListenerCountPeer::getOMClass(false);
- // populate the object(s)
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key = CcListenerCountPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj = CcListenerCountPeer::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;
- CcListenerCountPeer::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 (CcListenerCount object, last column rank)
- */
- public static function populateObject($row, $startcol = 0)
- {
- $key = CcListenerCountPeer::getPrimaryKeyHashFromRow($row, $startcol);
- if (null !== ($obj = CcListenerCountPeer::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 + CcListenerCountPeer::NUM_COLUMNS;
- } else {
- $cls = CcListenerCountPeer::OM_CLASS;
- $obj = new $cls();
- $col = $obj->hydrate($row, $startcol);
- CcListenerCountPeer::addInstanceToPool($obj, $key);
- }
- return array($obj, $col);
- }
-
- /**
- * Returns the number of rows matching criteria, joining the related CcTimestamp 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 doCountJoinCcTimestamp(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(CcListenerCountPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcListenerCountPeer::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(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::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 CcMountName 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 doCountJoinCcMountName(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(CcListenerCountPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcListenerCountPeer::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(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::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 CcListenerCount objects pre-filled with their CcTimestamp 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 CcListenerCount objects.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelectJoinCcTimestamp(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);
- }
-
- CcListenerCountPeer::addSelectColumns($criteria);
- $startcol = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS);
- CcTimestampPeer::addSelectColumns($criteria);
-
- $criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcListenerCountPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcListenerCountPeer::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 = CcListenerCountPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcListenerCountPeer::addInstanceToPool($obj1, $key1);
- } // if $obj1 already loaded
-
- $key2 = CcTimestampPeer::getPrimaryKeyHashFromRow($row, $startcol);
- if ($key2 !== null) {
- $obj2 = CcTimestampPeer::getInstanceFromPool($key2);
- if (!$obj2) {
-
- $cls = CcTimestampPeer::getOMClass(false);
-
- $obj2 = new $cls();
- $obj2->hydrate($row, $startcol);
- CcTimestampPeer::addInstanceToPool($obj2, $key2);
- } // if obj2 already loaded
-
- // Add the $obj1 (CcListenerCount) to $obj2 (CcTimestamp)
- $obj2->addCcListenerCount($obj1);
-
- } // if joined row was not null
-
- $results[] = $obj1;
- }
- $stmt->closeCursor();
- return $results;
- }
-
-
- /**
- * Selects a collection of CcListenerCount objects pre-filled with their CcMountName 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 CcListenerCount objects.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelectJoinCcMountName(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);
- }
-
- CcListenerCountPeer::addSelectColumns($criteria);
- $startcol = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS);
- CcMountNamePeer::addSelectColumns($criteria);
-
- $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcListenerCountPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcListenerCountPeer::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 = CcListenerCountPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcListenerCountPeer::addInstanceToPool($obj1, $key1);
- } // if $obj1 already loaded
-
- $key2 = CcMountNamePeer::getPrimaryKeyHashFromRow($row, $startcol);
- if ($key2 !== null) {
- $obj2 = CcMountNamePeer::getInstanceFromPool($key2);
- if (!$obj2) {
-
- $cls = CcMountNamePeer::getOMClass(false);
-
- $obj2 = new $cls();
- $obj2->hydrate($row, $startcol);
- CcMountNamePeer::addInstanceToPool($obj2, $key2);
- } // if obj2 already loaded
-
- // Add the $obj1 (CcListenerCount) to $obj2 (CcMountName)
- $obj2->addCcListenerCount($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(CcListenerCountPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcListenerCountPeer::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(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior);
-
- $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::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 CcListenerCount 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 CcListenerCount 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);
- }
-
- CcListenerCountPeer::addSelectColumns($criteria);
- $startcol2 = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcTimestampPeer::addSelectColumns($criteria);
- $startcol3 = $startcol2 + (CcTimestampPeer::NUM_COLUMNS - CcTimestampPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcMountNamePeer::addSelectColumns($criteria);
- $startcol4 = $startcol3 + (CcMountNamePeer::NUM_COLUMNS - CcMountNamePeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior);
-
- $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcListenerCountPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcListenerCountPeer::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 = CcListenerCountPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcListenerCountPeer::addInstanceToPool($obj1, $key1);
- } // if obj1 already loaded
-
- // Add objects for joined CcTimestamp rows
-
- $key2 = CcTimestampPeer::getPrimaryKeyHashFromRow($row, $startcol2);
- if ($key2 !== null) {
- $obj2 = CcTimestampPeer::getInstanceFromPool($key2);
- if (!$obj2) {
-
- $cls = CcTimestampPeer::getOMClass(false);
-
- $obj2 = new $cls();
- $obj2->hydrate($row, $startcol2);
- CcTimestampPeer::addInstanceToPool($obj2, $key2);
- } // if obj2 loaded
-
- // Add the $obj1 (CcListenerCount) to the collection in $obj2 (CcTimestamp)
- $obj2->addCcListenerCount($obj1);
- } // if joined row not null
-
- // Add objects for joined CcMountName rows
-
- $key3 = CcMountNamePeer::getPrimaryKeyHashFromRow($row, $startcol3);
- if ($key3 !== null) {
- $obj3 = CcMountNamePeer::getInstanceFromPool($key3);
- if (!$obj3) {
-
- $cls = CcMountNamePeer::getOMClass(false);
-
- $obj3 = new $cls();
- $obj3->hydrate($row, $startcol3);
- CcMountNamePeer::addInstanceToPool($obj3, $key3);
- } // if obj3 loaded
-
- // Add the $obj1 (CcListenerCount) to the collection in $obj3 (CcMountName)
- $obj3->addCcListenerCount($obj1);
- } // if joined row not null
-
- $results[] = $obj1;
- }
- $stmt->closeCursor();
- return $results;
- }
-
-
- /**
- * Returns the number of rows matching criteria, joining the related CcTimestamp 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 doCountJoinAllExceptCcTimestamp(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(CcListenerCountPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcListenerCountPeer::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(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::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 CcMountName 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 doCountJoinAllExceptCcMountName(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(CcListenerCountPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcListenerCountPeer::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(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::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 CcListenerCount objects pre-filled with all related objects except CcTimestamp.
- *
- * @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 CcListenerCount objects.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelectJoinAllExceptCcTimestamp(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);
- }
-
- CcListenerCountPeer::addSelectColumns($criteria);
- $startcol2 = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcMountNamePeer::addSelectColumns($criteria);
- $startcol3 = $startcol2 + (CcMountNamePeer::NUM_COLUMNS - CcMountNamePeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior);
-
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcListenerCountPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcListenerCountPeer::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 = CcListenerCountPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcListenerCountPeer::addInstanceToPool($obj1, $key1);
- } // if obj1 already loaded
-
- // Add objects for joined CcMountName rows
-
- $key2 = CcMountNamePeer::getPrimaryKeyHashFromRow($row, $startcol2);
- if ($key2 !== null) {
- $obj2 = CcMountNamePeer::getInstanceFromPool($key2);
- if (!$obj2) {
-
- $cls = CcMountNamePeer::getOMClass(false);
-
- $obj2 = new $cls();
- $obj2->hydrate($row, $startcol2);
- CcMountNamePeer::addInstanceToPool($obj2, $key2);
- } // if $obj2 already loaded
-
- // Add the $obj1 (CcListenerCount) to the collection in $obj2 (CcMountName)
- $obj2->addCcListenerCount($obj1);
-
- } // if joined row is not null
-
- $results[] = $obj1;
- }
- $stmt->closeCursor();
- return $results;
- }
-
-
- /**
- * Selects a collection of CcListenerCount objects pre-filled with all related objects except CcMountName.
- *
- * @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 CcListenerCount objects.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelectJoinAllExceptCcMountName(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);
- }
-
- CcListenerCountPeer::addSelectColumns($criteria);
- $startcol2 = (CcListenerCountPeer::NUM_COLUMNS - CcListenerCountPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcTimestampPeer::addSelectColumns($criteria);
- $startcol3 = $startcol2 + (CcTimestampPeer::NUM_COLUMNS - CcTimestampPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior);
-
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcListenerCountPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcListenerCountPeer::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 = CcListenerCountPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcListenerCountPeer::addInstanceToPool($obj1, $key1);
- } // if obj1 already loaded
-
- // Add objects for joined CcTimestamp rows
-
- $key2 = CcTimestampPeer::getPrimaryKeyHashFromRow($row, $startcol2);
- if ($key2 !== null) {
- $obj2 = CcTimestampPeer::getInstanceFromPool($key2);
- if (!$obj2) {
-
- $cls = CcTimestampPeer::getOMClass(false);
-
- $obj2 = new $cls();
- $obj2->hydrate($row, $startcol2);
- CcTimestampPeer::addInstanceToPool($obj2, $key2);
- } // if $obj2 already loaded
-
- // Add the $obj1 (CcListenerCount) to the collection in $obj2 (CcTimestamp)
- $obj2->addCcListenerCount($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(BaseCcListenerCountPeer::DATABASE_NAME);
- if (!$dbMap->hasTable(BaseCcListenerCountPeer::TABLE_NAME))
- {
- $dbMap->addTableObject(new CcListenerCountTableMap());
- }
- }
-
- /**
- * 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 ? CcListenerCountPeer::CLASS_DEFAULT : CcListenerCountPeer::OM_CLASS;
- }
-
- /**
- * Method perform an INSERT on the database, given a CcListenerCount or Criteria object.
- *
- * @param mixed $values Criteria or CcListenerCount 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(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
- } else {
- $criteria = $values->buildCriteria(); // build Criteria from CcListenerCount object
- }
-
- if ($criteria->containsKey(CcListenerCountPeer::ID) && $criteria->keyContainsValue(CcListenerCountPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcListenerCountPeer::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 CcListenerCount or Criteria object.
- *
- * @param mixed $values Criteria or CcListenerCount 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(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $selectCriteria = new Criteria(self::DATABASE_NAME);
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
-
- $comparison = $criteria->getComparison(CcListenerCountPeer::ID);
- $value = $criteria->remove(CcListenerCountPeer::ID);
- if ($value) {
- $selectCriteria->add(CcListenerCountPeer::ID, $value, $comparison);
- } else {
- $selectCriteria->setPrimaryTableName(CcListenerCountPeer::TABLE_NAME);
- }
-
- } else { // $values is CcListenerCount 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_listener_count 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(CcListenerCountPeer::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(CcListenerCountPeer::TABLE_NAME, $con, CcListenerCountPeer::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).
- CcListenerCountPeer::clearInstancePool();
- CcListenerCountPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Method perform a DELETE on the database, given a CcListenerCount or Criteria object OR a primary key value.
- *
- * @param mixed $values Criteria or CcListenerCount 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(CcListenerCountPeer::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.
- CcListenerCountPeer::clearInstancePool();
- // rename for clarity
- $criteria = clone $values;
- } elseif ($values instanceof CcListenerCount) { // it's a model object
- // invalidate the cache for this single object
- CcListenerCountPeer::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(CcListenerCountPeer::ID, (array) $values, Criteria::IN);
- // invalidate the cache for this object(s)
- foreach ((array) $values as $singleval) {
- CcListenerCountPeer::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);
- CcListenerCountPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Validates all modified columns of given CcListenerCount 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 CcListenerCount $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(CcListenerCount $obj, $cols = null)
- {
- $columns = array();
-
- if ($cols) {
- $dbMap = Propel::getDatabaseMap(CcListenerCountPeer::DATABASE_NAME);
- $tableMap = $dbMap->getTable(CcListenerCountPeer::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(CcListenerCountPeer::DATABASE_NAME, CcListenerCountPeer::TABLE_NAME, $columns);
- }
-
- /**
- * Retrieve a single object by pkey.
- *
- * @param int $pk the primary key.
- * @param PropelPDO $con the connection to use
- * @return CcListenerCount
- */
- public static function retrieveByPK($pk, PropelPDO $con = null)
- {
-
- if (null !== ($obj = CcListenerCountPeer::getInstanceFromPool((string) $pk))) {
- return $obj;
- }
-
- if ($con === null) {
- $con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria = new Criteria(CcListenerCountPeer::DATABASE_NAME);
- $criteria->add(CcListenerCountPeer::ID, $pk);
-
- $v = CcListenerCountPeer::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(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $objs = null;
- if (empty($pks)) {
- $objs = array();
- } else {
- $criteria = new Criteria(CcListenerCountPeer::DATABASE_NAME);
- $criteria->add(CcListenerCountPeer::ID, $pks, Criteria::IN);
- $objs = CcListenerCountPeer::doSelect($criteria, $con);
- }
- return $objs;
- }
+abstract class BaseCcListenerCountPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_listener_count';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcListenerCount';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcListenerCountTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 4;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 4;
+
+ /** the column name for the id field */
+ const ID = 'cc_listener_count.id';
+
+ /** the column name for the timestamp_id field */
+ const TIMESTAMP_ID = 'cc_listener_count.timestamp_id';
+
+ /** the column name for the mount_name_id field */
+ const MOUNT_NAME_ID = 'cc_listener_count.mount_name_id';
+
+ /** the column name for the listener_count field */
+ const LISTENER_COUNT = 'cc_listener_count.listener_count';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcListenerCount objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcListenerCount[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcListenerCountPeer::$fieldNames[CcListenerCountPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbTimestampId', 'DbMountNameId', 'DbListenerCount', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTimestampId', 'dbMountNameId', 'dbListenerCount', ),
+ BasePeer::TYPE_COLNAME => array (CcListenerCountPeer::ID, CcListenerCountPeer::TIMESTAMP_ID, CcListenerCountPeer::MOUNT_NAME_ID, CcListenerCountPeer::LISTENER_COUNT, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TIMESTAMP_ID', 'MOUNT_NAME_ID', 'LISTENER_COUNT', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'timestamp_id', 'mount_name_id', 'listener_count', ),
+ 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. CcListenerCountPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbTimestampId' => 1, 'DbMountNameId' => 2, 'DbListenerCount' => 3, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTimestampId' => 1, 'dbMountNameId' => 2, 'dbListenerCount' => 3, ),
+ BasePeer::TYPE_COLNAME => array (CcListenerCountPeer::ID => 0, CcListenerCountPeer::TIMESTAMP_ID => 1, CcListenerCountPeer::MOUNT_NAME_ID => 2, CcListenerCountPeer::LISTENER_COUNT => 3, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TIMESTAMP_ID' => 1, 'MOUNT_NAME_ID' => 2, 'LISTENER_COUNT' => 3, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'timestamp_id' => 1, 'mount_name_id' => 2, 'listener_count' => 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcListenerCountPeer::getFieldNames($toType);
+ $key = isset(CcListenerCountPeer::$fieldKeys[$fromType][$name]) ? CcListenerCountPeer::$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(CcListenerCountPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcListenerCountPeer::$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 CcListenerCountPeer::$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. CcListenerCountPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcListenerCountPeer::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(CcListenerCountPeer::ID);
+ $criteria->addSelectColumn(CcListenerCountPeer::TIMESTAMP_ID);
+ $criteria->addSelectColumn(CcListenerCountPeer::MOUNT_NAME_ID);
+ $criteria->addSelectColumn(CcListenerCountPeer::LISTENER_COUNT);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.timestamp_id');
+ $criteria->addSelectColumn($alias . '.mount_name_id');
+ $criteria->addSelectColumn($alias . '.listener_count');
+ }
+ }
+
+ /**
+ * 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(CcListenerCountPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcListenerCountPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(CcListenerCountPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcListenerCountPeer::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;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcListenerCount
+ * @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 = CcListenerCountPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 CcListenerCountPeer::populateObjects(CcListenerCountPeer::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 directly (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(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcListenerCountPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcListenerCountPeer::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 CcListenerCount $obj A CcListenerCount object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcListenerCountPeer::$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 CcListenerCount object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcListenerCount) {
+ $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 CcListenerCount object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(CcListenerCountPeer::$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 CcListenerCount 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(CcListenerCountPeer::$instances[$key])) {
+ return CcListenerCountPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcListenerCountPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcListenerCountPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_listener_count
+ * 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 = CcListenerCountPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcListenerCountPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcListenerCountPeer::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;
+ CcListenerCountPeer::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 (CcListenerCount object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcListenerCountPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcListenerCountPeer::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 + CcListenerCountPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = CcListenerCountPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcListenerCountPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcTimestamp 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 doCountJoinCcTimestamp(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(CcListenerCountPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcListenerCountPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::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 CcMountName 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 doCountJoinCcMountName(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(CcListenerCountPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcListenerCountPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::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 CcListenerCount objects pre-filled with their CcTimestamp 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 CcListenerCount objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcTimestamp(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(CcListenerCountPeer::DATABASE_NAME);
+ }
+
+ CcListenerCountPeer::addSelectColumns($criteria);
+ $startcol = CcListenerCountPeer::NUM_HYDRATE_COLUMNS;
+ CcTimestampPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcListenerCountPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcListenerCountPeer::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 = CcListenerCountPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcListenerCountPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcTimestampPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcTimestampPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcTimestampPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcTimestampPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcListenerCount) to $obj2 (CcTimestamp)
+ $obj2->addCcListenerCount($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Selects a collection of CcListenerCount objects pre-filled with their CcMountName 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 CcListenerCount objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcMountName(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(CcListenerCountPeer::DATABASE_NAME);
+ }
+
+ CcListenerCountPeer::addSelectColumns($criteria);
+ $startcol = CcListenerCountPeer::NUM_HYDRATE_COLUMNS;
+ CcMountNamePeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcListenerCountPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcListenerCountPeer::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 = CcListenerCountPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcListenerCountPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcMountNamePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcMountNamePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcMountNamePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcMountNamePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcListenerCount) to $obj2 (CcMountName)
+ $obj2->addCcListenerCount($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(CcListenerCountPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcListenerCountPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::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 CcListenerCount 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 CcListenerCount 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(CcListenerCountPeer::DATABASE_NAME);
+ }
+
+ CcListenerCountPeer::addSelectColumns($criteria);
+ $startcol2 = CcListenerCountPeer::NUM_HYDRATE_COLUMNS;
+
+ CcTimestampPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcTimestampPeer::NUM_HYDRATE_COLUMNS;
+
+ CcMountNamePeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + CcMountNamePeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcListenerCountPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcListenerCountPeer::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 = CcListenerCountPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcListenerCountPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcTimestamp rows
+
+ $key2 = CcTimestampPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcTimestampPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcTimestampPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcTimestampPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CcListenerCount) to the collection in $obj2 (CcTimestamp)
+ $obj2->addCcListenerCount($obj1);
+ } // if joined row not null
+
+ // Add objects for joined CcMountName rows
+
+ $key3 = CcMountNamePeer::getPrimaryKeyHashFromRow($row, $startcol3);
+ if ($key3 !== null) {
+ $obj3 = CcMountNamePeer::getInstanceFromPool($key3);
+ if (!$obj3) {
+
+ $cls = CcMountNamePeer::getOMClass();
+
+ $obj3 = new $cls();
+ $obj3->hydrate($row, $startcol3);
+ CcMountNamePeer::addInstanceToPool($obj3, $key3);
+ } // if obj3 loaded
+
+ // Add the $obj1 (CcListenerCount) to the collection in $obj3 (CcMountName)
+ $obj3->addCcListenerCount($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcTimestamp 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 doCountJoinAllExceptCcTimestamp(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(CcListenerCountPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcListenerCountPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY should not affect count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::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 CcMountName 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 doCountJoinAllExceptCcMountName(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(CcListenerCountPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcListenerCountPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY should not affect count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::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 CcListenerCount objects pre-filled with all related objects except CcTimestamp.
+ *
+ * @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 CcListenerCount objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAllExceptCcTimestamp(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(CcListenerCountPeer::DATABASE_NAME);
+ }
+
+ CcListenerCountPeer::addSelectColumns($criteria);
+ $startcol2 = CcListenerCountPeer::NUM_HYDRATE_COLUMNS;
+
+ CcMountNamePeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcMountNamePeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcListenerCountPeer::MOUNT_NAME_ID, CcMountNamePeer::ID, $join_behavior);
+
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcListenerCountPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcListenerCountPeer::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 = CcListenerCountPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcListenerCountPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcMountName rows
+
+ $key2 = CcMountNamePeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcMountNamePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcMountNamePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcMountNamePeer::addInstanceToPool($obj2, $key2);
+ } // if $obj2 already loaded
+
+ // Add the $obj1 (CcListenerCount) to the collection in $obj2 (CcMountName)
+ $obj2->addCcListenerCount($obj1);
+
+ } // if joined row is not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Selects a collection of CcListenerCount objects pre-filled with all related objects except CcMountName.
+ *
+ * @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 CcListenerCount objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAllExceptCcMountName(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(CcListenerCountPeer::DATABASE_NAME);
+ }
+
+ CcListenerCountPeer::addSelectColumns($criteria);
+ $startcol2 = CcListenerCountPeer::NUM_HYDRATE_COLUMNS;
+
+ CcTimestampPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcTimestampPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcListenerCountPeer::TIMESTAMP_ID, CcTimestampPeer::ID, $join_behavior);
+
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcListenerCountPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcListenerCountPeer::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 = CcListenerCountPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcListenerCountPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcTimestamp rows
+
+ $key2 = CcTimestampPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcTimestampPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcTimestampPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcTimestampPeer::addInstanceToPool($obj2, $key2);
+ } // if $obj2 already loaded
+
+ // Add the $obj1 (CcListenerCount) to the collection in $obj2 (CcTimestamp)
+ $obj2->addCcListenerCount($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(CcListenerCountPeer::DATABASE_NAME)->getTable(CcListenerCountPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcListenerCountPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcListenerCountPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \CcListenerCountTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcListenerCountPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a CcListenerCount or Criteria object.
+ *
+ * @param mixed $values Criteria or CcListenerCount 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(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcListenerCount object
+ }
+
+ if ($criteria->containsKey(CcListenerCountPeer::ID) && $criteria->keyContainsValue(CcListenerCountPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcListenerCountPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(CcListenerCountPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a CcListenerCount or Criteria object.
+ *
+ * @param mixed $values Criteria or CcListenerCount 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(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(CcListenerCountPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcListenerCountPeer::ID);
+ $value = $criteria->remove(CcListenerCountPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcListenerCountPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcListenerCountPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcListenerCount object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(CcListenerCountPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_listener_count table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcListenerCountPeer::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(CcListenerCountPeer::TABLE_NAME, $con, CcListenerCountPeer::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).
+ CcListenerCountPeer::clearInstancePool();
+ CcListenerCountPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a CcListenerCount or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcListenerCount 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(CcListenerCountPeer::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.
+ CcListenerCountPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcListenerCount) { // it's a model object
+ // invalidate the cache for this single object
+ CcListenerCountPeer::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(CcListenerCountPeer::DATABASE_NAME);
+ $criteria->add(CcListenerCountPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcListenerCountPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcListenerCountPeer::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);
+ CcListenerCountPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcListenerCount 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 CcListenerCount $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($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcListenerCountPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcListenerCountPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcListenerCountPeer::DATABASE_NAME, CcListenerCountPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcListenerCount
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcListenerCountPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcListenerCountPeer::DATABASE_NAME);
+ $criteria->add(CcListenerCountPeer::ID, $pk);
+
+ $v = CcListenerCountPeer::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
+ * @return CcListenerCount[]
+ * @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(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcListenerCountPeer::DATABASE_NAME);
+ $criteria->add(CcListenerCountPeer::ID, $pks, Criteria::IN);
+ $objs = CcListenerCountPeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
} // BaseCcListenerCountPeer
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcListenerCountQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcListenerCountQuery.php
index 30c702e6e..24c5a1f1a 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcListenerCountQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcListenerCountQuery.php
@@ -4,403 +4,575 @@
/**
* Base class that represents a query for the 'cc_listener_count' table.
*
- *
*
- * @method CcListenerCountQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcListenerCountQuery orderByDbTimestampId($order = Criteria::ASC) Order by the timestamp_id column
- * @method CcListenerCountQuery orderByDbMountNameId($order = Criteria::ASC) Order by the mount_name_id column
- * @method CcListenerCountQuery orderByDbListenerCount($order = Criteria::ASC) Order by the listener_count column
*
- * @method CcListenerCountQuery groupByDbId() Group by the id column
- * @method CcListenerCountQuery groupByDbTimestampId() Group by the timestamp_id column
- * @method CcListenerCountQuery groupByDbMountNameId() Group by the mount_name_id column
- * @method CcListenerCountQuery groupByDbListenerCount() Group by the listener_count column
+ * @method CcListenerCountQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcListenerCountQuery orderByDbTimestampId($order = Criteria::ASC) Order by the timestamp_id column
+ * @method CcListenerCountQuery orderByDbMountNameId($order = Criteria::ASC) Order by the mount_name_id column
+ * @method CcListenerCountQuery orderByDbListenerCount($order = Criteria::ASC) Order by the listener_count column
*
- * @method CcListenerCountQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcListenerCountQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcListenerCountQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcListenerCountQuery groupByDbId() Group by the id column
+ * @method CcListenerCountQuery groupByDbTimestampId() Group by the timestamp_id column
+ * @method CcListenerCountQuery groupByDbMountNameId() Group by the mount_name_id column
+ * @method CcListenerCountQuery groupByDbListenerCount() Group by the listener_count column
*
- * @method CcListenerCountQuery leftJoinCcTimestamp($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcTimestamp relation
- * @method CcListenerCountQuery rightJoinCcTimestamp($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcTimestamp relation
- * @method CcListenerCountQuery innerJoinCcTimestamp($relationAlias = '') Adds a INNER JOIN clause to the query using the CcTimestamp relation
+ * @method CcListenerCountQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcListenerCountQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcListenerCountQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcListenerCountQuery leftJoinCcMountName($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcMountName relation
- * @method CcListenerCountQuery rightJoinCcMountName($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcMountName relation
- * @method CcListenerCountQuery innerJoinCcMountName($relationAlias = '') Adds a INNER JOIN clause to the query using the CcMountName relation
+ * @method CcListenerCountQuery leftJoinCcTimestamp($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcTimestamp relation
+ * @method CcListenerCountQuery rightJoinCcTimestamp($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcTimestamp relation
+ * @method CcListenerCountQuery innerJoinCcTimestamp($relationAlias = null) Adds a INNER JOIN clause to the query using the CcTimestamp relation
*
- * @method CcListenerCount findOne(PropelPDO $con = null) Return the first CcListenerCount matching the query
- * @method CcListenerCount findOneOrCreate(PropelPDO $con = null) Return the first CcListenerCount matching the query, or a new CcListenerCount object populated from the query conditions when no match is found
+ * @method CcListenerCountQuery leftJoinCcMountName($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcMountName relation
+ * @method CcListenerCountQuery rightJoinCcMountName($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcMountName relation
+ * @method CcListenerCountQuery innerJoinCcMountName($relationAlias = null) Adds a INNER JOIN clause to the query using the CcMountName relation
*
- * @method CcListenerCount findOneByDbId(int $id) Return the first CcListenerCount filtered by the id column
- * @method CcListenerCount findOneByDbTimestampId(int $timestamp_id) Return the first CcListenerCount filtered by the timestamp_id column
- * @method CcListenerCount findOneByDbMountNameId(int $mount_name_id) Return the first CcListenerCount filtered by the mount_name_id column
- * @method CcListenerCount findOneByDbListenerCount(int $listener_count) Return the first CcListenerCount filtered by the listener_count column
+ * @method CcListenerCount findOne(PropelPDO $con = null) Return the first CcListenerCount matching the query
+ * @method CcListenerCount findOneOrCreate(PropelPDO $con = null) Return the first CcListenerCount matching the query, or a new CcListenerCount object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcListenerCount objects filtered by the id column
- * @method array findByDbTimestampId(int $timestamp_id) Return CcListenerCount objects filtered by the timestamp_id column
- * @method array findByDbMountNameId(int $mount_name_id) Return CcListenerCount objects filtered by the mount_name_id column
- * @method array findByDbListenerCount(int $listener_count) Return CcListenerCount objects filtered by the listener_count column
+ * @method CcListenerCount findOneByDbTimestampId(int $timestamp_id) Return the first CcListenerCount filtered by the timestamp_id column
+ * @method CcListenerCount findOneByDbMountNameId(int $mount_name_id) Return the first CcListenerCount filtered by the mount_name_id column
+ * @method CcListenerCount findOneByDbListenerCount(int $listener_count) Return the first CcListenerCount filtered by the listener_count column
+ *
+ * @method array findByDbId(int $id) Return CcListenerCount objects filtered by the id column
+ * @method array findByDbTimestampId(int $timestamp_id) Return CcListenerCount objects filtered by the timestamp_id column
+ * @method array findByDbMountNameId(int $mount_name_id) Return CcListenerCount objects filtered by the mount_name_id column
+ * @method array findByDbListenerCount(int $listener_count) Return CcListenerCount objects filtered by the listener_count column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcListenerCountQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcListenerCountQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcListenerCount';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcListenerCountQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcListenerCount', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcListenerCountQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcListenerCountQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcListenerCountQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcListenerCountQuery) {
+ return $criteria;
+ }
+ $query = new CcListenerCountQuery(null, null, $modelAlias);
- /**
- * Returns a new CcListenerCountQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcListenerCountQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcListenerCountQuery) {
- return $criteria;
- }
- $query = new CcListenerCountQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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 CcListenerCount|array|mixed the result, formatted by the current formatter
- */
- public function findPk($key, $con = null)
- {
- if ((null !== ($obj = CcListenerCountPeer::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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcListenerCount|CcListenerCount[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcListenerCountPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcListenerCountPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
- /**
- * Filter the query by primary key
- *
- * @param mixed $key Primary key to use for the query
- *
- * @return CcListenerCountQuery The current query, for fluid interface
- */
- public function filterByPrimaryKey($key)
- {
- return $this->addUsingAlias(CcListenerCountPeer::ID, $key, Criteria::EQUAL);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcListenerCount A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * Filter the query by a list of primary keys
- *
- * @param array $keys The list of primary key to use for the query
- *
- * @return CcListenerCountQuery The current query, for fluid interface
- */
- public function filterByPrimaryKeys($keys)
- {
- return $this->addUsingAlias(CcListenerCountPeer::ID, $keys, Criteria::IN);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcListenerCount A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "timestamp_id", "mount_name_id", "listener_count" FROM "cc_listener_count" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcListenerCount();
+ $obj->hydrate($row);
+ CcListenerCountPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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 CcListenerCountQuery 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(CcListenerCountPeer::ID, $dbId, $comparison);
- }
+ return $obj;
+ }
- /**
- * Filter the query on the timestamp_id column
- *
- * @param int|array $dbTimestampId 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 CcListenerCountQuery The current query, for fluid interface
- */
- public function filterByDbTimestampId($dbTimestampId = null, $comparison = null)
- {
- if (is_array($dbTimestampId)) {
- $useMinMax = false;
- if (isset($dbTimestampId['min'])) {
- $this->addUsingAlias(CcListenerCountPeer::TIMESTAMP_ID, $dbTimestampId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbTimestampId['max'])) {
- $this->addUsingAlias(CcListenerCountPeer::TIMESTAMP_ID, $dbTimestampId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcListenerCountPeer::TIMESTAMP_ID, $dbTimestampId, $comparison);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcListenerCount|CcListenerCount[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * Filter the query on the mount_name_id column
- *
- * @param int|array $dbMountNameId 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 CcListenerCountQuery The current query, for fluid interface
- */
- public function filterByDbMountNameId($dbMountNameId = null, $comparison = null)
- {
- if (is_array($dbMountNameId)) {
- $useMinMax = false;
- if (isset($dbMountNameId['min'])) {
- $this->addUsingAlias(CcListenerCountPeer::MOUNT_NAME_ID, $dbMountNameId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbMountNameId['max'])) {
- $this->addUsingAlias(CcListenerCountPeer::MOUNT_NAME_ID, $dbMountNameId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcListenerCountPeer::MOUNT_NAME_ID, $dbMountNameId, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * Filter the query on the listener_count column
- *
- * @param int|array $dbListenerCount 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 CcListenerCountQuery The current query, for fluid interface
- */
- public function filterByDbListenerCount($dbListenerCount = null, $comparison = null)
- {
- if (is_array($dbListenerCount)) {
- $useMinMax = false;
- if (isset($dbListenerCount['min'])) {
- $this->addUsingAlias(CcListenerCountPeer::LISTENER_COUNT, $dbListenerCount['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbListenerCount['max'])) {
- $this->addUsingAlias(CcListenerCountPeer::LISTENER_COUNT, $dbListenerCount['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcListenerCountPeer::LISTENER_COUNT, $dbListenerCount, $comparison);
- }
+ /**
+ * 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|CcListenerCount[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * Filter the query by a related CcTimestamp object
- *
- * @param CcTimestamp $ccTimestamp the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return CcListenerCountQuery The current query, for fluid interface
- */
- public function filterByCcTimestamp($ccTimestamp, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcListenerCountPeer::TIMESTAMP_ID, $ccTimestamp->getDbId(), $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * Adds a JOIN clause to the query using the CcTimestamp relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return CcListenerCountQuery The current query, for fluid interface
- */
- public function joinCcTimestamp($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcTimestamp');
-
- // 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, 'CcTimestamp');
- }
-
- return $this;
- }
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcListenerCountQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
- /**
- * Use the CcTimestamp relation CcTimestamp 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 CcTimestampQuery A secondary query class using the current class as primary query
- */
- public function useCcTimestampQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinCcTimestamp($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcTimestamp', 'CcTimestampQuery');
- }
+ return $this->addUsingAlias(CcListenerCountPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * Filter the query by a related CcMountName object
- *
- * @param CcMountName $ccMountName the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return CcListenerCountQuery The current query, for fluid interface
- */
- public function filterByCcMountName($ccMountName, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcListenerCountPeer::MOUNT_NAME_ID, $ccMountName->getDbId(), $comparison);
- }
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcListenerCountQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
- /**
- * Adds a JOIN clause to the query using the CcMountName relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return CcListenerCountQuery The current query, for fluid interface
- */
- public function joinCcMountName($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcMountName');
-
- // 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, 'CcMountName');
- }
-
- return $this;
- }
+ return $this->addUsingAlias(CcListenerCountPeer::ID, $keys, Criteria::IN);
+ }
- /**
- * Use the CcMountName relation CcMountName 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 CcMountNameQuery A secondary query class using the current class as primary query
- */
- public function useCcMountNameQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinCcMountName($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcMountName', 'CcMountNameQuery');
- }
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcListenerCountQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcListenerCountPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcListenerCountPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * Exclude object from result
- *
- * @param CcListenerCount $ccListenerCount Object to remove from the list of results
- *
- * @return CcListenerCountQuery The current query, for fluid interface
- */
- public function prune($ccListenerCount = null)
- {
- if ($ccListenerCount) {
- $this->addUsingAlias(CcListenerCountPeer::ID, $ccListenerCount->getDbId(), Criteria::NOT_EQUAL);
- }
-
- return $this;
- }
+ return $this->addUsingAlias(CcListenerCountPeer::ID, $dbId, $comparison);
+ }
-} // BaseCcListenerCountQuery
+ /**
+ * Filter the query on the timestamp_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbTimestampId(1234); // WHERE timestamp_id = 1234
+ * $query->filterByDbTimestampId(array(12, 34)); // WHERE timestamp_id IN (12, 34)
+ * $query->filterByDbTimestampId(array('min' => 12)); // WHERE timestamp_id >= 12
+ * $query->filterByDbTimestampId(array('max' => 12)); // WHERE timestamp_id <= 12
+ *
+ *
+ * @see filterByCcTimestamp()
+ *
+ * @param mixed $dbTimestampId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcListenerCountQuery The current query, for fluid interface
+ */
+ public function filterByDbTimestampId($dbTimestampId = null, $comparison = null)
+ {
+ if (is_array($dbTimestampId)) {
+ $useMinMax = false;
+ if (isset($dbTimestampId['min'])) {
+ $this->addUsingAlias(CcListenerCountPeer::TIMESTAMP_ID, $dbTimestampId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbTimestampId['max'])) {
+ $this->addUsingAlias(CcListenerCountPeer::TIMESTAMP_ID, $dbTimestampId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcListenerCountPeer::TIMESTAMP_ID, $dbTimestampId, $comparison);
+ }
+
+ /**
+ * Filter the query on the mount_name_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbMountNameId(1234); // WHERE mount_name_id = 1234
+ * $query->filterByDbMountNameId(array(12, 34)); // WHERE mount_name_id IN (12, 34)
+ * $query->filterByDbMountNameId(array('min' => 12)); // WHERE mount_name_id >= 12
+ * $query->filterByDbMountNameId(array('max' => 12)); // WHERE mount_name_id <= 12
+ *
+ *
+ * @see filterByCcMountName()
+ *
+ * @param mixed $dbMountNameId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcListenerCountQuery The current query, for fluid interface
+ */
+ public function filterByDbMountNameId($dbMountNameId = null, $comparison = null)
+ {
+ if (is_array($dbMountNameId)) {
+ $useMinMax = false;
+ if (isset($dbMountNameId['min'])) {
+ $this->addUsingAlias(CcListenerCountPeer::MOUNT_NAME_ID, $dbMountNameId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbMountNameId['max'])) {
+ $this->addUsingAlias(CcListenerCountPeer::MOUNT_NAME_ID, $dbMountNameId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcListenerCountPeer::MOUNT_NAME_ID, $dbMountNameId, $comparison);
+ }
+
+ /**
+ * Filter the query on the listener_count column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbListenerCount(1234); // WHERE listener_count = 1234
+ * $query->filterByDbListenerCount(array(12, 34)); // WHERE listener_count IN (12, 34)
+ * $query->filterByDbListenerCount(array('min' => 12)); // WHERE listener_count >= 12
+ * $query->filterByDbListenerCount(array('max' => 12)); // WHERE listener_count <= 12
+ *
+ *
+ * @param mixed $dbListenerCount The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcListenerCountQuery The current query, for fluid interface
+ */
+ public function filterByDbListenerCount($dbListenerCount = null, $comparison = null)
+ {
+ if (is_array($dbListenerCount)) {
+ $useMinMax = false;
+ if (isset($dbListenerCount['min'])) {
+ $this->addUsingAlias(CcListenerCountPeer::LISTENER_COUNT, $dbListenerCount['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbListenerCount['max'])) {
+ $this->addUsingAlias(CcListenerCountPeer::LISTENER_COUNT, $dbListenerCount['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcListenerCountPeer::LISTENER_COUNT, $dbListenerCount, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcTimestamp object
+ *
+ * @param CcTimestamp|PropelObjectCollection $ccTimestamp The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcListenerCountQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcTimestamp($ccTimestamp, $comparison = null)
+ {
+ if ($ccTimestamp instanceof CcTimestamp) {
+ return $this
+ ->addUsingAlias(CcListenerCountPeer::TIMESTAMP_ID, $ccTimestamp->getDbId(), $comparison);
+ } elseif ($ccTimestamp instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcListenerCountPeer::TIMESTAMP_ID, $ccTimestamp->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcTimestamp() only accepts arguments of type CcTimestamp or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcTimestamp relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcListenerCountQuery The current query, for fluid interface
+ */
+ public function joinCcTimestamp($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcTimestamp');
+
+ // 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, 'CcTimestamp');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcTimestamp relation CcTimestamp 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 CcTimestampQuery A secondary query class using the current class as primary query
+ */
+ public function useCcTimestampQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcTimestamp($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcTimestamp', 'CcTimestampQuery');
+ }
+
+ /**
+ * Filter the query by a related CcMountName object
+ *
+ * @param CcMountName|PropelObjectCollection $ccMountName The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcListenerCountQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcMountName($ccMountName, $comparison = null)
+ {
+ if ($ccMountName instanceof CcMountName) {
+ return $this
+ ->addUsingAlias(CcListenerCountPeer::MOUNT_NAME_ID, $ccMountName->getDbId(), $comparison);
+ } elseif ($ccMountName instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcListenerCountPeer::MOUNT_NAME_ID, $ccMountName->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcMountName() only accepts arguments of type CcMountName or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcMountName relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcListenerCountQuery The current query, for fluid interface
+ */
+ public function joinCcMountName($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcMountName');
+
+ // 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, 'CcMountName');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcMountName relation CcMountName 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 CcMountNameQuery A secondary query class using the current class as primary query
+ */
+ public function useCcMountNameQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcMountName($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcMountName', 'CcMountNameQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcListenerCount $ccListenerCount Object to remove from the list of results
+ *
+ * @return CcListenerCountQuery The current query, for fluid interface
+ */
+ public function prune($ccListenerCount = null)
+ {
+ if ($ccListenerCount) {
+ $this->addUsingAlias(CcListenerCountPeer::ID, $ccListenerCount->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcLiveLog.php b/airtime_mvc/application/models/airtime/om/BaseCcLiveLog.php
index 583630ee6..cacb87395 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcLiveLog.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcLiveLog.php
@@ -4,913 +4,989 @@
/**
* Base class that represents a row from the 'cc_live_log' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcLiveLog extends BaseObject implements Persistent
+abstract class BaseCcLiveLog extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcLiveLogPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcLiveLogPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the state field.
- * @var string
- */
- protected $state;
-
- /**
- * The value for the start_time field.
- * @var string
- */
- protected $start_time;
-
- /**
- * The value for the end_time field.
- * @var string
- */
- protected $end_time;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Get the [id] column value.
- *
- * @return int
- */
- public function getDbId()
- {
- return $this->id;
- }
-
- /**
- * Get the [state] column value.
- *
- * @return string
- */
- public function getDbState()
- {
- return $this->state;
- }
-
- /**
- * 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 = 'Y-m-d H:i:s')
- {
- 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 [optionally formatted] temporal [end_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 getDbEndTime($format = 'Y-m-d H:i:s')
- {
- if ($this->end_time === null) {
- return null;
- }
-
-
-
- try {
- $dt = new DateTime($this->end_time);
- } catch (Exception $x) {
- throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->end_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);
- }
- }
-
- /**
- * Set the value of [id] column.
- *
- * @param int $v new value
- * @return CcLiveLog 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[] = CcLiveLogPeer::ID;
- }
-
- return $this;
- } // setDbId()
-
- /**
- * Set the value of [state] column.
- *
- * @param string $v new value
- * @return CcLiveLog The current object (for fluent API support)
- */
- public function setDbState($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->state !== $v) {
- $this->state = $v;
- $this->modifiedColumns[] = CcLiveLogPeer::STATE;
- }
-
- return $this;
- } // setDbState()
-
- /**
- * 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 CcLiveLog 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('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_time = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
- $this->modifiedColumns[] = CcLiveLogPeer::START_TIME;
- }
- } // if either are not null
-
- return $this;
- } // setDbStartTime()
-
- /**
- * Sets the value of [end_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 CcLiveLog The current object (for fluent API support)
- */
- public function setDbEndTime($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->end_time !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->end_time !== null && $tmpDt = new DateTime($this->end_time)) ? $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->end_time = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
- $this->modifiedColumns[] = CcLiveLogPeer::END_TIME;
- }
- } // if either are not null
-
- return $this;
- } // setDbEndTime()
-
- /**
- * 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->state = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
- $this->start_time = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
- $this->end_time = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 4; // 4 = CcLiveLogPeer::NUM_COLUMNS - CcLiveLogPeer::NUM_LAZY_LOAD_COLUMNS).
-
- } catch (Exception $e) {
- throw new PropelException("Error populating CcLiveLog 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(CcLiveLogPeer::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 = CcLiveLogPeer::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(CcLiveLogPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $con->beginTransaction();
- try {
- $ret = $this->preDelete($con);
- if ($ret) {
- CcLiveLogQuery::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(CcLiveLogPeer::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);
- CcLiveLogPeer::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[] = CcLiveLogPeer::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(CcLiveLogPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcLiveLogPeer::ID.')');
- }
-
- $pk = BasePeer::doInsert($criteria, $con);
- $affectedRows = 1;
- $this->setDbId($pk); //[IMV] update autoincrement primary key
- $this->setNew(false);
- } else {
- $affectedRows = CcLiveLogPeer::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 = CcLiveLogPeer::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 = CcLiveLogPeer::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->getDbState();
- break;
- case 2:
- return $this->getDbStartTime();
- break;
- case 3:
- return $this->getDbEndTime();
- 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 = CcLiveLogPeer::getFieldNames($keyType);
- $result = array(
- $keys[0] => $this->getDbId(),
- $keys[1] => $this->getDbState(),
- $keys[2] => $this->getDbStartTime(),
- $keys[3] => $this->getDbEndTime(),
- );
- 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 = CcLiveLogPeer::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->setDbState($value);
- break;
- case 2:
- $this->setDbStartTime($value);
- break;
- case 3:
- $this->setDbEndTime($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 = CcLiveLogPeer::getFieldNames($keyType);
-
- if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
- if (array_key_exists($keys[1], $arr)) $this->setDbState($arr[$keys[1]]);
- if (array_key_exists($keys[2], $arr)) $this->setDbStartTime($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setDbEndTime($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(CcLiveLogPeer::DATABASE_NAME);
-
- if ($this->isColumnModified(CcLiveLogPeer::ID)) $criteria->add(CcLiveLogPeer::ID, $this->id);
- if ($this->isColumnModified(CcLiveLogPeer::STATE)) $criteria->add(CcLiveLogPeer::STATE, $this->state);
- if ($this->isColumnModified(CcLiveLogPeer::START_TIME)) $criteria->add(CcLiveLogPeer::START_TIME, $this->start_time);
- if ($this->isColumnModified(CcLiveLogPeer::END_TIME)) $criteria->add(CcLiveLogPeer::END_TIME, $this->end_time);
-
- 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(CcLiveLogPeer::DATABASE_NAME);
- $criteria->add(CcLiveLogPeer::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 CcLiveLog (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->setDbState($this->state);
- $copyObj->setDbStartTime($this->start_time);
- $copyObj->setDbEndTime($this->end_time);
-
- $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 CcLiveLog 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 CcLiveLogPeer
- */
- public function getPeer()
- {
- if (self::$peer === null) {
- self::$peer = new CcLiveLogPeer();
- }
- return self::$peer;
- }
-
- /**
- * Clears the current object and sets all attributes to their default values
- */
- public function clear()
- {
- $this->id = null;
- $this->state = null;
- $this->start_time = null;
- $this->end_time = 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);
- }
-
-} // BaseCcLiveLog
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcLiveLogPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcLiveLogPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the state field.
+ * @var string
+ */
+ protected $state;
+
+ /**
+ * The value for the start_time field.
+ * @var string
+ */
+ protected $start_time;
+
+ /**
+ * The value for the end_time field.
+ * @var string
+ */
+ protected $end_time;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getDbId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [state] column value.
+ *
+ * @return string
+ */
+ public function getDbState()
+ {
+
+ return $this->state;
+ }
+
+ /**
+ * 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 = 'Y-m-d H:i:s')
+ {
+ 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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [end_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 getDbEndTime($format = 'Y-m-d H:i:s')
+ {
+ if ($this->end_time === null) {
+ return null;
+ }
+
+
+ try {
+ $dt = new DateTime($this->end_time);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->end_time, true), $x);
+ }
+
+ if ($format === null) {
+ // Because propel.useDateTimeClass is true, we return a DateTime object.
+ return $dt;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcLiveLog The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcLiveLogPeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [state] column.
+ *
+ * @param string $v new value
+ * @return CcLiveLog The current object (for fluent API support)
+ */
+ public function setDbState($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->state !== $v) {
+ $this->state = $v;
+ $this->modifiedColumns[] = CcLiveLogPeer::STATE;
+ }
+
+
+ return $this;
+ } // setDbState()
+
+ /**
+ * 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 strings are treated as null.
+ * @return CcLiveLog The current object (for fluent API support)
+ */
+ public function setDbStartTime($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->start_time !== null || $dt !== null) {
+ $currentDateAsString = ($this->start_time !== null && $tmpDt = new DateTime($this->start_time)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->start_time = $newDateAsString;
+ $this->modifiedColumns[] = CcLiveLogPeer::START_TIME;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbStartTime()
+
+ /**
+ * Sets the value of [end_time] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or DateTime value.
+ * Empty strings are treated as null.
+ * @return CcLiveLog The current object (for fluent API support)
+ */
+ public function setDbEndTime($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->end_time !== null || $dt !== null) {
+ $currentDateAsString = ($this->end_time !== null && $tmpDt = new DateTime($this->end_time)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->end_time = $newDateAsString;
+ $this->modifiedColumns[] = CcLiveLogPeer::END_TIME;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbEndTime()
+
+ /**
+ * 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 resultset 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->state = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->start_time = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->end_time = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 4; // 4 = CcLiveLogPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcLiveLog 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(CcLiveLogPeer::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 = CcLiveLogPeer::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
+ * @throws Exception
+ * @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(CcLiveLogPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = CcLiveLogQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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(CcLiveLogPeer::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);
+ CcLiveLogPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcLiveLogPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcLiveLogPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_live_log_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcLiveLogPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcLiveLogPeer::STATE)) {
+ $modifiedColumns[':p' . $index++] = '"state"';
+ }
+ if ($this->isColumnModified(CcLiveLogPeer::START_TIME)) {
+ $modifiedColumns[':p' . $index++] = '"start_time"';
+ }
+ if ($this->isColumnModified(CcLiveLogPeer::END_TIME)) {
+ $modifiedColumns[':p' . $index++] = '"end_time"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_live_log" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"state"':
+ $stmt->bindValue($identifier, $this->state, PDO::PARAM_STR);
+ break;
+ case '"start_time"':
+ $stmt->bindValue($identifier, $this->start_time, PDO::PARAM_STR);
+ break;
+ case '"end_time"':
+ $stmt->bindValue($identifier, $this->end_time, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ if (($retval = CcLiveLogPeer::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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcLiveLogPeer::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->getDbState();
+ break;
+ case 2:
+ return $this->getDbStartTime();
+ break;
+ case 3:
+ return $this->getDbEndTime();
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
+ {
+ if (isset($alreadyDumpedObjects['CcLiveLog'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcLiveLog'][$this->getPrimaryKey()] = true;
+ $keys = CcLiveLogPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbState(),
+ $keys[2] => $this->getDbStartTime(),
+ $keys[3] => $this->getDbEndTime(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcLiveLogPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbState($value);
+ break;
+ case 2:
+ $this->setDbStartTime($value);
+ break;
+ case 3:
+ $this->setDbEndTime($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 BasePeer::TYPE_PHPNAME
+ *
+ * @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 = CcLiveLogPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbState($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbStartTime($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbEndTime($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(CcLiveLogPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcLiveLogPeer::ID)) $criteria->add(CcLiveLogPeer::ID, $this->id);
+ if ($this->isColumnModified(CcLiveLogPeer::STATE)) $criteria->add(CcLiveLogPeer::STATE, $this->state);
+ if ($this->isColumnModified(CcLiveLogPeer::START_TIME)) $criteria->add(CcLiveLogPeer::START_TIME, $this->start_time);
+ if ($this->isColumnModified(CcLiveLogPeer::END_TIME)) $criteria->add(CcLiveLogPeer::END_TIME, $this->end_time);
+
+ 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(CcLiveLogPeer::DATABASE_NAME);
+ $criteria->add(CcLiveLogPeer::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 CcLiveLog (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbState($this->getDbState());
+ $copyObj->setDbStartTime($this->getDbStartTime());
+ $copyObj->setDbEndTime($this->getDbEndTime());
+ if ($makeNew) {
+ $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 CcLiveLog 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 CcLiveLogPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcLiveLogPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->state = null;
+ $this->start_time = null;
+ $this->end_time = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcLiveLogPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcLiveLogPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcLiveLogPeer.php
index 0a8cb69c5..1d564519d 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcLiveLogPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcLiveLogPeer.php
@@ -4,742 +4,764 @@
/**
* Base static class for performing query and update operations on the 'cc_live_log' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcLiveLogPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_live_log';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcLiveLog';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcLiveLog';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcLiveLogTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 4;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_live_log.ID';
-
- /** the column name for the STATE field */
- const STATE = 'cc_live_log.STATE';
-
- /** the column name for the START_TIME field */
- const START_TIME = 'cc_live_log.START_TIME';
-
- /** the column name for the END_TIME field */
- const END_TIME = 'cc_live_log.END_TIME';
-
- /**
- * An identiy map to hold any loaded instances of CcLiveLog objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcLiveLog[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbState', 'DbStartTime', 'DbEndTime', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbState', 'dbStartTime', 'dbEndTime', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::STATE, self::START_TIME, self::END_TIME, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STATE', 'START_TIME', 'END_TIME', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'state', 'start_time', 'end_time', ),
- 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, 'DbState' => 1, 'DbStartTime' => 2, 'DbEndTime' => 3, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbState' => 1, 'dbStartTime' => 2, 'dbEndTime' => 3, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STATE => 1, self::START_TIME => 2, self::END_TIME => 3, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STATE' => 1, 'START_TIME' => 2, 'END_TIME' => 3, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'state' => 1, 'start_time' => 2, 'end_time' => 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. CcLiveLogPeer::COLUMN_NAME).
- * @return string
- */
- public static function alias($alias, $column)
- {
- return str_replace(CcLiveLogPeer::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(CcLiveLogPeer::ID);
- $criteria->addSelectColumn(CcLiveLogPeer::STATE);
- $criteria->addSelectColumn(CcLiveLogPeer::START_TIME);
- $criteria->addSelectColumn(CcLiveLogPeer::END_TIME);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.STATE');
- $criteria->addSelectColumn($alias . '.START_TIME');
- $criteria->addSelectColumn($alias . '.END_TIME');
- }
- }
-
- /**
- * 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(CcLiveLogPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcLiveLogPeer::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(CcLiveLogPeer::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 CcLiveLog
- * @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 = CcLiveLogPeer::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 CcLiveLogPeer::populateObjects(CcLiveLogPeer::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(CcLiveLogPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- if (!$criteria->hasSelectClause()) {
- $criteria = clone $criteria;
- CcLiveLogPeer::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 CcLiveLog $value A CcLiveLog object.
- * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
- */
- public static function addInstanceToPool(CcLiveLog $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 CcLiveLog object or a primary key value.
- */
- public static function removeInstanceFromPool($value)
- {
- if (Propel::isInstancePoolingEnabled() && $value !== null) {
- if (is_object($value) && $value instanceof CcLiveLog) {
- $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 CcLiveLog 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 CcLiveLog 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_live_log
- * 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 = CcLiveLogPeer::getOMClass(false);
- // populate the object(s)
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key = CcLiveLogPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj = CcLiveLogPeer::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;
- CcLiveLogPeer::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 (CcLiveLog object, last column rank)
- */
- public static function populateObject($row, $startcol = 0)
- {
- $key = CcLiveLogPeer::getPrimaryKeyHashFromRow($row, $startcol);
- if (null !== ($obj = CcLiveLogPeer::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 + CcLiveLogPeer::NUM_COLUMNS;
- } else {
- $cls = CcLiveLogPeer::OM_CLASS;
- $obj = new $cls();
- $col = $obj->hydrate($row, $startcol);
- CcLiveLogPeer::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(BaseCcLiveLogPeer::DATABASE_NAME);
- if (!$dbMap->hasTable(BaseCcLiveLogPeer::TABLE_NAME))
- {
- $dbMap->addTableObject(new CcLiveLogTableMap());
- }
- }
-
- /**
- * 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 ? CcLiveLogPeer::CLASS_DEFAULT : CcLiveLogPeer::OM_CLASS;
- }
-
- /**
- * Method perform an INSERT on the database, given a CcLiveLog or Criteria object.
- *
- * @param mixed $values Criteria or CcLiveLog 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(CcLiveLogPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
- } else {
- $criteria = $values->buildCriteria(); // build Criteria from CcLiveLog object
- }
-
- if ($criteria->containsKey(CcLiveLogPeer::ID) && $criteria->keyContainsValue(CcLiveLogPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcLiveLogPeer::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 CcLiveLog or Criteria object.
- *
- * @param mixed $values Criteria or CcLiveLog 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(CcLiveLogPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $selectCriteria = new Criteria(self::DATABASE_NAME);
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
-
- $comparison = $criteria->getComparison(CcLiveLogPeer::ID);
- $value = $criteria->remove(CcLiveLogPeer::ID);
- if ($value) {
- $selectCriteria->add(CcLiveLogPeer::ID, $value, $comparison);
- } else {
- $selectCriteria->setPrimaryTableName(CcLiveLogPeer::TABLE_NAME);
- }
-
- } else { // $values is CcLiveLog 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_live_log 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(CcLiveLogPeer::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(CcLiveLogPeer::TABLE_NAME, $con, CcLiveLogPeer::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).
- CcLiveLogPeer::clearInstancePool();
- CcLiveLogPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Method perform a DELETE on the database, given a CcLiveLog or Criteria object OR a primary key value.
- *
- * @param mixed $values Criteria or CcLiveLog 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(CcLiveLogPeer::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.
- CcLiveLogPeer::clearInstancePool();
- // rename for clarity
- $criteria = clone $values;
- } elseif ($values instanceof CcLiveLog) { // it's a model object
- // invalidate the cache for this single object
- CcLiveLogPeer::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(CcLiveLogPeer::ID, (array) $values, Criteria::IN);
- // invalidate the cache for this object(s)
- foreach ((array) $values as $singleval) {
- CcLiveLogPeer::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);
- CcLiveLogPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Validates all modified columns of given CcLiveLog 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 CcLiveLog $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(CcLiveLog $obj, $cols = null)
- {
- $columns = array();
-
- if ($cols) {
- $dbMap = Propel::getDatabaseMap(CcLiveLogPeer::DATABASE_NAME);
- $tableMap = $dbMap->getTable(CcLiveLogPeer::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(CcLiveLogPeer::DATABASE_NAME, CcLiveLogPeer::TABLE_NAME, $columns);
- }
-
- /**
- * Retrieve a single object by pkey.
- *
- * @param int $pk the primary key.
- * @param PropelPDO $con the connection to use
- * @return CcLiveLog
- */
- public static function retrieveByPK($pk, PropelPDO $con = null)
- {
-
- if (null !== ($obj = CcLiveLogPeer::getInstanceFromPool((string) $pk))) {
- return $obj;
- }
-
- if ($con === null) {
- $con = Propel::getConnection(CcLiveLogPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria = new Criteria(CcLiveLogPeer::DATABASE_NAME);
- $criteria->add(CcLiveLogPeer::ID, $pk);
-
- $v = CcLiveLogPeer::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(CcLiveLogPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $objs = null;
- if (empty($pks)) {
- $objs = array();
- } else {
- $criteria = new Criteria(CcLiveLogPeer::DATABASE_NAME);
- $criteria->add(CcLiveLogPeer::ID, $pks, Criteria::IN);
- $objs = CcLiveLogPeer::doSelect($criteria, $con);
- }
- return $objs;
- }
+abstract class BaseCcLiveLogPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_live_log';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcLiveLog';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcLiveLogTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 4;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 4;
+
+ /** the column name for the id field */
+ const ID = 'cc_live_log.id';
+
+ /** the column name for the state field */
+ const STATE = 'cc_live_log.state';
+
+ /** the column name for the start_time field */
+ const START_TIME = 'cc_live_log.start_time';
+
+ /** the column name for the end_time field */
+ const END_TIME = 'cc_live_log.end_time';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcLiveLog objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcLiveLog[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcLiveLogPeer::$fieldNames[CcLiveLogPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbState', 'DbStartTime', 'DbEndTime', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbState', 'dbStartTime', 'dbEndTime', ),
+ BasePeer::TYPE_COLNAME => array (CcLiveLogPeer::ID, CcLiveLogPeer::STATE, CcLiveLogPeer::START_TIME, CcLiveLogPeer::END_TIME, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STATE', 'START_TIME', 'END_TIME', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'state', 'start_time', 'end_time', ),
+ 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. CcLiveLogPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbState' => 1, 'DbStartTime' => 2, 'DbEndTime' => 3, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbState' => 1, 'dbStartTime' => 2, 'dbEndTime' => 3, ),
+ BasePeer::TYPE_COLNAME => array (CcLiveLogPeer::ID => 0, CcLiveLogPeer::STATE => 1, CcLiveLogPeer::START_TIME => 2, CcLiveLogPeer::END_TIME => 3, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STATE' => 1, 'START_TIME' => 2, 'END_TIME' => 3, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'state' => 1, 'start_time' => 2, 'end_time' => 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcLiveLogPeer::getFieldNames($toType);
+ $key = isset(CcLiveLogPeer::$fieldKeys[$fromType][$name]) ? CcLiveLogPeer::$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(CcLiveLogPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcLiveLogPeer::$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 CcLiveLogPeer::$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. CcLiveLogPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcLiveLogPeer::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(CcLiveLogPeer::ID);
+ $criteria->addSelectColumn(CcLiveLogPeer::STATE);
+ $criteria->addSelectColumn(CcLiveLogPeer::START_TIME);
+ $criteria->addSelectColumn(CcLiveLogPeer::END_TIME);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.state');
+ $criteria->addSelectColumn($alias . '.start_time');
+ $criteria->addSelectColumn($alias . '.end_time');
+ }
+ }
+
+ /**
+ * 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(CcLiveLogPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcLiveLogPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(CcLiveLogPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcLiveLogPeer::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;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcLiveLog
+ * @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 = CcLiveLogPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 CcLiveLogPeer::populateObjects(CcLiveLogPeer::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 directly (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(CcLiveLogPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcLiveLogPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcLiveLogPeer::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 CcLiveLog $obj A CcLiveLog object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcLiveLogPeer::$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 CcLiveLog object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcLiveLog) {
+ $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 CcLiveLog object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(CcLiveLogPeer::$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 CcLiveLog 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(CcLiveLogPeer::$instances[$key])) {
+ return CcLiveLogPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcLiveLogPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcLiveLogPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_live_log
+ * 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 = CcLiveLogPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcLiveLogPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcLiveLogPeer::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;
+ CcLiveLogPeer::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 (CcLiveLog object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcLiveLogPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcLiveLogPeer::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 + CcLiveLogPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = CcLiveLogPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcLiveLogPeer::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(CcLiveLogPeer::DATABASE_NAME)->getTable(CcLiveLogPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcLiveLogPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcLiveLogPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \CcLiveLogTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcLiveLogPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a CcLiveLog or Criteria object.
+ *
+ * @param mixed $values Criteria or CcLiveLog 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(CcLiveLogPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcLiveLog object
+ }
+
+ if ($criteria->containsKey(CcLiveLogPeer::ID) && $criteria->keyContainsValue(CcLiveLogPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcLiveLogPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(CcLiveLogPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a CcLiveLog or Criteria object.
+ *
+ * @param mixed $values Criteria or CcLiveLog 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(CcLiveLogPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(CcLiveLogPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcLiveLogPeer::ID);
+ $value = $criteria->remove(CcLiveLogPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcLiveLogPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcLiveLogPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcLiveLog object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(CcLiveLogPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_live_log table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcLiveLogPeer::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(CcLiveLogPeer::TABLE_NAME, $con, CcLiveLogPeer::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).
+ CcLiveLogPeer::clearInstancePool();
+ CcLiveLogPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a CcLiveLog or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcLiveLog 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(CcLiveLogPeer::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.
+ CcLiveLogPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcLiveLog) { // it's a model object
+ // invalidate the cache for this single object
+ CcLiveLogPeer::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(CcLiveLogPeer::DATABASE_NAME);
+ $criteria->add(CcLiveLogPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcLiveLogPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcLiveLogPeer::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);
+ CcLiveLogPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcLiveLog 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 CcLiveLog $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($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcLiveLogPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcLiveLogPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcLiveLogPeer::DATABASE_NAME, CcLiveLogPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcLiveLog
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcLiveLogPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcLiveLogPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcLiveLogPeer::DATABASE_NAME);
+ $criteria->add(CcLiveLogPeer::ID, $pk);
+
+ $v = CcLiveLogPeer::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
+ * @return CcLiveLog[]
+ * @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(CcLiveLogPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcLiveLogPeer::DATABASE_NAME);
+ $criteria->add(CcLiveLogPeer::ID, $pks, Criteria::IN);
+ $objs = CcLiveLogPeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
} // BaseCcLiveLogPeer
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcLiveLogQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcLiveLogQuery.php
index 723d568de..c2badd5d4 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcLiveLogQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcLiveLogQuery.php
@@ -4,258 +4,400 @@
/**
* Base class that represents a query for the 'cc_live_log' table.
*
- *
*
- * @method CcLiveLogQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcLiveLogQuery orderByDbState($order = Criteria::ASC) Order by the state column
- * @method CcLiveLogQuery orderByDbStartTime($order = Criteria::ASC) Order by the start_time column
- * @method CcLiveLogQuery orderByDbEndTime($order = Criteria::ASC) Order by the end_time column
*
- * @method CcLiveLogQuery groupByDbId() Group by the id column
- * @method CcLiveLogQuery groupByDbState() Group by the state column
- * @method CcLiveLogQuery groupByDbStartTime() Group by the start_time column
- * @method CcLiveLogQuery groupByDbEndTime() Group by the end_time column
+ * @method CcLiveLogQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcLiveLogQuery orderByDbState($order = Criteria::ASC) Order by the state column
+ * @method CcLiveLogQuery orderByDbStartTime($order = Criteria::ASC) Order by the start_time column
+ * @method CcLiveLogQuery orderByDbEndTime($order = Criteria::ASC) Order by the end_time column
*
- * @method CcLiveLogQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcLiveLogQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcLiveLogQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcLiveLogQuery groupByDbId() Group by the id column
+ * @method CcLiveLogQuery groupByDbState() Group by the state column
+ * @method CcLiveLogQuery groupByDbStartTime() Group by the start_time column
+ * @method CcLiveLogQuery groupByDbEndTime() Group by the end_time column
*
- * @method CcLiveLog findOne(PropelPDO $con = null) Return the first CcLiveLog matching the query
- * @method CcLiveLog findOneOrCreate(PropelPDO $con = null) Return the first CcLiveLog matching the query, or a new CcLiveLog object populated from the query conditions when no match is found
+ * @method CcLiveLogQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcLiveLogQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcLiveLogQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcLiveLog findOneByDbId(int $id) Return the first CcLiveLog filtered by the id column
- * @method CcLiveLog findOneByDbState(string $state) Return the first CcLiveLog filtered by the state column
- * @method CcLiveLog findOneByDbStartTime(string $start_time) Return the first CcLiveLog filtered by the start_time column
- * @method CcLiveLog findOneByDbEndTime(string $end_time) Return the first CcLiveLog filtered by the end_time column
+ * @method CcLiveLog findOne(PropelPDO $con = null) Return the first CcLiveLog matching the query
+ * @method CcLiveLog findOneOrCreate(PropelPDO $con = null) Return the first CcLiveLog matching the query, or a new CcLiveLog object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcLiveLog objects filtered by the id column
- * @method array findByDbState(string $state) Return CcLiveLog objects filtered by the state column
- * @method array findByDbStartTime(string $start_time) Return CcLiveLog objects filtered by the start_time column
- * @method array findByDbEndTime(string $end_time) Return CcLiveLog objects filtered by the end_time column
+ * @method CcLiveLog findOneByDbState(string $state) Return the first CcLiveLog filtered by the state column
+ * @method CcLiveLog findOneByDbStartTime(string $start_time) Return the first CcLiveLog filtered by the start_time column
+ * @method CcLiveLog findOneByDbEndTime(string $end_time) Return the first CcLiveLog filtered by the end_time column
+ *
+ * @method array findByDbId(int $id) Return CcLiveLog objects filtered by the id column
+ * @method array findByDbState(string $state) Return CcLiveLog objects filtered by the state column
+ * @method array findByDbStartTime(string $start_time) Return CcLiveLog objects filtered by the start_time column
+ * @method array findByDbEndTime(string $end_time) Return CcLiveLog objects filtered by the end_time column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcLiveLogQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcLiveLogQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcLiveLog';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcLiveLogQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcLiveLog', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcLiveLogQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcLiveLogQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcLiveLogQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcLiveLogQuery) {
+ return $criteria;
+ }
+ $query = new CcLiveLogQuery(null, null, $modelAlias);
- /**
- * Returns a new CcLiveLogQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcLiveLogQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcLiveLogQuery) {
- return $criteria;
- }
- $query = new CcLiveLogQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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 CcLiveLog|array|mixed the result, formatted by the current formatter
- */
- public function findPk($key, $con = null)
- {
- if ((null !== ($obj = CcLiveLogPeer::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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcLiveLog|CcLiveLog[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcLiveLogPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcLiveLogPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
- /**
- * Filter the query by primary key
- *
- * @param mixed $key Primary key to use for the query
- *
- * @return CcLiveLogQuery The current query, for fluid interface
- */
- public function filterByPrimaryKey($key)
- {
- return $this->addUsingAlias(CcLiveLogPeer::ID, $key, Criteria::EQUAL);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcLiveLog A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * Filter the query by a list of primary keys
- *
- * @param array $keys The list of primary key to use for the query
- *
- * @return CcLiveLogQuery The current query, for fluid interface
- */
- public function filterByPrimaryKeys($keys)
- {
- return $this->addUsingAlias(CcLiveLogPeer::ID, $keys, Criteria::IN);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcLiveLog A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "state", "start_time", "end_time" FROM "cc_live_log" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcLiveLog();
+ $obj->hydrate($row);
+ CcLiveLogPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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 CcLiveLogQuery 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(CcLiveLogPeer::ID, $dbId, $comparison);
- }
+ return $obj;
+ }
- /**
- * 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 CcLiveLogQuery 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(CcLiveLogPeer::STATE, $dbState, $comparison);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcLiveLog|CcLiveLog[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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 CcLiveLogQuery 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(CcLiveLogPeer::START_TIME, $dbStartTime['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbStartTime['max'])) {
- $this->addUsingAlias(CcLiveLogPeer::START_TIME, $dbStartTime['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcLiveLogPeer::START_TIME, $dbStartTime, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * Filter the query on the end_time column
- *
- * @param string|array $dbEndTime 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 CcLiveLogQuery The current query, for fluid interface
- */
- public function filterByDbEndTime($dbEndTime = null, $comparison = null)
- {
- if (is_array($dbEndTime)) {
- $useMinMax = false;
- if (isset($dbEndTime['min'])) {
- $this->addUsingAlias(CcLiveLogPeer::END_TIME, $dbEndTime['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbEndTime['max'])) {
- $this->addUsingAlias(CcLiveLogPeer::END_TIME, $dbEndTime['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcLiveLogPeer::END_TIME, $dbEndTime, $comparison);
- }
+ /**
+ * 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|CcLiveLog[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * Exclude object from result
- *
- * @param CcLiveLog $ccLiveLog Object to remove from the list of results
- *
- * @return CcLiveLogQuery The current query, for fluid interface
- */
- public function prune($ccLiveLog = null)
- {
- if ($ccLiveLog) {
- $this->addUsingAlias(CcLiveLogPeer::ID, $ccLiveLog->getDbId(), Criteria::NOT_EQUAL);
- }
-
- return $this;
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
-} // BaseCcLiveLogQuery
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcLiveLogQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(CcLiveLogPeer::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 CcLiveLogQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(CcLiveLogPeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcLiveLogQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcLiveLogPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcLiveLogPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcLiveLogPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the state column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbState('fooValue'); // WHERE state = 'fooValue'
+ * $query->filterByDbState('%fooValue%'); // WHERE state LIKE '%fooValue%'
+ *
+ *
+ * @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 CcLiveLogQuery 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(CcLiveLogPeer::STATE, $dbState, $comparison);
+ }
+
+ /**
+ * Filter the query on the start_time column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbStartTime('2011-03-14'); // WHERE start_time = '2011-03-14'
+ * $query->filterByDbStartTime('now'); // WHERE start_time = '2011-03-14'
+ * $query->filterByDbStartTime(array('max' => 'yesterday')); // WHERE start_time < '2011-03-13'
+ *
+ *
+ * @param mixed $dbStartTime The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcLiveLogQuery 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(CcLiveLogPeer::START_TIME, $dbStartTime['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbStartTime['max'])) {
+ $this->addUsingAlias(CcLiveLogPeer::START_TIME, $dbStartTime['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcLiveLogPeer::START_TIME, $dbStartTime, $comparison);
+ }
+
+ /**
+ * Filter the query on the end_time column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbEndTime('2011-03-14'); // WHERE end_time = '2011-03-14'
+ * $query->filterByDbEndTime('now'); // WHERE end_time = '2011-03-14'
+ * $query->filterByDbEndTime(array('max' => 'yesterday')); // WHERE end_time < '2011-03-13'
+ *
+ *
+ * @param mixed $dbEndTime The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcLiveLogQuery The current query, for fluid interface
+ */
+ public function filterByDbEndTime($dbEndTime = null, $comparison = null)
+ {
+ if (is_array($dbEndTime)) {
+ $useMinMax = false;
+ if (isset($dbEndTime['min'])) {
+ $this->addUsingAlias(CcLiveLogPeer::END_TIME, $dbEndTime['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbEndTime['max'])) {
+ $this->addUsingAlias(CcLiveLogPeer::END_TIME, $dbEndTime['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcLiveLogPeer::END_TIME, $dbEndTime, $comparison);
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcLiveLog $ccLiveLog Object to remove from the list of results
+ *
+ * @return CcLiveLogQuery The current query, for fluid interface
+ */
+ public function prune($ccLiveLog = null)
+ {
+ if ($ccLiveLog) {
+ $this->addUsingAlias(CcLiveLogPeer::ID, $ccLiveLog->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcLocale.php b/airtime_mvc/application/models/airtime/om/BaseCcLocale.php
index fdd4d43d8..651c3f1ef 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcLocale.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcLocale.php
@@ -4,761 +4,881 @@
/**
* Base class that represents a row from the 'cc_locale' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcLocale extends BaseObject implements Persistent
+abstract class BaseCcLocale extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcLocalePeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcLocalePeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the locale_code field.
- * @var string
- */
- protected $locale_code;
-
- /**
- * The value for the locale_lang field.
- * @var string
- */
- protected $locale_lang;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Get the [id] column value.
- *
- * @return int
- */
- public function getDbId()
- {
- return $this->id;
- }
-
- /**
- * Get the [locale_code] column value.
- *
- * @return string
- */
- public function getDbLocaleCode()
- {
- return $this->locale_code;
- }
-
- /**
- * Get the [locale_lang] column value.
- *
- * @return string
- */
- public function getDbLocaleLang()
- {
- return $this->locale_lang;
- }
-
- /**
- * Set the value of [id] column.
- *
- * @param int $v new value
- * @return CcLocale 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[] = CcLocalePeer::ID;
- }
-
- return $this;
- } // setDbId()
-
- /**
- * Set the value of [locale_code] column.
- *
- * @param string $v new value
- * @return CcLocale The current object (for fluent API support)
- */
- public function setDbLocaleCode($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->locale_code !== $v) {
- $this->locale_code = $v;
- $this->modifiedColumns[] = CcLocalePeer::LOCALE_CODE;
- }
-
- return $this;
- } // setDbLocaleCode()
-
- /**
- * Set the value of [locale_lang] column.
- *
- * @param string $v new value
- * @return CcLocale The current object (for fluent API support)
- */
- public function setDbLocaleLang($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->locale_lang !== $v) {
- $this->locale_lang = $v;
- $this->modifiedColumns[] = CcLocalePeer::LOCALE_LANG;
- }
-
- return $this;
- } // setDbLocaleLang()
-
- /**
- * 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->locale_code = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
- $this->locale_lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 3; // 3 = CcLocalePeer::NUM_COLUMNS - CcLocalePeer::NUM_LAZY_LOAD_COLUMNS).
-
- } catch (Exception $e) {
- throw new PropelException("Error populating CcLocale 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(CcLocalePeer::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 = CcLocalePeer::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(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $con->beginTransaction();
- try {
- $ret = $this->preDelete($con);
- if ($ret) {
- CcLocaleQuery::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(CcLocalePeer::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);
- CcLocalePeer::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[] = CcLocalePeer::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(CcLocalePeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcLocalePeer::ID.')');
- }
-
- $pk = BasePeer::doInsert($criteria, $con);
- $affectedRows = 1;
- $this->setDbId($pk); //[IMV] update autoincrement primary key
- $this->setNew(false);
- } else {
- $affectedRows = CcLocalePeer::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 = CcLocalePeer::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 = CcLocalePeer::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->getDbLocaleCode();
- break;
- case 2:
- return $this->getDbLocaleLang();
- 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 = CcLocalePeer::getFieldNames($keyType);
- $result = array(
- $keys[0] => $this->getDbId(),
- $keys[1] => $this->getDbLocaleCode(),
- $keys[2] => $this->getDbLocaleLang(),
- );
- 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 = CcLocalePeer::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->setDbLocaleCode($value);
- break;
- case 2:
- $this->setDbLocaleLang($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 = CcLocalePeer::getFieldNames($keyType);
-
- if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
- if (array_key_exists($keys[1], $arr)) $this->setDbLocaleCode($arr[$keys[1]]);
- if (array_key_exists($keys[2], $arr)) $this->setDbLocaleLang($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(CcLocalePeer::DATABASE_NAME);
-
- if ($this->isColumnModified(CcLocalePeer::ID)) $criteria->add(CcLocalePeer::ID, $this->id);
- if ($this->isColumnModified(CcLocalePeer::LOCALE_CODE)) $criteria->add(CcLocalePeer::LOCALE_CODE, $this->locale_code);
- if ($this->isColumnModified(CcLocalePeer::LOCALE_LANG)) $criteria->add(CcLocalePeer::LOCALE_LANG, $this->locale_lang);
-
- 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(CcLocalePeer::DATABASE_NAME);
- $criteria->add(CcLocalePeer::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 CcLocale (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->setDbLocaleCode($this->locale_code);
- $copyObj->setDbLocaleLang($this->locale_lang);
-
- $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 CcLocale 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 CcLocalePeer
- */
- public function getPeer()
- {
- if (self::$peer === null) {
- self::$peer = new CcLocalePeer();
- }
- return self::$peer;
- }
-
- /**
- * Clears the current object and sets all attributes to their default values
- */
- public function clear()
- {
- $this->id = null;
- $this->locale_code = null;
- $this->locale_lang = 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);
- }
-
-} // BaseCcLocale
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcLocalePeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcLocalePeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the locale_code field.
+ * @var string
+ */
+ protected $locale_code;
+
+ /**
+ * The value for the locale_lang field.
+ * @var string
+ */
+ protected $locale_lang;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getDbId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale_code] column value.
+ *
+ * @return string
+ */
+ public function getDbLocaleCode()
+ {
+
+ return $this->locale_code;
+ }
+
+ /**
+ * Get the [locale_lang] column value.
+ *
+ * @return string
+ */
+ public function getDbLocaleLang()
+ {
+
+ return $this->locale_lang;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcLocale The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcLocalePeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [locale_code] column.
+ *
+ * @param string $v new value
+ * @return CcLocale The current object (for fluent API support)
+ */
+ public function setDbLocaleCode($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale_code !== $v) {
+ $this->locale_code = $v;
+ $this->modifiedColumns[] = CcLocalePeer::LOCALE_CODE;
+ }
+
+
+ return $this;
+ } // setDbLocaleCode()
+
+ /**
+ * Set the value of [locale_lang] column.
+ *
+ * @param string $v new value
+ * @return CcLocale The current object (for fluent API support)
+ */
+ public function setDbLocaleLang($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale_lang !== $v) {
+ $this->locale_lang = $v;
+ $this->modifiedColumns[] = CcLocalePeer::LOCALE_LANG;
+ }
+
+
+ return $this;
+ } // setDbLocaleLang()
+
+ /**
+ * 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 resultset 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->locale_code = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->locale_lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 3; // 3 = CcLocalePeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcLocale 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(CcLocalePeer::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 = CcLocalePeer::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
+ * @throws Exception
+ * @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(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = CcLocaleQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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(CcLocalePeer::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);
+ CcLocalePeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcLocalePeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcLocalePeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_locale_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcLocalePeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcLocalePeer::LOCALE_CODE)) {
+ $modifiedColumns[':p' . $index++] = '"locale_code"';
+ }
+ if ($this->isColumnModified(CcLocalePeer::LOCALE_LANG)) {
+ $modifiedColumns[':p' . $index++] = '"locale_lang"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_locale" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"locale_code"':
+ $stmt->bindValue($identifier, $this->locale_code, PDO::PARAM_STR);
+ break;
+ case '"locale_lang"':
+ $stmt->bindValue($identifier, $this->locale_lang, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ if (($retval = CcLocalePeer::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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcLocalePeer::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->getDbLocaleCode();
+ break;
+ case 2:
+ return $this->getDbLocaleLang();
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
+ {
+ if (isset($alreadyDumpedObjects['CcLocale'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcLocale'][$this->getPrimaryKey()] = true;
+ $keys = CcLocalePeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbLocaleCode(),
+ $keys[2] => $this->getDbLocaleLang(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcLocalePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbLocaleCode($value);
+ break;
+ case 2:
+ $this->setDbLocaleLang($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 BasePeer::TYPE_PHPNAME
+ *
+ * @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 = CcLocalePeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbLocaleCode($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbLocaleLang($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(CcLocalePeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcLocalePeer::ID)) $criteria->add(CcLocalePeer::ID, $this->id);
+ if ($this->isColumnModified(CcLocalePeer::LOCALE_CODE)) $criteria->add(CcLocalePeer::LOCALE_CODE, $this->locale_code);
+ if ($this->isColumnModified(CcLocalePeer::LOCALE_LANG)) $criteria->add(CcLocalePeer::LOCALE_LANG, $this->locale_lang);
+
+ 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(CcLocalePeer::DATABASE_NAME);
+ $criteria->add(CcLocalePeer::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 CcLocale (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbLocaleCode($this->getDbLocaleCode());
+ $copyObj->setDbLocaleLang($this->getDbLocaleLang());
+ if ($makeNew) {
+ $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 CcLocale 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 CcLocalePeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcLocalePeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale_code = null;
+ $this->locale_lang = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcLocalePeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcLocalePeer.php b/airtime_mvc/application/models/airtime/om/BaseCcLocalePeer.php
index eebb6a002..73658ced3 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcLocalePeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcLocalePeer.php
@@ -4,737 +4,759 @@
/**
* Base static class for performing query and update operations on the 'cc_locale' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcLocalePeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_locale';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcLocale';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcLocale';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcLocaleTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 3;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_locale.ID';
-
- /** the column name for the LOCALE_CODE field */
- const LOCALE_CODE = 'cc_locale.LOCALE_CODE';
-
- /** the column name for the LOCALE_LANG field */
- const LOCALE_LANG = 'cc_locale.LOCALE_LANG';
-
- /**
- * An identiy map to hold any loaded instances of CcLocale objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcLocale[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbLocaleCode', 'DbLocaleLang', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbLocaleCode', 'dbLocaleLang', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::LOCALE_CODE, self::LOCALE_LANG, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE_CODE', 'LOCALE_LANG', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'locale_code', 'locale_lang', ),
- 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, 'DbLocaleCode' => 1, 'DbLocaleLang' => 2, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbLocaleCode' => 1, 'dbLocaleLang' => 2, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::LOCALE_CODE => 1, self::LOCALE_LANG => 2, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE_CODE' => 1, 'LOCALE_LANG' => 2, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale_code' => 1, 'locale_lang' => 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. CcLocalePeer::COLUMN_NAME).
- * @return string
- */
- public static function alias($alias, $column)
- {
- return str_replace(CcLocalePeer::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(CcLocalePeer::ID);
- $criteria->addSelectColumn(CcLocalePeer::LOCALE_CODE);
- $criteria->addSelectColumn(CcLocalePeer::LOCALE_LANG);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.LOCALE_CODE');
- $criteria->addSelectColumn($alias . '.LOCALE_LANG');
- }
- }
-
- /**
- * 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(CcLocalePeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcLocalePeer::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(CcLocalePeer::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 CcLocale
- * @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 = CcLocalePeer::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 CcLocalePeer::populateObjects(CcLocalePeer::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(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- if (!$criteria->hasSelectClause()) {
- $criteria = clone $criteria;
- CcLocalePeer::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 CcLocale $value A CcLocale object.
- * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
- */
- public static function addInstanceToPool(CcLocale $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 CcLocale object or a primary key value.
- */
- public static function removeInstanceFromPool($value)
- {
- if (Propel::isInstancePoolingEnabled() && $value !== null) {
- if (is_object($value) && $value instanceof CcLocale) {
- $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 CcLocale 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 CcLocale 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_locale
- * 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 = CcLocalePeer::getOMClass(false);
- // populate the object(s)
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key = CcLocalePeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj = CcLocalePeer::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;
- CcLocalePeer::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 (CcLocale object, last column rank)
- */
- public static function populateObject($row, $startcol = 0)
- {
- $key = CcLocalePeer::getPrimaryKeyHashFromRow($row, $startcol);
- if (null !== ($obj = CcLocalePeer::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 + CcLocalePeer::NUM_COLUMNS;
- } else {
- $cls = CcLocalePeer::OM_CLASS;
- $obj = new $cls();
- $col = $obj->hydrate($row, $startcol);
- CcLocalePeer::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(BaseCcLocalePeer::DATABASE_NAME);
- if (!$dbMap->hasTable(BaseCcLocalePeer::TABLE_NAME))
- {
- $dbMap->addTableObject(new CcLocaleTableMap());
- }
- }
-
- /**
- * 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 ? CcLocalePeer::CLASS_DEFAULT : CcLocalePeer::OM_CLASS;
- }
-
- /**
- * Method perform an INSERT on the database, given a CcLocale or Criteria object.
- *
- * @param mixed $values Criteria or CcLocale 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(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
- } else {
- $criteria = $values->buildCriteria(); // build Criteria from CcLocale object
- }
-
- if ($criteria->containsKey(CcLocalePeer::ID) && $criteria->keyContainsValue(CcLocalePeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcLocalePeer::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 CcLocale or Criteria object.
- *
- * @param mixed $values Criteria or CcLocale 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(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $selectCriteria = new Criteria(self::DATABASE_NAME);
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
-
- $comparison = $criteria->getComparison(CcLocalePeer::ID);
- $value = $criteria->remove(CcLocalePeer::ID);
- if ($value) {
- $selectCriteria->add(CcLocalePeer::ID, $value, $comparison);
- } else {
- $selectCriteria->setPrimaryTableName(CcLocalePeer::TABLE_NAME);
- }
-
- } else { // $values is CcLocale 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_locale 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(CcLocalePeer::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(CcLocalePeer::TABLE_NAME, $con, CcLocalePeer::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).
- CcLocalePeer::clearInstancePool();
- CcLocalePeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Method perform a DELETE on the database, given a CcLocale or Criteria object OR a primary key value.
- *
- * @param mixed $values Criteria or CcLocale 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(CcLocalePeer::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.
- CcLocalePeer::clearInstancePool();
- // rename for clarity
- $criteria = clone $values;
- } elseif ($values instanceof CcLocale) { // it's a model object
- // invalidate the cache for this single object
- CcLocalePeer::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(CcLocalePeer::ID, (array) $values, Criteria::IN);
- // invalidate the cache for this object(s)
- foreach ((array) $values as $singleval) {
- CcLocalePeer::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);
- CcLocalePeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Validates all modified columns of given CcLocale 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 CcLocale $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(CcLocale $obj, $cols = null)
- {
- $columns = array();
-
- if ($cols) {
- $dbMap = Propel::getDatabaseMap(CcLocalePeer::DATABASE_NAME);
- $tableMap = $dbMap->getTable(CcLocalePeer::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(CcLocalePeer::DATABASE_NAME, CcLocalePeer::TABLE_NAME, $columns);
- }
-
- /**
- * Retrieve a single object by pkey.
- *
- * @param int $pk the primary key.
- * @param PropelPDO $con the connection to use
- * @return CcLocale
- */
- public static function retrieveByPK($pk, PropelPDO $con = null)
- {
-
- if (null !== ($obj = CcLocalePeer::getInstanceFromPool((string) $pk))) {
- return $obj;
- }
-
- if ($con === null) {
- $con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria = new Criteria(CcLocalePeer::DATABASE_NAME);
- $criteria->add(CcLocalePeer::ID, $pk);
-
- $v = CcLocalePeer::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(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $objs = null;
- if (empty($pks)) {
- $objs = array();
- } else {
- $criteria = new Criteria(CcLocalePeer::DATABASE_NAME);
- $criteria->add(CcLocalePeer::ID, $pks, Criteria::IN);
- $objs = CcLocalePeer::doSelect($criteria, $con);
- }
- return $objs;
- }
+abstract class BaseCcLocalePeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_locale';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcLocale';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcLocaleTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 3;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 3;
+
+ /** the column name for the id field */
+ const ID = 'cc_locale.id';
+
+ /** the column name for the locale_code field */
+ const LOCALE_CODE = 'cc_locale.locale_code';
+
+ /** the column name for the locale_lang field */
+ const LOCALE_LANG = 'cc_locale.locale_lang';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcLocale objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcLocale[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcLocalePeer::$fieldNames[CcLocalePeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbLocaleCode', 'DbLocaleLang', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbLocaleCode', 'dbLocaleLang', ),
+ BasePeer::TYPE_COLNAME => array (CcLocalePeer::ID, CcLocalePeer::LOCALE_CODE, CcLocalePeer::LOCALE_LANG, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE_CODE', 'LOCALE_LANG', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale_code', 'locale_lang', ),
+ 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. CcLocalePeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbLocaleCode' => 1, 'DbLocaleLang' => 2, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbLocaleCode' => 1, 'dbLocaleLang' => 2, ),
+ BasePeer::TYPE_COLNAME => array (CcLocalePeer::ID => 0, CcLocalePeer::LOCALE_CODE => 1, CcLocalePeer::LOCALE_LANG => 2, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE_CODE' => 1, 'LOCALE_LANG' => 2, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale_code' => 1, 'locale_lang' => 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcLocalePeer::getFieldNames($toType);
+ $key = isset(CcLocalePeer::$fieldKeys[$fromType][$name]) ? CcLocalePeer::$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(CcLocalePeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcLocalePeer::$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 CcLocalePeer::$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. CcLocalePeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcLocalePeer::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(CcLocalePeer::ID);
+ $criteria->addSelectColumn(CcLocalePeer::LOCALE_CODE);
+ $criteria->addSelectColumn(CcLocalePeer::LOCALE_LANG);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.locale_code');
+ $criteria->addSelectColumn($alias . '.locale_lang');
+ }
+ }
+
+ /**
+ * 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(CcLocalePeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcLocalePeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(CcLocalePeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcLocalePeer::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;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcLocale
+ * @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 = CcLocalePeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 CcLocalePeer::populateObjects(CcLocalePeer::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 directly (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(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcLocalePeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcLocalePeer::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 CcLocale $obj A CcLocale object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcLocalePeer::$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 CcLocale object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcLocale) {
+ $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 CcLocale object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(CcLocalePeer::$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 CcLocale 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(CcLocalePeer::$instances[$key])) {
+ return CcLocalePeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcLocalePeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcLocalePeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_locale
+ * 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 = CcLocalePeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcLocalePeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcLocalePeer::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;
+ CcLocalePeer::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 (CcLocale object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcLocalePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcLocalePeer::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 + CcLocalePeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = CcLocalePeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcLocalePeer::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(CcLocalePeer::DATABASE_NAME)->getTable(CcLocalePeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcLocalePeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcLocalePeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \CcLocaleTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcLocalePeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a CcLocale or Criteria object.
+ *
+ * @param mixed $values Criteria or CcLocale 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(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcLocale object
+ }
+
+ if ($criteria->containsKey(CcLocalePeer::ID) && $criteria->keyContainsValue(CcLocalePeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcLocalePeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(CcLocalePeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a CcLocale or Criteria object.
+ *
+ * @param mixed $values Criteria or CcLocale 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(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(CcLocalePeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcLocalePeer::ID);
+ $value = $criteria->remove(CcLocalePeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcLocalePeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcLocalePeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcLocale object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(CcLocalePeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_locale table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcLocalePeer::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(CcLocalePeer::TABLE_NAME, $con, CcLocalePeer::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).
+ CcLocalePeer::clearInstancePool();
+ CcLocalePeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a CcLocale or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcLocale 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(CcLocalePeer::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.
+ CcLocalePeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcLocale) { // it's a model object
+ // invalidate the cache for this single object
+ CcLocalePeer::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(CcLocalePeer::DATABASE_NAME);
+ $criteria->add(CcLocalePeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcLocalePeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcLocalePeer::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);
+ CcLocalePeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcLocale 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 CcLocale $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($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcLocalePeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcLocalePeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcLocalePeer::DATABASE_NAME, CcLocalePeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcLocale
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcLocalePeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcLocalePeer::DATABASE_NAME);
+ $criteria->add(CcLocalePeer::ID, $pk);
+
+ $v = CcLocalePeer::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
+ * @return CcLocale[]
+ * @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(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcLocalePeer::DATABASE_NAME);
+ $criteria->add(CcLocalePeer::ID, $pks, Criteria::IN);
+ $objs = CcLocalePeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
} // BaseCcLocalePeer
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcLocaleQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcLocaleQuery.php
index e12a5971b..ab5960d9b 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcLocaleQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcLocaleQuery.php
@@ -4,214 +4,339 @@
/**
* Base class that represents a query for the 'cc_locale' table.
*
- *
*
- * @method CcLocaleQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcLocaleQuery orderByDbLocaleCode($order = Criteria::ASC) Order by the locale_code column
- * @method CcLocaleQuery orderByDbLocaleLang($order = Criteria::ASC) Order by the locale_lang column
*
- * @method CcLocaleQuery groupByDbId() Group by the id column
- * @method CcLocaleQuery groupByDbLocaleCode() Group by the locale_code column
- * @method CcLocaleQuery groupByDbLocaleLang() Group by the locale_lang column
+ * @method CcLocaleQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcLocaleQuery orderByDbLocaleCode($order = Criteria::ASC) Order by the locale_code column
+ * @method CcLocaleQuery orderByDbLocaleLang($order = Criteria::ASC) Order by the locale_lang column
*
- * @method CcLocaleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcLocaleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcLocaleQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcLocaleQuery groupByDbId() Group by the id column
+ * @method CcLocaleQuery groupByDbLocaleCode() Group by the locale_code column
+ * @method CcLocaleQuery groupByDbLocaleLang() Group by the locale_lang column
*
- * @method CcLocale findOne(PropelPDO $con = null) Return the first CcLocale matching the query
- * @method CcLocale findOneOrCreate(PropelPDO $con = null) Return the first CcLocale matching the query, or a new CcLocale object populated from the query conditions when no match is found
+ * @method CcLocaleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcLocaleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcLocaleQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcLocale findOneByDbId(int $id) Return the first CcLocale filtered by the id column
- * @method CcLocale findOneByDbLocaleCode(string $locale_code) Return the first CcLocale filtered by the locale_code column
- * @method CcLocale findOneByDbLocaleLang(string $locale_lang) Return the first CcLocale filtered by the locale_lang column
+ * @method CcLocale findOne(PropelPDO $con = null) Return the first CcLocale matching the query
+ * @method CcLocale findOneOrCreate(PropelPDO $con = null) Return the first CcLocale matching the query, or a new CcLocale object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcLocale objects filtered by the id column
- * @method array findByDbLocaleCode(string $locale_code) Return CcLocale objects filtered by the locale_code column
- * @method array findByDbLocaleLang(string $locale_lang) Return CcLocale objects filtered by the locale_lang column
+ * @method CcLocale findOneByDbLocaleCode(string $locale_code) Return the first CcLocale filtered by the locale_code column
+ * @method CcLocale findOneByDbLocaleLang(string $locale_lang) Return the first CcLocale filtered by the locale_lang column
+ *
+ * @method array findByDbId(int $id) Return CcLocale objects filtered by the id column
+ * @method array findByDbLocaleCode(string $locale_code) Return CcLocale objects filtered by the locale_code column
+ * @method array findByDbLocaleLang(string $locale_lang) Return CcLocale objects filtered by the locale_lang column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcLocaleQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcLocaleQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcLocale';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcLocaleQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcLocale', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcLocaleQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcLocaleQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcLocaleQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcLocaleQuery) {
+ return $criteria;
+ }
+ $query = new CcLocaleQuery(null, null, $modelAlias);
- /**
- * Returns a new CcLocaleQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcLocaleQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcLocaleQuery) {
- return $criteria;
- }
- $query = new CcLocaleQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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 CcLocale|array|mixed the result, formatted by the current formatter
- */
- public function findPk($key, $con = null)
- {
- if ((null !== ($obj = CcLocalePeer::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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcLocale|CcLocale[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcLocalePeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
- /**
- * Filter the query by primary key
- *
- * @param mixed $key Primary key to use for the query
- *
- * @return CcLocaleQuery The current query, for fluid interface
- */
- public function filterByPrimaryKey($key)
- {
- return $this->addUsingAlias(CcLocalePeer::ID, $key, Criteria::EQUAL);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcLocale A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * Filter the query by a list of primary keys
- *
- * @param array $keys The list of primary key to use for the query
- *
- * @return CcLocaleQuery The current query, for fluid interface
- */
- public function filterByPrimaryKeys($keys)
- {
- return $this->addUsingAlias(CcLocalePeer::ID, $keys, Criteria::IN);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcLocale A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "locale_code", "locale_lang" FROM "cc_locale" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcLocale();
+ $obj->hydrate($row);
+ CcLocalePeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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 CcLocaleQuery 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(CcLocalePeer::ID, $dbId, $comparison);
- }
+ return $obj;
+ }
- /**
- * Filter the query on the locale_code column
- *
- * @param string $dbLocaleCode 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 CcLocaleQuery The current query, for fluid interface
- */
- public function filterByDbLocaleCode($dbLocaleCode = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbLocaleCode)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbLocaleCode)) {
- $dbLocaleCode = str_replace('*', '%', $dbLocaleCode);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcLocalePeer::LOCALE_CODE, $dbLocaleCode, $comparison);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcLocale|CcLocale[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * Filter the query on the locale_lang column
- *
- * @param string $dbLocaleLang 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 CcLocaleQuery The current query, for fluid interface
- */
- public function filterByDbLocaleLang($dbLocaleLang = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbLocaleLang)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbLocaleLang)) {
- $dbLocaleLang = str_replace('*', '%', $dbLocaleLang);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcLocalePeer::LOCALE_LANG, $dbLocaleLang, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * Exclude object from result
- *
- * @param CcLocale $ccLocale Object to remove from the list of results
- *
- * @return CcLocaleQuery The current query, for fluid interface
- */
- public function prune($ccLocale = null)
- {
- if ($ccLocale) {
- $this->addUsingAlias(CcLocalePeer::ID, $ccLocale->getDbId(), Criteria::NOT_EQUAL);
- }
-
- return $this;
- }
+ /**
+ * 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|CcLocale[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
-} // BaseCcLocaleQuery
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcLocaleQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(CcLocalePeer::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 CcLocaleQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(CcLocalePeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcLocaleQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcLocalePeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcLocalePeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcLocalePeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale_code column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLocaleCode('fooValue'); // WHERE locale_code = 'fooValue'
+ * $query->filterByDbLocaleCode('%fooValue%'); // WHERE locale_code LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbLocaleCode 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 CcLocaleQuery The current query, for fluid interface
+ */
+ public function filterByDbLocaleCode($dbLocaleCode = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbLocaleCode)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbLocaleCode)) {
+ $dbLocaleCode = str_replace('*', '%', $dbLocaleCode);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcLocalePeer::LOCALE_CODE, $dbLocaleCode, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale_lang column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLocaleLang('fooValue'); // WHERE locale_lang = 'fooValue'
+ * $query->filterByDbLocaleLang('%fooValue%'); // WHERE locale_lang LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbLocaleLang 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 CcLocaleQuery The current query, for fluid interface
+ */
+ public function filterByDbLocaleLang($dbLocaleLang = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbLocaleLang)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbLocaleLang)) {
+ $dbLocaleLang = str_replace('*', '%', $dbLocaleLang);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcLocalePeer::LOCALE_LANG, $dbLocaleLang, $comparison);
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcLocale $ccLocale Object to remove from the list of results
+ *
+ * @return CcLocaleQuery The current query, for fluid interface
+ */
+ public function prune($ccLocale = null)
+ {
+ if ($ccLocale) {
+ $this->addUsingAlias(CcLocalePeer::ID, $ccLocale->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcLoginAttempts.php b/airtime_mvc/application/models/airtime/om/BaseCcLoginAttempts.php
index b529e12d5..bccc85ab1 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcLoginAttempts.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcLoginAttempts.php
@@ -4,732 +4,838 @@
/**
* Base class that represents a row from the 'cc_login_attempts' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
+abstract class BaseCcLoginAttempts extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcLoginAttemptsPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcLoginAttemptsPeer
- */
- protected static $peer;
-
- /**
- * The value for the ip field.
- * @var string
- */
- protected $ip;
-
- /**
- * The value for the attempts field.
- * Note: this column has a database default value of: 0
- * @var int
- */
- protected $attempts;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Applies default values to this object.
- * This method should be called from the object's constructor (or
- * equivalent initialization method).
- * @see __construct()
- */
- public function applyDefaultValues()
- {
- $this->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
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcLoginAttemptsPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcLoginAttemptsPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the ip field.
+ * @var string
+ */
+ protected $ip;
+
+ /**
+ * The value for the attempts field.
+ * Note: this column has a database default value of: 0
+ * @var int
+ */
+ protected $attempts;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->attempts !== $v) {
+ $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 resultset 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();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 2; // 2 = CcLoginAttemptsPeer::NUM_HYDRATE_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
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcLoginAttemptsQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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 (Exception $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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcLoginAttemptsPeer::IP)) {
+ $modifiedColumns[':p' . $index++] = '"ip"';
+ }
+ if ($this->isColumnModified(CcLoginAttemptsPeer::ATTEMPTS)) {
+ $modifiedColumns[':p' . $index++] = '"attempts"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_login_attempts" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"ip"':
+ $stmt->bindValue($identifier, $this->ip, PDO::PARAM_STR);
+ break;
+ case '"attempts"':
+ $stmt->bindValue($identifier, $this->attempts, PDO::PARAM_INT);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
+ {
+ if (isset($alreadyDumpedObjects['CcLoginAttempts'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcLoginAttempts'][$this->getPrimaryKey()] = true;
+ $keys = CcLoginAttemptsPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbIP(),
+ $keys[1] => $this->getDbAttempts(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcLoginAttemptsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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 BasePeer::TYPE_PHPNAME
+ *
+ * @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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbAttempts($this->getDbAttempts());
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setDbIP(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 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->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcLoginAttemptsPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcLoginAttemptsPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcLoginAttemptsPeer.php
index 27b4cd90c..b9fcca697 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcLoginAttemptsPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcLoginAttemptsPeer.php
@@ -4,728 +4,750 @@
/**
* Base static class for performing query and update operations on the 'cc_login_attempts' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcLoginAttemptsPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_login_attempts';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcLoginAttempts';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcLoginAttempts';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcLoginAttemptsTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 2;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the IP field */
- const IP = 'cc_login_attempts.IP';
-
- /** the column name for the ATTEMPTS field */
- const ATTEMPTS = 'cc_login_attempts.ATTEMPTS';
-
- /**
- * An identiy map to hold any loaded instances of CcLoginAttempts objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcLoginAttempts[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => 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;
- }
+abstract class BaseCcLoginAttemptsPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_login_attempts';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcLoginAttempts';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcLoginAttemptsTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 2;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 2;
+
+ /** the column name for the ip field */
+ const IP = 'cc_login_attempts.ip';
+
+ /** the column name for the attempts field */
+ const ATTEMPTS = 'cc_login_attempts.attempts';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcLoginAttempts objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcLoginAttempts[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcLoginAttemptsPeer::$fieldNames[CcLoginAttemptsPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbIP', 'DbAttempts', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbIP', 'dbAttempts', ),
+ BasePeer::TYPE_COLNAME => array (CcLoginAttemptsPeer::IP, CcLoginAttemptsPeer::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. CcLoginAttemptsPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbIP' => 0, 'DbAttempts' => 1, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbIP' => 0, 'dbAttempts' => 1, ),
+ BasePeer::TYPE_COLNAME => array (CcLoginAttemptsPeer::IP => 0, CcLoginAttemptsPeer::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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcLoginAttemptsPeer::getFieldNames($toType);
+ $key = isset(CcLoginAttemptsPeer::$fieldKeys[$fromType][$name]) ? CcLoginAttemptsPeer::$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(CcLoginAttemptsPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcLoginAttemptsPeer::$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 CcLoginAttemptsPeer::$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(CcLoginAttemptsPeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcLoginAttemptsPeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbIP();
+ } // if key === null
+ CcLoginAttemptsPeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcLoginAttemptsPeer::$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(CcLoginAttemptsPeer::$instances[$key])) {
+ return CcLoginAttemptsPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcLoginAttemptsPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcLoginAttemptsPeer::$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();
+ // 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_HYDRATE_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(CcLoginAttemptsPeer::DATABASE_NAME)->getTable(CcLoginAttemptsPeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcLoginAttemptsPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcLoginAttemptsPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcLoginAttemptsPeer::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(CcLoginAttemptsPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_login_attempts table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcLoginAttemptsPeer::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(CcLoginAttemptsPeer::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 (Exception $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($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->hasColumn($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
+ * @return CcLoginAttempts[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcLoginAttemptsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcLoginAttemptsQuery.php
index 930f32eda..eb29818c9 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcLoginAttemptsQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcLoginAttemptsQuery.php
@@ -4,202 +4,306 @@
/**
* Base class that represents a query for the 'cc_login_attempts' table.
*
- *
*
- * @method CcLoginAttemptsQuery orderByDbIP($order = Criteria::ASC) Order by the ip column
- * @method CcLoginAttemptsQuery orderByDbAttempts($order = Criteria::ASC) Order by the attempts column
*
- * @method CcLoginAttemptsQuery groupByDbIP() Group by the ip column
- * @method CcLoginAttemptsQuery groupByDbAttempts() Group by the attempts column
+ * @method CcLoginAttemptsQuery orderByDbIP($order = Criteria::ASC) Order by the ip column
+ * @method CcLoginAttemptsQuery orderByDbAttempts($order = Criteria::ASC) Order by the attempts column
*
- * @method CcLoginAttemptsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcLoginAttemptsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcLoginAttemptsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcLoginAttemptsQuery groupByDbIP() Group by the ip column
+ * @method CcLoginAttemptsQuery groupByDbAttempts() Group by the attempts column
*
- * @method CcLoginAttempts findOne(PropelPDO $con = null) Return the first CcLoginAttempts matching the query
- * @method CcLoginAttempts findOneOrCreate(PropelPDO $con = null) Return the first CcLoginAttempts matching the query, or a new CcLoginAttempts object populated from the query conditions when no match is found
+ * @method CcLoginAttemptsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcLoginAttemptsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcLoginAttemptsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcLoginAttempts findOneByDbIP(string $ip) Return the first CcLoginAttempts filtered by the ip column
- * @method CcLoginAttempts findOneByDbAttempts(int $attempts) Return the first CcLoginAttempts filtered by the attempts column
+ * @method CcLoginAttempts findOne(PropelPDO $con = null) Return the first CcLoginAttempts matching the query
+ * @method CcLoginAttempts findOneOrCreate(PropelPDO $con = null) Return the first CcLoginAttempts matching the query, or a new CcLoginAttempts object populated from the query conditions when no match is found
*
- * @method array findByDbIP(string $ip) Return CcLoginAttempts objects filtered by the ip column
- * @method array findByDbAttempts(int $attempts) Return CcLoginAttempts objects filtered by the attempts column
+ * @method CcLoginAttempts findOneByDbAttempts(int $attempts) Return the first CcLoginAttempts filtered by the attempts column
+ *
+ * @method array findByDbIP(string $ip) Return CcLoginAttempts objects filtered by the ip column
+ * @method array findByDbAttempts(int $attempts) Return CcLoginAttempts objects filtered by the attempts column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcLoginAttemptsQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcLoginAttemptsQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcLoginAttempts';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcLoginAttemptsQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcLoginAttempts', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcLoginAttemptsQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcLoginAttemptsQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcLoginAttemptsQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcLoginAttemptsQuery) {
+ return $criteria;
+ }
+ $query = new CcLoginAttemptsQuery(null, null, $modelAlias);
- /**
- * Returns a new CcLoginAttemptsQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcLoginAttemptsQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcLoginAttemptsQuery) {
- return $criteria;
- }
- $query = new CcLoginAttemptsQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcLoginAttempts|CcLoginAttempts[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcLoginAttemptsPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcLoginAttemptsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $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);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcLoginAttempts A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbIP($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcLoginAttempts A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "ip", "attempts" FROM "cc_login_attempts" WHERE "ip" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcLoginAttempts();
+ $obj->hydrate($row);
+ CcLoginAttemptsPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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);
- }
+ return $obj;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcLoginAttempts|CcLoginAttempts[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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;
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
-} // BaseCcLoginAttemptsQuery
+ /**
+ * 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|CcLoginAttempts[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * 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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbIP('fooValue'); // WHERE ip = 'fooValue'
+ * $query->filterByDbIP('%fooValue%'); // WHERE ip LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbAttempts(1234); // WHERE attempts = 1234
+ * $query->filterByDbAttempts(array(12, 34)); // WHERE attempts IN (12, 34)
+ * $query->filterByDbAttempts(array('min' => 12)); // WHERE attempts >= 12
+ * $query->filterByDbAttempts(array('max' => 12)); // WHERE attempts <= 12
+ *
+ *
+ * @param mixed $dbAttempts The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcMountName.php b/airtime_mvc/application/models/airtime/om/BaseCcMountName.php
index b476f05a8..6917ae1ef 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcMountName.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcMountName.php
@@ -4,890 +4,1163 @@
/**
* Base class that represents a row from the 'cc_mount_name' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcMountName extends BaseObject implements Persistent
+abstract class BaseCcMountName extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcMountNamePeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcMountNamePeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the mount_name field.
- * @var string
- */
- protected $mount_name;
-
- /**
- * @var array CcListenerCount[] Collection to store aggregation of CcListenerCount objects.
- */
- protected $collCcListenerCounts;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Get the [id] column value.
- *
- * @return int
- */
- public function getDbId()
- {
- return $this->id;
- }
-
- /**
- * Get the [mount_name] column value.
- *
- * @return string
- */
- public function getDbMountName()
- {
- return $this->mount_name;
- }
-
- /**
- * Set the value of [id] column.
- *
- * @param int $v new value
- * @return CcMountName 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[] = CcMountNamePeer::ID;
- }
-
- return $this;
- } // setDbId()
-
- /**
- * Set the value of [mount_name] column.
- *
- * @param string $v new value
- * @return CcMountName The current object (for fluent API support)
- */
- public function setDbMountName($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->mount_name !== $v) {
- $this->mount_name = $v;
- $this->modifiedColumns[] = CcMountNamePeer::MOUNT_NAME;
- }
-
- return $this;
- } // setDbMountName()
-
- /**
- * 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->mount_name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 2; // 2 = CcMountNamePeer::NUM_COLUMNS - CcMountNamePeer::NUM_LAZY_LOAD_COLUMNS).
-
- } catch (Exception $e) {
- throw new PropelException("Error populating CcMountName 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(CcMountNamePeer::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 = CcMountNamePeer::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->collCcListenerCounts = 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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $con->beginTransaction();
- try {
- $ret = $this->preDelete($con);
- if ($ret) {
- CcMountNameQuery::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(CcMountNamePeer::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);
- CcMountNamePeer::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[] = CcMountNamePeer::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(CcMountNamePeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcMountNamePeer::ID.')');
- }
-
- $pk = BasePeer::doInsert($criteria, $con);
- $affectedRows = 1;
- $this->setDbId($pk); //[IMV] update autoincrement primary key
- $this->setNew(false);
- } else {
- $affectedRows = CcMountNamePeer::doUpdate($this, $con);
- }
-
- $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
- }
-
- if ($this->collCcListenerCounts !== null) {
- foreach ($this->collCcListenerCounts 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 = CcMountNamePeer::doValidate($this, $columns)) !== true) {
- $failureMap = array_merge($failureMap, $retval);
- }
-
-
- if ($this->collCcListenerCounts !== null) {
- foreach ($this->collCcListenerCounts 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 = CcMountNamePeer::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->getDbMountName();
- 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 = CcMountNamePeer::getFieldNames($keyType);
- $result = array(
- $keys[0] => $this->getDbId(),
- $keys[1] => $this->getDbMountName(),
- );
- 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 = CcMountNamePeer::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->setDbMountName($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 = CcMountNamePeer::getFieldNames($keyType);
-
- if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
- if (array_key_exists($keys[1], $arr)) $this->setDbMountName($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(CcMountNamePeer::DATABASE_NAME);
-
- if ($this->isColumnModified(CcMountNamePeer::ID)) $criteria->add(CcMountNamePeer::ID, $this->id);
- if ($this->isColumnModified(CcMountNamePeer::MOUNT_NAME)) $criteria->add(CcMountNamePeer::MOUNT_NAME, $this->mount_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(CcMountNamePeer::DATABASE_NAME);
- $criteria->add(CcMountNamePeer::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 CcMountName (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->setDbMountName($this->mount_name);
-
- 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->getCcListenerCounts() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addCcListenerCount($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 CcMountName 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 CcMountNamePeer
- */
- public function getPeer()
- {
- if (self::$peer === null) {
- self::$peer = new CcMountNamePeer();
- }
- return self::$peer;
- }
-
- /**
- * Clears out the collCcListenerCounts 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 addCcListenerCounts()
- */
- public function clearCcListenerCounts()
- {
- $this->collCcListenerCounts = null; // important to set this to NULL since that means it is uninitialized
- }
-
- /**
- * Initializes the collCcListenerCounts collection.
- *
- * By default this just sets the collCcListenerCounts collection to an empty array (like clearcollCcListenerCounts());
- * 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 initCcListenerCounts()
- {
- $this->collCcListenerCounts = new PropelObjectCollection();
- $this->collCcListenerCounts->setModel('CcListenerCount');
- }
-
- /**
- * Gets an array of CcListenerCount 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 CcMountName 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 CcListenerCount[] List of CcListenerCount objects
- * @throws PropelException
- */
- public function getCcListenerCounts($criteria = null, PropelPDO $con = null)
- {
- if(null === $this->collCcListenerCounts || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcListenerCounts) {
- // return empty collection
- $this->initCcListenerCounts();
- } else {
- $collCcListenerCounts = CcListenerCountQuery::create(null, $criteria)
- ->filterByCcMountName($this)
- ->find($con);
- if (null !== $criteria) {
- return $collCcListenerCounts;
- }
- $this->collCcListenerCounts = $collCcListenerCounts;
- }
- }
- return $this->collCcListenerCounts;
- }
-
- /**
- * Returns the number of related CcListenerCount objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related CcListenerCount objects.
- * @throws PropelException
- */
- public function countCcListenerCounts(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- if(null === $this->collCcListenerCounts || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcListenerCounts) {
- return 0;
- } else {
- $query = CcListenerCountQuery::create(null, $criteria);
- if($distinct) {
- $query->distinct();
- }
- return $query
- ->filterByCcMountName($this)
- ->count($con);
- }
- } else {
- return count($this->collCcListenerCounts);
- }
- }
-
- /**
- * Method called to associate a CcListenerCount object to this object
- * through the CcListenerCount foreign key attribute.
- *
- * @param CcListenerCount $l CcListenerCount
- * @return void
- * @throws PropelException
- */
- public function addCcListenerCount(CcListenerCount $l)
- {
- if ($this->collCcListenerCounts === null) {
- $this->initCcListenerCounts();
- }
- if (!$this->collCcListenerCounts->contains($l)) { // only add it if the **same** object is not already associated
- $this->collCcListenerCounts[]= $l;
- $l->setCcMountName($this);
- }
- }
-
-
- /**
- * If this collection has already been initialized with
- * an identical criteria, it returns the collection.
- * Otherwise if this CcMountName is new, it will return
- * an empty collection; or if this CcMountName has previously
- * been saved, it will retrieve related CcListenerCounts 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 CcMountName.
- *
- * @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 CcListenerCount[] List of CcListenerCount objects
- */
- public function getCcListenerCountsJoinCcTimestamp($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
- {
- $query = CcListenerCountQuery::create(null, $criteria);
- $query->joinWith('CcTimestamp', $join_behavior);
-
- return $this->getCcListenerCounts($query, $con);
- }
-
- /**
- * Clears the current object and sets all attributes to their default values
- */
- public function clear()
- {
- $this->id = null;
- $this->mount_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 ($this->collCcListenerCounts) {
- foreach ((array) $this->collCcListenerCounts as $o) {
- $o->clearAllReferences($deep);
- }
- }
- } // if ($deep)
-
- $this->collCcListenerCounts = 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);
- }
-
-} // BaseCcMountName
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcMountNamePeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcMountNamePeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the mount_name field.
+ * @var string
+ */
+ protected $mount_name;
+
+ /**
+ * @var PropelObjectCollection|CcListenerCount[] Collection to store aggregation of CcListenerCount objects.
+ */
+ protected $collCcListenerCounts;
+ protected $collCcListenerCountsPartial;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccListenerCountsScheduledForDeletion = null;
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getDbId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [mount_name] column value.
+ *
+ * @return string
+ */
+ public function getDbMountName()
+ {
+
+ return $this->mount_name;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcMountName The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcMountNamePeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [mount_name] column.
+ *
+ * @param string $v new value
+ * @return CcMountName The current object (for fluent API support)
+ */
+ public function setDbMountName($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->mount_name !== $v) {
+ $this->mount_name = $v;
+ $this->modifiedColumns[] = CcMountNamePeer::MOUNT_NAME;
+ }
+
+
+ return $this;
+ } // setDbMountName()
+
+ /**
+ * 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 resultset 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->mount_name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 2; // 2 = CcMountNamePeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcMountName 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(CcMountNamePeer::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 = CcMountNamePeer::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->collCcListenerCounts = null;
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = CcMountNameQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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(CcMountNamePeer::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);
+ CcMountNamePeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ if ($this->ccListenerCountsScheduledForDeletion !== null) {
+ if (!$this->ccListenerCountsScheduledForDeletion->isEmpty()) {
+ CcListenerCountQuery::create()
+ ->filterByPrimaryKeys($this->ccListenerCountsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccListenerCountsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcListenerCounts !== null) {
+ foreach ($this->collCcListenerCounts as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcMountNamePeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcMountNamePeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_mount_name_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcMountNamePeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcMountNamePeer::MOUNT_NAME)) {
+ $modifiedColumns[':p' . $index++] = '"mount_name"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_mount_name" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"mount_name"':
+ $stmt->bindValue($identifier, $this->mount_name, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ if (($retval = CcMountNamePeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+ if ($this->collCcListenerCounts !== null) {
+ foreach ($this->collCcListenerCounts 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcMountNamePeer::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->getDbMountName();
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcMountName'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcMountName'][$this->getPrimaryKey()] = true;
+ $keys = CcMountNamePeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbMountName(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->collCcListenerCounts) {
+ $result['CcListenerCounts'] = $this->collCcListenerCounts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ }
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcMountNamePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbMountName($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 BasePeer::TYPE_PHPNAME
+ *
+ * @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 = CcMountNamePeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbMountName($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(CcMountNamePeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcMountNamePeer::ID)) $criteria->add(CcMountNamePeer::ID, $this->id);
+ if ($this->isColumnModified(CcMountNamePeer::MOUNT_NAME)) $criteria->add(CcMountNamePeer::MOUNT_NAME, $this->mount_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(CcMountNamePeer::DATABASE_NAME);
+ $criteria->add(CcMountNamePeer::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 CcMountName (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbMountName($this->getDbMountName());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ foreach ($this->getCcListenerCounts() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcListenerCount($relObj->copy($deepCopy));
+ }
+ }
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 CcMountName 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 CcMountNamePeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcMountNamePeer();
+ }
+
+ return self::$peer;
+ }
+
+
+ /**
+ * Initializes a collection based on the name of a relation.
+ * Avoids crafting an 'init[$relationName]s' method name
+ * that wouldn't work when StandardEnglishPluralizer is used.
+ *
+ * @param string $relationName The name of the relation to initialize
+ * @return void
+ */
+ public function initRelation($relationName)
+ {
+ if ('CcListenerCount' == $relationName) {
+ $this->initCcListenerCounts();
+ }
+ }
+
+ /**
+ * Clears out the collCcListenerCounts 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 CcMountName The current object (for fluent API support)
+ * @see addCcListenerCounts()
+ */
+ public function clearCcListenerCounts()
+ {
+ $this->collCcListenerCounts = null; // important to set this to null since that means it is uninitialized
+ $this->collCcListenerCountsPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcListenerCounts collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcListenerCounts($v = true)
+ {
+ $this->collCcListenerCountsPartial = $v;
+ }
+
+ /**
+ * Initializes the collCcListenerCounts collection.
+ *
+ * By default this just sets the collCcListenerCounts collection to an empty array (like clearcollCcListenerCounts());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcListenerCounts($overrideExisting = true)
+ {
+ if (null !== $this->collCcListenerCounts && !$overrideExisting) {
+ return;
+ }
+ $this->collCcListenerCounts = new PropelObjectCollection();
+ $this->collCcListenerCounts->setModel('CcListenerCount');
+ }
+
+ /**
+ * Gets an array of CcListenerCount 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 CcMountName 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 PropelObjectCollection|CcListenerCount[] List of CcListenerCount objects
+ * @throws PropelException
+ */
+ public function getCcListenerCounts($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcListenerCountsPartial && !$this->isNew();
+ if (null === $this->collCcListenerCounts || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcListenerCounts) {
+ // return empty collection
+ $this->initCcListenerCounts();
+ } else {
+ $collCcListenerCounts = CcListenerCountQuery::create(null, $criteria)
+ ->filterByCcMountName($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcListenerCountsPartial && count($collCcListenerCounts)) {
+ $this->initCcListenerCounts(false);
+
+ foreach ($collCcListenerCounts as $obj) {
+ if (false == $this->collCcListenerCounts->contains($obj)) {
+ $this->collCcListenerCounts->append($obj);
+ }
+ }
+
+ $this->collCcListenerCountsPartial = true;
+ }
+
+ $collCcListenerCounts->getInternalIterator()->rewind();
+
+ return $collCcListenerCounts;
+ }
+
+ if ($partial && $this->collCcListenerCounts) {
+ foreach ($this->collCcListenerCounts as $obj) {
+ if ($obj->isNew()) {
+ $collCcListenerCounts[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcListenerCounts = $collCcListenerCounts;
+ $this->collCcListenerCountsPartial = false;
+ }
+ }
+
+ return $this->collCcListenerCounts;
+ }
+
+ /**
+ * Sets a collection of CcListenerCount objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccListenerCounts A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcMountName The current object (for fluent API support)
+ */
+ public function setCcListenerCounts(PropelCollection $ccListenerCounts, PropelPDO $con = null)
+ {
+ $ccListenerCountsToDelete = $this->getCcListenerCounts(new Criteria(), $con)->diff($ccListenerCounts);
+
+
+ $this->ccListenerCountsScheduledForDeletion = $ccListenerCountsToDelete;
+
+ foreach ($ccListenerCountsToDelete as $ccListenerCountRemoved) {
+ $ccListenerCountRemoved->setCcMountName(null);
+ }
+
+ $this->collCcListenerCounts = null;
+ foreach ($ccListenerCounts as $ccListenerCount) {
+ $this->addCcListenerCount($ccListenerCount);
+ }
+
+ $this->collCcListenerCounts = $ccListenerCounts;
+ $this->collCcListenerCountsPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related CcListenerCount objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcListenerCount objects.
+ * @throws PropelException
+ */
+ public function countCcListenerCounts(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collCcListenerCountsPartial && !$this->isNew();
+ if (null === $this->collCcListenerCounts || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcListenerCounts) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcListenerCounts());
+ }
+ $query = CcListenerCountQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcMountName($this)
+ ->count($con);
+ }
+
+ return count($this->collCcListenerCounts);
+ }
+
+ /**
+ * Method called to associate a CcListenerCount object to this object
+ * through the CcListenerCount foreign key attribute.
+ *
+ * @param CcListenerCount $l CcListenerCount
+ * @return CcMountName The current object (for fluent API support)
+ */
+ public function addCcListenerCount(CcListenerCount $l)
+ {
+ if ($this->collCcListenerCounts === null) {
+ $this->initCcListenerCounts();
+ $this->collCcListenerCountsPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcListenerCounts->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcListenerCount($l);
+
+ if ($this->ccListenerCountsScheduledForDeletion and $this->ccListenerCountsScheduledForDeletion->contains($l)) {
+ $this->ccListenerCountsScheduledForDeletion->remove($this->ccListenerCountsScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcListenerCount $ccListenerCount The ccListenerCount object to add.
+ */
+ protected function doAddCcListenerCount($ccListenerCount)
+ {
+ $this->collCcListenerCounts[]= $ccListenerCount;
+ $ccListenerCount->setCcMountName($this);
+ }
+
+ /**
+ * @param CcListenerCount $ccListenerCount The ccListenerCount object to remove.
+ * @return CcMountName The current object (for fluent API support)
+ */
+ public function removeCcListenerCount($ccListenerCount)
+ {
+ if ($this->getCcListenerCounts()->contains($ccListenerCount)) {
+ $this->collCcListenerCounts->remove($this->collCcListenerCounts->search($ccListenerCount));
+ if (null === $this->ccListenerCountsScheduledForDeletion) {
+ $this->ccListenerCountsScheduledForDeletion = clone $this->collCcListenerCounts;
+ $this->ccListenerCountsScheduledForDeletion->clear();
+ }
+ $this->ccListenerCountsScheduledForDeletion[]= clone $ccListenerCount;
+ $ccListenerCount->setCcMountName(null);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this CcMountName is new, it will return
+ * an empty collection; or if this CcMountName has previously
+ * been saved, it will retrieve related CcListenerCounts 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 CcMountName.
+ *
+ * @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 PropelObjectCollection|CcListenerCount[] List of CcListenerCount objects
+ */
+ public function getCcListenerCountsJoinCcTimestamp($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcListenerCountQuery::create(null, $criteria);
+ $query->joinWith('CcTimestamp', $join_behavior);
+
+ return $this->getCcListenerCounts($query, $con);
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->mount_name = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->collCcListenerCounts) {
+ foreach ($this->collCcListenerCounts as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ if ($this->collCcListenerCounts instanceof PropelCollection) {
+ $this->collCcListenerCounts->clearIterator();
+ }
+ $this->collCcListenerCounts = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcMountNamePeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcMountNamePeer.php b/airtime_mvc/application/models/airtime/om/BaseCcMountNamePeer.php
index af2e416b1..ebbdb596e 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcMountNamePeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcMountNamePeer.php
@@ -4,735 +4,757 @@
/**
* Base static class for performing query and update operations on the 'cc_mount_name' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcMountNamePeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_mount_name';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcMountName';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcMountName';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcMountNameTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 2;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_mount_name.ID';
-
- /** the column name for the MOUNT_NAME field */
- const MOUNT_NAME = 'cc_mount_name.MOUNT_NAME';
-
- /**
- * An identiy map to hold any loaded instances of CcMountName objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcMountName[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbMountName', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbMountName', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::MOUNT_NAME, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'MOUNT_NAME', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'mount_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 ('DbId' => 0, 'DbMountName' => 1, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbMountName' => 1, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::MOUNT_NAME => 1, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'MOUNT_NAME' => 1, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'mount_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. CcMountNamePeer::COLUMN_NAME).
- * @return string
- */
- public static function alias($alias, $column)
- {
- return str_replace(CcMountNamePeer::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(CcMountNamePeer::ID);
- $criteria->addSelectColumn(CcMountNamePeer::MOUNT_NAME);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.MOUNT_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(CcMountNamePeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcMountNamePeer::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(CcMountNamePeer::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 CcMountName
- * @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 = CcMountNamePeer::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 CcMountNamePeer::populateObjects(CcMountNamePeer::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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- if (!$criteria->hasSelectClause()) {
- $criteria = clone $criteria;
- CcMountNamePeer::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 CcMountName $value A CcMountName object.
- * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
- */
- public static function addInstanceToPool(CcMountName $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 CcMountName object or a primary key value.
- */
- public static function removeInstanceFromPool($value)
- {
- if (Propel::isInstancePoolingEnabled() && $value !== null) {
- if (is_object($value) && $value instanceof CcMountName) {
- $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 CcMountName 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 CcMountName 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_mount_name
- * by a foreign key with ON DELETE CASCADE
- */
- public static function clearRelatedInstancePool()
- {
- // Invalidate objects in CcListenerCountPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CcListenerCountPeer::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 = CcMountNamePeer::getOMClass(false);
- // populate the object(s)
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key = CcMountNamePeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj = CcMountNamePeer::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;
- CcMountNamePeer::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 (CcMountName object, last column rank)
- */
- public static function populateObject($row, $startcol = 0)
- {
- $key = CcMountNamePeer::getPrimaryKeyHashFromRow($row, $startcol);
- if (null !== ($obj = CcMountNamePeer::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 + CcMountNamePeer::NUM_COLUMNS;
- } else {
- $cls = CcMountNamePeer::OM_CLASS;
- $obj = new $cls();
- $col = $obj->hydrate($row, $startcol);
- CcMountNamePeer::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(BaseCcMountNamePeer::DATABASE_NAME);
- if (!$dbMap->hasTable(BaseCcMountNamePeer::TABLE_NAME))
- {
- $dbMap->addTableObject(new CcMountNameTableMap());
- }
- }
-
- /**
- * 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 ? CcMountNamePeer::CLASS_DEFAULT : CcMountNamePeer::OM_CLASS;
- }
-
- /**
- * Method perform an INSERT on the database, given a CcMountName or Criteria object.
- *
- * @param mixed $values Criteria or CcMountName 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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
- } else {
- $criteria = $values->buildCriteria(); // build Criteria from CcMountName object
- }
-
- if ($criteria->containsKey(CcMountNamePeer::ID) && $criteria->keyContainsValue(CcMountNamePeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcMountNamePeer::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 CcMountName or Criteria object.
- *
- * @param mixed $values Criteria or CcMountName 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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $selectCriteria = new Criteria(self::DATABASE_NAME);
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
-
- $comparison = $criteria->getComparison(CcMountNamePeer::ID);
- $value = $criteria->remove(CcMountNamePeer::ID);
- if ($value) {
- $selectCriteria->add(CcMountNamePeer::ID, $value, $comparison);
- } else {
- $selectCriteria->setPrimaryTableName(CcMountNamePeer::TABLE_NAME);
- }
-
- } else { // $values is CcMountName 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_mount_name 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(CcMountNamePeer::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(CcMountNamePeer::TABLE_NAME, $con, CcMountNamePeer::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).
- CcMountNamePeer::clearInstancePool();
- CcMountNamePeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Method perform a DELETE on the database, given a CcMountName or Criteria object OR a primary key value.
- *
- * @param mixed $values Criteria or CcMountName 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(CcMountNamePeer::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.
- CcMountNamePeer::clearInstancePool();
- // rename for clarity
- $criteria = clone $values;
- } elseif ($values instanceof CcMountName) { // it's a model object
- // invalidate the cache for this single object
- CcMountNamePeer::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(CcMountNamePeer::ID, (array) $values, Criteria::IN);
- // invalidate the cache for this object(s)
- foreach ((array) $values as $singleval) {
- CcMountNamePeer::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);
- CcMountNamePeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Validates all modified columns of given CcMountName 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 CcMountName $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(CcMountName $obj, $cols = null)
- {
- $columns = array();
-
- if ($cols) {
- $dbMap = Propel::getDatabaseMap(CcMountNamePeer::DATABASE_NAME);
- $tableMap = $dbMap->getTable(CcMountNamePeer::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(CcMountNamePeer::DATABASE_NAME, CcMountNamePeer::TABLE_NAME, $columns);
- }
-
- /**
- * Retrieve a single object by pkey.
- *
- * @param int $pk the primary key.
- * @param PropelPDO $con the connection to use
- * @return CcMountName
- */
- public static function retrieveByPK($pk, PropelPDO $con = null)
- {
-
- if (null !== ($obj = CcMountNamePeer::getInstanceFromPool((string) $pk))) {
- return $obj;
- }
-
- if ($con === null) {
- $con = Propel::getConnection(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria = new Criteria(CcMountNamePeer::DATABASE_NAME);
- $criteria->add(CcMountNamePeer::ID, $pk);
-
- $v = CcMountNamePeer::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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $objs = null;
- if (empty($pks)) {
- $objs = array();
- } else {
- $criteria = new Criteria(CcMountNamePeer::DATABASE_NAME);
- $criteria->add(CcMountNamePeer::ID, $pks, Criteria::IN);
- $objs = CcMountNamePeer::doSelect($criteria, $con);
- }
- return $objs;
- }
+abstract class BaseCcMountNamePeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_mount_name';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcMountName';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcMountNameTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 2;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 2;
+
+ /** the column name for the id field */
+ const ID = 'cc_mount_name.id';
+
+ /** the column name for the mount_name field */
+ const MOUNT_NAME = 'cc_mount_name.mount_name';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcMountName objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcMountName[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcMountNamePeer::$fieldNames[CcMountNamePeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbMountName', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbMountName', ),
+ BasePeer::TYPE_COLNAME => array (CcMountNamePeer::ID, CcMountNamePeer::MOUNT_NAME, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'MOUNT_NAME', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'mount_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. CcMountNamePeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbMountName' => 1, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbMountName' => 1, ),
+ BasePeer::TYPE_COLNAME => array (CcMountNamePeer::ID => 0, CcMountNamePeer::MOUNT_NAME => 1, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'MOUNT_NAME' => 1, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'mount_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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcMountNamePeer::getFieldNames($toType);
+ $key = isset(CcMountNamePeer::$fieldKeys[$fromType][$name]) ? CcMountNamePeer::$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(CcMountNamePeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcMountNamePeer::$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 CcMountNamePeer::$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. CcMountNamePeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcMountNamePeer::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(CcMountNamePeer::ID);
+ $criteria->addSelectColumn(CcMountNamePeer::MOUNT_NAME);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.mount_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(CcMountNamePeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcMountNamePeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(CcMountNamePeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcMountNamePeer::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;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcMountName
+ * @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 = CcMountNamePeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 CcMountNamePeer::populateObjects(CcMountNamePeer::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 directly (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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcMountNamePeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcMountNamePeer::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 CcMountName $obj A CcMountName object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcMountNamePeer::$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 CcMountName object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcMountName) {
+ $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 CcMountName object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(CcMountNamePeer::$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 CcMountName 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(CcMountNamePeer::$instances[$key])) {
+ return CcMountNamePeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcMountNamePeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcMountNamePeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_mount_name
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ // Invalidate objects in CcListenerCountPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcListenerCountPeer::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 = CcMountNamePeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcMountNamePeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcMountNamePeer::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;
+ CcMountNamePeer::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 (CcMountName object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcMountNamePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcMountNamePeer::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 + CcMountNamePeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = CcMountNamePeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcMountNamePeer::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(CcMountNamePeer::DATABASE_NAME)->getTable(CcMountNamePeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcMountNamePeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcMountNamePeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \CcMountNameTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcMountNamePeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a CcMountName or Criteria object.
+ *
+ * @param mixed $values Criteria or CcMountName 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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcMountName object
+ }
+
+ if ($criteria->containsKey(CcMountNamePeer::ID) && $criteria->keyContainsValue(CcMountNamePeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcMountNamePeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(CcMountNamePeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a CcMountName or Criteria object.
+ *
+ * @param mixed $values Criteria or CcMountName 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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(CcMountNamePeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcMountNamePeer::ID);
+ $value = $criteria->remove(CcMountNamePeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcMountNamePeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcMountNamePeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcMountName object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(CcMountNamePeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_mount_name table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcMountNamePeer::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(CcMountNamePeer::TABLE_NAME, $con, CcMountNamePeer::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).
+ CcMountNamePeer::clearInstancePool();
+ CcMountNamePeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a CcMountName or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcMountName 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(CcMountNamePeer::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.
+ CcMountNamePeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcMountName) { // it's a model object
+ // invalidate the cache for this single object
+ CcMountNamePeer::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(CcMountNamePeer::DATABASE_NAME);
+ $criteria->add(CcMountNamePeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcMountNamePeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcMountNamePeer::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);
+ CcMountNamePeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcMountName 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 CcMountName $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($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcMountNamePeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcMountNamePeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcMountNamePeer::DATABASE_NAME, CcMountNamePeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcMountName
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcMountNamePeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcMountNamePeer::DATABASE_NAME);
+ $criteria->add(CcMountNamePeer::ID, $pk);
+
+ $v = CcMountNamePeer::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
+ * @return CcMountName[]
+ * @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(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcMountNamePeer::DATABASE_NAME);
+ $criteria->add(CcMountNamePeer::ID, $pks, Criteria::IN);
+ $objs = CcMountNamePeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
} // BaseCcMountNamePeer
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcMountNameQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcMountNameQuery.php
index 52af75f38..af0f6befc 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcMountNameQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcMountNameQuery.php
@@ -4,256 +4,384 @@
/**
* Base class that represents a query for the 'cc_mount_name' table.
*
- *
*
- * @method CcMountNameQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcMountNameQuery orderByDbMountName($order = Criteria::ASC) Order by the mount_name column
*
- * @method CcMountNameQuery groupByDbId() Group by the id column
- * @method CcMountNameQuery groupByDbMountName() Group by the mount_name column
+ * @method CcMountNameQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcMountNameQuery orderByDbMountName($order = Criteria::ASC) Order by the mount_name column
*
- * @method CcMountNameQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcMountNameQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcMountNameQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcMountNameQuery groupByDbId() Group by the id column
+ * @method CcMountNameQuery groupByDbMountName() Group by the mount_name column
*
- * @method CcMountNameQuery leftJoinCcListenerCount($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcListenerCount relation
- * @method CcMountNameQuery rightJoinCcListenerCount($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcListenerCount relation
- * @method CcMountNameQuery innerJoinCcListenerCount($relationAlias = '') Adds a INNER JOIN clause to the query using the CcListenerCount relation
+ * @method CcMountNameQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcMountNameQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcMountNameQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcMountName findOne(PropelPDO $con = null) Return the first CcMountName matching the query
- * @method CcMountName findOneOrCreate(PropelPDO $con = null) Return the first CcMountName matching the query, or a new CcMountName object populated from the query conditions when no match is found
+ * @method CcMountNameQuery leftJoinCcListenerCount($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcListenerCount relation
+ * @method CcMountNameQuery rightJoinCcListenerCount($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcListenerCount relation
+ * @method CcMountNameQuery innerJoinCcListenerCount($relationAlias = null) Adds a INNER JOIN clause to the query using the CcListenerCount relation
*
- * @method CcMountName findOneByDbId(int $id) Return the first CcMountName filtered by the id column
- * @method CcMountName findOneByDbMountName(string $mount_name) Return the first CcMountName filtered by the mount_name column
+ * @method CcMountName findOne(PropelPDO $con = null) Return the first CcMountName matching the query
+ * @method CcMountName findOneOrCreate(PropelPDO $con = null) Return the first CcMountName matching the query, or a new CcMountName object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcMountName objects filtered by the id column
- * @method array findByDbMountName(string $mount_name) Return CcMountName objects filtered by the mount_name column
+ * @method CcMountName findOneByDbMountName(string $mount_name) Return the first CcMountName filtered by the mount_name column
+ *
+ * @method array findByDbId(int $id) Return CcMountName objects filtered by the id column
+ * @method array findByDbMountName(string $mount_name) Return CcMountName objects filtered by the mount_name column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcMountNameQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcMountNameQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcMountName';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcMountNameQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcMountName', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcMountNameQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcMountNameQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcMountNameQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcMountNameQuery) {
+ return $criteria;
+ }
+ $query = new CcMountNameQuery(null, null, $modelAlias);
- /**
- * Returns a new CcMountNameQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcMountNameQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcMountNameQuery) {
- return $criteria;
- }
- $query = new CcMountNameQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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 CcMountName|array|mixed the result, formatted by the current formatter
- */
- public function findPk($key, $con = null)
- {
- if ((null !== ($obj = CcMountNamePeer::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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcMountName|CcMountName[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcMountNamePeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcMountNamePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
- /**
- * Filter the query by primary key
- *
- * @param mixed $key Primary key to use for the query
- *
- * @return CcMountNameQuery The current query, for fluid interface
- */
- public function filterByPrimaryKey($key)
- {
- return $this->addUsingAlias(CcMountNamePeer::ID, $key, Criteria::EQUAL);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcMountName A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * Filter the query by a list of primary keys
- *
- * @param array $keys The list of primary key to use for the query
- *
- * @return CcMountNameQuery The current query, for fluid interface
- */
- public function filterByPrimaryKeys($keys)
- {
- return $this->addUsingAlias(CcMountNamePeer::ID, $keys, Criteria::IN);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcMountName A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "mount_name" FROM "cc_mount_name" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcMountName();
+ $obj->hydrate($row);
+ CcMountNamePeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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 CcMountNameQuery 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(CcMountNamePeer::ID, $dbId, $comparison);
- }
+ return $obj;
+ }
- /**
- * Filter the query on the mount_name column
- *
- * @param string $dbMountName 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 CcMountNameQuery The current query, for fluid interface
- */
- public function filterByDbMountName($dbMountName = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbMountName)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbMountName)) {
- $dbMountName = str_replace('*', '%', $dbMountName);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcMountNamePeer::MOUNT_NAME, $dbMountName, $comparison);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcMountName|CcMountName[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * Filter the query by a related CcListenerCount object
- *
- * @param CcListenerCount $ccListenerCount the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return CcMountNameQuery The current query, for fluid interface
- */
- public function filterByCcListenerCount($ccListenerCount, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcMountNamePeer::ID, $ccListenerCount->getDbMountNameId(), $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * Adds a JOIN clause to the query using the CcListenerCount relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return CcMountNameQuery The current query, for fluid interface
- */
- public function joinCcListenerCount($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcListenerCount');
-
- // 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, 'CcListenerCount');
- }
-
- return $this;
- }
+ /**
+ * 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|CcMountName[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * Use the CcListenerCount relation CcListenerCount 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 CcListenerCountQuery A secondary query class using the current class as primary query
- */
- public function useCcListenerCountQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinCcListenerCount($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcListenerCount', 'CcListenerCountQuery');
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * Exclude object from result
- *
- * @param CcMountName $ccMountName Object to remove from the list of results
- *
- * @return CcMountNameQuery The current query, for fluid interface
- */
- public function prune($ccMountName = null)
- {
- if ($ccMountName) {
- $this->addUsingAlias(CcMountNamePeer::ID, $ccMountName->getDbId(), Criteria::NOT_EQUAL);
- }
-
- return $this;
- }
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcMountNameQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
-} // BaseCcMountNameQuery
+ return $this->addUsingAlias(CcMountNamePeer::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 CcMountNameQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(CcMountNamePeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcMountNameQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcMountNamePeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcMountNamePeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcMountNamePeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the mount_name column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbMountName('fooValue'); // WHERE mount_name = 'fooValue'
+ * $query->filterByDbMountName('%fooValue%'); // WHERE mount_name LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbMountName 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 CcMountNameQuery The current query, for fluid interface
+ */
+ public function filterByDbMountName($dbMountName = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbMountName)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbMountName)) {
+ $dbMountName = str_replace('*', '%', $dbMountName);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcMountNamePeer::MOUNT_NAME, $dbMountName, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcListenerCount object
+ *
+ * @param CcListenerCount|PropelObjectCollection $ccListenerCount the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcMountNameQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcListenerCount($ccListenerCount, $comparison = null)
+ {
+ if ($ccListenerCount instanceof CcListenerCount) {
+ return $this
+ ->addUsingAlias(CcMountNamePeer::ID, $ccListenerCount->getDbMountNameId(), $comparison);
+ } elseif ($ccListenerCount instanceof PropelObjectCollection) {
+ return $this
+ ->useCcListenerCountQuery()
+ ->filterByPrimaryKeys($ccListenerCount->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcListenerCount() only accepts arguments of type CcListenerCount or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcListenerCount relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcMountNameQuery The current query, for fluid interface
+ */
+ public function joinCcListenerCount($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcListenerCount');
+
+ // 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, 'CcListenerCount');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcListenerCount relation CcListenerCount 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 CcListenerCountQuery A secondary query class using the current class as primary query
+ */
+ public function useCcListenerCountQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcListenerCount($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcListenerCount', 'CcListenerCountQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcMountName $ccMountName Object to remove from the list of results
+ *
+ * @return CcMountNameQuery The current query, for fluid interface
+ */
+ public function prune($ccMountName = null)
+ {
+ if ($ccMountName) {
+ $this->addUsingAlias(CcMountNamePeer::ID, $ccMountName->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcMusicDirs.php b/airtime_mvc/application/models/airtime/om/BaseCcMusicDirs.php
index f58915945..97718b729 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcMusicDirs.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcMusicDirs.php
@@ -4,1092 +4,1406 @@
/**
* Base class that represents a row from the 'cc_music_dirs' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcMusicDirs extends BaseObject implements Persistent
+abstract class BaseCcMusicDirs extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcMusicDirsPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcMusicDirsPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the directory field.
- * @var string
- */
- protected $directory;
-
- /**
- * The value for the type field.
- * @var string
- */
- protected $type;
-
- /**
- * The value for the exists field.
- * Note: this column has a database default value of: true
- * @var boolean
- */
- protected $exists;
-
- /**
- * The value for the watched field.
- * Note: this column has a database default value of: true
- * @var boolean
- */
- protected $watched;
-
- /**
- * @var array CcFiles[] Collection to store aggregation of CcFiles objects.
- */
- protected $collCcFiless;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Applies default values to this object.
- * This method should be called from the object's constructor (or
- * equivalent initialization method).
- * @see __construct()
- */
- public function applyDefaultValues()
- {
- $this->exists = true;
- $this->watched = true;
- }
-
- /**
- * Initializes internal state of BaseCcMusicDirs 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 [directory] column value.
- *
- * @return string
- */
- public function getDirectory()
- {
- return $this->directory;
- }
-
- /**
- * Get the [type] column value.
- *
- * @return string
- */
- public function getType()
- {
- return $this->type;
- }
-
- /**
- * Get the [exists] column value.
- *
- * @return boolean
- */
- public function getExists()
- {
- return $this->exists;
- }
-
- /**
- * Get the [watched] column value.
- *
- * @return boolean
- */
- public function getWatched()
- {
- return $this->watched;
- }
-
- /**
- * 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()
-
- /**
- * Set the value of [exists] column.
- *
- * @param boolean $v new value
- * @return CcMusicDirs The current object (for fluent API support)
- */
- public function setExists($v)
- {
- if ($v !== null) {
- $v = (boolean) $v;
- }
-
- if ($this->exists !== $v || $this->isNew()) {
- $this->exists = $v;
- $this->modifiedColumns[] = CcMusicDirsPeer::EXISTS;
- }
-
- return $this;
- } // setExists()
-
- /**
- * Set the value of [watched] column.
- *
- * @param boolean $v new value
- * @return CcMusicDirs The current object (for fluent API support)
- */
- public function setWatched($v)
- {
- if ($v !== null) {
- $v = (boolean) $v;
- }
-
- if ($this->watched !== $v || $this->isNew()) {
- $this->watched = $v;
- $this->modifiedColumns[] = CcMusicDirsPeer::WATCHED;
- }
-
- return $this;
- } // setWatched()
-
- /**
- * 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->exists !== true) {
- return false;
- }
-
- if ($this->watched !== true) {
- 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->directory = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
- $this->type = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
- $this->exists = ($row[$startcol + 3] !== null) ? (boolean) $row[$startcol + 3] : null;
- $this->watched = ($row[$startcol + 4] !== null) ? (boolean) $row[$startcol + 4] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 5; // 5 = 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;
- case 3:
- return $this->getExists();
- break;
- case 4:
- return $this->getWatched();
- 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(),
- $keys[3] => $this->getExists(),
- $keys[4] => $this->getWatched(),
- );
- 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;
- case 3:
- $this->setExists($value);
- break;
- case 4:
- $this->setWatched($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]]);
- if (array_key_exists($keys[3], $arr)) $this->setExists($arr[$keys[3]]);
- if (array_key_exists($keys[4], $arr)) $this->setWatched($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(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);
- if ($this->isColumnModified(CcMusicDirsPeer::EXISTS)) $criteria->add(CcMusicDirsPeer::EXISTS, $this->exists);
- if ($this->isColumnModified(CcMusicDirsPeer::WATCHED)) $criteria->add(CcMusicDirsPeer::WATCHED, $this->watched);
-
- 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);
- $copyObj->setExists($this->exists);
- $copyObj->setWatched($this->watched);
-
- 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 getCcFilessJoinFkOwner($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
- {
- $query = CcFilesQuery::create(null, $criteria);
- $query->joinWith('FkOwner', $join_behavior);
-
- return $this->getCcFiless($query, $con);
- }
-
-
- /**
- * 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 getCcFilessJoinCcSubjsRelatedByDbEditedby($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
- {
- $query = CcFilesQuery::create(null, $criteria);
- $query->joinWith('CcSubjsRelatedByDbEditedby', $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->exists = null;
- $this->watched = 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->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
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcMusicDirsPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcMusicDirsPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the directory field.
+ * @var string
+ */
+ protected $directory;
+
+ /**
+ * The value for the type field.
+ * @var string
+ */
+ protected $type;
+
+ /**
+ * The value for the exists field.
+ * Note: this column has a database default value of: true
+ * @var boolean
+ */
+ protected $exists;
+
+ /**
+ * The value for the watched field.
+ * Note: this column has a database default value of: true
+ * @var boolean
+ */
+ protected $watched;
+
+ /**
+ * @var PropelObjectCollection|CcFiles[] Collection to store aggregation of CcFiles objects.
+ */
+ protected $collCcFiless;
+ protected $collCcFilessPartial;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccFilessScheduledForDeletion = null;
+
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->exists = true;
+ $this->watched = true;
+ }
+
+ /**
+ * Initializes internal state of BaseCcMusicDirs 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 [directory] column value.
+ *
+ * @return string
+ */
+ public function getDirectory()
+ {
+
+ return $this->directory;
+ }
+
+ /**
+ * Get the [type] column value.
+ *
+ * @return string
+ */
+ public function getType()
+ {
+
+ return $this->type;
+ }
+
+ /**
+ * Get the [exists] column value.
+ *
+ * @return boolean
+ */
+ public function getExists()
+ {
+
+ return $this->exists;
+ }
+
+ /**
+ * Get the [watched] column value.
+ *
+ * @return boolean
+ */
+ public function getWatched()
+ {
+
+ return $this->watched;
+ }
+
+ /**
+ * 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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->type !== $v) {
+ $this->type = $v;
+ $this->modifiedColumns[] = CcMusicDirsPeer::TYPE;
+ }
+
+
+ return $this;
+ } // setType()
+
+ /**
+ * Sets the value of the [exists] column.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ *
+ * @param boolean|integer|string $v The new value
+ * @return CcMusicDirs The current object (for fluent API support)
+ */
+ public function setExists($v)
+ {
+ if ($v !== null) {
+ if (is_string($v)) {
+ $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ } else {
+ $v = (boolean) $v;
+ }
+ }
+
+ if ($this->exists !== $v) {
+ $this->exists = $v;
+ $this->modifiedColumns[] = CcMusicDirsPeer::EXISTS;
+ }
+
+
+ return $this;
+ } // setExists()
+
+ /**
+ * Sets the value of the [watched] column.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ *
+ * @param boolean|integer|string $v The new value
+ * @return CcMusicDirs The current object (for fluent API support)
+ */
+ public function setWatched($v)
+ {
+ if ($v !== null) {
+ if (is_string($v)) {
+ $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ } else {
+ $v = (boolean) $v;
+ }
+ }
+
+ if ($this->watched !== $v) {
+ $this->watched = $v;
+ $this->modifiedColumns[] = CcMusicDirsPeer::WATCHED;
+ }
+
+
+ return $this;
+ } // setWatched()
+
+ /**
+ * 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->exists !== true) {
+ return false;
+ }
+
+ if ($this->watched !== true) {
+ 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 resultset 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->exists = ($row[$startcol + 3] !== null) ? (boolean) $row[$startcol + 3] : null;
+ $this->watched = ($row[$startcol + 4] !== null) ? (boolean) $row[$startcol + 4] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 5; // 5 = CcMusicDirsPeer::NUM_HYDRATE_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
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcMusicDirsQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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 (Exception $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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ if ($this->ccFilessScheduledForDeletion !== null) {
+ if (!$this->ccFilessScheduledForDeletion->isEmpty()) {
+ foreach ($this->ccFilessScheduledForDeletion as $ccFiles) {
+ // need to save related object because we set the relation to null
+ $ccFiles->save($con);
+ }
+ $this->ccFilessScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcFiless !== null) {
+ foreach ($this->collCcFiless as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcMusicDirsPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcMusicDirsPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_music_dirs_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcMusicDirsPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcMusicDirsPeer::DIRECTORY)) {
+ $modifiedColumns[':p' . $index++] = '"directory"';
+ }
+ if ($this->isColumnModified(CcMusicDirsPeer::TYPE)) {
+ $modifiedColumns[':p' . $index++] = '"type"';
+ }
+ if ($this->isColumnModified(CcMusicDirsPeer::EXISTS)) {
+ $modifiedColumns[':p' . $index++] = '"exists"';
+ }
+ if ($this->isColumnModified(CcMusicDirsPeer::WATCHED)) {
+ $modifiedColumns[':p' . $index++] = '"watched"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_music_dirs" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"directory"':
+ $stmt->bindValue($identifier, $this->directory, PDO::PARAM_STR);
+ break;
+ case '"type"':
+ $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR);
+ break;
+ case '"exists"':
+ $stmt->bindValue($identifier, $this->exists, PDO::PARAM_BOOL);
+ break;
+ case '"watched"':
+ $stmt->bindValue($identifier, $this->watched, PDO::PARAM_BOOL);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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;
+ case 3:
+ return $this->getExists();
+ break;
+ case 4:
+ return $this->getWatched();
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcMusicDirs'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcMusicDirs'][$this->getPrimaryKey()] = true;
+ $keys = CcMusicDirsPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getDirectory(),
+ $keys[2] => $this->getType(),
+ $keys[3] => $this->getExists(),
+ $keys[4] => $this->getWatched(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->collCcFiless) {
+ $result['CcFiless'] = $this->collCcFiless->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ }
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcMusicDirsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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;
+ case 3:
+ $this->setExists($value);
+ break;
+ case 4:
+ $this->setWatched($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 BasePeer::TYPE_PHPNAME
+ *
+ * @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]]);
+ if (array_key_exists($keys[3], $arr)) $this->setExists($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setWatched($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(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);
+ if ($this->isColumnModified(CcMusicDirsPeer::EXISTS)) $criteria->add(CcMusicDirsPeer::EXISTS, $this->exists);
+ if ($this->isColumnModified(CcMusicDirsPeer::WATCHED)) $criteria->add(CcMusicDirsPeer::WATCHED, $this->watched);
+
+ 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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDirectory($this->getDirectory());
+ $copyObj->setType($this->getType());
+ $copyObj->setExists($this->getExists());
+ $copyObj->setWatched($this->getWatched());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ 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));
+ }
+ }
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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;
+ }
+
+
+ /**
+ * Initializes a collection based on the name of a relation.
+ * Avoids crafting an 'init[$relationName]s' method name
+ * that wouldn't work when StandardEnglishPluralizer is used.
+ *
+ * @param string $relationName The name of the relation to initialize
+ * @return void
+ */
+ public function initRelation($relationName)
+ {
+ if ('CcFiles' == $relationName) {
+ $this->initCcFiless();
+ }
+ }
+
+ /**
+ * 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 CcMusicDirs The current object (for fluent API support)
+ * @see addCcFiless()
+ */
+ public function clearCcFiless()
+ {
+ $this->collCcFiless = null; // important to set this to null since that means it is uninitialized
+ $this->collCcFilessPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcFiless collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcFiless($v = true)
+ {
+ $this->collCcFilessPartial = $v;
+ }
+
+ /**
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcFiless($overrideExisting = true)
+ {
+ if (null !== $this->collCcFiless && !$overrideExisting) {
+ return;
+ }
+ $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 PropelObjectCollection|CcFiles[] List of CcFiles objects
+ * @throws PropelException
+ */
+ public function getCcFiless($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcFilessPartial && !$this->isNew();
+ if (null === $this->collCcFiless || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcFiless) {
+ // return empty collection
+ $this->initCcFiless();
+ } else {
+ $collCcFiless = CcFilesQuery::create(null, $criteria)
+ ->filterByCcMusicDirs($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcFilessPartial && count($collCcFiless)) {
+ $this->initCcFiless(false);
+
+ foreach ($collCcFiless as $obj) {
+ if (false == $this->collCcFiless->contains($obj)) {
+ $this->collCcFiless->append($obj);
+ }
+ }
+
+ $this->collCcFilessPartial = true;
+ }
+
+ $collCcFiless->getInternalIterator()->rewind();
+
+ return $collCcFiless;
+ }
+
+ if ($partial && $this->collCcFiless) {
+ foreach ($this->collCcFiless as $obj) {
+ if ($obj->isNew()) {
+ $collCcFiless[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcFiless = $collCcFiless;
+ $this->collCcFilessPartial = false;
+ }
+ }
+
+ return $this->collCcFiless;
+ }
+
+ /**
+ * Sets a collection of CcFiles objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccFiless A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcMusicDirs The current object (for fluent API support)
+ */
+ public function setCcFiless(PropelCollection $ccFiless, PropelPDO $con = null)
+ {
+ $ccFilessToDelete = $this->getCcFiless(new Criteria(), $con)->diff($ccFiless);
+
+
+ $this->ccFilessScheduledForDeletion = $ccFilessToDelete;
+
+ foreach ($ccFilessToDelete as $ccFilesRemoved) {
+ $ccFilesRemoved->setCcMusicDirs(null);
+ }
+
+ $this->collCcFiless = null;
+ foreach ($ccFiless as $ccFiles) {
+ $this->addCcFiles($ccFiles);
+ }
+
+ $this->collCcFiless = $ccFiless;
+ $this->collCcFilessPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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)
+ {
+ $partial = $this->collCcFilessPartial && !$this->isNew();
+ if (null === $this->collCcFiless || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcFiless) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcFiless());
+ }
+ $query = CcFilesQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcMusicDirs($this)
+ ->count($con);
+ }
+
+ 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 CcMusicDirs The current object (for fluent API support)
+ */
+ public function addCcFiles(CcFiles $l)
+ {
+ if ($this->collCcFiless === null) {
+ $this->initCcFiless();
+ $this->collCcFilessPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcFiless->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcFiles($l);
+
+ if ($this->ccFilessScheduledForDeletion and $this->ccFilessScheduledForDeletion->contains($l)) {
+ $this->ccFilessScheduledForDeletion->remove($this->ccFilessScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcFiles $ccFiles The ccFiles object to add.
+ */
+ protected function doAddCcFiles($ccFiles)
+ {
+ $this->collCcFiless[]= $ccFiles;
+ $ccFiles->setCcMusicDirs($this);
+ }
+
+ /**
+ * @param CcFiles $ccFiles The ccFiles object to remove.
+ * @return CcMusicDirs The current object (for fluent API support)
+ */
+ public function removeCcFiles($ccFiles)
+ {
+ if ($this->getCcFiless()->contains($ccFiles)) {
+ $this->collCcFiless->remove($this->collCcFiless->search($ccFiles));
+ if (null === $this->ccFilessScheduledForDeletion) {
+ $this->ccFilessScheduledForDeletion = clone $this->collCcFiless;
+ $this->ccFilessScheduledForDeletion->clear();
+ }
+ $this->ccFilessScheduledForDeletion[]= $ccFiles;
+ $ccFiles->setCcMusicDirs(null);
+ }
+
+ return $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 PropelObjectCollection|CcFiles[] List of CcFiles objects
+ */
+ public function getCcFilessJoinFkOwner($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcFilesQuery::create(null, $criteria);
+ $query->joinWith('FkOwner', $join_behavior);
+
+ return $this->getCcFiless($query, $con);
+ }
+
+
+ /**
+ * 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 PropelObjectCollection|CcFiles[] List of CcFiles objects
+ */
+ public function getCcFilessJoinCcSubjsRelatedByDbEditedby($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcFilesQuery::create(null, $criteria);
+ $query->joinWith('CcSubjsRelatedByDbEditedby', $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->exists = null;
+ $this->watched = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->collCcFiless) {
+ foreach ($this->collCcFiless as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ if ($this->collCcFiless instanceof PropelCollection) {
+ $this->collCcFiless->clearIterator();
+ }
+ $this->collCcFiless = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcMusicDirsPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcMusicDirsPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcMusicDirsPeer.php
index 22f30f960..8e4ca38b1 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcMusicDirsPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcMusicDirsPeer.php
@@ -4,747 +4,769 @@
/**
* Base static class for performing query and update operations on the 'cc_music_dirs' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcMusicDirsPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_music_dirs';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcMusicDirs';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcMusicDirs';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcMusicDirsTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 5;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_music_dirs.ID';
-
- /** the column name for the DIRECTORY field */
- const DIRECTORY = 'cc_music_dirs.DIRECTORY';
-
- /** the column name for the TYPE field */
- const TYPE = 'cc_music_dirs.TYPE';
-
- /** the column name for the EXISTS field */
- const EXISTS = 'cc_music_dirs.EXISTS';
-
- /** the column name for the WATCHED field */
- const WATCHED = 'cc_music_dirs.WATCHED';
-
- /**
- * An identiy map to hold any loaded instances of CcMusicDirs objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcMusicDirs[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('Id', 'Directory', 'Type', 'Exists', 'Watched', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'directory', 'type', 'exists', 'watched', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::DIRECTORY, self::TYPE, self::EXISTS, self::WATCHED, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'DIRECTORY', 'TYPE', 'EXISTS', 'WATCHED', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'directory', 'type', 'exists', 'watched', ),
- 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, 'Directory' => 1, 'Type' => 2, 'Exists' => 3, 'Watched' => 4, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'directory' => 1, 'type' => 2, 'exists' => 3, 'watched' => 4, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::DIRECTORY => 1, self::TYPE => 2, self::EXISTS => 3, self::WATCHED => 4, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'DIRECTORY' => 1, 'TYPE' => 2, 'EXISTS' => 3, 'WATCHED' => 4, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'directory' => 1, 'type' => 2, 'exists' => 3, 'watched' => 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. 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);
- $criteria->addSelectColumn(CcMusicDirsPeer::EXISTS);
- $criteria->addSelectColumn(CcMusicDirsPeer::WATCHED);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.DIRECTORY');
- $criteria->addSelectColumn($alias . '.TYPE');
- $criteria->addSelectColumn($alias . '.EXISTS');
- $criteria->addSelectColumn($alias . '.WATCHED');
- }
- }
-
- /**
- * 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()
- {
- }
-
- /**
- * 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;
- }
+abstract class BaseCcMusicDirsPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_music_dirs';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcMusicDirs';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcMusicDirsTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 5;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 5;
+
+ /** the column name for the id field */
+ const ID = 'cc_music_dirs.id';
+
+ /** the column name for the directory field */
+ const DIRECTORY = 'cc_music_dirs.directory';
+
+ /** the column name for the type field */
+ const TYPE = 'cc_music_dirs.type';
+
+ /** the column name for the exists field */
+ const EXISTS = 'cc_music_dirs.exists';
+
+ /** the column name for the watched field */
+ const WATCHED = 'cc_music_dirs.watched';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcMusicDirs objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcMusicDirs[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcMusicDirsPeer::$fieldNames[CcMusicDirsPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Id', 'Directory', 'Type', 'Exists', 'Watched', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'directory', 'type', 'exists', 'watched', ),
+ BasePeer::TYPE_COLNAME => array (CcMusicDirsPeer::ID, CcMusicDirsPeer::DIRECTORY, CcMusicDirsPeer::TYPE, CcMusicDirsPeer::EXISTS, CcMusicDirsPeer::WATCHED, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'DIRECTORY', 'TYPE', 'EXISTS', 'WATCHED', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'directory', 'type', 'exists', 'watched', ),
+ 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. CcMusicDirsPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Directory' => 1, 'Type' => 2, 'Exists' => 3, 'Watched' => 4, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'directory' => 1, 'type' => 2, 'exists' => 3, 'watched' => 4, ),
+ BasePeer::TYPE_COLNAME => array (CcMusicDirsPeer::ID => 0, CcMusicDirsPeer::DIRECTORY => 1, CcMusicDirsPeer::TYPE => 2, CcMusicDirsPeer::EXISTS => 3, CcMusicDirsPeer::WATCHED => 4, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'DIRECTORY' => 1, 'TYPE' => 2, 'EXISTS' => 3, 'WATCHED' => 4, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'directory' => 1, 'type' => 2, 'exists' => 3, 'watched' => 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcMusicDirsPeer::getFieldNames($toType);
+ $key = isset(CcMusicDirsPeer::$fieldKeys[$fromType][$name]) ? CcMusicDirsPeer::$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(CcMusicDirsPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcMusicDirsPeer::$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 CcMusicDirsPeer::$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);
+ $criteria->addSelectColumn(CcMusicDirsPeer::EXISTS);
+ $criteria->addSelectColumn(CcMusicDirsPeer::WATCHED);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.directory');
+ $criteria->addSelectColumn($alias . '.type');
+ $criteria->addSelectColumn($alias . '.exists');
+ $criteria->addSelectColumn($alias . '.watched');
+ }
+ }
+
+ /**
+ * 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(CcMusicDirsPeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcMusicDirsPeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getId();
+ } // if key === null
+ CcMusicDirsPeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcMusicDirsPeer::$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(CcMusicDirsPeer::$instances[$key])) {
+ return CcMusicDirsPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcMusicDirsPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcMusicDirsPeer::$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()
+ {
+ }
+
+ /**
+ * 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();
+ // 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_HYDRATE_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(CcMusicDirsPeer::DATABASE_NAME)->getTable(CcMusicDirsPeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcMusicDirsPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcMusicDirsPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcMusicDirsPeer::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(CcMusicDirsPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_music_dirs table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcMusicDirsPeer::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(CcMusicDirsPeer::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 (Exception $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($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->hasColumn($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
+ * @return CcMusicDirs[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcMusicDirsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcMusicDirsQuery.php
index 31bbec3d4..016ba51e0 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcMusicDirsQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcMusicDirsQuery.php
@@ -4,324 +4,479 @@
/**
* Base class that represents a query for the 'cc_music_dirs' table.
*
- *
*
- * @method CcMusicDirsQuery orderById($order = Criteria::ASC) Order by the id column
- * @method CcMusicDirsQuery orderByDirectory($order = Criteria::ASC) Order by the directory column
- * @method CcMusicDirsQuery orderByType($order = Criteria::ASC) Order by the type column
- * @method CcMusicDirsQuery orderByExists($order = Criteria::ASC) Order by the exists column
- * @method CcMusicDirsQuery orderByWatched($order = Criteria::ASC) Order by the watched column
*
- * @method CcMusicDirsQuery groupById() Group by the id column
- * @method CcMusicDirsQuery groupByDirectory() Group by the directory column
- * @method CcMusicDirsQuery groupByType() Group by the type column
- * @method CcMusicDirsQuery groupByExists() Group by the exists column
- * @method CcMusicDirsQuery groupByWatched() Group by the watched column
+ * @method CcMusicDirsQuery orderById($order = Criteria::ASC) Order by the id column
+ * @method CcMusicDirsQuery orderByDirectory($order = Criteria::ASC) Order by the directory column
+ * @method CcMusicDirsQuery orderByType($order = Criteria::ASC) Order by the type column
+ * @method CcMusicDirsQuery orderByExists($order = Criteria::ASC) Order by the exists column
+ * @method CcMusicDirsQuery orderByWatched($order = Criteria::ASC) Order by the watched column
*
- * @method CcMusicDirsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcMusicDirsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcMusicDirsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcMusicDirsQuery groupById() Group by the id column
+ * @method CcMusicDirsQuery groupByDirectory() Group by the directory column
+ * @method CcMusicDirsQuery groupByType() Group by the type column
+ * @method CcMusicDirsQuery groupByExists() Group by the exists column
+ * @method CcMusicDirsQuery groupByWatched() Group by the watched column
*
- * @method CcMusicDirsQuery leftJoinCcFiles($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFiles relation
- * @method CcMusicDirsQuery rightJoinCcFiles($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFiles relation
- * @method CcMusicDirsQuery innerJoinCcFiles($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFiles relation
+ * @method CcMusicDirsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcMusicDirsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcMusicDirsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcMusicDirs findOne(PropelPDO $con = null) Return the first CcMusicDirs matching the query
- * @method CcMusicDirs findOneOrCreate(PropelPDO $con = null) Return the first CcMusicDirs matching the query, or a new CcMusicDirs object populated from the query conditions when no match is found
+ * @method CcMusicDirsQuery leftJoinCcFiles($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcFiles relation
+ * @method CcMusicDirsQuery rightJoinCcFiles($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcFiles relation
+ * @method CcMusicDirsQuery innerJoinCcFiles($relationAlias = null) Adds a INNER JOIN clause to the query using the CcFiles relation
*
- * @method CcMusicDirs findOneById(int $id) Return the first CcMusicDirs filtered by the id column
- * @method CcMusicDirs findOneByDirectory(string $directory) Return the first CcMusicDirs filtered by the directory column
- * @method CcMusicDirs findOneByType(string $type) Return the first CcMusicDirs filtered by the type column
- * @method CcMusicDirs findOneByExists(boolean $exists) Return the first CcMusicDirs filtered by the exists column
- * @method CcMusicDirs findOneByWatched(boolean $watched) Return the first CcMusicDirs filtered by the watched column
+ * @method CcMusicDirs findOne(PropelPDO $con = null) Return the first CcMusicDirs matching the query
+ * @method CcMusicDirs findOneOrCreate(PropelPDO $con = null) Return the first CcMusicDirs matching the query, or a new CcMusicDirs object populated from the query conditions when no match is found
*
- * @method array findById(int $id) Return CcMusicDirs objects filtered by the id column
- * @method array findByDirectory(string $directory) Return CcMusicDirs objects filtered by the directory column
- * @method array findByType(string $type) Return CcMusicDirs objects filtered by the type column
- * @method array findByExists(boolean $exists) Return CcMusicDirs objects filtered by the exists column
- * @method array findByWatched(boolean $watched) Return CcMusicDirs objects filtered by the watched column
+ * @method CcMusicDirs findOneByDirectory(string $directory) Return the first CcMusicDirs filtered by the directory column
+ * @method CcMusicDirs findOneByType(string $type) Return the first CcMusicDirs filtered by the type column
+ * @method CcMusicDirs findOneByExists(boolean $exists) Return the first CcMusicDirs filtered by the exists column
+ * @method CcMusicDirs findOneByWatched(boolean $watched) Return the first CcMusicDirs filtered by the watched column
+ *
+ * @method array findById(int $id) Return CcMusicDirs objects filtered by the id column
+ * @method array findByDirectory(string $directory) Return CcMusicDirs objects filtered by the directory column
+ * @method array findByType(string $type) Return CcMusicDirs objects filtered by the type column
+ * @method array findByExists(boolean $exists) Return CcMusicDirs objects filtered by the exists column
+ * @method array findByWatched(boolean $watched) Return CcMusicDirs objects filtered by the watched column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcMusicDirsQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcMusicDirsQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcMusicDirs';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcMusicDirsQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcMusicDirs', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcMusicDirsQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcMusicDirsQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcMusicDirsQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcMusicDirsQuery) {
+ return $criteria;
+ }
+ $query = new CcMusicDirsQuery(null, null, $modelAlias);
- /**
- * Returns a new CcMusicDirsQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcMusicDirsQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcMusicDirsQuery) {
- return $criteria;
- }
- $query = new CcMusicDirsQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcMusicDirs|CcMusicDirs[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcMusicDirsPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $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);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcMusicDirs A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneById($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcMusicDirs A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "directory", "type", "exists", "watched" FROM "cc_music_dirs" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcMusicDirs();
+ $obj->hydrate($row);
+ CcMusicDirsPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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);
- }
+ return $obj;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcMusicDirs|CcMusicDirs[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * Filter the query on the exists column
- *
- * @param boolean|string $exists 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 CcMusicDirsQuery The current query, for fluid interface
- */
- public function filterByExists($exists = null, $comparison = null)
- {
- if (is_string($exists)) {
- $exists = in_array(strtolower($exists), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
- }
- return $this->addUsingAlias(CcMusicDirsPeer::EXISTS, $exists, $comparison);
- }
+ /**
+ * 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|CcMusicDirs[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * Filter the query on the watched column
- *
- * @param boolean|string $watched 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 CcMusicDirsQuery The current query, for fluid interface
- */
- public function filterByWatched($watched = null, $comparison = null)
- {
- if (is_string($watched)) {
- $watched = in_array(strtolower($watched), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
- }
- return $this->addUsingAlias(CcMusicDirsPeer::WATCHED, $watched, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * 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);
- }
+ /**
+ * 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)
+ {
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcMusicDirsPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * 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 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)
+ {
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcMusicDirsPeer::ID, $keys, Criteria::IN);
+ }
-} // BaseCcMusicDirsQuery
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id >= 12
+ * $query->filterById(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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)) {
+ $useMinMax = false;
+ if (isset($id['min'])) {
+ $this->addUsingAlias(CcMusicDirsPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(CcMusicDirsPeer::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcMusicDirsPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the directory column
+ *
+ * Example usage:
+ *
+ * $query->filterByDirectory('fooValue'); // WHERE directory = 'fooValue'
+ * $query->filterByDirectory('%fooValue%'); // WHERE directory LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByType('fooValue'); // WHERE type = 'fooValue'
+ * $query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%'
+ *
+ *
+ * @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 on the exists column
+ *
+ * Example usage:
+ *
+ * $query->filterByExists(true); // WHERE exists = true
+ * $query->filterByExists('yes'); // WHERE exists = true
+ *
+ *
+ * @param boolean|string $exists The value to use as filter.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcMusicDirsQuery The current query, for fluid interface
+ */
+ public function filterByExists($exists = null, $comparison = null)
+ {
+ if (is_string($exists)) {
+ $exists = in_array(strtolower($exists), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
+
+ return $this->addUsingAlias(CcMusicDirsPeer::EXISTS, $exists, $comparison);
+ }
+
+ /**
+ * Filter the query on the watched column
+ *
+ * Example usage:
+ *
+ * $query->filterByWatched(true); // WHERE watched = true
+ * $query->filterByWatched('yes'); // WHERE watched = true
+ *
+ *
+ * @param boolean|string $watched The value to use as filter.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcMusicDirsQuery The current query, for fluid interface
+ */
+ public function filterByWatched($watched = null, $comparison = null)
+ {
+ if (is_string($watched)) {
+ $watched = in_array(strtolower($watched), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
+
+ return $this->addUsingAlias(CcMusicDirsPeer::WATCHED, $watched, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcFiles object
+ *
+ * @param CcFiles|PropelObjectCollection $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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcFiles($ccFiles, $comparison = null)
+ {
+ if ($ccFiles instanceof CcFiles) {
+ return $this
+ ->addUsingAlias(CcMusicDirsPeer::ID, $ccFiles->getDbDirectory(), $comparison);
+ } elseif ($ccFiles instanceof PropelObjectCollection) {
+ return $this
+ ->useCcFilesQuery()
+ ->filterByPrimaryKeys($ccFiles->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcFiles() only accepts arguments of type CcFiles or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $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;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPerms.php b/airtime_mvc/application/models/airtime/om/BaseCcPerms.php
index a86413fc1..edb76be71 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPerms.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPerms.php
@@ -4,942 +4,1090 @@
/**
* Base class that represents a row from the 'cc_perms' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcPerms extends BaseObject implements Persistent
+abstract class BaseCcPerms extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcPermsPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcPermsPeer
- */
- protected static $peer;
-
- /**
- * The value for the permid field.
- * @var int
- */
- protected $permid;
-
- /**
- * The value for the subj field.
- * @var int
- */
- protected $subj;
-
- /**
- * The value for the action field.
- * @var string
- */
- protected $action;
-
- /**
- * The value for the obj field.
- * @var int
- */
- protected $obj;
-
- /**
- * The value for the type field.
- * @var string
- */
- protected $type;
-
- /**
- * @var CcSubjs
- */
- protected $aCcSubjs;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Get the [permid] column value.
- *
- * @return int
- */
- public function getPermid()
- {
- return $this->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
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcPermsPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcPermsPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the permid field.
+ * @var int
+ */
+ protected $permid;
+
+ /**
+ * The value for the subj field.
+ * @var int
+ */
+ protected $subj;
+
+ /**
+ * The value for the action field.
+ * @var string
+ */
+ protected $action;
+
+ /**
+ * The value for the obj field.
+ * @var int
+ */
+ protected $obj;
+
+ /**
+ * The value for the type field.
+ * @var string
+ */
+ protected $type;
+
+ /**
+ * @var CcSubjs
+ */
+ protected $aCcSubjs;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Get the [permid] column value.
+ *
+ * @return int
+ */
+ public function getPermid()
+ {
+
+ return $this->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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 resultset 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();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 5; // 5 = CcPermsPeer::NUM_HYDRATE_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
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcPermsQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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 (Exception $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 corresponding 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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcPermsPeer::PERMID)) {
+ $modifiedColumns[':p' . $index++] = '"permid"';
+ }
+ if ($this->isColumnModified(CcPermsPeer::SUBJ)) {
+ $modifiedColumns[':p' . $index++] = '"subj"';
+ }
+ if ($this->isColumnModified(CcPermsPeer::ACTION)) {
+ $modifiedColumns[':p' . $index++] = '"action"';
+ }
+ if ($this->isColumnModified(CcPermsPeer::OBJ)) {
+ $modifiedColumns[':p' . $index++] = '"obj"';
+ }
+ if ($this->isColumnModified(CcPermsPeer::TYPE)) {
+ $modifiedColumns[':p' . $index++] = '"type"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_perms" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"permid"':
+ $stmt->bindValue($identifier, $this->permid, PDO::PARAM_INT);
+ break;
+ case '"subj"':
+ $stmt->bindValue($identifier, $this->subj, PDO::PARAM_INT);
+ break;
+ case '"action"':
+ $stmt->bindValue($identifier, $this->action, PDO::PARAM_STR);
+ break;
+ case '"obj"':
+ $stmt->bindValue($identifier, $this->obj, PDO::PARAM_INT);
+ break;
+ case '"type"':
+ $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcPerms'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcPerms'][$this->getPrimaryKey()] = true;
+ $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(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcSubjs) {
+ $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPermsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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 BasePeer::TYPE_PHPNAME
+ *
+ * @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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setSubj($this->getSubj());
+ $copyObj->setAction($this->getAction());
+ $copyObj->setObj($this->getObj());
+ $copyObj->setType($this->getType());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setPermid(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 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 $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcSubjs The associated CcSubjs object.
+ * @throws PropelException
+ */
+ public function getCcSubjs(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcSubjs === null && ($this->subj !== null) && $doQuery) {
+ $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->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->aCcSubjs instanceof Persistent) {
+ $this->aCcSubjs->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ $this->aCcSubjs = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcPermsPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPermsPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcPermsPeer.php
index 4bd4c07ea..ce8abcd4a 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPermsPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPermsPeer.php
@@ -4,977 +4,1003 @@
/**
* Base static class for performing query and update operations on the 'cc_perms' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcPermsPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_perms';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcPerms';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcPerms';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcPermsTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 5;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the PERMID field */
- const PERMID = 'cc_perms.PERMID';
-
- /** the column name for the SUBJ field */
- const SUBJ = 'cc_perms.SUBJ';
-
- /** the column name for the ACTION field */
- const ACTION = 'cc_perms.ACTION';
-
- /** the column name for the OBJ field */
- const OBJ = 'cc_perms.OBJ';
-
- /** the column name for the TYPE field */
- const TYPE = 'cc_perms.TYPE';
-
- /**
- * An identiy map to hold any loaded instances of CcPerms objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcPerms[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => 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;
- }
+abstract class BaseCcPermsPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_perms';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcPerms';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcPermsTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 5;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 5;
+
+ /** the column name for the permid field */
+ const PERMID = 'cc_perms.permid';
+
+ /** the column name for the subj field */
+ const SUBJ = 'cc_perms.subj';
+
+ /** the column name for the action field */
+ const ACTION = 'cc_perms.action';
+
+ /** the column name for the obj field */
+ const OBJ = 'cc_perms.obj';
+
+ /** the column name for the type field */
+ const TYPE = 'cc_perms.type';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcPerms objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcPerms[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcPermsPeer::$fieldNames[CcPermsPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Permid', 'Subj', 'Action', 'Obj', 'Type', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('permid', 'subj', 'action', 'obj', 'type', ),
+ BasePeer::TYPE_COLNAME => array (CcPermsPeer::PERMID, CcPermsPeer::SUBJ, CcPermsPeer::ACTION, CcPermsPeer::OBJ, CcPermsPeer::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. CcPermsPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected 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 (CcPermsPeer::PERMID => 0, CcPermsPeer::SUBJ => 1, CcPermsPeer::ACTION => 2, CcPermsPeer::OBJ => 3, CcPermsPeer::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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcPermsPeer::getFieldNames($toType);
+ $key = isset(CcPermsPeer::$fieldKeys[$fromType][$name]) ? CcPermsPeer::$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(CcPermsPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcPermsPeer::$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 CcPermsPeer::$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(CcPermsPeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcPermsPeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getPermid();
+ } // if key === null
+ CcPermsPeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcPermsPeer::$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(CcPermsPeer::$instances[$key])) {
+ return CcPermsPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcPermsPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcPermsPeer::$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();
+ // 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_HYDRATE_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(CcPermsPeer::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(CcPermsPeer::DATABASE_NAME);
+ }
+
+ CcPermsPeer::addSelectColumns($criteria);
+ $startcol = CcPermsPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcPermsPeer::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(CcPermsPeer::DATABASE_NAME);
+ }
+
+ CcPermsPeer::addSelectColumns($criteria);
+ $startcol2 = CcPermsPeer::NUM_HYDRATE_COLUMNS;
+
+ CcSubjsPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcSubjsPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcPermsPeer::DATABASE_NAME)->getTable(CcPermsPeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcPermsPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcPermsPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcPermsPeer::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(CcPermsPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_perms table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcPermsPeer::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(CcPermsPeer::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 (Exception $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($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->hasColumn($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
+ * @return CcPerms[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPermsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPermsQuery.php
index 5866aa488..f01a73a22 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPermsQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPermsQuery.php
@@ -4,352 +4,513 @@
/**
* Base class that represents a query for the 'cc_perms' table.
*
- *
*
- * @method CcPermsQuery orderByPermid($order = Criteria::ASC) Order by the permid column
- * @method CcPermsQuery orderBySubj($order = Criteria::ASC) Order by the subj column
- * @method CcPermsQuery orderByAction($order = Criteria::ASC) Order by the action column
- * @method CcPermsQuery orderByObj($order = Criteria::ASC) Order by the obj column
- * @method CcPermsQuery orderByType($order = Criteria::ASC) Order by the type column
*
- * @method CcPermsQuery groupByPermid() Group by the permid column
- * @method CcPermsQuery groupBySubj() Group by the subj column
- * @method CcPermsQuery groupByAction() Group by the action column
- * @method CcPermsQuery groupByObj() Group by the obj column
- * @method CcPermsQuery groupByType() Group by the type column
+ * @method CcPermsQuery orderByPermid($order = Criteria::ASC) Order by the permid column
+ * @method CcPermsQuery orderBySubj($order = Criteria::ASC) Order by the subj column
+ * @method CcPermsQuery orderByAction($order = Criteria::ASC) Order by the action column
+ * @method CcPermsQuery orderByObj($order = Criteria::ASC) Order by the obj column
+ * @method CcPermsQuery orderByType($order = Criteria::ASC) Order by the type column
*
- * @method CcPermsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcPermsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcPermsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcPermsQuery groupByPermid() Group by the permid column
+ * @method CcPermsQuery groupBySubj() Group by the subj column
+ * @method CcPermsQuery groupByAction() Group by the action column
+ * @method CcPermsQuery groupByObj() Group by the obj column
+ * @method CcPermsQuery groupByType() Group by the type column
*
- * @method CcPermsQuery leftJoinCcSubjs($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjs relation
- * @method CcPermsQuery rightJoinCcSubjs($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjs relation
- * @method CcPermsQuery innerJoinCcSubjs($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjs relation
+ * @method CcPermsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcPermsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcPermsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcPerms findOne(PropelPDO $con = null) Return the first CcPerms matching the query
- * @method CcPerms findOneOrCreate(PropelPDO $con = null) Return the first CcPerms matching the query, or a new CcPerms object populated from the query conditions when no match is found
+ * @method CcPermsQuery leftJoinCcSubjs($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSubjs relation
+ * @method CcPermsQuery rightJoinCcSubjs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjs relation
+ * @method CcPermsQuery innerJoinCcSubjs($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjs relation
*
- * @method CcPerms findOneByPermid(int $permid) Return the first CcPerms filtered by the permid column
- * @method CcPerms findOneBySubj(int $subj) Return the first CcPerms filtered by the subj column
- * @method CcPerms findOneByAction(string $action) Return the first CcPerms filtered by the action column
- * @method CcPerms findOneByObj(int $obj) Return the first CcPerms filtered by the obj column
- * @method CcPerms findOneByType(string $type) Return the first CcPerms filtered by the type column
+ * @method CcPerms findOne(PropelPDO $con = null) Return the first CcPerms matching the query
+ * @method CcPerms findOneOrCreate(PropelPDO $con = null) Return the first CcPerms matching the query, or a new CcPerms object populated from the query conditions when no match is found
*
- * @method array findByPermid(int $permid) Return CcPerms objects filtered by the permid column
- * @method array findBySubj(int $subj) Return CcPerms objects filtered by the subj column
- * @method array findByAction(string $action) Return CcPerms objects filtered by the action column
- * @method array findByObj(int $obj) Return CcPerms objects filtered by the obj column
- * @method array findByType(string $type) Return CcPerms objects filtered by the type column
+ * @method CcPerms findOneBySubj(int $subj) Return the first CcPerms filtered by the subj column
+ * @method CcPerms findOneByAction(string $action) Return the first CcPerms filtered by the action column
+ * @method CcPerms findOneByObj(int $obj) Return the first CcPerms filtered by the obj column
+ * @method CcPerms findOneByType(string $type) Return the first CcPerms filtered by the type column
+ *
+ * @method array findByPermid(int $permid) Return CcPerms objects filtered by the permid column
+ * @method array findBySubj(int $subj) Return CcPerms objects filtered by the subj column
+ * @method array findByAction(string $action) Return CcPerms objects filtered by the action column
+ * @method array findByObj(int $obj) Return CcPerms objects filtered by the obj column
+ * @method array findByType(string $type) Return CcPerms objects filtered by the type column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPermsQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcPermsQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcPerms';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcPermsQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcPerms', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcPermsQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcPermsQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcPermsQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcPermsQuery) {
+ return $criteria;
+ }
+ $query = new CcPermsQuery(null, null, $modelAlias);
- /**
- * Returns a new CcPermsQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcPermsQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcPermsQuery) {
- return $criteria;
- }
- $query = new CcPermsQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcPerms|CcPerms[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcPermsPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcPermsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $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);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPerms A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByPermid($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPerms A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "permid", "subj", "action", "obj", "type" FROM "cc_perms" WHERE "permid" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcPerms();
+ $obj->hydrate($row);
+ CcPermsPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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);
- }
+ return $obj;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPerms|CcPerms[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * 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);
- }
+ /**
+ * 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|CcPerms[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * 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);
- }
+ /**
+ * 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)
+ {
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcPermsPeer::PERMID, $key, Criteria::EQUAL);
+ }
- /**
- * 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 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)
+ {
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcPermsPeer::PERMID, $keys, Criteria::IN);
+ }
-} // BaseCcPermsQuery
+ /**
+ * Filter the query on the permid column
+ *
+ * Example usage:
+ *
+ * $query->filterByPermid(1234); // WHERE permid = 1234
+ * $query->filterByPermid(array(12, 34)); // WHERE permid IN (12, 34)
+ * $query->filterByPermid(array('min' => 12)); // WHERE permid >= 12
+ * $query->filterByPermid(array('max' => 12)); // WHERE permid <= 12
+ *
+ *
+ * @param mixed $permid The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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)) {
+ $useMinMax = false;
+ if (isset($permid['min'])) {
+ $this->addUsingAlias(CcPermsPeer::PERMID, $permid['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($permid['max'])) {
+ $this->addUsingAlias(CcPermsPeer::PERMID, $permid['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcPermsPeer::PERMID, $permid, $comparison);
+ }
+
+ /**
+ * Filter the query on the subj column
+ *
+ * Example usage:
+ *
+ * $query->filterBySubj(1234); // WHERE subj = 1234
+ * $query->filterBySubj(array(12, 34)); // WHERE subj IN (12, 34)
+ * $query->filterBySubj(array('min' => 12)); // WHERE subj >= 12
+ * $query->filterBySubj(array('max' => 12)); // WHERE subj <= 12
+ *
+ *
+ * @see filterByCcSubjs()
+ *
+ * @param mixed $subj The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByAction('fooValue'); // WHERE action = 'fooValue'
+ * $query->filterByAction('%fooValue%'); // WHERE action LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByObj(1234); // WHERE obj = 1234
+ * $query->filterByObj(array(12, 34)); // WHERE obj IN (12, 34)
+ * $query->filterByObj(array('min' => 12)); // WHERE obj >= 12
+ * $query->filterByObj(array('max' => 12)); // WHERE obj <= 12
+ *
+ *
+ * @param mixed $obj The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByType('fooValue'); // WHERE type = 'fooValue'
+ * $query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%'
+ *
+ *
+ * @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|PropelObjectCollection $ccSubjs The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcSubjs($ccSubjs, $comparison = null)
+ {
+ if ($ccSubjs instanceof CcSubjs) {
+ return $this
+ ->addUsingAlias(CcPermsPeer::SUBJ, $ccSubjs->getDbId(), $comparison);
+ } elseif ($ccSubjs instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcPermsPeer::SUBJ, $ccSubjs->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcSubjs() only accepts arguments of type CcSubjs or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $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;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylist.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylist.php
index 73b081708..29783a952 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylist.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylist.php
@@ -4,1413 +4,1684 @@
/**
* Base class that represents a row from the 'cc_playlist' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcPlaylist extends BaseObject implements Persistent
+abstract class BaseCcPlaylist extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcPlaylistPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcPlaylistPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the name field.
- * Note: this column has a database default value of: ''
- * @var string
- */
- protected $name;
-
- /**
- * The value for the mtime field.
- * @var string
- */
- protected $mtime;
-
- /**
- * The value for the utime field.
- * @var string
- */
- protected $utime;
-
- /**
- * The value for the creator_id field.
- * @var int
- */
- protected $creator_id;
-
- /**
- * The value for the description field.
- * @var string
- */
- protected $description;
-
- /**
- * The value for the length field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $length;
-
- /**
- * @var CcSubjs
- */
- protected $aCcSubjs;
-
- /**
- * @var array CcPlaylistcontents[] Collection to store aggregation of CcPlaylistcontents objects.
- */
- protected $collCcPlaylistcontentss;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Applies default values to this object.
- * This method should be called from the object's constructor (or
- * equivalent initialization method).
- * @see __construct()
- */
- public function applyDefaultValues()
- {
- $this->name = '';
- $this->length = '00:00:00';
- }
-
- /**
- * 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 [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 [optionally formatted] temporal [utime] 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 getDbUtime($format = 'Y-m-d H:i:s')
- {
- if ($this->utime === null) {
- return null;
- }
-
-
-
- try {
- $dt = new DateTime($this->utime);
- } catch (Exception $x) {
- throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->utime, 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_id] column value.
- *
- * @return int
- */
- public function getDbCreatorId()
- {
- return $this->creator_id;
- }
-
- /**
- * Get the [description] column value.
- *
- * @return string
- */
- public function getDbDescription()
- {
- return $this->description;
- }
-
- /**
- * Get the [length] column value.
- *
- * @return string
- */
- public function getDbLength()
- {
- return $this->length;
- }
-
- /**
- * 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()
-
- /**
- * 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()
-
- /**
- * Sets the value of [utime] 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 setDbUtime($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->utime !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->utime !== null && $tmpDt = new DateTime($this->utime)) ? $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->utime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
- $this->modifiedColumns[] = CcPlaylistPeer::UTIME;
- }
- } // if either are not null
-
- return $this;
- } // setDbUtime()
-
- /**
- * Set the value of [creator_id] column.
- *
- * @param int $v new value
- * @return CcPlaylist The current object (for fluent API support)
- */
- public function setDbCreatorId($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->creator_id !== $v) {
- $this->creator_id = $v;
- $this->modifiedColumns[] = CcPlaylistPeer::CREATOR_ID;
- }
-
- if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) {
- $this->aCcSubjs = null;
- }
-
- return $this;
- } // setDbCreatorId()
-
- /**
- * 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()
-
- /**
- * Set the value of [length] column.
- *
- * @param string $v new value
- * @return CcPlaylist The current object (for fluent API support)
- */
- public function setDbLength($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->length !== $v || $this->isNew()) {
- $this->length = $v;
- $this->modifiedColumns[] = CcPlaylistPeer::LENGTH;
- }
-
- return $this;
- } // setDbLength()
-
- /**
- * 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->length !== '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->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
- $this->mtime = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
- $this->utime = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
- $this->creator_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
- $this->description = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
- $this->length = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 7; // 7 = 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->creator_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(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->getDbMtime();
- break;
- case 3:
- return $this->getDbUtime();
- break;
- case 4:
- return $this->getDbCreatorId();
- break;
- case 5:
- return $this->getDbDescription();
- break;
- case 6:
- return $this->getDbLength();
- 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->getDbMtime(),
- $keys[3] => $this->getDbUtime(),
- $keys[4] => $this->getDbCreatorId(),
- $keys[5] => $this->getDbDescription(),
- $keys[6] => $this->getDbLength(),
- );
- 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->setDbMtime($value);
- break;
- case 3:
- $this->setDbUtime($value);
- break;
- case 4:
- $this->setDbCreatorId($value);
- break;
- case 5:
- $this->setDbDescription($value);
- break;
- case 6:
- $this->setDbLength($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->setDbMtime($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setDbUtime($arr[$keys[3]]);
- if (array_key_exists($keys[4], $arr)) $this->setDbCreatorId($arr[$keys[4]]);
- if (array_key_exists($keys[5], $arr)) $this->setDbDescription($arr[$keys[5]]);
- if (array_key_exists($keys[6], $arr)) $this->setDbLength($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(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::MTIME)) $criteria->add(CcPlaylistPeer::MTIME, $this->mtime);
- if ($this->isColumnModified(CcPlaylistPeer::UTIME)) $criteria->add(CcPlaylistPeer::UTIME, $this->utime);
- if ($this->isColumnModified(CcPlaylistPeer::CREATOR_ID)) $criteria->add(CcPlaylistPeer::CREATOR_ID, $this->creator_id);
- if ($this->isColumnModified(CcPlaylistPeer::DESCRIPTION)) $criteria->add(CcPlaylistPeer::DESCRIPTION, $this->description);
- if ($this->isColumnModified(CcPlaylistPeer::LENGTH)) $criteria->add(CcPlaylistPeer::LENGTH, $this->length);
-
- 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->setDbMtime($this->mtime);
- $copyObj->setDbUtime($this->utime);
- $copyObj->setDbCreatorId($this->creator_id);
- $copyObj->setDbDescription($this->description);
- $copyObj->setDbLength($this->length);
-
- 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->setDbCreatorId(NULL);
- } else {
- $this->setDbCreatorId($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->creator_id !== null)) {
- $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->creator_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->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);
- }
-
-
- /**
- * 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 getCcPlaylistcontentssJoinCcBlock($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
- {
- $query = CcPlaylistcontentsQuery::create(null, $criteria);
- $query->joinWith('CcBlock', $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->mtime = null;
- $this->utime = null;
- $this->creator_id = null;
- $this->description = null;
- $this->length = 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;
- }
-
- // aggregate_column behavior
-
- /**
- * Computes the value of the aggregate column length
- *
- * @param PropelPDO $con A connection object
- *
- * @return mixed The scalar result from the aggregate query
- */
- public function computeDbLength(PropelPDO $con)
- {
- $stmt = $con->prepare('SELECT SUM(cliplength) FROM "cc_playlistcontents" WHERE cc_playlistcontents.PLAYLIST_ID = :p1');
- $stmt->bindValue(':p1', $this->getDbId());
- $stmt->execute();
- return $stmt->fetchColumn();
- }
-
- /**
- * Updates the aggregate column length
- *
- * @param PropelPDO $con A connection object
- */
- public function updateDbLength(PropelPDO $con)
- {
- $this->setDbLength($this->computeDbLength($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);
- }
-
-} // BaseCcPlaylist
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcPlaylistPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcPlaylistPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the name field.
+ * Note: this column has a database default value of: ''
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * The value for the mtime field.
+ * @var string
+ */
+ protected $mtime;
+
+ /**
+ * The value for the utime field.
+ * @var string
+ */
+ protected $utime;
+
+ /**
+ * The value for the creator_id field.
+ * @var int
+ */
+ protected $creator_id;
+
+ /**
+ * The value for the description field.
+ * @var string
+ */
+ protected $description;
+
+ /**
+ * The value for the length field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $length;
+
+ /**
+ * @var CcSubjs
+ */
+ protected $aCcSubjs;
+
+ /**
+ * @var PropelObjectCollection|CcPlaylistcontents[] Collection to store aggregation of CcPlaylistcontents objects.
+ */
+ protected $collCcPlaylistcontentss;
+ protected $collCcPlaylistcontentssPartial;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccPlaylistcontentssScheduledForDeletion = null;
+
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->name = '';
+ $this->length = '00:00:00';
+ }
+
+ /**
+ * 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 [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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [utime] 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 getDbUtime($format = 'Y-m-d H:i:s')
+ {
+ if ($this->utime === null) {
+ return null;
+ }
+
+
+ try {
+ $dt = new DateTime($this->utime);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->utime, true), $x);
+ }
+
+ if ($format === null) {
+ // Because propel.useDateTimeClass is true, we return a DateTime object.
+ return $dt;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Get the [creator_id] column value.
+ *
+ * @return int
+ */
+ public function getDbCreatorId()
+ {
+
+ return $this->creator_id;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDbDescription()
+ {
+
+ return $this->description;
+ }
+
+ /**
+ * Get the [length] column value.
+ *
+ * @return string
+ */
+ public function getDbLength()
+ {
+
+ return $this->length;
+ }
+
+ /**
+ * 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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->name !== $v) {
+ $this->name = $v;
+ $this->modifiedColumns[] = CcPlaylistPeer::NAME;
+ }
+
+
+ return $this;
+ } // setDbName()
+
+ /**
+ * 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 strings are treated as null.
+ * @return CcPlaylist The current object (for fluent API support)
+ */
+ public function setDbMtime($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->mtime !== null || $dt !== null) {
+ $currentDateAsString = ($this->mtime !== null && $tmpDt = new DateTime($this->mtime)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->mtime = $newDateAsString;
+ $this->modifiedColumns[] = CcPlaylistPeer::MTIME;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbMtime()
+
+ /**
+ * Sets the value of [utime] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or DateTime value.
+ * Empty strings are treated as null.
+ * @return CcPlaylist The current object (for fluent API support)
+ */
+ public function setDbUtime($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->utime !== null || $dt !== null) {
+ $currentDateAsString = ($this->utime !== null && $tmpDt = new DateTime($this->utime)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->utime = $newDateAsString;
+ $this->modifiedColumns[] = CcPlaylistPeer::UTIME;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbUtime()
+
+ /**
+ * Set the value of [creator_id] column.
+ *
+ * @param int $v new value
+ * @return CcPlaylist The current object (for fluent API support)
+ */
+ public function setDbCreatorId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->creator_id !== $v) {
+ $this->creator_id = $v;
+ $this->modifiedColumns[] = CcPlaylistPeer::CREATOR_ID;
+ }
+
+ if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) {
+ $this->aCcSubjs = null;
+ }
+
+
+ return $this;
+ } // setDbCreatorId()
+
+ /**
+ * 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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = CcPlaylistPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDbDescription()
+
+ /**
+ * Set the value of [length] column.
+ *
+ * @param string $v new value
+ * @return CcPlaylist The current object (for fluent API support)
+ */
+ public function setDbLength($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->length !== $v) {
+ $this->length = $v;
+ $this->modifiedColumns[] = CcPlaylistPeer::LENGTH;
+ }
+
+
+ return $this;
+ } // setDbLength()
+
+ /**
+ * 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->length !== '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 resultset 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->mtime = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->utime = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->creator_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
+ $this->description = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->length = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 7; // 7 = CcPlaylistPeer::NUM_HYDRATE_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->creator_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(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
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcPlaylistQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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);
+ // aggregate_column behavior
+ if (null !== $this->collCcPlaylistcontentss) {
+ $this->setDbLength($this->computeDbLength($con));
+ if ($this->isModified()) {
+ $this->save($con);
+ }
+ }
+
+ CcPlaylistPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $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 corresponding 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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ if ($this->ccPlaylistcontentssScheduledForDeletion !== null) {
+ if (!$this->ccPlaylistcontentssScheduledForDeletion->isEmpty()) {
+ CcPlaylistcontentsQuery::create()
+ ->filterByPrimaryKeys($this->ccPlaylistcontentssScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccPlaylistcontentssScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcPlaylistcontentss !== null) {
+ foreach ($this->collCcPlaylistcontentss as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcPlaylistPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcPlaylistPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_playlist_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcPlaylistPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcPlaylistPeer::NAME)) {
+ $modifiedColumns[':p' . $index++] = '"name"';
+ }
+ if ($this->isColumnModified(CcPlaylistPeer::MTIME)) {
+ $modifiedColumns[':p' . $index++] = '"mtime"';
+ }
+ if ($this->isColumnModified(CcPlaylistPeer::UTIME)) {
+ $modifiedColumns[':p' . $index++] = '"utime"';
+ }
+ if ($this->isColumnModified(CcPlaylistPeer::CREATOR_ID)) {
+ $modifiedColumns[':p' . $index++] = '"creator_id"';
+ }
+ if ($this->isColumnModified(CcPlaylistPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '"description"';
+ }
+ if ($this->isColumnModified(CcPlaylistPeer::LENGTH)) {
+ $modifiedColumns[':p' . $index++] = '"length"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_playlist" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"name"':
+ $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
+ break;
+ case '"mtime"':
+ $stmt->bindValue($identifier, $this->mtime, PDO::PARAM_STR);
+ break;
+ case '"utime"':
+ $stmt->bindValue($identifier, $this->utime, PDO::PARAM_STR);
+ break;
+ case '"creator_id"':
+ $stmt->bindValue($identifier, $this->creator_id, PDO::PARAM_INT);
+ break;
+ case '"description"':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '"length"':
+ $stmt->bindValue($identifier, $this->length, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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->getDbMtime();
+ break;
+ case 3:
+ return $this->getDbUtime();
+ break;
+ case 4:
+ return $this->getDbCreatorId();
+ break;
+ case 5:
+ return $this->getDbDescription();
+ break;
+ case 6:
+ return $this->getDbLength();
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcPlaylist'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcPlaylist'][$this->getPrimaryKey()] = true;
+ $keys = CcPlaylistPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbName(),
+ $keys[2] => $this->getDbMtime(),
+ $keys[3] => $this->getDbUtime(),
+ $keys[4] => $this->getDbCreatorId(),
+ $keys[5] => $this->getDbDescription(),
+ $keys[6] => $this->getDbLength(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcSubjs) {
+ $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->collCcPlaylistcontentss) {
+ $result['CcPlaylistcontentss'] = $this->collCcPlaylistcontentss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ }
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlaylistPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbMtime($value);
+ break;
+ case 3:
+ $this->setDbUtime($value);
+ break;
+ case 4:
+ $this->setDbCreatorId($value);
+ break;
+ case 5:
+ $this->setDbDescription($value);
+ break;
+ case 6:
+ $this->setDbLength($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 BasePeer::TYPE_PHPNAME
+ *
+ * @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->setDbMtime($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbUtime($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbCreatorId($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDbDescription($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setDbLength($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(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::MTIME)) $criteria->add(CcPlaylistPeer::MTIME, $this->mtime);
+ if ($this->isColumnModified(CcPlaylistPeer::UTIME)) $criteria->add(CcPlaylistPeer::UTIME, $this->utime);
+ if ($this->isColumnModified(CcPlaylistPeer::CREATOR_ID)) $criteria->add(CcPlaylistPeer::CREATOR_ID, $this->creator_id);
+ if ($this->isColumnModified(CcPlaylistPeer::DESCRIPTION)) $criteria->add(CcPlaylistPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(CcPlaylistPeer::LENGTH)) $criteria->add(CcPlaylistPeer::LENGTH, $this->length);
+
+ 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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbName($this->getDbName());
+ $copyObj->setDbMtime($this->getDbMtime());
+ $copyObj->setDbUtime($this->getDbUtime());
+ $copyObj->setDbCreatorId($this->getDbCreatorId());
+ $copyObj->setDbDescription($this->getDbDescription());
+ $copyObj->setDbLength($this->getDbLength());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ 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));
+ }
+ }
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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->setDbCreatorId(NULL);
+ } else {
+ $this->setDbCreatorId($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 $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcSubjs The associated CcSubjs object.
+ * @throws PropelException
+ */
+ public function getCcSubjs(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcSubjs === null && ($this->creator_id !== null) && $doQuery) {
+ $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->creator_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->addCcPlaylists($this);
+ */
+ }
+
+ return $this->aCcSubjs;
+ }
+
+
+ /**
+ * Initializes a collection based on the name of a relation.
+ * Avoids crafting an 'init[$relationName]s' method name
+ * that wouldn't work when StandardEnglishPluralizer is used.
+ *
+ * @param string $relationName The name of the relation to initialize
+ * @return void
+ */
+ public function initRelation($relationName)
+ {
+ if ('CcPlaylistcontents' == $relationName) {
+ $this->initCcPlaylistcontentss();
+ }
+ }
+
+ /**
+ * 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 CcPlaylist The current object (for fluent API support)
+ * @see addCcPlaylistcontentss()
+ */
+ public function clearCcPlaylistcontentss()
+ {
+ $this->collCcPlaylistcontentss = null; // important to set this to null since that means it is uninitialized
+ $this->collCcPlaylistcontentssPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcPlaylistcontentss collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcPlaylistcontentss($v = true)
+ {
+ $this->collCcPlaylistcontentssPartial = $v;
+ }
+
+ /**
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcPlaylistcontentss($overrideExisting = true)
+ {
+ if (null !== $this->collCcPlaylistcontentss && !$overrideExisting) {
+ return;
+ }
+ $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 PropelObjectCollection|CcPlaylistcontents[] List of CcPlaylistcontents objects
+ * @throws PropelException
+ */
+ public function getCcPlaylistcontentss($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcPlaylistcontentssPartial && !$this->isNew();
+ if (null === $this->collCcPlaylistcontentss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPlaylistcontentss) {
+ // return empty collection
+ $this->initCcPlaylistcontentss();
+ } else {
+ $collCcPlaylistcontentss = CcPlaylistcontentsQuery::create(null, $criteria)
+ ->filterByCcPlaylist($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcPlaylistcontentssPartial && count($collCcPlaylistcontentss)) {
+ $this->initCcPlaylistcontentss(false);
+
+ foreach ($collCcPlaylistcontentss as $obj) {
+ if (false == $this->collCcPlaylistcontentss->contains($obj)) {
+ $this->collCcPlaylistcontentss->append($obj);
+ }
+ }
+
+ $this->collCcPlaylistcontentssPartial = true;
+ }
+
+ $collCcPlaylistcontentss->getInternalIterator()->rewind();
+
+ return $collCcPlaylistcontentss;
+ }
+
+ if ($partial && $this->collCcPlaylistcontentss) {
+ foreach ($this->collCcPlaylistcontentss as $obj) {
+ if ($obj->isNew()) {
+ $collCcPlaylistcontentss[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcPlaylistcontentss = $collCcPlaylistcontentss;
+ $this->collCcPlaylistcontentssPartial = false;
+ }
+ }
+
+ return $this->collCcPlaylistcontentss;
+ }
+
+ /**
+ * Sets a collection of CcPlaylistcontents objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccPlaylistcontentss A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcPlaylist The current object (for fluent API support)
+ */
+ public function setCcPlaylistcontentss(PropelCollection $ccPlaylistcontentss, PropelPDO $con = null)
+ {
+ $ccPlaylistcontentssToDelete = $this->getCcPlaylistcontentss(new Criteria(), $con)->diff($ccPlaylistcontentss);
+
+
+ $this->ccPlaylistcontentssScheduledForDeletion = $ccPlaylistcontentssToDelete;
+
+ foreach ($ccPlaylistcontentssToDelete as $ccPlaylistcontentsRemoved) {
+ $ccPlaylistcontentsRemoved->setCcPlaylist(null);
+ }
+
+ $this->collCcPlaylistcontentss = null;
+ foreach ($ccPlaylistcontentss as $ccPlaylistcontents) {
+ $this->addCcPlaylistcontents($ccPlaylistcontents);
+ }
+
+ $this->collCcPlaylistcontentss = $ccPlaylistcontentss;
+ $this->collCcPlaylistcontentssPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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)
+ {
+ $partial = $this->collCcPlaylistcontentssPartial && !$this->isNew();
+ if (null === $this->collCcPlaylistcontentss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPlaylistcontentss) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcPlaylistcontentss());
+ }
+ $query = CcPlaylistcontentsQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcPlaylist($this)
+ ->count($con);
+ }
+
+ 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 CcPlaylist The current object (for fluent API support)
+ */
+ public function addCcPlaylistcontents(CcPlaylistcontents $l)
+ {
+ if ($this->collCcPlaylistcontentss === null) {
+ $this->initCcPlaylistcontentss();
+ $this->collCcPlaylistcontentssPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcPlaylistcontentss->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcPlaylistcontents($l);
+
+ if ($this->ccPlaylistcontentssScheduledForDeletion and $this->ccPlaylistcontentssScheduledForDeletion->contains($l)) {
+ $this->ccPlaylistcontentssScheduledForDeletion->remove($this->ccPlaylistcontentssScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcPlaylistcontents $ccPlaylistcontents The ccPlaylistcontents object to add.
+ */
+ protected function doAddCcPlaylistcontents($ccPlaylistcontents)
+ {
+ $this->collCcPlaylistcontentss[]= $ccPlaylistcontents;
+ $ccPlaylistcontents->setCcPlaylist($this);
+ }
+
+ /**
+ * @param CcPlaylistcontents $ccPlaylistcontents The ccPlaylistcontents object to remove.
+ * @return CcPlaylist The current object (for fluent API support)
+ */
+ public function removeCcPlaylistcontents($ccPlaylistcontents)
+ {
+ if ($this->getCcPlaylistcontentss()->contains($ccPlaylistcontents)) {
+ $this->collCcPlaylistcontentss->remove($this->collCcPlaylistcontentss->search($ccPlaylistcontents));
+ if (null === $this->ccPlaylistcontentssScheduledForDeletion) {
+ $this->ccPlaylistcontentssScheduledForDeletion = clone $this->collCcPlaylistcontentss;
+ $this->ccPlaylistcontentssScheduledForDeletion->clear();
+ }
+ $this->ccPlaylistcontentssScheduledForDeletion[]= $ccPlaylistcontents;
+ $ccPlaylistcontents->setCcPlaylist(null);
+ }
+
+ return $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 PropelObjectCollection|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);
+ }
+
+
+ /**
+ * 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 PropelObjectCollection|CcPlaylistcontents[] List of CcPlaylistcontents objects
+ */
+ public function getCcPlaylistcontentssJoinCcBlock($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcPlaylistcontentsQuery::create(null, $criteria);
+ $query->joinWith('CcBlock', $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->mtime = null;
+ $this->utime = null;
+ $this->creator_id = null;
+ $this->description = null;
+ $this->length = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->collCcPlaylistcontentss) {
+ foreach ($this->collCcPlaylistcontentss as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->aCcSubjs instanceof Persistent) {
+ $this->aCcSubjs->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ if ($this->collCcPlaylistcontentss instanceof PropelCollection) {
+ $this->collCcPlaylistcontentss->clearIterator();
+ }
+ $this->collCcPlaylistcontentss = null;
+ $this->aCcSubjs = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcPlaylistPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+ // aggregate_column behavior
+
+ /**
+ * Computes the value of the aggregate column length *
+ * @param PropelPDO $con A connection object
+ *
+ * @return mixed The scalar result from the aggregate query
+ */
+ public function computeDbLength(PropelPDO $con)
+ {
+ $stmt = $con->prepare('SELECT SUM(cliplength) FROM "cc_playlistcontents" WHERE cc_playlistcontents.playlist_id = :p1');
+ $stmt->bindValue(':p1', $this->getDbId());
+ $stmt->execute();
+
+ return $stmt->fetchColumn();
+ }
+
+ /**
+ * Updates the aggregate column length *
+ * @param PropelPDO $con A connection object
+ */
+ public function updateDbLength(PropelPDO $con)
+ {
+ $this->setDbLength($this->computeDbLength($con));
+ $this->save($con);
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistPeer.php
index da3593e02..11515ef0c 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistPeer.php
@@ -4,994 +4,1020 @@
/**
* Base static class for performing query and update operations on the 'cc_playlist' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcPlaylistPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_playlist';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcPlaylist';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcPlaylist';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcPlaylistTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 7;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_playlist.ID';
-
- /** the column name for the NAME field */
- const NAME = 'cc_playlist.NAME';
-
- /** the column name for the MTIME field */
- const MTIME = 'cc_playlist.MTIME';
-
- /** the column name for the UTIME field */
- const UTIME = 'cc_playlist.UTIME';
-
- /** the column name for the CREATOR_ID field */
- const CREATOR_ID = 'cc_playlist.CREATOR_ID';
-
- /** the column name for the DESCRIPTION field */
- const DESCRIPTION = 'cc_playlist.DESCRIPTION';
-
- /** the column name for the LENGTH field */
- const LENGTH = 'cc_playlist.LENGTH';
-
- /**
- * An identiy map to hold any loaded instances of CcPlaylist objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcPlaylist[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMtime', 'DbUtime', 'DbCreatorId', 'DbDescription', 'DbLength', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMtime', 'dbUtime', 'dbCreatorId', 'dbDescription', 'dbLength', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::MTIME, self::UTIME, self::CREATOR_ID, self::DESCRIPTION, self::LENGTH, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MTIME', 'UTIME', 'CREATOR_ID', 'DESCRIPTION', 'LENGTH', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mtime', 'utime', 'creator_id', 'description', 'length', ),
- 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, 'DbMtime' => 2, 'DbUtime' => 3, 'DbCreatorId' => 4, 'DbDescription' => 5, 'DbLength' => 6, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMtime' => 2, 'dbUtime' => 3, 'dbCreatorId' => 4, 'dbDescription' => 5, 'dbLength' => 6, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::MTIME => 2, self::UTIME => 3, self::CREATOR_ID => 4, self::DESCRIPTION => 5, self::LENGTH => 6, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MTIME' => 2, 'UTIME' => 3, 'CREATOR_ID' => 4, 'DESCRIPTION' => 5, 'LENGTH' => 6, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mtime' => 2, 'utime' => 3, 'creator_id' => 4, 'description' => 5, 'length' => 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. 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::MTIME);
- $criteria->addSelectColumn(CcPlaylistPeer::UTIME);
- $criteria->addSelectColumn(CcPlaylistPeer::CREATOR_ID);
- $criteria->addSelectColumn(CcPlaylistPeer::DESCRIPTION);
- $criteria->addSelectColumn(CcPlaylistPeer::LENGTH);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.NAME');
- $criteria->addSelectColumn($alias . '.MTIME');
- $criteria->addSelectColumn($alias . '.UTIME');
- $criteria->addSelectColumn($alias . '.CREATOR_ID');
- $criteria->addSelectColumn($alias . '.DESCRIPTION');
- $criteria->addSelectColumn($alias . '.LENGTH');
- }
- }
-
- /**
- * 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::CREATOR_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 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::CREATOR_ID, 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::CREATOR_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 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::CREATOR_ID, 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;
- }
+abstract class BaseCcPlaylistPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_playlist';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcPlaylist';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcPlaylistTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 7;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 7;
+
+ /** the column name for the id field */
+ const ID = 'cc_playlist.id';
+
+ /** the column name for the name field */
+ const NAME = 'cc_playlist.name';
+
+ /** the column name for the mtime field */
+ const MTIME = 'cc_playlist.mtime';
+
+ /** the column name for the utime field */
+ const UTIME = 'cc_playlist.utime';
+
+ /** the column name for the creator_id field */
+ const CREATOR_ID = 'cc_playlist.creator_id';
+
+ /** the column name for the description field */
+ const DESCRIPTION = 'cc_playlist.description';
+
+ /** the column name for the length field */
+ const LENGTH = 'cc_playlist.length';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcPlaylist objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcPlaylist[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcPlaylistPeer::$fieldNames[CcPlaylistPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMtime', 'DbUtime', 'DbCreatorId', 'DbDescription', 'DbLength', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMtime', 'dbUtime', 'dbCreatorId', 'dbDescription', 'dbLength', ),
+ BasePeer::TYPE_COLNAME => array (CcPlaylistPeer::ID, CcPlaylistPeer::NAME, CcPlaylistPeer::MTIME, CcPlaylistPeer::UTIME, CcPlaylistPeer::CREATOR_ID, CcPlaylistPeer::DESCRIPTION, CcPlaylistPeer::LENGTH, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MTIME', 'UTIME', 'CREATOR_ID', 'DESCRIPTION', 'LENGTH', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mtime', 'utime', 'creator_id', 'description', 'length', ),
+ 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. CcPlaylistPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMtime' => 2, 'DbUtime' => 3, 'DbCreatorId' => 4, 'DbDescription' => 5, 'DbLength' => 6, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMtime' => 2, 'dbUtime' => 3, 'dbCreatorId' => 4, 'dbDescription' => 5, 'dbLength' => 6, ),
+ BasePeer::TYPE_COLNAME => array (CcPlaylistPeer::ID => 0, CcPlaylistPeer::NAME => 1, CcPlaylistPeer::MTIME => 2, CcPlaylistPeer::UTIME => 3, CcPlaylistPeer::CREATOR_ID => 4, CcPlaylistPeer::DESCRIPTION => 5, CcPlaylistPeer::LENGTH => 6, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MTIME' => 2, 'UTIME' => 3, 'CREATOR_ID' => 4, 'DESCRIPTION' => 5, 'LENGTH' => 6, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mtime' => 2, 'utime' => 3, 'creator_id' => 4, 'description' => 5, 'length' => 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcPlaylistPeer::getFieldNames($toType);
+ $key = isset(CcPlaylistPeer::$fieldKeys[$fromType][$name]) ? CcPlaylistPeer::$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(CcPlaylistPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcPlaylistPeer::$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 CcPlaylistPeer::$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::MTIME);
+ $criteria->addSelectColumn(CcPlaylistPeer::UTIME);
+ $criteria->addSelectColumn(CcPlaylistPeer::CREATOR_ID);
+ $criteria->addSelectColumn(CcPlaylistPeer::DESCRIPTION);
+ $criteria->addSelectColumn(CcPlaylistPeer::LENGTH);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.name');
+ $criteria->addSelectColumn($alias . '.mtime');
+ $criteria->addSelectColumn($alias . '.utime');
+ $criteria->addSelectColumn($alias . '.creator_id');
+ $criteria->addSelectColumn($alias . '.description');
+ $criteria->addSelectColumn($alias . '.length');
+ }
+ }
+
+ /**
+ * 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(CcPlaylistPeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcPlaylistPeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcPlaylistPeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcPlaylistPeer::$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(CcPlaylistPeer::$instances[$key])) {
+ return CcPlaylistPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcPlaylistPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcPlaylistPeer::$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();
+ // 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_HYDRATE_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(CcPlaylistPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlaylistPeer::CREATOR_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 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(CcPlaylistPeer::DATABASE_NAME);
+ }
+
+ CcPlaylistPeer::addSelectColumns($criteria);
+ $startcol = CcPlaylistPeer::NUM_HYDRATE_COLUMNS;
+ CcSubjsPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcPlaylistPeer::CREATOR_ID, 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();
+
+ $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();
+
+ $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(CcPlaylistPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlaylistPeer::CREATOR_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 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(CcPlaylistPeer::DATABASE_NAME);
+ }
+
+ CcPlaylistPeer::addSelectColumns($criteria);
+ $startcol2 = CcPlaylistPeer::NUM_HYDRATE_COLUMNS;
+
+ CcSubjsPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcSubjsPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcPlaylistPeer::CREATOR_ID, 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();
+
+ $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();
+
+ $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(CcPlaylistPeer::DATABASE_NAME)->getTable(CcPlaylistPeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcPlaylistPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcPlaylistPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcPlaylistPeer::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(CcPlaylistPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_playlist table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcPlaylistPeer::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(CcPlaylistPeer::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 (Exception $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($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->hasColumn($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
+ * @return CcPlaylist[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistQuery.php
index 66b50e1c2..8e66d8f54 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistQuery.php
@@ -4,481 +4,672 @@
/**
* Base class that represents a query for the 'cc_playlist' table.
*
- *
*
- * @method CcPlaylistQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcPlaylistQuery orderByDbName($order = Criteria::ASC) Order by the name column
- * @method CcPlaylistQuery orderByDbMtime($order = Criteria::ASC) Order by the mtime column
- * @method CcPlaylistQuery orderByDbUtime($order = Criteria::ASC) Order by the utime column
- * @method CcPlaylistQuery orderByDbCreatorId($order = Criteria::ASC) Order by the creator_id column
- * @method CcPlaylistQuery orderByDbDescription($order = Criteria::ASC) Order by the description column
- * @method CcPlaylistQuery orderByDbLength($order = Criteria::ASC) Order by the length column
*
- * @method CcPlaylistQuery groupByDbId() Group by the id column
- * @method CcPlaylistQuery groupByDbName() Group by the name column
- * @method CcPlaylistQuery groupByDbMtime() Group by the mtime column
- * @method CcPlaylistQuery groupByDbUtime() Group by the utime column
- * @method CcPlaylistQuery groupByDbCreatorId() Group by the creator_id column
- * @method CcPlaylistQuery groupByDbDescription() Group by the description column
- * @method CcPlaylistQuery groupByDbLength() Group by the length column
+ * @method CcPlaylistQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcPlaylistQuery orderByDbName($order = Criteria::ASC) Order by the name column
+ * @method CcPlaylistQuery orderByDbMtime($order = Criteria::ASC) Order by the mtime column
+ * @method CcPlaylistQuery orderByDbUtime($order = Criteria::ASC) Order by the utime column
+ * @method CcPlaylistQuery orderByDbCreatorId($order = Criteria::ASC) Order by the creator_id column
+ * @method CcPlaylistQuery orderByDbDescription($order = Criteria::ASC) Order by the description column
+ * @method CcPlaylistQuery orderByDbLength($order = Criteria::ASC) Order by the length column
*
- * @method CcPlaylistQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcPlaylistQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcPlaylistQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcPlaylistQuery groupByDbId() Group by the id column
+ * @method CcPlaylistQuery groupByDbName() Group by the name column
+ * @method CcPlaylistQuery groupByDbMtime() Group by the mtime column
+ * @method CcPlaylistQuery groupByDbUtime() Group by the utime column
+ * @method CcPlaylistQuery groupByDbCreatorId() Group by the creator_id column
+ * @method CcPlaylistQuery groupByDbDescription() Group by the description column
+ * @method CcPlaylistQuery groupByDbLength() Group by the length column
*
- * @method CcPlaylistQuery leftJoinCcSubjs($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjs relation
- * @method CcPlaylistQuery rightJoinCcSubjs($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjs relation
- * @method CcPlaylistQuery innerJoinCcSubjs($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjs relation
+ * @method CcPlaylistQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcPlaylistQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcPlaylistQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcPlaylistQuery leftJoinCcPlaylistcontents($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlaylistcontents relation
- * @method CcPlaylistQuery rightJoinCcPlaylistcontents($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlaylistcontents relation
- * @method CcPlaylistQuery innerJoinCcPlaylistcontents($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlaylistcontents relation
+ * @method CcPlaylistQuery leftJoinCcSubjs($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSubjs relation
+ * @method CcPlaylistQuery rightJoinCcSubjs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjs relation
+ * @method CcPlaylistQuery innerJoinCcSubjs($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjs relation
*
- * @method CcPlaylist findOne(PropelPDO $con = null) Return the first CcPlaylist matching the query
- * @method CcPlaylist findOneOrCreate(PropelPDO $con = null) Return the first CcPlaylist matching the query, or a new CcPlaylist object populated from the query conditions when no match is found
+ * @method CcPlaylistQuery leftJoinCcPlaylistcontents($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPlaylistcontents relation
+ * @method CcPlaylistQuery rightJoinCcPlaylistcontents($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPlaylistcontents relation
+ * @method CcPlaylistQuery innerJoinCcPlaylistcontents($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPlaylistcontents relation
*
- * @method CcPlaylist findOneByDbId(int $id) Return the first CcPlaylist filtered by the id column
- * @method CcPlaylist findOneByDbName(string $name) Return the first CcPlaylist filtered by the name column
- * @method CcPlaylist findOneByDbMtime(string $mtime) Return the first CcPlaylist filtered by the mtime column
- * @method CcPlaylist findOneByDbUtime(string $utime) Return the first CcPlaylist filtered by the utime column
- * @method CcPlaylist findOneByDbCreatorId(int $creator_id) Return the first CcPlaylist filtered by the creator_id column
- * @method CcPlaylist findOneByDbDescription(string $description) Return the first CcPlaylist filtered by the description column
- * @method CcPlaylist findOneByDbLength(string $length) Return the first CcPlaylist filtered by the length column
+ * @method CcPlaylist findOne(PropelPDO $con = null) Return the first CcPlaylist matching the query
+ * @method CcPlaylist findOneOrCreate(PropelPDO $con = null) Return the first CcPlaylist matching the query, or a new CcPlaylist object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcPlaylist objects filtered by the id column
- * @method array findByDbName(string $name) Return CcPlaylist objects filtered by the name column
- * @method array findByDbMtime(string $mtime) Return CcPlaylist objects filtered by the mtime column
- * @method array findByDbUtime(string $utime) Return CcPlaylist objects filtered by the utime column
- * @method array findByDbCreatorId(int $creator_id) Return CcPlaylist objects filtered by the creator_id column
- * @method array findByDbDescription(string $description) Return CcPlaylist objects filtered by the description column
- * @method array findByDbLength(string $length) Return CcPlaylist objects filtered by the length column
+ * @method CcPlaylist findOneByDbName(string $name) Return the first CcPlaylist filtered by the name column
+ * @method CcPlaylist findOneByDbMtime(string $mtime) Return the first CcPlaylist filtered by the mtime column
+ * @method CcPlaylist findOneByDbUtime(string $utime) Return the first CcPlaylist filtered by the utime column
+ * @method CcPlaylist findOneByDbCreatorId(int $creator_id) Return the first CcPlaylist filtered by the creator_id column
+ * @method CcPlaylist findOneByDbDescription(string $description) Return the first CcPlaylist filtered by the description column
+ * @method CcPlaylist findOneByDbLength(string $length) Return the first CcPlaylist filtered by the length column
+ *
+ * @method array findByDbId(int $id) Return CcPlaylist objects filtered by the id column
+ * @method array findByDbName(string $name) Return CcPlaylist objects filtered by the name column
+ * @method array findByDbMtime(string $mtime) Return CcPlaylist objects filtered by the mtime column
+ * @method array findByDbUtime(string $utime) Return CcPlaylist objects filtered by the utime column
+ * @method array findByDbCreatorId(int $creator_id) Return CcPlaylist objects filtered by the creator_id column
+ * @method array findByDbDescription(string $description) Return CcPlaylist objects filtered by the description column
+ * @method array findByDbLength(string $length) Return CcPlaylist objects filtered by the length column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlaylistQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcPlaylistQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcPlaylist';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcPlaylistQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcPlaylist', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcPlaylistQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcPlaylistQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcPlaylistQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcPlaylistQuery) {
+ return $criteria;
+ }
+ $query = new CcPlaylistQuery(null, null, $modelAlias);
- /**
- * Returns a new CcPlaylistQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcPlaylistQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcPlaylistQuery) {
- return $criteria;
- }
- $query = new CcPlaylistQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcPlaylist|CcPlaylist[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcPlaylistPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $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);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPlaylist A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPlaylist A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "name", "mtime", "utime", "creator_id", "description", "length" FROM "cc_playlist" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcPlaylist();
+ $obj->hydrate($row);
+ CcPlaylistPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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);
- }
+ return $obj;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPlaylist|CcPlaylist[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * Filter the query on the utime column
- *
- * @param string|array $dbUtime 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 filterByDbUtime($dbUtime = null, $comparison = null)
- {
- if (is_array($dbUtime)) {
- $useMinMax = false;
- if (isset($dbUtime['min'])) {
- $this->addUsingAlias(CcPlaylistPeer::UTIME, $dbUtime['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbUtime['max'])) {
- $this->addUsingAlias(CcPlaylistPeer::UTIME, $dbUtime['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcPlaylistPeer::UTIME, $dbUtime, $comparison);
- }
+ /**
+ * 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|CcPlaylist[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * Filter the query on the creator_id column
- *
- * @param int|array $dbCreatorId 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 filterByDbCreatorId($dbCreatorId = null, $comparison = null)
- {
- if (is_array($dbCreatorId)) {
- $useMinMax = false;
- if (isset($dbCreatorId['min'])) {
- $this->addUsingAlias(CcPlaylistPeer::CREATOR_ID, $dbCreatorId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbCreatorId['max'])) {
- $this->addUsingAlias(CcPlaylistPeer::CREATOR_ID, $dbCreatorId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcPlaylistPeer::CREATOR_ID, $dbCreatorId, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * 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 primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcPlaylistQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
- /**
- * Filter the query on the length column
- *
- * @param string $dbLength 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 filterByDbLength($dbLength = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbLength)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbLength)) {
- $dbLength = str_replace('*', '%', $dbLength);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcPlaylistPeer::LENGTH, $dbLength, $comparison);
- }
+ return $this->addUsingAlias(CcPlaylistPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * 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::CREATOR_ID, $ccSubjs->getDbId(), $comparison);
- }
+ /**
+ * 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)
+ {
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcPlaylistPeer::ID, $keys, Criteria::IN);
+ }
- /**
- * 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 on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcPlaylistPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcPlaylistPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcPlaylistPeer::ID, $dbId, $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;
- }
+ /**
+ * Filter the query on the name column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbName('fooValue'); // WHERE name = 'fooValue'
+ * $query->filterByDbName('%fooValue%'); // WHERE name LIKE '%fooValue%'
+ *
+ *
+ * @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;
+ }
+ }
- /**
- * 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');
- }
+ return $this->addUsingAlias(CcPlaylistPeer::NAME, $dbName, $comparison);
+ }
- /**
- * 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;
- }
+ /**
+ * Filter the query on the mtime column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbMtime('2011-03-14'); // WHERE mtime = '2011-03-14'
+ * $query->filterByDbMtime('now'); // WHERE mtime = '2011-03-14'
+ * $query->filterByDbMtime(array('max' => 'yesterday')); // WHERE mtime < '2011-03-13'
+ *
+ *
+ * @param mixed $dbMtime The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
-} // BaseCcPlaylistQuery
+ return $this->addUsingAlias(CcPlaylistPeer::MTIME, $dbMtime, $comparison);
+ }
+
+ /**
+ * Filter the query on the utime column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbUtime('2011-03-14'); // WHERE utime = '2011-03-14'
+ * $query->filterByDbUtime('now'); // WHERE utime = '2011-03-14'
+ * $query->filterByDbUtime(array('max' => 'yesterday')); // WHERE utime < '2011-03-13'
+ *
+ *
+ * @param mixed $dbUtime The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlaylistQuery The current query, for fluid interface
+ */
+ public function filterByDbUtime($dbUtime = null, $comparison = null)
+ {
+ if (is_array($dbUtime)) {
+ $useMinMax = false;
+ if (isset($dbUtime['min'])) {
+ $this->addUsingAlias(CcPlaylistPeer::UTIME, $dbUtime['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbUtime['max'])) {
+ $this->addUsingAlias(CcPlaylistPeer::UTIME, $dbUtime['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcPlaylistPeer::UTIME, $dbUtime, $comparison);
+ }
+
+ /**
+ * Filter the query on the creator_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCreatorId(1234); // WHERE creator_id = 1234
+ * $query->filterByDbCreatorId(array(12, 34)); // WHERE creator_id IN (12, 34)
+ * $query->filterByDbCreatorId(array('min' => 12)); // WHERE creator_id >= 12
+ * $query->filterByDbCreatorId(array('max' => 12)); // WHERE creator_id <= 12
+ *
+ *
+ * @see filterByCcSubjs()
+ *
+ * @param mixed $dbCreatorId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlaylistQuery The current query, for fluid interface
+ */
+ public function filterByDbCreatorId($dbCreatorId = null, $comparison = null)
+ {
+ if (is_array($dbCreatorId)) {
+ $useMinMax = false;
+ if (isset($dbCreatorId['min'])) {
+ $this->addUsingAlias(CcPlaylistPeer::CREATOR_ID, $dbCreatorId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbCreatorId['max'])) {
+ $this->addUsingAlias(CcPlaylistPeer::CREATOR_ID, $dbCreatorId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcPlaylistPeer::CREATOR_ID, $dbCreatorId, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDbDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @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 on the length column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLength('fooValue'); // WHERE length = 'fooValue'
+ * $query->filterByDbLength('%fooValue%'); // WHERE length LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbLength 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 filterByDbLength($dbLength = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbLength)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbLength)) {
+ $dbLength = str_replace('*', '%', $dbLength);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcPlaylistPeer::LENGTH, $dbLength, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcSubjs object
+ *
+ * @param CcSubjs|PropelObjectCollection $ccSubjs The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcSubjs($ccSubjs, $comparison = null)
+ {
+ if ($ccSubjs instanceof CcSubjs) {
+ return $this
+ ->addUsingAlias(CcPlaylistPeer::CREATOR_ID, $ccSubjs->getDbId(), $comparison);
+ } elseif ($ccSubjs instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcPlaylistPeer::CREATOR_ID, $ccSubjs->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcSubjs() only accepts arguments of type CcSubjs or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcSubjs($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery');
+ }
+
+ /**
+ * Filter the query by a related CcPlaylistcontents object
+ *
+ * @param CcPlaylistcontents|PropelObjectCollection $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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcPlaylistcontents($ccPlaylistcontents, $comparison = null)
+ {
+ if ($ccPlaylistcontents instanceof CcPlaylistcontents) {
+ return $this
+ ->addUsingAlias(CcPlaylistPeer::ID, $ccPlaylistcontents->getDbPlaylistId(), $comparison);
+ } elseif ($ccPlaylistcontents instanceof PropelObjectCollection) {
+ return $this
+ ->useCcPlaylistcontentsQuery()
+ ->filterByPrimaryKeys($ccPlaylistcontents->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcPlaylistcontents() only accepts arguments of type CcPlaylistcontents or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $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;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php
index cf6e53a98..1c634b382 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php
@@ -4,1688 +4,1870 @@
/**
* Base class that represents a row from the 'cc_playlistcontents' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
+abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcPlaylistcontentsPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcPlaylistcontentsPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the playlist_id field.
- * @var int
- */
- protected $playlist_id;
-
- /**
- * The value for the file_id field.
- * @var int
- */
- protected $file_id;
-
- /**
- * The value for the block_id field.
- * @var int
- */
- protected $block_id;
-
- /**
- * The value for the stream_id field.
- * @var int
- */
- protected $stream_id;
-
- /**
- * The value for the type field.
- * Note: this column has a database default value of: 0
- * @var int
- */
- protected $type;
-
- /**
- * The value for the position field.
- * @var int
- */
- protected $position;
-
- /**
- * The value for the trackoffset field.
- * Note: this column has a database default value of: 0
- * @var double
- */
- protected $trackoffset;
-
- /**
- * The value for the cliplength field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $cliplength;
-
- /**
- * The value for the cuein field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $cuein;
-
- /**
- * The value for the cueout field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $cueout;
-
- /**
- * The value for the fadein field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $fadein;
-
- /**
- * The value for the fadeout field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $fadeout;
-
- /**
- * @var CcFiles
- */
- protected $aCcFiles;
-
- /**
- * @var CcBlock
- */
- protected $aCcBlock;
-
- /**
- * @var CcPlaylist
- */
- protected $aCcPlaylist;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- // aggregate_column_relation behavior
- protected $oldCcPlaylist;
-
- /**
- * Applies default values to this object.
- * This method should be called from the object's constructor (or
- * equivalent initialization method).
- * @see __construct()
- */
- public function applyDefaultValues()
- {
- $this->type = 0;
- $this->trackoffset = 0;
- $this->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 [block_id] column value.
- *
- * @return int
- */
- public function getDbBlockId()
- {
- return $this->block_id;
- }
-
- /**
- * Get the [stream_id] column value.
- *
- * @return int
- */
- public function getDbStreamId()
- {
- return $this->stream_id;
- }
-
- /**
- * Get the [type] column value.
- *
- * @return int
- */
- public function getDbType()
- {
- return $this->type;
- }
-
- /**
- * Get the [position] column value.
- *
- * @return int
- */
- public function getDbPosition()
- {
- return $this->position;
- }
-
- /**
- * Get the [trackoffset] column value.
- *
- * @return double
- */
- public function getDbTrackOffset()
- {
- return $this->trackoffset;
- }
-
- /**
- * Get the [cliplength] column value.
- *
- * @return string
- */
- public function getDbCliplength()
- {
- return $this->cliplength;
- }
-
- /**
- * Get the [cuein] column value.
- *
- * @return string
- */
- public function getDbCuein()
- {
- return $this->cuein;
- }
-
- /**
- * Get the [cueout] column value.
- *
- * @return string
- */
- public function getDbCueout()
- {
- return $this->cueout;
- }
-
- /**
- * 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 [block_id] column.
- *
- * @param int $v new value
- * @return CcPlaylistcontents The current object (for fluent API support)
- */
- public function setDbBlockId($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->block_id !== $v) {
- $this->block_id = $v;
- $this->modifiedColumns[] = CcPlaylistcontentsPeer::BLOCK_ID;
- }
-
- if ($this->aCcBlock !== null && $this->aCcBlock->getDbId() !== $v) {
- $this->aCcBlock = null;
- }
-
- return $this;
- } // setDbBlockId()
-
- /**
- * Set the value of [stream_id] column.
- *
- * @param int $v new value
- * @return CcPlaylistcontents The current object (for fluent API support)
- */
- public function setDbStreamId($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->stream_id !== $v) {
- $this->stream_id = $v;
- $this->modifiedColumns[] = CcPlaylistcontentsPeer::STREAM_ID;
- }
-
- return $this;
- } // setDbStreamId()
-
- /**
- * Set the value of [type] column.
- *
- * @param int $v new value
- * @return CcPlaylistcontents The current object (for fluent API support)
- */
- public function setDbType($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->type !== $v || $this->isNew()) {
- $this->type = $v;
- $this->modifiedColumns[] = CcPlaylistcontentsPeer::TYPE;
- }
-
- return $this;
- } // setDbType()
-
- /**
- * 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()
-
- /**
- * Set the value of [trackoffset] column.
- *
- * @param double $v new value
- * @return CcPlaylistcontents The current object (for fluent API support)
- */
- public function setDbTrackOffset($v)
- {
- if ($v !== null) {
- $v = (double) $v;
- }
-
- if ($this->trackoffset !== $v || $this->isNew()) {
- $this->trackoffset = $v;
- $this->modifiedColumns[] = CcPlaylistcontentsPeer::TRACKOFFSET;
- }
-
- return $this;
- } // setDbTrackOffset()
-
- /**
- * Set the value of [cliplength] column.
- *
- * @param string $v new value
- * @return CcPlaylistcontents The current object (for fluent API support)
- */
- public function setDbCliplength($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->cliplength !== $v || $this->isNew()) {
- $this->cliplength = $v;
- $this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH;
- }
-
- return $this;
- } // setDbCliplength()
-
- /**
- * Set the value of [cuein] column.
- *
- * @param string $v new value
- * @return CcPlaylistcontents The current object (for fluent API support)
- */
- public function setDbCuein($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->cuein !== $v || $this->isNew()) {
- $this->cuein = $v;
- $this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN;
- }
-
- return $this;
- } // setDbCuein()
-
- /**
- * Set the value of [cueout] column.
- *
- * @param string $v new value
- * @return CcPlaylistcontents The current object (for fluent API support)
- */
- public function setDbCueout($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->cueout !== $v || $this->isNew()) {
- $this->cueout = $v;
- $this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT;
- }
-
- 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->type !== 0) {
- return false;
- }
-
- if ($this->trackoffset !== 0) {
- return false;
- }
-
- 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->block_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
- $this->stream_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
- $this->type = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
- $this->position = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
- $this->trackoffset = ($row[$startcol + 7] !== null) ? (double) $row[$startcol + 7] : null;
- $this->cliplength = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
- $this->cuein = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
- $this->cueout = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
- $this->fadein = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
- $this->fadeout = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 13; // 13 = 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;
- }
- if ($this->aCcBlock !== null && $this->block_id !== $this->aCcBlock->getDbId()) {
- $this->aCcBlock = 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->aCcBlock = 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);
- // aggregate_column_relation behavior
- $this->updateRelatedCcPlaylist($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->aCcBlock !== null) {
- if ($this->aCcBlock->isModified() || $this->aCcBlock->isNew()) {
- $affectedRows += $this->aCcBlock->save($con);
- }
- $this->setCcBlock($this->aCcBlock);
- }
-
- 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->aCcBlock !== null) {
- if (!$this->aCcBlock->validate($columns)) {
- $failureMap = array_merge($failureMap, $this->aCcBlock->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->getDbBlockId();
- break;
- case 4:
- return $this->getDbStreamId();
- break;
- case 5:
- return $this->getDbType();
- break;
- case 6:
- return $this->getDbPosition();
- break;
- case 7:
- return $this->getDbTrackOffset();
- break;
- case 8:
- return $this->getDbCliplength();
- break;
- case 9:
- return $this->getDbCuein();
- break;
- case 10:
- return $this->getDbCueout();
- break;
- case 11:
- return $this->getDbFadein();
- break;
- case 12:
- 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->getDbBlockId(),
- $keys[4] => $this->getDbStreamId(),
- $keys[5] => $this->getDbType(),
- $keys[6] => $this->getDbPosition(),
- $keys[7] => $this->getDbTrackOffset(),
- $keys[8] => $this->getDbCliplength(),
- $keys[9] => $this->getDbCuein(),
- $keys[10] => $this->getDbCueout(),
- $keys[11] => $this->getDbFadein(),
- $keys[12] => $this->getDbFadeout(),
- );
- if ($includeForeignObjects) {
- if (null !== $this->aCcFiles) {
- $result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, true);
- }
- if (null !== $this->aCcBlock) {
- $result['CcBlock'] = $this->aCcBlock->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->setDbBlockId($value);
- break;
- case 4:
- $this->setDbStreamId($value);
- break;
- case 5:
- $this->setDbType($value);
- break;
- case 6:
- $this->setDbPosition($value);
- break;
- case 7:
- $this->setDbTrackOffset($value);
- break;
- case 8:
- $this->setDbCliplength($value);
- break;
- case 9:
- $this->setDbCuein($value);
- break;
- case 10:
- $this->setDbCueout($value);
- break;
- case 11:
- $this->setDbFadein($value);
- break;
- case 12:
- $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->setDbBlockId($arr[$keys[3]]);
- if (array_key_exists($keys[4], $arr)) $this->setDbStreamId($arr[$keys[4]]);
- if (array_key_exists($keys[5], $arr)) $this->setDbType($arr[$keys[5]]);
- if (array_key_exists($keys[6], $arr)) $this->setDbPosition($arr[$keys[6]]);
- if (array_key_exists($keys[7], $arr)) $this->setDbTrackOffset($arr[$keys[7]]);
- if (array_key_exists($keys[8], $arr)) $this->setDbCliplength($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->setDbFadein($arr[$keys[11]]);
- if (array_key_exists($keys[12], $arr)) $this->setDbFadeout($arr[$keys[12]]);
- }
-
- /**
- * 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::BLOCK_ID)) $criteria->add(CcPlaylistcontentsPeer::BLOCK_ID, $this->block_id);
- if ($this->isColumnModified(CcPlaylistcontentsPeer::STREAM_ID)) $criteria->add(CcPlaylistcontentsPeer::STREAM_ID, $this->stream_id);
- if ($this->isColumnModified(CcPlaylistcontentsPeer::TYPE)) $criteria->add(CcPlaylistcontentsPeer::TYPE, $this->type);
- if ($this->isColumnModified(CcPlaylistcontentsPeer::POSITION)) $criteria->add(CcPlaylistcontentsPeer::POSITION, $this->position);
- if ($this->isColumnModified(CcPlaylistcontentsPeer::TRACKOFFSET)) $criteria->add(CcPlaylistcontentsPeer::TRACKOFFSET, $this->trackoffset);
- 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->setDbBlockId($this->block_id);
- $copyObj->setDbStreamId($this->stream_id);
- $copyObj->setDbType($this->type);
- $copyObj->setDbPosition($this->position);
- $copyObj->setDbTrackOffset($this->trackoffset);
- $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 CcBlock object.
- *
- * @param CcBlock $v
- * @return CcPlaylistcontents The current object (for fluent API support)
- * @throws PropelException
- */
- public function setCcBlock(CcBlock $v = null)
- {
- if ($v === null) {
- $this->setDbBlockId(NULL);
- } else {
- $this->setDbBlockId($v->getDbId());
- }
-
- $this->aCcBlock = $v;
-
- // Add binding for other direction of this n:n relationship.
- // If this object has already been added to the CcBlock object, it will not be re-added.
- if ($v !== null) {
- $v->addCcPlaylistcontents($this);
- }
-
- return $this;
- }
-
-
- /**
- * Get the associated CcBlock object
- *
- * @param PropelPDO Optional Connection object.
- * @return CcBlock The associated CcBlock object.
- * @throws PropelException
- */
- public function getCcBlock(PropelPDO $con = null)
- {
- if ($this->aCcBlock === null && ($this->block_id !== null)) {
- $this->aCcBlock = CcBlockQuery::create()->findPk($this->block_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->aCcBlock->addCcPlaylistcontentss($this);
- */
- }
- return $this->aCcBlock;
- }
-
- /**
- * 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)
- {
- // aggregate_column_relation behavior
- if (null !== $this->aCcPlaylist && $v !== $this->aCcPlaylist) {
- $this->oldCcPlaylist = $this->aCcPlaylist;
- }
- 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->block_id = null;
- $this->stream_id = null;
- $this->type = null;
- $this->position = null;
- $this->trackoffset = 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->aCcBlock = null;
- $this->aCcPlaylist = null;
- }
-
- // aggregate_column_relation behavior
-
- /**
- * Update the aggregate column in the related CcPlaylist object
- *
- * @param PropelPDO $con A connection object
- */
- protected function updateRelatedCcPlaylist(PropelPDO $con)
- {
- if ($ccPlaylist = $this->getCcPlaylist()) {
- $ccPlaylist->updateDbLength($con);
- }
- if ($this->oldCcPlaylist) {
- $this->oldCcPlaylist->updateDbLength($con);
- $this->oldCcPlaylist = 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
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcPlaylistcontentsPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcPlaylistcontentsPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the playlist_id field.
+ * @var int
+ */
+ protected $playlist_id;
+
+ /**
+ * The value for the file_id field.
+ * @var int
+ */
+ protected $file_id;
+
+ /**
+ * The value for the block_id field.
+ * @var int
+ */
+ protected $block_id;
+
+ /**
+ * The value for the stream_id field.
+ * @var int
+ */
+ protected $stream_id;
+
+ /**
+ * The value for the type field.
+ * Note: this column has a database default value of: 0
+ * @var int
+ */
+ protected $type;
+
+ /**
+ * The value for the position field.
+ * @var int
+ */
+ protected $position;
+
+ /**
+ * The value for the trackoffset field.
+ * Note: this column has a database default value of: 0
+ * @var double
+ */
+ protected $trackoffset;
+
+ /**
+ * The value for the cliplength field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $cliplength;
+
+ /**
+ * The value for the cuein field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $cuein;
+
+ /**
+ * The value for the cueout field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $cueout;
+
+ /**
+ * The value for the fadein field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $fadein;
+
+ /**
+ * The value for the fadeout field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $fadeout;
+
+ /**
+ * @var CcFiles
+ */
+ protected $aCcFiles;
+
+ /**
+ * @var CcBlock
+ */
+ protected $aCcBlock;
+
+ /**
+ * @var CcPlaylist
+ */
+ protected $aCcPlaylist;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ // aggregate_column_relation behavior
+ protected $oldCcPlaylist;
+
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->type = 0;
+ $this->trackoffset = 0;
+ $this->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 [block_id] column value.
+ *
+ * @return int
+ */
+ public function getDbBlockId()
+ {
+
+ return $this->block_id;
+ }
+
+ /**
+ * Get the [stream_id] column value.
+ *
+ * @return int
+ */
+ public function getDbStreamId()
+ {
+
+ return $this->stream_id;
+ }
+
+ /**
+ * Get the [type] column value.
+ *
+ * @return int
+ */
+ public function getDbType()
+ {
+
+ return $this->type;
+ }
+
+ /**
+ * Get the [position] column value.
+ *
+ * @return int
+ */
+ public function getDbPosition()
+ {
+
+ return $this->position;
+ }
+
+ /**
+ * Get the [trackoffset] column value.
+ *
+ * @return double
+ */
+ public function getDbTrackOffset()
+ {
+
+ return $this->trackoffset;
+ }
+
+ /**
+ * Get the [cliplength] column value.
+ *
+ * @return string
+ */
+ public function getDbCliplength()
+ {
+
+ return $this->cliplength;
+ }
+
+ /**
+ * Get the [cuein] column value.
+ *
+ * @return string
+ */
+ public function getDbCuein()
+ {
+
+ return $this->cuein;
+ }
+
+ /**
+ * Get the [cueout] column value.
+ *
+ * @return string
+ */
+ public function getDbCueout()
+ {
+
+ return $this->cueout;
+ }
+
+ /**
+ * 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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ 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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ 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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 [block_id] column.
+ *
+ * @param int $v new value
+ * @return CcPlaylistcontents The current object (for fluent API support)
+ */
+ public function setDbBlockId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->block_id !== $v) {
+ $this->block_id = $v;
+ $this->modifiedColumns[] = CcPlaylistcontentsPeer::BLOCK_ID;
+ }
+
+ if ($this->aCcBlock !== null && $this->aCcBlock->getDbId() !== $v) {
+ $this->aCcBlock = null;
+ }
+
+
+ return $this;
+ } // setDbBlockId()
+
+ /**
+ * Set the value of [stream_id] column.
+ *
+ * @param int $v new value
+ * @return CcPlaylistcontents The current object (for fluent API support)
+ */
+ public function setDbStreamId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->stream_id !== $v) {
+ $this->stream_id = $v;
+ $this->modifiedColumns[] = CcPlaylistcontentsPeer::STREAM_ID;
+ }
+
+
+ return $this;
+ } // setDbStreamId()
+
+ /**
+ * Set the value of [type] column.
+ *
+ * @param int $v new value
+ * @return CcPlaylistcontents The current object (for fluent API support)
+ */
+ public function setDbType($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->type !== $v) {
+ $this->type = $v;
+ $this->modifiedColumns[] = CcPlaylistcontentsPeer::TYPE;
+ }
+
+
+ return $this;
+ } // setDbType()
+
+ /**
+ * 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 && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->position !== $v) {
+ $this->position = $v;
+ $this->modifiedColumns[] = CcPlaylistcontentsPeer::POSITION;
+ }
+
+
+ return $this;
+ } // setDbPosition()
+
+ /**
+ * Set the value of [trackoffset] column.
+ *
+ * @param double $v new value
+ * @return CcPlaylistcontents The current object (for fluent API support)
+ */
+ public function setDbTrackOffset($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (double) $v;
+ }
+
+ if ($this->trackoffset !== $v) {
+ $this->trackoffset = $v;
+ $this->modifiedColumns[] = CcPlaylistcontentsPeer::TRACKOFFSET;
+ }
+
+
+ return $this;
+ } // setDbTrackOffset()
+
+ /**
+ * Set the value of [cliplength] column.
+ *
+ * @param string $v new value
+ * @return CcPlaylistcontents The current object (for fluent API support)
+ */
+ public function setDbCliplength($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->cliplength !== $v) {
+ $this->cliplength = $v;
+ $this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH;
+ }
+
+
+ return $this;
+ } // setDbCliplength()
+
+ /**
+ * Set the value of [cuein] column.
+ *
+ * @param string $v new value
+ * @return CcPlaylistcontents The current object (for fluent API support)
+ */
+ public function setDbCuein($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->cuein !== $v) {
+ $this->cuein = $v;
+ $this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN;
+ }
+
+
+ return $this;
+ } // setDbCuein()
+
+ /**
+ * Set the value of [cueout] column.
+ *
+ * @param string $v new value
+ * @return CcPlaylistcontents The current object (for fluent API support)
+ */
+ public function setDbCueout($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->cueout !== $v) {
+ $this->cueout = $v;
+ $this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT;
+ }
+
+
+ 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 strings are treated as null.
+ * @return CcPlaylistcontents The current object (for fluent API support)
+ */
+ public function setDbFadein($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->fadein !== null || $dt !== null) {
+ $currentDateAsString = ($this->fadein !== null && $tmpDt = new DateTime($this->fadein)) ? $tmpDt->format('H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('H:i:s') : null;
+ if ( ($currentDateAsString !== $newDateAsString) // normalized values don't match
+ || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
+ ) {
+ $this->fadein = $newDateAsString;
+ $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 strings are treated as null.
+ * @return CcPlaylistcontents The current object (for fluent API support)
+ */
+ public function setDbFadeout($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->fadeout !== null || $dt !== null) {
+ $currentDateAsString = ($this->fadeout !== null && $tmpDt = new DateTime($this->fadeout)) ? $tmpDt->format('H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('H:i:s') : null;
+ if ( ($currentDateAsString !== $newDateAsString) // normalized values don't match
+ || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
+ ) {
+ $this->fadeout = $newDateAsString;
+ $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->type !== 0) {
+ return false;
+ }
+
+ if ($this->trackoffset !== 0) {
+ return false;
+ }
+
+ 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 resultset 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->block_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
+ $this->stream_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
+ $this->type = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
+ $this->position = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
+ $this->trackoffset = ($row[$startcol + 7] !== null) ? (double) $row[$startcol + 7] : null;
+ $this->cliplength = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
+ $this->cuein = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
+ $this->cueout = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
+ $this->fadein = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
+ $this->fadeout = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 13; // 13 = CcPlaylistcontentsPeer::NUM_HYDRATE_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;
+ }
+ if ($this->aCcBlock !== null && $this->block_id !== $this->aCcBlock->getDbId()) {
+ $this->aCcBlock = 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->aCcBlock = null;
+ $this->aCcPlaylist = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcPlaylistcontentsQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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);
+ // aggregate_column_relation behavior
+ $this->updateRelatedCcPlaylist($con);
+ CcPlaylistcontentsPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $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 corresponding 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->aCcBlock !== null) {
+ if ($this->aCcBlock->isModified() || $this->aCcBlock->isNew()) {
+ $affectedRows += $this->aCcBlock->save($con);
+ }
+ $this->setCcBlock($this->aCcBlock);
+ }
+
+ if ($this->aCcPlaylist !== null) {
+ if ($this->aCcPlaylist->isModified() || $this->aCcPlaylist->isNew()) {
+ $affectedRows += $this->aCcPlaylist->save($con);
+ }
+ $this->setCcPlaylist($this->aCcPlaylist);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcPlaylistcontentsPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcPlaylistcontentsPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_playlistcontents_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcPlaylistcontentsPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcPlaylistcontentsPeer::PLAYLIST_ID)) {
+ $modifiedColumns[':p' . $index++] = '"playlist_id"';
+ }
+ if ($this->isColumnModified(CcPlaylistcontentsPeer::FILE_ID)) {
+ $modifiedColumns[':p' . $index++] = '"file_id"';
+ }
+ if ($this->isColumnModified(CcPlaylistcontentsPeer::BLOCK_ID)) {
+ $modifiedColumns[':p' . $index++] = '"block_id"';
+ }
+ if ($this->isColumnModified(CcPlaylistcontentsPeer::STREAM_ID)) {
+ $modifiedColumns[':p' . $index++] = '"stream_id"';
+ }
+ if ($this->isColumnModified(CcPlaylistcontentsPeer::TYPE)) {
+ $modifiedColumns[':p' . $index++] = '"type"';
+ }
+ if ($this->isColumnModified(CcPlaylistcontentsPeer::POSITION)) {
+ $modifiedColumns[':p' . $index++] = '"position"';
+ }
+ if ($this->isColumnModified(CcPlaylistcontentsPeer::TRACKOFFSET)) {
+ $modifiedColumns[':p' . $index++] = '"trackoffset"';
+ }
+ if ($this->isColumnModified(CcPlaylistcontentsPeer::CLIPLENGTH)) {
+ $modifiedColumns[':p' . $index++] = '"cliplength"';
+ }
+ if ($this->isColumnModified(CcPlaylistcontentsPeer::CUEIN)) {
+ $modifiedColumns[':p' . $index++] = '"cuein"';
+ }
+ if ($this->isColumnModified(CcPlaylistcontentsPeer::CUEOUT)) {
+ $modifiedColumns[':p' . $index++] = '"cueout"';
+ }
+ if ($this->isColumnModified(CcPlaylistcontentsPeer::FADEIN)) {
+ $modifiedColumns[':p' . $index++] = '"fadein"';
+ }
+ if ($this->isColumnModified(CcPlaylistcontentsPeer::FADEOUT)) {
+ $modifiedColumns[':p' . $index++] = '"fadeout"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_playlistcontents" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"playlist_id"':
+ $stmt->bindValue($identifier, $this->playlist_id, PDO::PARAM_INT);
+ break;
+ case '"file_id"':
+ $stmt->bindValue($identifier, $this->file_id, PDO::PARAM_INT);
+ break;
+ case '"block_id"':
+ $stmt->bindValue($identifier, $this->block_id, PDO::PARAM_INT);
+ break;
+ case '"stream_id"':
+ $stmt->bindValue($identifier, $this->stream_id, PDO::PARAM_INT);
+ break;
+ case '"type"':
+ $stmt->bindValue($identifier, $this->type, PDO::PARAM_INT);
+ break;
+ case '"position"':
+ $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
+ break;
+ case '"trackoffset"':
+ $stmt->bindValue($identifier, $this->trackoffset, PDO::PARAM_STR);
+ break;
+ case '"cliplength"':
+ $stmt->bindValue($identifier, $this->cliplength, PDO::PARAM_STR);
+ break;
+ case '"cuein"':
+ $stmt->bindValue($identifier, $this->cuein, PDO::PARAM_STR);
+ break;
+ case '"cueout"':
+ $stmt->bindValue($identifier, $this->cueout, PDO::PARAM_STR);
+ break;
+ case '"fadein"':
+ $stmt->bindValue($identifier, $this->fadein, PDO::PARAM_STR);
+ break;
+ case '"fadeout"':
+ $stmt->bindValue($identifier, $this->fadeout, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding 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->aCcBlock !== null) {
+ if (!$this->aCcBlock->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcBlock->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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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->getDbBlockId();
+ break;
+ case 4:
+ return $this->getDbStreamId();
+ break;
+ case 5:
+ return $this->getDbType();
+ break;
+ case 6:
+ return $this->getDbPosition();
+ break;
+ case 7:
+ return $this->getDbTrackOffset();
+ break;
+ case 8:
+ return $this->getDbCliplength();
+ break;
+ case 9:
+ return $this->getDbCuein();
+ break;
+ case 10:
+ return $this->getDbCueout();
+ break;
+ case 11:
+ return $this->getDbFadein();
+ break;
+ case 12:
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcPlaylistcontents'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcPlaylistcontents'][$this->getPrimaryKey()] = true;
+ $keys = CcPlaylistcontentsPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbPlaylistId(),
+ $keys[2] => $this->getDbFileId(),
+ $keys[3] => $this->getDbBlockId(),
+ $keys[4] => $this->getDbStreamId(),
+ $keys[5] => $this->getDbType(),
+ $keys[6] => $this->getDbPosition(),
+ $keys[7] => $this->getDbTrackOffset(),
+ $keys[8] => $this->getDbCliplength(),
+ $keys[9] => $this->getDbCuein(),
+ $keys[10] => $this->getDbCueout(),
+ $keys[11] => $this->getDbFadein(),
+ $keys[12] => $this->getDbFadeout(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcFiles) {
+ $result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->aCcBlock) {
+ $result['CcBlock'] = $this->aCcBlock->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->aCcPlaylist) {
+ $result['CcPlaylist'] = $this->aCcPlaylist->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlaylistcontentsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbBlockId($value);
+ break;
+ case 4:
+ $this->setDbStreamId($value);
+ break;
+ case 5:
+ $this->setDbType($value);
+ break;
+ case 6:
+ $this->setDbPosition($value);
+ break;
+ case 7:
+ $this->setDbTrackOffset($value);
+ break;
+ case 8:
+ $this->setDbCliplength($value);
+ break;
+ case 9:
+ $this->setDbCuein($value);
+ break;
+ case 10:
+ $this->setDbCueout($value);
+ break;
+ case 11:
+ $this->setDbFadein($value);
+ break;
+ case 12:
+ $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 BasePeer::TYPE_PHPNAME
+ *
+ * @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->setDbBlockId($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbStreamId($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDbType($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setDbPosition($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setDbTrackOffset($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setDbCliplength($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->setDbFadein($arr[$keys[11]]);
+ if (array_key_exists($keys[12], $arr)) $this->setDbFadeout($arr[$keys[12]]);
+ }
+
+ /**
+ * 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::BLOCK_ID)) $criteria->add(CcPlaylistcontentsPeer::BLOCK_ID, $this->block_id);
+ if ($this->isColumnModified(CcPlaylistcontentsPeer::STREAM_ID)) $criteria->add(CcPlaylistcontentsPeer::STREAM_ID, $this->stream_id);
+ if ($this->isColumnModified(CcPlaylistcontentsPeer::TYPE)) $criteria->add(CcPlaylistcontentsPeer::TYPE, $this->type);
+ if ($this->isColumnModified(CcPlaylistcontentsPeer::POSITION)) $criteria->add(CcPlaylistcontentsPeer::POSITION, $this->position);
+ if ($this->isColumnModified(CcPlaylistcontentsPeer::TRACKOFFSET)) $criteria->add(CcPlaylistcontentsPeer::TRACKOFFSET, $this->trackoffset);
+ 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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbPlaylistId($this->getDbPlaylistId());
+ $copyObj->setDbFileId($this->getDbFileId());
+ $copyObj->setDbBlockId($this->getDbBlockId());
+ $copyObj->setDbStreamId($this->getDbStreamId());
+ $copyObj->setDbType($this->getDbType());
+ $copyObj->setDbPosition($this->getDbPosition());
+ $copyObj->setDbTrackOffset($this->getDbTrackOffset());
+ $copyObj->setDbCliplength($this->getDbCliplength());
+ $copyObj->setDbCuein($this->getDbCuein());
+ $copyObj->setDbCueout($this->getDbCueout());
+ $copyObj->setDbFadein($this->getDbFadein());
+ $copyObj->setDbFadeout($this->getDbFadeout());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcFiles The associated CcFiles object.
+ * @throws PropelException
+ */
+ public function getCcFiles(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcFiles === null && ($this->file_id !== null) && $doQuery) {
+ $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 CcBlock object.
+ *
+ * @param CcBlock $v
+ * @return CcPlaylistcontents The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcBlock(CcBlock $v = null)
+ {
+ if ($v === null) {
+ $this->setDbBlockId(NULL);
+ } else {
+ $this->setDbBlockId($v->getDbId());
+ }
+
+ $this->aCcBlock = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcBlock object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcPlaylistcontents($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcBlock object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcBlock The associated CcBlock object.
+ * @throws PropelException
+ */
+ public function getCcBlock(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcBlock === null && ($this->block_id !== null) && $doQuery) {
+ $this->aCcBlock = CcBlockQuery::create()->findPk($this->block_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->aCcBlock->addCcPlaylistcontentss($this);
+ */
+ }
+
+ return $this->aCcBlock;
+ }
+
+ /**
+ * 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)
+ {
+ // aggregate_column_relation behavior
+ if (null !== $this->aCcPlaylist && $v !== $this->aCcPlaylist) {
+ $this->oldCcPlaylist = $this->aCcPlaylist;
+ }
+ 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 $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcPlaylist The associated CcPlaylist object.
+ * @throws PropelException
+ */
+ public function getCcPlaylist(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcPlaylist === null && ($this->playlist_id !== null) && $doQuery) {
+ $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->block_id = null;
+ $this->stream_id = null;
+ $this->type = null;
+ $this->position = null;
+ $this->trackoffset = null;
+ $this->cliplength = null;
+ $this->cuein = null;
+ $this->cueout = null;
+ $this->fadein = null;
+ $this->fadeout = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->aCcFiles instanceof Persistent) {
+ $this->aCcFiles->clearAllReferences($deep);
+ }
+ if ($this->aCcBlock instanceof Persistent) {
+ $this->aCcBlock->clearAllReferences($deep);
+ }
+ if ($this->aCcPlaylist instanceof Persistent) {
+ $this->aCcPlaylist->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ $this->aCcFiles = null;
+ $this->aCcBlock = null;
+ $this->aCcPlaylist = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcPlaylistcontentsPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+ // aggregate_column_relation behavior
+
+ /**
+ * Update the aggregate column in the related CcPlaylist object
+ *
+ * @param PropelPDO $con A connection object
+ */
+ protected function updateRelatedCcPlaylist(PropelPDO $con)
+ {
+ if ($ccPlaylist = $this->getCcPlaylist()) {
+ if (!$ccPlaylist->isAlreadyInSave()) {
+ $ccPlaylist->updateDbLength($con);
+ }
+ }
+ if ($this->oldCcPlaylist) {
+ $this->oldCcPlaylist->updateDbLength($con);
+ $this->oldCcPlaylist = null;
+ }
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsPeer.php
index 0e23f44c3..5f55d962f 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsPeer.php
@@ -4,1750 +4,1786 @@
/**
* Base static class for performing query and update operations on the 'cc_playlistcontents' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcPlaylistcontentsPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_playlistcontents';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcPlaylistcontents';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcPlaylistcontents';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcPlaylistcontentsTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 13;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_playlistcontents.ID';
-
- /** the column name for the PLAYLIST_ID field */
- const PLAYLIST_ID = 'cc_playlistcontents.PLAYLIST_ID';
-
- /** the column name for the FILE_ID field */
- const FILE_ID = 'cc_playlistcontents.FILE_ID';
-
- /** the column name for the BLOCK_ID field */
- const BLOCK_ID = 'cc_playlistcontents.BLOCK_ID';
-
- /** the column name for the STREAM_ID field */
- const STREAM_ID = 'cc_playlistcontents.STREAM_ID';
-
- /** the column name for the TYPE field */
- const TYPE = 'cc_playlistcontents.TYPE';
-
- /** the column name for the POSITION field */
- const POSITION = 'cc_playlistcontents.POSITION';
-
- /** the column name for the TRACKOFFSET field */
- const TRACKOFFSET = 'cc_playlistcontents.TRACKOFFSET';
-
- /** the column name for the CLIPLENGTH field */
- const CLIPLENGTH = 'cc_playlistcontents.CLIPLENGTH';
-
- /** the column name for the CUEIN field */
- const CUEIN = 'cc_playlistcontents.CUEIN';
-
- /** the column name for the CUEOUT field */
- const CUEOUT = 'cc_playlistcontents.CUEOUT';
-
- /** the column name for the FADEIN field */
- const FADEIN = 'cc_playlistcontents.FADEIN';
-
- /** the column name for the FADEOUT field */
- const FADEOUT = 'cc_playlistcontents.FADEOUT';
-
- /**
- * An identiy map to hold any loaded instances of CcPlaylistcontents objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcPlaylistcontents[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbPlaylistId', 'DbFileId', 'DbBlockId', 'DbStreamId', 'DbType', 'DbPosition', 'DbTrackOffset', 'DbCliplength', 'DbCuein', 'DbCueout', 'DbFadein', 'DbFadeout', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbFileId', 'dbBlockId', 'dbStreamId', 'dbType', 'dbPosition', 'dbTrackOffset', 'dbCliplength', 'dbCuein', 'dbCueout', 'dbFadein', 'dbFadeout', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::PLAYLIST_ID, self::FILE_ID, self::BLOCK_ID, self::STREAM_ID, self::TYPE, self::POSITION, self::TRACKOFFSET, self::CLIPLENGTH, self::CUEIN, self::CUEOUT, self::FADEIN, self::FADEOUT, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'FILE_ID', 'BLOCK_ID', 'STREAM_ID', 'TYPE', 'POSITION', 'TRACKOFFSET', 'CLIPLENGTH', 'CUEIN', 'CUEOUT', 'FADEIN', 'FADEOUT', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'file_id', 'block_id', 'stream_id', 'type', 'position', 'trackoffset', 'cliplength', 'cuein', 'cueout', 'fadein', 'fadeout', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
- );
-
- /**
- * 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, 'DbBlockId' => 3, 'DbStreamId' => 4, 'DbType' => 5, 'DbPosition' => 6, 'DbTrackOffset' => 7, 'DbCliplength' => 8, 'DbCuein' => 9, 'DbCueout' => 10, 'DbFadein' => 11, 'DbFadeout' => 12, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbFileId' => 2, 'dbBlockId' => 3, 'dbStreamId' => 4, 'dbType' => 5, 'dbPosition' => 6, 'dbTrackOffset' => 7, 'dbCliplength' => 8, 'dbCuein' => 9, 'dbCueout' => 10, 'dbFadein' => 11, 'dbFadeout' => 12, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PLAYLIST_ID => 1, self::FILE_ID => 2, self::BLOCK_ID => 3, self::STREAM_ID => 4, self::TYPE => 5, self::POSITION => 6, self::TRACKOFFSET => 7, self::CLIPLENGTH => 8, self::CUEIN => 9, self::CUEOUT => 10, self::FADEIN => 11, self::FADEOUT => 12, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'FILE_ID' => 2, 'BLOCK_ID' => 3, 'STREAM_ID' => 4, 'TYPE' => 5, 'POSITION' => 6, 'TRACKOFFSET' => 7, 'CLIPLENGTH' => 8, 'CUEIN' => 9, 'CUEOUT' => 10, 'FADEIN' => 11, 'FADEOUT' => 12, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'file_id' => 2, 'block_id' => 3, 'stream_id' => 4, 'type' => 5, 'position' => 6, 'trackoffset' => 7, 'cliplength' => 8, 'cuein' => 9, 'cueout' => 10, 'fadein' => 11, 'fadeout' => 12, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
- );
-
- /**
- * 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::BLOCK_ID);
- $criteria->addSelectColumn(CcPlaylistcontentsPeer::STREAM_ID);
- $criteria->addSelectColumn(CcPlaylistcontentsPeer::TYPE);
- $criteria->addSelectColumn(CcPlaylistcontentsPeer::POSITION);
- $criteria->addSelectColumn(CcPlaylistcontentsPeer::TRACKOFFSET);
- $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 . '.BLOCK_ID');
- $criteria->addSelectColumn($alias . '.STREAM_ID');
- $criteria->addSelectColumn($alias . '.TYPE');
- $criteria->addSelectColumn($alias . '.POSITION');
- $criteria->addSelectColumn($alias . '.TRACKOFFSET');
- $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 CcBlock 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 doCountJoinCcBlock(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::BLOCK_ID, CcBlockPeer::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 CcBlock 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 doSelectJoinCcBlock(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);
- CcBlockPeer::addSelectColumns($criteria);
-
- $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::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 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol);
- if ($key2 !== null) {
- $obj2 = CcBlockPeer::getInstanceFromPool($key2);
- if (!$obj2) {
-
- $cls = CcBlockPeer::getOMClass(false);
-
- $obj2 = new $cls();
- $obj2->hydrate($row, $startcol);
- CcBlockPeer::addInstanceToPool($obj2, $key2);
- } // if obj2 already loaded
-
- // Add the $obj1 (CcPlaylistcontents) to $obj2 (CcBlock)
- $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::BLOCK_ID, CcBlockPeer::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);
-
- CcBlockPeer::addSelectColumns($criteria);
- $startcol4 = $startcol3 + (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcPlaylistPeer::addSelectColumns($criteria);
- $startcol5 = $startcol4 + (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
-
- $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::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 CcBlock rows
-
- $key3 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol3);
- if ($key3 !== null) {
- $obj3 = CcBlockPeer::getInstanceFromPool($key3);
- if (!$obj3) {
-
- $cls = CcBlockPeer::getOMClass(false);
-
- $obj3 = new $cls();
- $obj3->hydrate($row, $startcol3);
- CcBlockPeer::addInstanceToPool($obj3, $key3);
- } // if obj3 loaded
-
- // Add the $obj1 (CcPlaylistcontents) to the collection in $obj3 (CcBlock)
- $obj3->addCcPlaylistcontents($obj1);
- } // if joined row not null
-
- // Add objects for joined CcPlaylist rows
-
- $key4 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, $startcol4);
- if ($key4 !== null) {
- $obj4 = CcPlaylistPeer::getInstanceFromPool($key4);
- if (!$obj4) {
-
- $cls = CcPlaylistPeer::getOMClass(false);
-
- $obj4 = new $cls();
- $obj4->hydrate($row, $startcol4);
- CcPlaylistPeer::addInstanceToPool($obj4, $key4);
- } // if obj4 loaded
-
- // Add the $obj1 (CcPlaylistcontents) to the collection in $obj4 (CcPlaylist)
- $obj4->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::BLOCK_ID, CcBlockPeer::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;
- }
-
-
- /**
- * Returns the number of rows matching criteria, joining the related CcBlock 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 doCountJoinAllExceptCcBlock(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);
-
- $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);
-
- $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::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);
-
- CcBlockPeer::addSelectColumns($criteria);
- $startcol3 = $startcol2 + (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcPlaylistPeer::addSelectColumns($criteria);
- $startcol4 = $startcol3 + (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::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 CcBlock rows
-
- $key2 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol2);
- if ($key2 !== null) {
- $obj2 = CcBlockPeer::getInstanceFromPool($key2);
- if (!$obj2) {
-
- $cls = CcBlockPeer::getOMClass(false);
-
- $obj2 = new $cls();
- $obj2->hydrate($row, $startcol2);
- CcBlockPeer::addInstanceToPool($obj2, $key2);
- } // if $obj2 already loaded
-
- // Add the $obj1 (CcPlaylistcontents) to the collection in $obj2 (CcBlock)
- $obj2->addCcPlaylistcontents($obj1);
-
- } // if joined row is 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 already loaded
-
- // Add the $obj1 (CcPlaylistcontents) to the collection in $obj3 (CcPlaylist)
- $obj3->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 CcBlock.
- *
- * @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 doSelectJoinAllExceptCcBlock(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);
-
- 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);
+abstract class BaseCcPlaylistcontentsPeer
+{
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
- $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
-
- // 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 already loaded
-
- // Add the $obj1 (CcPlaylistcontents) to the collection in $obj3 (CcPlaylist)
- $obj3->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);
-
- CcBlockPeer::addSelectColumns($criteria);
- $startcol4 = $startcol3 + (CcBlockPeer::NUM_COLUMNS - CcBlockPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
-
- $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::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
-
- // Add objects for joined CcBlock rows
-
- $key3 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol3);
- if ($key3 !== null) {
- $obj3 = CcBlockPeer::getInstanceFromPool($key3);
- if (!$obj3) {
-
- $cls = CcBlockPeer::getOMClass(false);
-
- $obj3 = new $cls();
- $obj3->hydrate($row, $startcol3);
- CcBlockPeer::addInstanceToPool($obj3, $key3);
- } // if $obj3 already loaded
-
- // Add the $obj1 (CcPlaylistcontents) to the collection in $obj3 (CcBlock)
- $obj3->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;
- }
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_playlistcontents';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcPlaylistcontents';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcPlaylistcontentsTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 13;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 13;
+
+ /** the column name for the id field */
+ const ID = 'cc_playlistcontents.id';
+
+ /** the column name for the playlist_id field */
+ const PLAYLIST_ID = 'cc_playlistcontents.playlist_id';
+
+ /** the column name for the file_id field */
+ const FILE_ID = 'cc_playlistcontents.file_id';
+
+ /** the column name for the block_id field */
+ const BLOCK_ID = 'cc_playlistcontents.block_id';
+
+ /** the column name for the stream_id field */
+ const STREAM_ID = 'cc_playlistcontents.stream_id';
+
+ /** the column name for the type field */
+ const TYPE = 'cc_playlistcontents.type';
+
+ /** the column name for the position field */
+ const POSITION = 'cc_playlistcontents.position';
+
+ /** the column name for the trackoffset field */
+ const TRACKOFFSET = 'cc_playlistcontents.trackoffset';
+
+ /** the column name for the cliplength field */
+ const CLIPLENGTH = 'cc_playlistcontents.cliplength';
+
+ /** the column name for the cuein field */
+ const CUEIN = 'cc_playlistcontents.cuein';
+
+ /** the column name for the cueout field */
+ const CUEOUT = 'cc_playlistcontents.cueout';
+
+ /** the column name for the fadein field */
+ const FADEIN = 'cc_playlistcontents.fadein';
+
+ /** the column name for the fadeout field */
+ const FADEOUT = 'cc_playlistcontents.fadeout';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcPlaylistcontents objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcPlaylistcontents[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcPlaylistcontentsPeer::$fieldNames[CcPlaylistcontentsPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbPlaylistId', 'DbFileId', 'DbBlockId', 'DbStreamId', 'DbType', 'DbPosition', 'DbTrackOffset', 'DbCliplength', 'DbCuein', 'DbCueout', 'DbFadein', 'DbFadeout', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbFileId', 'dbBlockId', 'dbStreamId', 'dbType', 'dbPosition', 'dbTrackOffset', 'dbCliplength', 'dbCuein', 'dbCueout', 'dbFadein', 'dbFadeout', ),
+ BasePeer::TYPE_COLNAME => array (CcPlaylistcontentsPeer::ID, CcPlaylistcontentsPeer::PLAYLIST_ID, CcPlaylistcontentsPeer::FILE_ID, CcPlaylistcontentsPeer::BLOCK_ID, CcPlaylistcontentsPeer::STREAM_ID, CcPlaylistcontentsPeer::TYPE, CcPlaylistcontentsPeer::POSITION, CcPlaylistcontentsPeer::TRACKOFFSET, CcPlaylistcontentsPeer::CLIPLENGTH, CcPlaylistcontentsPeer::CUEIN, CcPlaylistcontentsPeer::CUEOUT, CcPlaylistcontentsPeer::FADEIN, CcPlaylistcontentsPeer::FADEOUT, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'FILE_ID', 'BLOCK_ID', 'STREAM_ID', 'TYPE', 'POSITION', 'TRACKOFFSET', 'CLIPLENGTH', 'CUEIN', 'CUEOUT', 'FADEIN', 'FADEOUT', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'file_id', 'block_id', 'stream_id', 'type', 'position', 'trackoffset', 'cliplength', 'cuein', 'cueout', 'fadein', 'fadeout', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. CcPlaylistcontentsPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbPlaylistId' => 1, 'DbFileId' => 2, 'DbBlockId' => 3, 'DbStreamId' => 4, 'DbType' => 5, 'DbPosition' => 6, 'DbTrackOffset' => 7, 'DbCliplength' => 8, 'DbCuein' => 9, 'DbCueout' => 10, 'DbFadein' => 11, 'DbFadeout' => 12, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbFileId' => 2, 'dbBlockId' => 3, 'dbStreamId' => 4, 'dbType' => 5, 'dbPosition' => 6, 'dbTrackOffset' => 7, 'dbCliplength' => 8, 'dbCuein' => 9, 'dbCueout' => 10, 'dbFadein' => 11, 'dbFadeout' => 12, ),
+ BasePeer::TYPE_COLNAME => array (CcPlaylistcontentsPeer::ID => 0, CcPlaylistcontentsPeer::PLAYLIST_ID => 1, CcPlaylistcontentsPeer::FILE_ID => 2, CcPlaylistcontentsPeer::BLOCK_ID => 3, CcPlaylistcontentsPeer::STREAM_ID => 4, CcPlaylistcontentsPeer::TYPE => 5, CcPlaylistcontentsPeer::POSITION => 6, CcPlaylistcontentsPeer::TRACKOFFSET => 7, CcPlaylistcontentsPeer::CLIPLENGTH => 8, CcPlaylistcontentsPeer::CUEIN => 9, CcPlaylistcontentsPeer::CUEOUT => 10, CcPlaylistcontentsPeer::FADEIN => 11, CcPlaylistcontentsPeer::FADEOUT => 12, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'FILE_ID' => 2, 'BLOCK_ID' => 3, 'STREAM_ID' => 4, 'TYPE' => 5, 'POSITION' => 6, 'TRACKOFFSET' => 7, 'CLIPLENGTH' => 8, 'CUEIN' => 9, 'CUEOUT' => 10, 'FADEIN' => 11, 'FADEOUT' => 12, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'file_id' => 2, 'block_id' => 3, 'stream_id' => 4, 'type' => 5, 'position' => 6, 'trackoffset' => 7, 'cliplength' => 8, 'cuein' => 9, 'cueout' => 10, 'fadein' => 11, 'fadeout' => 12, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
+ );
+
+ /**
+ * 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcPlaylistcontentsPeer::getFieldNames($toType);
+ $key = isset(CcPlaylistcontentsPeer::$fieldKeys[$fromType][$name]) ? CcPlaylistcontentsPeer::$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(CcPlaylistcontentsPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcPlaylistcontentsPeer::$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 CcPlaylistcontentsPeer::$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::BLOCK_ID);
+ $criteria->addSelectColumn(CcPlaylistcontentsPeer::STREAM_ID);
+ $criteria->addSelectColumn(CcPlaylistcontentsPeer::TYPE);
+ $criteria->addSelectColumn(CcPlaylistcontentsPeer::POSITION);
+ $criteria->addSelectColumn(CcPlaylistcontentsPeer::TRACKOFFSET);
+ $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 . '.block_id');
+ $criteria->addSelectColumn($alias . '.stream_id');
+ $criteria->addSelectColumn($alias . '.type');
+ $criteria->addSelectColumn($alias . '.position');
+ $criteria->addSelectColumn($alias . '.trackoffset');
+ $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(CcPlaylistcontentsPeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcPlaylistcontentsPeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcPlaylistcontentsPeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcPlaylistcontentsPeer::$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(CcPlaylistcontentsPeer::$instances[$key])) {
+ return CcPlaylistcontentsPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcPlaylistcontentsPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcPlaylistcontentsPeer::$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();
+ // 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_HYDRATE_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(CcPlaylistcontentsPeer::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 CcBlock 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 doCountJoinCcBlock(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(CcPlaylistcontentsPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::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(CcPlaylistcontentsPeer::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(CcPlaylistcontentsPeer::DATABASE_NAME);
+ }
+
+ CcPlaylistcontentsPeer::addSelectColumns($criteria);
+ $startcol = CcPlaylistcontentsPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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 CcBlock 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 doSelectJoinCcBlock(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(CcPlaylistcontentsPeer::DATABASE_NAME);
+ }
+
+ CcPlaylistcontentsPeer::addSelectColumns($criteria);
+ $startcol = CcPlaylistcontentsPeer::NUM_HYDRATE_COLUMNS;
+ CcBlockPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::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();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlaylistcontentsPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcBlockPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcBlockPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcBlockPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcPlaylistcontents) to $obj2 (CcBlock)
+ $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(CcPlaylistcontentsPeer::DATABASE_NAME);
+ }
+
+ CcPlaylistcontentsPeer::addSelectColumns($criteria);
+ $startcol = CcPlaylistcontentsPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcPlaylistcontentsPeer::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::BLOCK_ID, CcBlockPeer::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(CcPlaylistcontentsPeer::DATABASE_NAME);
+ }
+
+ CcPlaylistcontentsPeer::addSelectColumns($criteria);
+ $startcol2 = CcPlaylistcontentsPeer::NUM_HYDRATE_COLUMNS;
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcFilesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcBlockPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + CcBlockPeer::NUM_HYDRATE_COLUMNS;
+
+ CcPlaylistPeer::addSelectColumns($criteria);
+ $startcol5 = $startcol4 + CcPlaylistPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::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();
+
+ $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();
+
+ $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 CcBlock rows
+
+ $key3 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol3);
+ if ($key3 !== null) {
+ $obj3 = CcBlockPeer::getInstanceFromPool($key3);
+ if (!$obj3) {
+
+ $cls = CcBlockPeer::getOMClass();
+
+ $obj3 = new $cls();
+ $obj3->hydrate($row, $startcol3);
+ CcBlockPeer::addInstanceToPool($obj3, $key3);
+ } // if obj3 loaded
+
+ // Add the $obj1 (CcPlaylistcontents) to the collection in $obj3 (CcBlock)
+ $obj3->addCcPlaylistcontents($obj1);
+ } // if joined row not null
+
+ // Add objects for joined CcPlaylist rows
+
+ $key4 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, $startcol4);
+ if ($key4 !== null) {
+ $obj4 = CcPlaylistPeer::getInstanceFromPool($key4);
+ if (!$obj4) {
+
+ $cls = CcPlaylistPeer::getOMClass();
+
+ $obj4 = new $cls();
+ $obj4->hydrate($row, $startcol4);
+ CcPlaylistPeer::addInstanceToPool($obj4, $key4);
+ } // if obj4 loaded
+
+ // Add the $obj1 (CcPlaylistcontents) to the collection in $obj4 (CcPlaylist)
+ $obj4->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(CcPlaylistcontentsPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::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;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcBlock 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 doCountJoinAllExceptCcBlock(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(CcPlaylistcontentsPeer::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;
+ }
+
+
+ /**
+ * 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(CcPlaylistcontentsPeer::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::BLOCK_ID, CcBlockPeer::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(CcPlaylistcontentsPeer::DATABASE_NAME);
+ }
+
+ CcPlaylistcontentsPeer::addSelectColumns($criteria);
+ $startcol2 = CcPlaylistcontentsPeer::NUM_HYDRATE_COLUMNS;
+
+ CcBlockPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcBlockPeer::NUM_HYDRATE_COLUMNS;
+
+ CcPlaylistPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + CcPlaylistPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::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();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlaylistcontentsPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcBlock rows
+
+ $key2 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcBlockPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcBlockPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcBlockPeer::addInstanceToPool($obj2, $key2);
+ } // if $obj2 already loaded
+
+ // Add the $obj1 (CcPlaylistcontents) to the collection in $obj2 (CcBlock)
+ $obj2->addCcPlaylistcontents($obj1);
+
+ } // if joined row is 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();
+
+ $obj3 = new $cls();
+ $obj3->hydrate($row, $startcol3);
+ CcPlaylistPeer::addInstanceToPool($obj3, $key3);
+ } // if $obj3 already loaded
+
+ // Add the $obj1 (CcPlaylistcontents) to the collection in $obj3 (CcPlaylist)
+ $obj3->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 CcBlock.
+ *
+ * @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 doSelectJoinAllExceptCcBlock(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(CcPlaylistcontentsPeer::DATABASE_NAME);
+ }
+
+ CcPlaylistcontentsPeer::addSelectColumns($criteria);
+ $startcol2 = CcPlaylistcontentsPeer::NUM_HYDRATE_COLUMNS;
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcFilesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcPlaylistPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + CcPlaylistPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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
+
+ // Add objects for joined CcPlaylist rows
+
+ $key3 = CcPlaylistPeer::getPrimaryKeyHashFromRow($row, $startcol3);
+ if ($key3 !== null) {
+ $obj3 = CcPlaylistPeer::getInstanceFromPool($key3);
+ if (!$obj3) {
+
+ $cls = CcPlaylistPeer::getOMClass();
+
+ $obj3 = new $cls();
+ $obj3->hydrate($row, $startcol3);
+ CcPlaylistPeer::addInstanceToPool($obj3, $key3);
+ } // if $obj3 already loaded
+
+ // Add the $obj1 (CcPlaylistcontents) to the collection in $obj3 (CcPlaylist)
+ $obj3->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(CcPlaylistcontentsPeer::DATABASE_NAME);
+ }
+
+ CcPlaylistcontentsPeer::addSelectColumns($criteria);
+ $startcol2 = CcPlaylistcontentsPeer::NUM_HYDRATE_COLUMNS;
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcFilesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcBlockPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + CcBlockPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcPlaylistcontentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcPlaylistcontentsPeer::BLOCK_ID, CcBlockPeer::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();
+
+ $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();
+
+ $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
+
+ // Add objects for joined CcBlock rows
+
+ $key3 = CcBlockPeer::getPrimaryKeyHashFromRow($row, $startcol3);
+ if ($key3 !== null) {
+ $obj3 = CcBlockPeer::getInstanceFromPool($key3);
+ if (!$obj3) {
+
+ $cls = CcBlockPeer::getOMClass();
+
+ $obj3 = new $cls();
+ $obj3->hydrate($row, $startcol3);
+ CcBlockPeer::addInstanceToPool($obj3, $key3);
+ } // if $obj3 already loaded
+
+ // Add the $obj1 (CcPlaylistcontents) to the collection in $obj3 (CcBlock)
+ $obj3->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(CcPlaylistcontentsPeer::DATABASE_NAME)->getTable(CcPlaylistcontentsPeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcPlaylistcontentsPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcPlaylistcontentsPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcPlaylistcontentsPeer::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(CcPlaylistcontentsPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_playlistcontents table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcPlaylistcontentsPeer::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(CcPlaylistcontentsPeer::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 (Exception $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($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->hasColumn($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
+ * @return CcPlaylistcontents[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php
index ef3d3877a..ea0aaaec6 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php
@@ -4,845 +4,1120 @@
/**
* Base class that represents a query for the 'cc_playlistcontents' table.
*
- *
*
- * @method CcPlaylistcontentsQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcPlaylistcontentsQuery orderByDbPlaylistId($order = Criteria::ASC) Order by the playlist_id column
- * @method CcPlaylistcontentsQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column
- * @method CcPlaylistcontentsQuery orderByDbBlockId($order = Criteria::ASC) Order by the block_id column
- * @method CcPlaylistcontentsQuery orderByDbStreamId($order = Criteria::ASC) Order by the stream_id column
- * @method CcPlaylistcontentsQuery orderByDbType($order = Criteria::ASC) Order by the type column
- * @method CcPlaylistcontentsQuery orderByDbPosition($order = Criteria::ASC) Order by the position column
- * @method CcPlaylistcontentsQuery orderByDbTrackOffset($order = Criteria::ASC) Order by the trackoffset column
- * @method CcPlaylistcontentsQuery orderByDbCliplength($order = Criteria::ASC) Order by the cliplength column
- * @method CcPlaylistcontentsQuery orderByDbCuein($order = Criteria::ASC) Order by the cuein column
- * @method CcPlaylistcontentsQuery orderByDbCueout($order = Criteria::ASC) Order by the cueout column
- * @method CcPlaylistcontentsQuery orderByDbFadein($order = Criteria::ASC) Order by the fadein column
- * @method CcPlaylistcontentsQuery orderByDbFadeout($order = Criteria::ASC) Order by the fadeout column
*
- * @method CcPlaylistcontentsQuery groupByDbId() Group by the id column
- * @method CcPlaylistcontentsQuery groupByDbPlaylistId() Group by the playlist_id column
- * @method CcPlaylistcontentsQuery groupByDbFileId() Group by the file_id column
- * @method CcPlaylistcontentsQuery groupByDbBlockId() Group by the block_id column
- * @method CcPlaylistcontentsQuery groupByDbStreamId() Group by the stream_id column
- * @method CcPlaylistcontentsQuery groupByDbType() Group by the type column
- * @method CcPlaylistcontentsQuery groupByDbPosition() Group by the position column
- * @method CcPlaylistcontentsQuery groupByDbTrackOffset() Group by the trackoffset column
- * @method CcPlaylistcontentsQuery groupByDbCliplength() Group by the cliplength column
- * @method CcPlaylistcontentsQuery groupByDbCuein() Group by the cuein column
- * @method CcPlaylistcontentsQuery groupByDbCueout() Group by the cueout column
- * @method CcPlaylistcontentsQuery groupByDbFadein() Group by the fadein column
- * @method CcPlaylistcontentsQuery groupByDbFadeout() Group by the fadeout column
+ * @method CcPlaylistcontentsQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcPlaylistcontentsQuery orderByDbPlaylistId($order = Criteria::ASC) Order by the playlist_id column
+ * @method CcPlaylistcontentsQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column
+ * @method CcPlaylistcontentsQuery orderByDbBlockId($order = Criteria::ASC) Order by the block_id column
+ * @method CcPlaylistcontentsQuery orderByDbStreamId($order = Criteria::ASC) Order by the stream_id column
+ * @method CcPlaylistcontentsQuery orderByDbType($order = Criteria::ASC) Order by the type column
+ * @method CcPlaylistcontentsQuery orderByDbPosition($order = Criteria::ASC) Order by the position column
+ * @method CcPlaylistcontentsQuery orderByDbTrackOffset($order = Criteria::ASC) Order by the trackoffset column
+ * @method CcPlaylistcontentsQuery orderByDbCliplength($order = Criteria::ASC) Order by the cliplength column
+ * @method CcPlaylistcontentsQuery orderByDbCuein($order = Criteria::ASC) Order by the cuein column
+ * @method CcPlaylistcontentsQuery orderByDbCueout($order = Criteria::ASC) Order by the cueout column
+ * @method CcPlaylistcontentsQuery orderByDbFadein($order = Criteria::ASC) Order by the fadein column
+ * @method CcPlaylistcontentsQuery orderByDbFadeout($order = Criteria::ASC) Order by the fadeout column
*
- * @method CcPlaylistcontentsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcPlaylistcontentsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcPlaylistcontentsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcPlaylistcontentsQuery groupByDbId() Group by the id column
+ * @method CcPlaylistcontentsQuery groupByDbPlaylistId() Group by the playlist_id column
+ * @method CcPlaylistcontentsQuery groupByDbFileId() Group by the file_id column
+ * @method CcPlaylistcontentsQuery groupByDbBlockId() Group by the block_id column
+ * @method CcPlaylistcontentsQuery groupByDbStreamId() Group by the stream_id column
+ * @method CcPlaylistcontentsQuery groupByDbType() Group by the type column
+ * @method CcPlaylistcontentsQuery groupByDbPosition() Group by the position column
+ * @method CcPlaylistcontentsQuery groupByDbTrackOffset() Group by the trackoffset column
+ * @method CcPlaylistcontentsQuery groupByDbCliplength() Group by the cliplength column
+ * @method CcPlaylistcontentsQuery groupByDbCuein() Group by the cuein column
+ * @method CcPlaylistcontentsQuery groupByDbCueout() Group by the cueout column
+ * @method CcPlaylistcontentsQuery groupByDbFadein() Group by the fadein column
+ * @method CcPlaylistcontentsQuery groupByDbFadeout() Group by the fadeout column
*
- * @method CcPlaylistcontentsQuery leftJoinCcFiles($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFiles relation
- * @method CcPlaylistcontentsQuery rightJoinCcFiles($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFiles relation
- * @method CcPlaylistcontentsQuery innerJoinCcFiles($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFiles relation
+ * @method CcPlaylistcontentsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcPlaylistcontentsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcPlaylistcontentsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcPlaylistcontentsQuery leftJoinCcBlock($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcBlock relation
- * @method CcPlaylistcontentsQuery rightJoinCcBlock($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcBlock relation
- * @method CcPlaylistcontentsQuery innerJoinCcBlock($relationAlias = '') Adds a INNER JOIN clause to the query using the CcBlock relation
+ * @method CcPlaylistcontentsQuery leftJoinCcFiles($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcFiles relation
+ * @method CcPlaylistcontentsQuery rightJoinCcFiles($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcFiles relation
+ * @method CcPlaylistcontentsQuery innerJoinCcFiles($relationAlias = null) Adds a INNER JOIN clause to the query using the CcFiles relation
*
- * @method CcPlaylistcontentsQuery leftJoinCcPlaylist($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlaylist relation
- * @method CcPlaylistcontentsQuery rightJoinCcPlaylist($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlaylist relation
- * @method CcPlaylistcontentsQuery innerJoinCcPlaylist($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlaylist relation
+ * @method CcPlaylistcontentsQuery leftJoinCcBlock($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcBlock relation
+ * @method CcPlaylistcontentsQuery rightJoinCcBlock($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcBlock relation
+ * @method CcPlaylistcontentsQuery innerJoinCcBlock($relationAlias = null) Adds a INNER JOIN clause to the query using the CcBlock relation
*
- * @method CcPlaylistcontents findOne(PropelPDO $con = null) Return the first CcPlaylistcontents matching the query
- * @method CcPlaylistcontents findOneOrCreate(PropelPDO $con = null) Return the first CcPlaylistcontents matching the query, or a new CcPlaylistcontents object populated from the query conditions when no match is found
+ * @method CcPlaylistcontentsQuery leftJoinCcPlaylist($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPlaylist relation
+ * @method CcPlaylistcontentsQuery rightJoinCcPlaylist($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPlaylist relation
+ * @method CcPlaylistcontentsQuery innerJoinCcPlaylist($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPlaylist relation
*
- * @method CcPlaylistcontents findOneByDbId(int $id) Return the first CcPlaylistcontents filtered by the id column
- * @method CcPlaylistcontents findOneByDbPlaylistId(int $playlist_id) Return the first CcPlaylistcontents filtered by the playlist_id column
- * @method CcPlaylistcontents findOneByDbFileId(int $file_id) Return the first CcPlaylistcontents filtered by the file_id column
- * @method CcPlaylistcontents findOneByDbBlockId(int $block_id) Return the first CcPlaylistcontents filtered by the block_id column
- * @method CcPlaylistcontents findOneByDbStreamId(int $stream_id) Return the first CcPlaylistcontents filtered by the stream_id column
- * @method CcPlaylistcontents findOneByDbType(int $type) Return the first CcPlaylistcontents filtered by the type column
- * @method CcPlaylistcontents findOneByDbPosition(int $position) Return the first CcPlaylistcontents filtered by the position column
- * @method CcPlaylistcontents findOneByDbTrackOffset(double $trackoffset) Return the first CcPlaylistcontents filtered by the trackoffset column
- * @method CcPlaylistcontents findOneByDbCliplength(string $cliplength) Return the first CcPlaylistcontents filtered by the cliplength column
- * @method CcPlaylistcontents findOneByDbCuein(string $cuein) Return the first CcPlaylistcontents filtered by the cuein column
- * @method CcPlaylistcontents findOneByDbCueout(string $cueout) Return the first CcPlaylistcontents filtered by the cueout column
- * @method CcPlaylistcontents findOneByDbFadein(string $fadein) Return the first CcPlaylistcontents filtered by the fadein column
- * @method CcPlaylistcontents findOneByDbFadeout(string $fadeout) Return the first CcPlaylistcontents filtered by the fadeout column
+ * @method CcPlaylistcontents findOne(PropelPDO $con = null) Return the first CcPlaylistcontents matching the query
+ * @method CcPlaylistcontents findOneOrCreate(PropelPDO $con = null) Return the first CcPlaylistcontents matching the query, or a new CcPlaylistcontents object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcPlaylistcontents objects filtered by the id column
- * @method array findByDbPlaylistId(int $playlist_id) Return CcPlaylistcontents objects filtered by the playlist_id column
- * @method array findByDbFileId(int $file_id) Return CcPlaylistcontents objects filtered by the file_id column
- * @method array findByDbBlockId(int $block_id) Return CcPlaylistcontents objects filtered by the block_id column
- * @method array findByDbStreamId(int $stream_id) Return CcPlaylistcontents objects filtered by the stream_id column
- * @method array findByDbType(int $type) Return CcPlaylistcontents objects filtered by the type column
- * @method array findByDbPosition(int $position) Return CcPlaylistcontents objects filtered by the position column
- * @method array findByDbTrackOffset(double $trackoffset) Return CcPlaylistcontents objects filtered by the trackoffset column
- * @method array findByDbCliplength(string $cliplength) Return CcPlaylistcontents objects filtered by the cliplength column
- * @method array findByDbCuein(string $cuein) Return CcPlaylistcontents objects filtered by the cuein column
- * @method array findByDbCueout(string $cueout) Return CcPlaylistcontents objects filtered by the cueout column
- * @method array findByDbFadein(string $fadein) Return CcPlaylistcontents objects filtered by the fadein column
- * @method array findByDbFadeout(string $fadeout) Return CcPlaylistcontents objects filtered by the fadeout column
+ * @method CcPlaylistcontents findOneByDbPlaylistId(int $playlist_id) Return the first CcPlaylistcontents filtered by the playlist_id column
+ * @method CcPlaylistcontents findOneByDbFileId(int $file_id) Return the first CcPlaylistcontents filtered by the file_id column
+ * @method CcPlaylistcontents findOneByDbBlockId(int $block_id) Return the first CcPlaylistcontents filtered by the block_id column
+ * @method CcPlaylistcontents findOneByDbStreamId(int $stream_id) Return the first CcPlaylistcontents filtered by the stream_id column
+ * @method CcPlaylistcontents findOneByDbType(int $type) Return the first CcPlaylistcontents filtered by the type column
+ * @method CcPlaylistcontents findOneByDbPosition(int $position) Return the first CcPlaylistcontents filtered by the position column
+ * @method CcPlaylistcontents findOneByDbTrackOffset(double $trackoffset) Return the first CcPlaylistcontents filtered by the trackoffset column
+ * @method CcPlaylistcontents findOneByDbCliplength(string $cliplength) Return the first CcPlaylistcontents filtered by the cliplength column
+ * @method CcPlaylistcontents findOneByDbCuein(string $cuein) Return the first CcPlaylistcontents filtered by the cuein column
+ * @method CcPlaylistcontents findOneByDbCueout(string $cueout) Return the first CcPlaylistcontents filtered by the cueout column
+ * @method CcPlaylistcontents findOneByDbFadein(string $fadein) Return the first CcPlaylistcontents filtered by the fadein column
+ * @method CcPlaylistcontents findOneByDbFadeout(string $fadeout) Return the first CcPlaylistcontents filtered by the fadeout column
+ *
+ * @method array findByDbId(int $id) Return CcPlaylistcontents objects filtered by the id column
+ * @method array findByDbPlaylistId(int $playlist_id) Return CcPlaylistcontents objects filtered by the playlist_id column
+ * @method array findByDbFileId(int $file_id) Return CcPlaylistcontents objects filtered by the file_id column
+ * @method array findByDbBlockId(int $block_id) Return CcPlaylistcontents objects filtered by the block_id column
+ * @method array findByDbStreamId(int $stream_id) Return CcPlaylistcontents objects filtered by the stream_id column
+ * @method array findByDbType(int $type) Return CcPlaylistcontents objects filtered by the type column
+ * @method array findByDbPosition(int $position) Return CcPlaylistcontents objects filtered by the position column
+ * @method array findByDbTrackOffset(double $trackoffset) Return CcPlaylistcontents objects filtered by the trackoffset column
+ * @method array findByDbCliplength(string $cliplength) Return CcPlaylistcontents objects filtered by the cliplength column
+ * @method array findByDbCuein(string $cuein) Return CcPlaylistcontents objects filtered by the cuein column
+ * @method array findByDbCueout(string $cueout) Return CcPlaylistcontents objects filtered by the cueout column
+ * @method array findByDbFadein(string $fadein) Return CcPlaylistcontents objects filtered by the fadein column
+ * @method array findByDbFadeout(string $fadeout) Return CcPlaylistcontents objects filtered by the fadeout column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcPlaylistcontentsQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcPlaylistcontents';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcPlaylistcontentsQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcPlaylistcontents', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcPlaylistcontentsQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcPlaylistcontentsQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcPlaylistcontentsQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcPlaylistcontentsQuery) {
+ return $criteria;
+ }
+ $query = new CcPlaylistcontentsQuery(null, null, $modelAlias);
- /**
- * Returns a new CcPlaylistcontentsQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcPlaylistcontentsQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcPlaylistcontentsQuery) {
- return $criteria;
- }
- $query = new CcPlaylistcontentsQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcPlaylistcontents|CcPlaylistcontents[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcPlaylistcontentsPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $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);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPlaylistcontents A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPlaylistcontents A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "playlist_id", "file_id", "block_id", "stream_id", "type", "position", "trackoffset", "cliplength", "cuein", "cueout", "fadein", "fadeout" FROM "cc_playlistcontents" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcPlaylistcontents();
+ $obj->hydrate($row);
+ CcPlaylistcontentsPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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);
- }
+ return $obj;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPlaylistcontents|CcPlaylistcontents[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * Filter the query on the block_id column
- *
- * @param int|array $dbBlockId 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 filterByDbBlockId($dbBlockId = null, $comparison = null)
- {
- if (is_array($dbBlockId)) {
- $useMinMax = false;
- if (isset($dbBlockId['min'])) {
- $this->addUsingAlias(CcPlaylistcontentsPeer::BLOCK_ID, $dbBlockId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbBlockId['max'])) {
- $this->addUsingAlias(CcPlaylistcontentsPeer::BLOCK_ID, $dbBlockId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcPlaylistcontentsPeer::BLOCK_ID, $dbBlockId, $comparison);
- }
+ /**
+ * 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|CcPlaylistcontents[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * Filter the query on the stream_id column
- *
- * @param int|array $dbStreamId 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 filterByDbStreamId($dbStreamId = null, $comparison = null)
- {
- if (is_array($dbStreamId)) {
- $useMinMax = false;
- if (isset($dbStreamId['min'])) {
- $this->addUsingAlias(CcPlaylistcontentsPeer::STREAM_ID, $dbStreamId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbStreamId['max'])) {
- $this->addUsingAlias(CcPlaylistcontentsPeer::STREAM_ID, $dbStreamId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcPlaylistcontentsPeer::STREAM_ID, $dbStreamId, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * Filter the query on the type column
- *
- * @param int|array $dbType 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 filterByDbType($dbType = null, $comparison = null)
- {
- if (is_array($dbType)) {
- $useMinMax = false;
- if (isset($dbType['min'])) {
- $this->addUsingAlias(CcPlaylistcontentsPeer::TYPE, $dbType['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbType['max'])) {
- $this->addUsingAlias(CcPlaylistcontentsPeer::TYPE, $dbType['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcPlaylistcontentsPeer::TYPE, $dbType, $comparison);
- }
+ /**
+ * 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)
+ {
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcPlaylistcontentsPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * Filter the query on the trackoffset column
- *
- * @param double|array $dbTrackOffset 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 filterByDbTrackOffset($dbTrackOffset = null, $comparison = null)
- {
- if (is_array($dbTrackOffset)) {
- $useMinMax = false;
- if (isset($dbTrackOffset['min'])) {
- $this->addUsingAlias(CcPlaylistcontentsPeer::TRACKOFFSET, $dbTrackOffset['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbTrackOffset['max'])) {
- $this->addUsingAlias(CcPlaylistcontentsPeer::TRACKOFFSET, $dbTrackOffset['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcPlaylistcontentsPeer::TRACKOFFSET, $dbTrackOffset, $comparison);
- }
+ /**
+ * 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)
+ {
- /**
- * Filter the query on the cliplength column
- *
- * @param string $dbCliplength 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 CcPlaylistcontentsQuery The current query, for fluid interface
- */
- public function filterByDbCliplength($dbCliplength = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbCliplength)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbCliplength)) {
- $dbCliplength = str_replace('*', '%', $dbCliplength);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcPlaylistcontentsPeer::CLIPLENGTH, $dbCliplength, $comparison);
- }
+ return $this->addUsingAlias(CcPlaylistcontentsPeer::ID, $keys, Criteria::IN);
+ }
- /**
- * Filter the query on the cuein column
- *
- * @param string $dbCuein 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 CcPlaylistcontentsQuery The current query, for fluid interface
- */
- public function filterByDbCuein($dbCuein = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbCuein)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbCuein)) {
- $dbCuein = str_replace('*', '%', $dbCuein);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcPlaylistcontentsPeer::CUEIN, $dbCuein, $comparison);
- }
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcPlaylistcontentsPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcPlaylistcontentsPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * Filter the query on the cueout column
- *
- * @param string $dbCueout 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 CcPlaylistcontentsQuery The current query, for fluid interface
- */
- public function filterByDbCueout($dbCueout = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbCueout)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbCueout)) {
- $dbCueout = str_replace('*', '%', $dbCueout);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcPlaylistcontentsPeer::CUEOUT, $dbCueout, $comparison);
- }
+ return $this->addUsingAlias(CcPlaylistcontentsPeer::ID, $dbId, $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 playlist_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbPlaylistId(1234); // WHERE playlist_id = 1234
+ * $query->filterByDbPlaylistId(array(12, 34)); // WHERE playlist_id IN (12, 34)
+ * $query->filterByDbPlaylistId(array('min' => 12)); // WHERE playlist_id >= 12
+ * $query->filterByDbPlaylistId(array('max' => 12)); // WHERE playlist_id <= 12
+ *
+ *
+ * @see filterByCcPlaylist()
+ *
+ * @param mixed $dbPlaylistId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcPlaylistcontentsPeer::PLAYLIST_ID, $dbPlaylistId, $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);
- }
+ /**
+ * Filter the query on the file_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbFileId(1234); // WHERE file_id = 1234
+ * $query->filterByDbFileId(array(12, 34)); // WHERE file_id IN (12, 34)
+ * $query->filterByDbFileId(array('min' => 12)); // WHERE file_id >= 12
+ * $query->filterByDbFileId(array('max' => 12)); // WHERE file_id <= 12
+ *
+ *
+ * @see filterByCcFiles()
+ *
+ * @param mixed $dbFileId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcPlaylistcontentsPeer::FILE_ID, $dbFileId, $comparison);
+ }
- /**
- * 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 on the block_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbBlockId(1234); // WHERE block_id = 1234
+ * $query->filterByDbBlockId(array(12, 34)); // WHERE block_id IN (12, 34)
+ * $query->filterByDbBlockId(array('min' => 12)); // WHERE block_id >= 12
+ * $query->filterByDbBlockId(array('max' => 12)); // WHERE block_id <= 12
+ *
+ *
+ * @see filterByCcBlock()
+ *
+ * @param mixed $dbBlockId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlaylistcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbBlockId($dbBlockId = null, $comparison = null)
+ {
+ if (is_array($dbBlockId)) {
+ $useMinMax = false;
+ if (isset($dbBlockId['min'])) {
+ $this->addUsingAlias(CcPlaylistcontentsPeer::BLOCK_ID, $dbBlockId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbBlockId['max'])) {
+ $this->addUsingAlias(CcPlaylistcontentsPeer::BLOCK_ID, $dbBlockId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * Filter the query by a related CcBlock object
- *
- * @param CcBlock $ccBlock 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 filterByCcBlock($ccBlock, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcPlaylistcontentsPeer::BLOCK_ID, $ccBlock->getDbId(), $comparison);
- }
+ return $this->addUsingAlias(CcPlaylistcontentsPeer::BLOCK_ID, $dbBlockId, $comparison);
+ }
- /**
- * Adds a JOIN clause to the query using the CcBlock 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 joinCcBlock($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcBlock');
-
- // 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, 'CcBlock');
- }
-
- return $this;
- }
+ /**
+ * Filter the query on the stream_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbStreamId(1234); // WHERE stream_id = 1234
+ * $query->filterByDbStreamId(array(12, 34)); // WHERE stream_id IN (12, 34)
+ * $query->filterByDbStreamId(array('min' => 12)); // WHERE stream_id >= 12
+ * $query->filterByDbStreamId(array('max' => 12)); // WHERE stream_id <= 12
+ *
+ *
+ * @param mixed $dbStreamId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlaylistcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbStreamId($dbStreamId = null, $comparison = null)
+ {
+ if (is_array($dbStreamId)) {
+ $useMinMax = false;
+ if (isset($dbStreamId['min'])) {
+ $this->addUsingAlias(CcPlaylistcontentsPeer::STREAM_ID, $dbStreamId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbStreamId['max'])) {
+ $this->addUsingAlias(CcPlaylistcontentsPeer::STREAM_ID, $dbStreamId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * Use the CcBlock relation CcBlock 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 CcBlockQuery A secondary query class using the current class as primary query
- */
- public function useCcBlockQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- return $this
- ->joinCcBlock($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcBlock', 'CcBlockQuery');
- }
+ return $this->addUsingAlias(CcPlaylistcontentsPeer::STREAM_ID, $dbStreamId, $comparison);
+ }
- /**
- * 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);
- }
+ /**
+ * Filter the query on the type column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbType(1234); // WHERE type = 1234
+ * $query->filterByDbType(array(12, 34)); // WHERE type IN (12, 34)
+ * $query->filterByDbType(array('min' => 12)); // WHERE type >= 12
+ * $query->filterByDbType(array('max' => 12)); // WHERE type <= 12
+ *
+ *
+ * @param mixed $dbType The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlaylistcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbType($dbType = null, $comparison = null)
+ {
+ if (is_array($dbType)) {
+ $useMinMax = false;
+ if (isset($dbType['min'])) {
+ $this->addUsingAlias(CcPlaylistcontentsPeer::TYPE, $dbType['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbType['max'])) {
+ $this->addUsingAlias(CcPlaylistcontentsPeer::TYPE, $dbType['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcPlaylistcontentsPeer::TYPE, $dbType, $comparison);
+ }
- /**
- * 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 on the position column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbPosition(1234); // WHERE position = 1234
+ * $query->filterByDbPosition(array(12, 34)); // WHERE position IN (12, 34)
+ * $query->filterByDbPosition(array('min' => 12)); // WHERE position >= 12
+ * $query->filterByDbPosition(array('max' => 12)); // WHERE position <= 12
+ *
+ *
+ * @param mixed $dbPosition The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcPlaylistcontentsPeer::POSITION, $dbPosition, $comparison);
+ }
- /**
- * 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->findRelatedCcPlaylists($con);
-
- return $this->preDelete($con);
- }
+ /**
+ * Filter the query on the trackoffset column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbTrackOffset(1234); // WHERE trackoffset = 1234
+ * $query->filterByDbTrackOffset(array(12, 34)); // WHERE trackoffset IN (12, 34)
+ * $query->filterByDbTrackOffset(array('min' => 12)); // WHERE trackoffset >= 12
+ * $query->filterByDbTrackOffset(array('max' => 12)); // WHERE trackoffset <= 12
+ *
+ *
+ * @param mixed $dbTrackOffset The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlaylistcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbTrackOffset($dbTrackOffset = null, $comparison = null)
+ {
+ if (is_array($dbTrackOffset)) {
+ $useMinMax = false;
+ if (isset($dbTrackOffset['min'])) {
+ $this->addUsingAlias(CcPlaylistcontentsPeer::TRACKOFFSET, $dbTrackOffset['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbTrackOffset['max'])) {
+ $this->addUsingAlias(CcPlaylistcontentsPeer::TRACKOFFSET, $dbTrackOffset['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * 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->updateRelatedCcPlaylists($con);
-
- return $this->postDelete($affectedRows, $con);
- }
+ return $this->addUsingAlias(CcPlaylistcontentsPeer::TRACKOFFSET, $dbTrackOffset, $comparison);
+ }
- /**
- * 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->findRelatedCcPlaylists($con);
-
- return $this->preUpdate($values, $con, $forceIndividualSaves);
- }
+ /**
+ * Filter the query on the cliplength column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCliplength('fooValue'); // WHERE cliplength = 'fooValue'
+ * $query->filterByDbCliplength('%fooValue%'); // WHERE cliplength LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbCliplength 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 CcPlaylistcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbCliplength($dbCliplength = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbCliplength)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCliplength)) {
+ $dbCliplength = str_replace('*', '%', $dbCliplength);
+ $comparison = Criteria::LIKE;
+ }
+ }
- /**
- * 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->updateRelatedCcPlaylists($con);
-
- return $this->postUpdate($affectedRows, $con);
- }
+ return $this->addUsingAlias(CcPlaylistcontentsPeer::CLIPLENGTH, $dbCliplength, $comparison);
+ }
- // aggregate_column_relation behavior
-
- /**
- * Finds the related CcPlaylist objects and keep them for later
- *
- * @param PropelPDO $con A connection object
- */
- protected function findRelatedCcPlaylists($con)
- {
- $criteria = clone $this;
- if ($this->useAliasInSQL) {
- $alias = $this->getModelAlias();
- $criteria->removeAlias($alias);
- } else {
- $alias = '';
- }
- $this->ccPlaylists = CcPlaylistQuery::create()
- ->joinCcPlaylistcontents($alias)
- ->mergeWith($criteria)
- ->find($con);
- }
-
- protected function updateRelatedCcPlaylists($con)
- {
- foreach ($this->ccPlaylists as $ccPlaylist) {
- $ccPlaylist->updateDbLength($con);
- }
- $this->ccPlaylists = array();
- }
+ /**
+ * Filter the query on the cuein column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCuein('fooValue'); // WHERE cuein = 'fooValue'
+ * $query->filterByDbCuein('%fooValue%'); // WHERE cuein LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbCuein 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 CcPlaylistcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbCuein($dbCuein = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbCuein)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCuein)) {
+ $dbCuein = str_replace('*', '%', $dbCuein);
+ $comparison = Criteria::LIKE;
+ }
+ }
-} // BaseCcPlaylistcontentsQuery
+ return $this->addUsingAlias(CcPlaylistcontentsPeer::CUEIN, $dbCuein, $comparison);
+ }
+
+ /**
+ * Filter the query on the cueout column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCueout('fooValue'); // WHERE cueout = 'fooValue'
+ * $query->filterByDbCueout('%fooValue%'); // WHERE cueout LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbCueout 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 CcPlaylistcontentsQuery The current query, for fluid interface
+ */
+ public function filterByDbCueout($dbCueout = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbCueout)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCueout)) {
+ $dbCueout = str_replace('*', '%', $dbCueout);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcPlaylistcontentsPeer::CUEOUT, $dbCueout, $comparison);
+ }
+
+ /**
+ * Filter the query on the fadein column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbFadein('2011-03-14'); // WHERE fadein = '2011-03-14'
+ * $query->filterByDbFadein('now'); // WHERE fadein = '2011-03-14'
+ * $query->filterByDbFadein(array('max' => 'yesterday')); // WHERE fadein < '2011-03-13'
+ *
+ *
+ * @param mixed $dbFadein The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbFadeout('2011-03-14'); // WHERE fadeout = '2011-03-14'
+ * $query->filterByDbFadeout('now'); // WHERE fadeout = '2011-03-14'
+ * $query->filterByDbFadeout(array('max' => 'yesterday')); // WHERE fadeout < '2011-03-13'
+ *
+ *
+ * @param mixed $dbFadeout The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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|PropelObjectCollection $ccFiles The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcFiles($ccFiles, $comparison = null)
+ {
+ if ($ccFiles instanceof CcFiles) {
+ return $this
+ ->addUsingAlias(CcPlaylistcontentsPeer::FILE_ID, $ccFiles->getDbId(), $comparison);
+ } elseif ($ccFiles instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcPlaylistcontentsPeer::FILE_ID, $ccFiles->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcFiles() only accepts arguments of type CcFiles or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcFiles($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery');
+ }
+
+ /**
+ * Filter the query by a related CcBlock object
+ *
+ * @param CcBlock|PropelObjectCollection $ccBlock The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcBlock($ccBlock, $comparison = null)
+ {
+ if ($ccBlock instanceof CcBlock) {
+ return $this
+ ->addUsingAlias(CcPlaylistcontentsPeer::BLOCK_ID, $ccBlock->getDbId(), $comparison);
+ } elseif ($ccBlock instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcPlaylistcontentsPeer::BLOCK_ID, $ccBlock->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcBlock() only accepts arguments of type CcBlock or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcBlock 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 joinCcBlock($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcBlock');
+
+ // 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, 'CcBlock');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcBlock relation CcBlock 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 CcBlockQuery A secondary query class using the current class as primary query
+ */
+ public function useCcBlockQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcBlock($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcBlock', 'CcBlockQuery');
+ }
+
+ /**
+ * Filter the query by a related CcPlaylist object
+ *
+ * @param CcPlaylist|PropelObjectCollection $ccPlaylist The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcPlaylist($ccPlaylist, $comparison = null)
+ {
+ if ($ccPlaylist instanceof CcPlaylist) {
+ return $this
+ ->addUsingAlias(CcPlaylistcontentsPeer::PLAYLIST_ID, $ccPlaylist->getDbId(), $comparison);
+ } elseif ($ccPlaylist instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcPlaylistcontentsPeer::PLAYLIST_ID, $ccPlaylist->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcPlaylist() only accepts arguments of type CcPlaylist or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $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;
+ }
+
+ /**
+ * 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->findRelatedCcPlaylists($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->updateRelatedCcPlaylists($con);
+
+ return $this->postDelete($affectedRows, $con);
+ }
+
+ /**
+ * Code to execute before every UPDATE statement
+ *
+ * @param array $values The associative 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(), otherwise 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->findRelatedCcPlaylists($con);
+
+ return $this->preUpdate($values, $con, $forceIndividualSaves);
+ }
+
+ /**
+ * Code to execute after every UPDATE statement
+ *
+ * @param int $affectedRows the number of updated rows
+ * @param PropelPDO $con The connection object used by the query
+ */
+ protected function basePostUpdate($affectedRows, PropelPDO $con)
+ {
+ // aggregate_column_relation behavior
+ $this->updateRelatedCcPlaylists($con);
+
+ return $this->postUpdate($affectedRows, $con);
+ }
+
+ // aggregate_column_relation behavior
+
+ /**
+ * Finds the related CcPlaylist objects and keep them for later
+ *
+ * @param PropelPDO $con A connection object
+ */
+ protected function findRelatedCcPlaylists($con)
+ {
+ $criteria = clone $this;
+ if ($this->useAliasInSQL) {
+ $alias = $this->getModelAlias();
+ $criteria->removeAlias($alias);
+ } else {
+ $alias = '';
+ }
+ $this->ccPlaylists = CcPlaylistQuery::create()
+ ->joinCcPlaylistcontents($alias)
+ ->mergeWith($criteria)
+ ->find($con);
+ }
+
+ protected function updateRelatedCcPlaylists($con)
+ {
+ foreach ($this->ccPlaylists as $ccPlaylist) {
+ $ccPlaylist->updateDbLength($con);
+ }
+ $this->ccPlaylists = array();
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistory.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistory.php
index 2e55a484f..8c172ac0e 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistory.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistory.php
@@ -4,1285 +4,1539 @@
/**
* Base class that represents a row from the 'cc_playout_history' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
+abstract class BaseCcPlayoutHistory extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcPlayoutHistoryPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcPlayoutHistoryPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the file_id field.
- * @var int
- */
- protected $file_id;
-
- /**
- * The value for the starts field.
- * @var string
- */
- protected $starts;
-
- /**
- * The value for the ends field.
- * @var string
- */
- protected $ends;
-
- /**
- * The value for the instance_id field.
- * @var int
- */
- protected $instance_id;
-
- /**
- * @var CcFiles
- */
- protected $aCcFiles;
-
- /**
- * @var CcShowInstances
- */
- protected $aCcShowInstances;
-
- /**
- * @var array CcPlayoutHistoryMetaData[] Collection to store aggregation of CcPlayoutHistoryMetaData objects.
- */
- protected $collCcPlayoutHistoryMetaDatas;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Get the [id] column value.
- *
- * @return int
- */
- public function getDbId()
- {
- return $this->id;
- }
-
- /**
- * Get the [file_id] column value.
- *
- * @return int
- */
- public function getDbFileId()
- {
- return $this->file_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 [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 CcPlayoutHistory 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[] = CcPlayoutHistoryPeer::ID;
- }
-
- return $this;
- } // setDbId()
-
- /**
- * Set the value of [file_id] column.
- *
- * @param int $v new value
- * @return CcPlayoutHistory 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[] = CcPlayoutHistoryPeer::FILE_ID;
- }
-
- if ($this->aCcFiles !== null && $this->aCcFiles->getDbId() !== $v) {
- $this->aCcFiles = null;
- }
-
- return $this;
- } // setDbFileId()
-
- /**
- * 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 CcPlayoutHistory 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[] = CcPlayoutHistoryPeer::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 CcPlayoutHistory 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[] = CcPlayoutHistoryPeer::ENDS;
- }
- } // if either are not null
-
- return $this;
- } // setDbEnds()
-
- /**
- * Set the value of [instance_id] column.
- *
- * @param int $v new value
- * @return CcPlayoutHistory 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[] = CcPlayoutHistoryPeer::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()
- {
- // 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->file_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->instance_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 5; // 5 = CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS).
-
- } catch (Exception $e) {
- throw new PropelException("Error populating CcPlayoutHistory 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(CcPlayoutHistoryPeer::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 = CcPlayoutHistoryPeer::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->aCcShowInstances = null;
- $this->collCcPlayoutHistoryMetaDatas = 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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $con->beginTransaction();
- try {
- $ret = $this->preDelete($con);
- if ($ret) {
- CcPlayoutHistoryQuery::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(CcPlayoutHistoryPeer::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);
- CcPlayoutHistoryPeer::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->aCcShowInstances !== null) {
- if ($this->aCcShowInstances->isModified() || $this->aCcShowInstances->isNew()) {
- $affectedRows += $this->aCcShowInstances->save($con);
- }
- $this->setCcShowInstances($this->aCcShowInstances);
- }
-
- if ($this->isNew() ) {
- $this->modifiedColumns[] = CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryPeer::ID.')');
- }
-
- $pk = BasePeer::doInsert($criteria, $con);
- $affectedRows += 1;
- $this->setDbId($pk); //[IMV] update autoincrement primary key
- $this->setNew(false);
- } else {
- $affectedRows += CcPlayoutHistoryPeer::doUpdate($this, $con);
- }
-
- $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
- }
-
- if ($this->collCcPlayoutHistoryMetaDatas !== null) {
- foreach ($this->collCcPlayoutHistoryMetaDatas 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->aCcFiles !== null) {
- if (!$this->aCcFiles->validate($columns)) {
- $failureMap = array_merge($failureMap, $this->aCcFiles->getValidationFailures());
- }
- }
-
- if ($this->aCcShowInstances !== null) {
- if (!$this->aCcShowInstances->validate($columns)) {
- $failureMap = array_merge($failureMap, $this->aCcShowInstances->getValidationFailures());
- }
- }
-
-
- if (($retval = CcPlayoutHistoryPeer::doValidate($this, $columns)) !== true) {
- $failureMap = array_merge($failureMap, $retval);
- }
-
-
- if ($this->collCcPlayoutHistoryMetaDatas !== null) {
- foreach ($this->collCcPlayoutHistoryMetaDatas 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 = CcPlayoutHistoryPeer::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->getDbFileId();
- break;
- case 2:
- return $this->getDbStarts();
- break;
- case 3:
- return $this->getDbEnds();
- break;
- case 4:
- 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 = CcPlayoutHistoryPeer::getFieldNames($keyType);
- $result = array(
- $keys[0] => $this->getDbId(),
- $keys[1] => $this->getDbFileId(),
- $keys[2] => $this->getDbStarts(),
- $keys[3] => $this->getDbEnds(),
- $keys[4] => $this->getDbInstanceId(),
- );
- if ($includeForeignObjects) {
- if (null !== $this->aCcFiles) {
- $result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, true);
- }
- 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 = CcPlayoutHistoryPeer::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->setDbFileId($value);
- break;
- case 2:
- $this->setDbStarts($value);
- break;
- case 3:
- $this->setDbEnds($value);
- break;
- case 4:
- $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 = CcPlayoutHistoryPeer::getFieldNames($keyType);
-
- if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
- if (array_key_exists($keys[1], $arr)) $this->setDbFileId($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->setDbInstanceId($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(CcPlayoutHistoryPeer::DATABASE_NAME);
-
- if ($this->isColumnModified(CcPlayoutHistoryPeer::ID)) $criteria->add(CcPlayoutHistoryPeer::ID, $this->id);
- if ($this->isColumnModified(CcPlayoutHistoryPeer::FILE_ID)) $criteria->add(CcPlayoutHistoryPeer::FILE_ID, $this->file_id);
- if ($this->isColumnModified(CcPlayoutHistoryPeer::STARTS)) $criteria->add(CcPlayoutHistoryPeer::STARTS, $this->starts);
- if ($this->isColumnModified(CcPlayoutHistoryPeer::ENDS)) $criteria->add(CcPlayoutHistoryPeer::ENDS, $this->ends);
- if ($this->isColumnModified(CcPlayoutHistoryPeer::INSTANCE_ID)) $criteria->add(CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::DATABASE_NAME);
- $criteria->add(CcPlayoutHistoryPeer::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 CcPlayoutHistory (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->setDbFileId($this->file_id);
- $copyObj->setDbStarts($this->starts);
- $copyObj->setDbEnds($this->ends);
- $copyObj->setDbInstanceId($this->instance_id);
-
- if ($deepCopy) {
- // important: temporarily setNew(false) because this affects the behavior of
- // the getter/setter methods for fkey referrer objects.
- $copyObj->setNew(false);
-
- foreach ($this->getCcPlayoutHistoryMetaDatas() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addCcPlayoutHistoryMetaData($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 CcPlayoutHistory 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 CcPlayoutHistoryPeer
- */
- public function getPeer()
- {
- if (self::$peer === null) {
- self::$peer = new CcPlayoutHistoryPeer();
- }
- return self::$peer;
- }
-
- /**
- * Declares an association between this object and a CcFiles object.
- *
- * @param CcFiles $v
- * @return CcPlayoutHistory 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->addCcPlayoutHistory($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->addCcPlayoutHistorys($this);
- */
- }
- return $this->aCcFiles;
- }
-
- /**
- * Declares an association between this object and a CcShowInstances object.
- *
- * @param CcShowInstances $v
- * @return CcPlayoutHistory 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->addCcPlayoutHistory($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->addCcPlayoutHistorys($this);
- */
- }
- return $this->aCcShowInstances;
- }
-
- /**
- * Clears out the collCcPlayoutHistoryMetaDatas 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 addCcPlayoutHistoryMetaDatas()
- */
- public function clearCcPlayoutHistoryMetaDatas()
- {
- $this->collCcPlayoutHistoryMetaDatas = null; // important to set this to NULL since that means it is uninitialized
- }
-
- /**
- * Initializes the collCcPlayoutHistoryMetaDatas collection.
- *
- * By default this just sets the collCcPlayoutHistoryMetaDatas collection to an empty array (like clearcollCcPlayoutHistoryMetaDatas());
- * 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 initCcPlayoutHistoryMetaDatas()
- {
- $this->collCcPlayoutHistoryMetaDatas = new PropelObjectCollection();
- $this->collCcPlayoutHistoryMetaDatas->setModel('CcPlayoutHistoryMetaData');
- }
-
- /**
- * Gets an array of CcPlayoutHistoryMetaData 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 CcPlayoutHistory 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 CcPlayoutHistoryMetaData[] List of CcPlayoutHistoryMetaData objects
- * @throws PropelException
- */
- public function getCcPlayoutHistoryMetaDatas($criteria = null, PropelPDO $con = null)
- {
- if(null === $this->collCcPlayoutHistoryMetaDatas || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcPlayoutHistoryMetaDatas) {
- // return empty collection
- $this->initCcPlayoutHistoryMetaDatas();
- } else {
- $collCcPlayoutHistoryMetaDatas = CcPlayoutHistoryMetaDataQuery::create(null, $criteria)
- ->filterByCcPlayoutHistory($this)
- ->find($con);
- if (null !== $criteria) {
- return $collCcPlayoutHistoryMetaDatas;
- }
- $this->collCcPlayoutHistoryMetaDatas = $collCcPlayoutHistoryMetaDatas;
- }
- }
- return $this->collCcPlayoutHistoryMetaDatas;
- }
-
- /**
- * Returns the number of related CcPlayoutHistoryMetaData objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related CcPlayoutHistoryMetaData objects.
- * @throws PropelException
- */
- public function countCcPlayoutHistoryMetaDatas(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- if(null === $this->collCcPlayoutHistoryMetaDatas || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcPlayoutHistoryMetaDatas) {
- return 0;
- } else {
- $query = CcPlayoutHistoryMetaDataQuery::create(null, $criteria);
- if($distinct) {
- $query->distinct();
- }
- return $query
- ->filterByCcPlayoutHistory($this)
- ->count($con);
- }
- } else {
- return count($this->collCcPlayoutHistoryMetaDatas);
- }
- }
-
- /**
- * Method called to associate a CcPlayoutHistoryMetaData object to this object
- * through the CcPlayoutHistoryMetaData foreign key attribute.
- *
- * @param CcPlayoutHistoryMetaData $l CcPlayoutHistoryMetaData
- * @return void
- * @throws PropelException
- */
- public function addCcPlayoutHistoryMetaData(CcPlayoutHistoryMetaData $l)
- {
- if ($this->collCcPlayoutHistoryMetaDatas === null) {
- $this->initCcPlayoutHistoryMetaDatas();
- }
- if (!$this->collCcPlayoutHistoryMetaDatas->contains($l)) { // only add it if the **same** object is not already associated
- $this->collCcPlayoutHistoryMetaDatas[]= $l;
- $l->setCcPlayoutHistory($this);
- }
- }
-
- /**
- * Clears the current object and sets all attributes to their default values
- */
- public function clear()
- {
- $this->id = null;
- $this->file_id = null;
- $this->starts = null;
- $this->ends = null;
- $this->instance_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 ($this->collCcPlayoutHistoryMetaDatas) {
- foreach ((array) $this->collCcPlayoutHistoryMetaDatas as $o) {
- $o->clearAllReferences($deep);
- }
- }
- } // if ($deep)
-
- $this->collCcPlayoutHistoryMetaDatas = null;
- $this->aCcFiles = null;
- $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);
- }
-
-} // BaseCcPlayoutHistory
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcPlayoutHistoryPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcPlayoutHistoryPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the file_id field.
+ * @var int
+ */
+ protected $file_id;
+
+ /**
+ * The value for the starts field.
+ * @var string
+ */
+ protected $starts;
+
+ /**
+ * The value for the ends field.
+ * @var string
+ */
+ protected $ends;
+
+ /**
+ * The value for the instance_id field.
+ * @var int
+ */
+ protected $instance_id;
+
+ /**
+ * @var CcFiles
+ */
+ protected $aCcFiles;
+
+ /**
+ * @var CcShowInstances
+ */
+ protected $aCcShowInstances;
+
+ /**
+ * @var PropelObjectCollection|CcPlayoutHistoryMetaData[] Collection to store aggregation of CcPlayoutHistoryMetaData objects.
+ */
+ protected $collCcPlayoutHistoryMetaDatas;
+ protected $collCcPlayoutHistoryMetaDatasPartial;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccPlayoutHistoryMetaDatasScheduledForDeletion = null;
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getDbId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [file_id] column value.
+ *
+ * @return int
+ */
+ public function getDbFileId()
+ {
+
+ return $this->file_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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ 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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * 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 CcPlayoutHistory The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryPeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [file_id] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistory The current object (for fluent API support)
+ */
+ public function setDbFileId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->file_id !== $v) {
+ $this->file_id = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryPeer::FILE_ID;
+ }
+
+ if ($this->aCcFiles !== null && $this->aCcFiles->getDbId() !== $v) {
+ $this->aCcFiles = null;
+ }
+
+
+ return $this;
+ } // setDbFileId()
+
+ /**
+ * 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 strings are treated as null.
+ * @return CcPlayoutHistory The current object (for fluent API support)
+ */
+ public function setDbStarts($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->starts !== null || $dt !== null) {
+ $currentDateAsString = ($this->starts !== null && $tmpDt = new DateTime($this->starts)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->starts = $newDateAsString;
+ $this->modifiedColumns[] = CcPlayoutHistoryPeer::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 strings are treated as null.
+ * @return CcPlayoutHistory The current object (for fluent API support)
+ */
+ public function setDbEnds($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->ends !== null || $dt !== null) {
+ $currentDateAsString = ($this->ends !== null && $tmpDt = new DateTime($this->ends)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->ends = $newDateAsString;
+ $this->modifiedColumns[] = CcPlayoutHistoryPeer::ENDS;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbEnds()
+
+ /**
+ * Set the value of [instance_id] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistory The current object (for fluent API support)
+ */
+ public function setDbInstanceId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->instance_id !== $v) {
+ $this->instance_id = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryPeer::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()
+ {
+ // 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 resultset 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->file_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->instance_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 5; // 5 = CcPlayoutHistoryPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcPlayoutHistory 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(CcPlayoutHistoryPeer::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 = CcPlayoutHistoryPeer::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->aCcShowInstances = null;
+ $this->collCcPlayoutHistoryMetaDatas = null;
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = CcPlayoutHistoryQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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(CcPlayoutHistoryPeer::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);
+ CcPlayoutHistoryPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $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 corresponding 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->aCcShowInstances !== null) {
+ if ($this->aCcShowInstances->isModified() || $this->aCcShowInstances->isNew()) {
+ $affectedRows += $this->aCcShowInstances->save($con);
+ }
+ $this->setCcShowInstances($this->aCcShowInstances);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ if ($this->ccPlayoutHistoryMetaDatasScheduledForDeletion !== null) {
+ if (!$this->ccPlayoutHistoryMetaDatasScheduledForDeletion->isEmpty()) {
+ CcPlayoutHistoryMetaDataQuery::create()
+ ->filterByPrimaryKeys($this->ccPlayoutHistoryMetaDatasScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccPlayoutHistoryMetaDatasScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcPlayoutHistoryMetaDatas !== null) {
+ foreach ($this->collCcPlayoutHistoryMetaDatas as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcPlayoutHistoryPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcPlayoutHistoryPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_playout_history_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcPlayoutHistoryPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcPlayoutHistoryPeer::FILE_ID)) {
+ $modifiedColumns[':p' . $index++] = '"file_id"';
+ }
+ if ($this->isColumnModified(CcPlayoutHistoryPeer::STARTS)) {
+ $modifiedColumns[':p' . $index++] = '"starts"';
+ }
+ if ($this->isColumnModified(CcPlayoutHistoryPeer::ENDS)) {
+ $modifiedColumns[':p' . $index++] = '"ends"';
+ }
+ if ($this->isColumnModified(CcPlayoutHistoryPeer::INSTANCE_ID)) {
+ $modifiedColumns[':p' . $index++] = '"instance_id"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_playout_history" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"file_id"':
+ $stmt->bindValue($identifier, $this->file_id, PDO::PARAM_INT);
+ break;
+ case '"starts"':
+ $stmt->bindValue($identifier, $this->starts, PDO::PARAM_STR);
+ break;
+ case '"ends"':
+ $stmt->bindValue($identifier, $this->ends, PDO::PARAM_STR);
+ break;
+ case '"instance_id"':
+ $stmt->bindValue($identifier, $this->instance_id, PDO::PARAM_INT);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding 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->aCcShowInstances !== null) {
+ if (!$this->aCcShowInstances->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcShowInstances->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CcPlayoutHistoryPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+ if ($this->collCcPlayoutHistoryMetaDatas !== null) {
+ foreach ($this->collCcPlayoutHistoryMetaDatas 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlayoutHistoryPeer::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->getDbFileId();
+ break;
+ case 2:
+ return $this->getDbStarts();
+ break;
+ case 3:
+ return $this->getDbEnds();
+ break;
+ case 4:
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcPlayoutHistory'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcPlayoutHistory'][$this->getPrimaryKey()] = true;
+ $keys = CcPlayoutHistoryPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbFileId(),
+ $keys[2] => $this->getDbStarts(),
+ $keys[3] => $this->getDbEnds(),
+ $keys[4] => $this->getDbInstanceId(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcFiles) {
+ $result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->aCcShowInstances) {
+ $result['CcShowInstances'] = $this->aCcShowInstances->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->collCcPlayoutHistoryMetaDatas) {
+ $result['CcPlayoutHistoryMetaDatas'] = $this->collCcPlayoutHistoryMetaDatas->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ }
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlayoutHistoryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbFileId($value);
+ break;
+ case 2:
+ $this->setDbStarts($value);
+ break;
+ case 3:
+ $this->setDbEnds($value);
+ break;
+ case 4:
+ $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 BasePeer::TYPE_PHPNAME
+ *
+ * @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 = CcPlayoutHistoryPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbFileId($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->setDbInstanceId($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(CcPlayoutHistoryPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcPlayoutHistoryPeer::ID)) $criteria->add(CcPlayoutHistoryPeer::ID, $this->id);
+ if ($this->isColumnModified(CcPlayoutHistoryPeer::FILE_ID)) $criteria->add(CcPlayoutHistoryPeer::FILE_ID, $this->file_id);
+ if ($this->isColumnModified(CcPlayoutHistoryPeer::STARTS)) $criteria->add(CcPlayoutHistoryPeer::STARTS, $this->starts);
+ if ($this->isColumnModified(CcPlayoutHistoryPeer::ENDS)) $criteria->add(CcPlayoutHistoryPeer::ENDS, $this->ends);
+ if ($this->isColumnModified(CcPlayoutHistoryPeer::INSTANCE_ID)) $criteria->add(CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryPeer::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 CcPlayoutHistory (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbFileId($this->getDbFileId());
+ $copyObj->setDbStarts($this->getDbStarts());
+ $copyObj->setDbEnds($this->getDbEnds());
+ $copyObj->setDbInstanceId($this->getDbInstanceId());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ foreach ($this->getCcPlayoutHistoryMetaDatas() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcPlayoutHistoryMetaData($relObj->copy($deepCopy));
+ }
+ }
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 CcPlayoutHistory 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 CcPlayoutHistoryPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcPlayoutHistoryPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcFiles object.
+ *
+ * @param CcFiles $v
+ * @return CcPlayoutHistory 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->addCcPlayoutHistory($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcFiles object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcFiles The associated CcFiles object.
+ * @throws PropelException
+ */
+ public function getCcFiles(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcFiles === null && ($this->file_id !== null) && $doQuery) {
+ $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->addCcPlayoutHistorys($this);
+ */
+ }
+
+ return $this->aCcFiles;
+ }
+
+ /**
+ * Declares an association between this object and a CcShowInstances object.
+ *
+ * @param CcShowInstances $v
+ * @return CcPlayoutHistory 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->addCcPlayoutHistory($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcShowInstances object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcShowInstances The associated CcShowInstances object.
+ * @throws PropelException
+ */
+ public function getCcShowInstances(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcShowInstances === null && ($this->instance_id !== null) && $doQuery) {
+ $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->addCcPlayoutHistorys($this);
+ */
+ }
+
+ return $this->aCcShowInstances;
+ }
+
+
+ /**
+ * Initializes a collection based on the name of a relation.
+ * Avoids crafting an 'init[$relationName]s' method name
+ * that wouldn't work when StandardEnglishPluralizer is used.
+ *
+ * @param string $relationName The name of the relation to initialize
+ * @return void
+ */
+ public function initRelation($relationName)
+ {
+ if ('CcPlayoutHistoryMetaData' == $relationName) {
+ $this->initCcPlayoutHistoryMetaDatas();
+ }
+ }
+
+ /**
+ * Clears out the collCcPlayoutHistoryMetaDatas 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 CcPlayoutHistory The current object (for fluent API support)
+ * @see addCcPlayoutHistoryMetaDatas()
+ */
+ public function clearCcPlayoutHistoryMetaDatas()
+ {
+ $this->collCcPlayoutHistoryMetaDatas = null; // important to set this to null since that means it is uninitialized
+ $this->collCcPlayoutHistoryMetaDatasPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcPlayoutHistoryMetaDatas collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcPlayoutHistoryMetaDatas($v = true)
+ {
+ $this->collCcPlayoutHistoryMetaDatasPartial = $v;
+ }
+
+ /**
+ * Initializes the collCcPlayoutHistoryMetaDatas collection.
+ *
+ * By default this just sets the collCcPlayoutHistoryMetaDatas collection to an empty array (like clearcollCcPlayoutHistoryMetaDatas());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcPlayoutHistoryMetaDatas($overrideExisting = true)
+ {
+ if (null !== $this->collCcPlayoutHistoryMetaDatas && !$overrideExisting) {
+ return;
+ }
+ $this->collCcPlayoutHistoryMetaDatas = new PropelObjectCollection();
+ $this->collCcPlayoutHistoryMetaDatas->setModel('CcPlayoutHistoryMetaData');
+ }
+
+ /**
+ * Gets an array of CcPlayoutHistoryMetaData 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 CcPlayoutHistory 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 PropelObjectCollection|CcPlayoutHistoryMetaData[] List of CcPlayoutHistoryMetaData objects
+ * @throws PropelException
+ */
+ public function getCcPlayoutHistoryMetaDatas($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcPlayoutHistoryMetaDatasPartial && !$this->isNew();
+ if (null === $this->collCcPlayoutHistoryMetaDatas || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistoryMetaDatas) {
+ // return empty collection
+ $this->initCcPlayoutHistoryMetaDatas();
+ } else {
+ $collCcPlayoutHistoryMetaDatas = CcPlayoutHistoryMetaDataQuery::create(null, $criteria)
+ ->filterByCcPlayoutHistory($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcPlayoutHistoryMetaDatasPartial && count($collCcPlayoutHistoryMetaDatas)) {
+ $this->initCcPlayoutHistoryMetaDatas(false);
+
+ foreach ($collCcPlayoutHistoryMetaDatas as $obj) {
+ if (false == $this->collCcPlayoutHistoryMetaDatas->contains($obj)) {
+ $this->collCcPlayoutHistoryMetaDatas->append($obj);
+ }
+ }
+
+ $this->collCcPlayoutHistoryMetaDatasPartial = true;
+ }
+
+ $collCcPlayoutHistoryMetaDatas->getInternalIterator()->rewind();
+
+ return $collCcPlayoutHistoryMetaDatas;
+ }
+
+ if ($partial && $this->collCcPlayoutHistoryMetaDatas) {
+ foreach ($this->collCcPlayoutHistoryMetaDatas as $obj) {
+ if ($obj->isNew()) {
+ $collCcPlayoutHistoryMetaDatas[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcPlayoutHistoryMetaDatas = $collCcPlayoutHistoryMetaDatas;
+ $this->collCcPlayoutHistoryMetaDatasPartial = false;
+ }
+ }
+
+ return $this->collCcPlayoutHistoryMetaDatas;
+ }
+
+ /**
+ * Sets a collection of CcPlayoutHistoryMetaData objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccPlayoutHistoryMetaDatas A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcPlayoutHistory The current object (for fluent API support)
+ */
+ public function setCcPlayoutHistoryMetaDatas(PropelCollection $ccPlayoutHistoryMetaDatas, PropelPDO $con = null)
+ {
+ $ccPlayoutHistoryMetaDatasToDelete = $this->getCcPlayoutHistoryMetaDatas(new Criteria(), $con)->diff($ccPlayoutHistoryMetaDatas);
+
+
+ $this->ccPlayoutHistoryMetaDatasScheduledForDeletion = $ccPlayoutHistoryMetaDatasToDelete;
+
+ foreach ($ccPlayoutHistoryMetaDatasToDelete as $ccPlayoutHistoryMetaDataRemoved) {
+ $ccPlayoutHistoryMetaDataRemoved->setCcPlayoutHistory(null);
+ }
+
+ $this->collCcPlayoutHistoryMetaDatas = null;
+ foreach ($ccPlayoutHistoryMetaDatas as $ccPlayoutHistoryMetaData) {
+ $this->addCcPlayoutHistoryMetaData($ccPlayoutHistoryMetaData);
+ }
+
+ $this->collCcPlayoutHistoryMetaDatas = $ccPlayoutHistoryMetaDatas;
+ $this->collCcPlayoutHistoryMetaDatasPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related CcPlayoutHistoryMetaData objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcPlayoutHistoryMetaData objects.
+ * @throws PropelException
+ */
+ public function countCcPlayoutHistoryMetaDatas(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collCcPlayoutHistoryMetaDatasPartial && !$this->isNew();
+ if (null === $this->collCcPlayoutHistoryMetaDatas || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistoryMetaDatas) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcPlayoutHistoryMetaDatas());
+ }
+ $query = CcPlayoutHistoryMetaDataQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcPlayoutHistory($this)
+ ->count($con);
+ }
+
+ return count($this->collCcPlayoutHistoryMetaDatas);
+ }
+
+ /**
+ * Method called to associate a CcPlayoutHistoryMetaData object to this object
+ * through the CcPlayoutHistoryMetaData foreign key attribute.
+ *
+ * @param CcPlayoutHistoryMetaData $l CcPlayoutHistoryMetaData
+ * @return CcPlayoutHistory The current object (for fluent API support)
+ */
+ public function addCcPlayoutHistoryMetaData(CcPlayoutHistoryMetaData $l)
+ {
+ if ($this->collCcPlayoutHistoryMetaDatas === null) {
+ $this->initCcPlayoutHistoryMetaDatas();
+ $this->collCcPlayoutHistoryMetaDatasPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcPlayoutHistoryMetaDatas->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcPlayoutHistoryMetaData($l);
+
+ if ($this->ccPlayoutHistoryMetaDatasScheduledForDeletion and $this->ccPlayoutHistoryMetaDatasScheduledForDeletion->contains($l)) {
+ $this->ccPlayoutHistoryMetaDatasScheduledForDeletion->remove($this->ccPlayoutHistoryMetaDatasScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcPlayoutHistoryMetaData $ccPlayoutHistoryMetaData The ccPlayoutHistoryMetaData object to add.
+ */
+ protected function doAddCcPlayoutHistoryMetaData($ccPlayoutHistoryMetaData)
+ {
+ $this->collCcPlayoutHistoryMetaDatas[]= $ccPlayoutHistoryMetaData;
+ $ccPlayoutHistoryMetaData->setCcPlayoutHistory($this);
+ }
+
+ /**
+ * @param CcPlayoutHistoryMetaData $ccPlayoutHistoryMetaData The ccPlayoutHistoryMetaData object to remove.
+ * @return CcPlayoutHistory The current object (for fluent API support)
+ */
+ public function removeCcPlayoutHistoryMetaData($ccPlayoutHistoryMetaData)
+ {
+ if ($this->getCcPlayoutHistoryMetaDatas()->contains($ccPlayoutHistoryMetaData)) {
+ $this->collCcPlayoutHistoryMetaDatas->remove($this->collCcPlayoutHistoryMetaDatas->search($ccPlayoutHistoryMetaData));
+ if (null === $this->ccPlayoutHistoryMetaDatasScheduledForDeletion) {
+ $this->ccPlayoutHistoryMetaDatasScheduledForDeletion = clone $this->collCcPlayoutHistoryMetaDatas;
+ $this->ccPlayoutHistoryMetaDatasScheduledForDeletion->clear();
+ }
+ $this->ccPlayoutHistoryMetaDatasScheduledForDeletion[]= clone $ccPlayoutHistoryMetaData;
+ $ccPlayoutHistoryMetaData->setCcPlayoutHistory(null);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->file_id = null;
+ $this->starts = null;
+ $this->ends = null;
+ $this->instance_id = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->collCcPlayoutHistoryMetaDatas) {
+ foreach ($this->collCcPlayoutHistoryMetaDatas as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->aCcFiles instanceof Persistent) {
+ $this->aCcFiles->clearAllReferences($deep);
+ }
+ if ($this->aCcShowInstances instanceof Persistent) {
+ $this->aCcShowInstances->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ if ($this->collCcPlayoutHistoryMetaDatas instanceof PropelCollection) {
+ $this->collCcPlayoutHistoryMetaDatas->clearIterator();
+ }
+ $this->collCcPlayoutHistoryMetaDatas = null;
+ $this->aCcFiles = null;
+ $this->aCcShowInstances = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcPlayoutHistoryPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaData.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaData.php
index a0cbb9539..84747072b 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaData.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaData.php
@@ -4,902 +4,1048 @@
/**
* Base class that represents a row from the 'cc_playout_history_metadata' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persistent
+abstract class BaseCcPlayoutHistoryMetaData extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcPlayoutHistoryMetaDataPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcPlayoutHistoryMetaDataPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the history_id field.
- * @var int
- */
- protected $history_id;
-
- /**
- * The value for the key field.
- * @var string
- */
- protected $key;
-
- /**
- * The value for the value field.
- * @var string
- */
- protected $value;
-
- /**
- * @var CcPlayoutHistory
- */
- protected $aCcPlayoutHistory;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Get the [id] column value.
- *
- * @return int
- */
- public function getDbId()
- {
- return $this->id;
- }
-
- /**
- * Get the [history_id] column value.
- *
- * @return int
- */
- public function getDbHistoryId()
- {
- return $this->history_id;
- }
-
- /**
- * Get the [key] column value.
- *
- * @return string
- */
- public function getDbKey()
- {
- return $this->key;
- }
-
- /**
- * Get the [value] column value.
- *
- * @return string
- */
- public function getDbValue()
- {
- return $this->value;
- }
-
- /**
- * Set the value of [id] column.
- *
- * @param int $v new value
- * @return CcPlayoutHistoryMetaData 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[] = CcPlayoutHistoryMetaDataPeer::ID;
- }
-
- return $this;
- } // setDbId()
-
- /**
- * Set the value of [history_id] column.
- *
- * @param int $v new value
- * @return CcPlayoutHistoryMetaData The current object (for fluent API support)
- */
- public function setDbHistoryId($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->history_id !== $v) {
- $this->history_id = $v;
- $this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::HISTORY_ID;
- }
-
- if ($this->aCcPlayoutHistory !== null && $this->aCcPlayoutHistory->getDbId() !== $v) {
- $this->aCcPlayoutHistory = null;
- }
-
- return $this;
- } // setDbHistoryId()
-
- /**
- * Set the value of [key] column.
- *
- * @param string $v new value
- * @return CcPlayoutHistoryMetaData The current object (for fluent API support)
- */
- public function setDbKey($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->key !== $v) {
- $this->key = $v;
- $this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::KEY;
- }
-
- return $this;
- } // setDbKey()
-
- /**
- * Set the value of [value] column.
- *
- * @param string $v new value
- * @return CcPlayoutHistoryMetaData 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[] = CcPlayoutHistoryMetaDataPeer::VALUE;
- }
-
- return $this;
- } // setDbValue()
-
- /**
- * 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->history_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
- $this->key = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
- $this->value = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 4; // 4 = CcPlayoutHistoryMetaDataPeer::NUM_COLUMNS - CcPlayoutHistoryMetaDataPeer::NUM_LAZY_LOAD_COLUMNS).
-
- } catch (Exception $e) {
- throw new PropelException("Error populating CcPlayoutHistoryMetaData 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->aCcPlayoutHistory !== null && $this->history_id !== $this->aCcPlayoutHistory->getDbId()) {
- $this->aCcPlayoutHistory = 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(CcPlayoutHistoryMetaDataPeer::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 = CcPlayoutHistoryMetaDataPeer::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->aCcPlayoutHistory = 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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $con->beginTransaction();
- try {
- $ret = $this->preDelete($con);
- if ($ret) {
- CcPlayoutHistoryMetaDataQuery::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(CcPlayoutHistoryMetaDataPeer::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);
- CcPlayoutHistoryMetaDataPeer::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->aCcPlayoutHistory !== null) {
- if ($this->aCcPlayoutHistory->isModified() || $this->aCcPlayoutHistory->isNew()) {
- $affectedRows += $this->aCcPlayoutHistory->save($con);
- }
- $this->setCcPlayoutHistory($this->aCcPlayoutHistory);
- }
-
- if ($this->isNew() ) {
- $this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryMetaDataPeer::ID.')');
- }
-
- $pk = BasePeer::doInsert($criteria, $con);
- $affectedRows += 1;
- $this->setDbId($pk); //[IMV] update autoincrement primary key
- $this->setNew(false);
- } else {
- $affectedRows += CcPlayoutHistoryMetaDataPeer::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->aCcPlayoutHistory !== null) {
- if (!$this->aCcPlayoutHistory->validate($columns)) {
- $failureMap = array_merge($failureMap, $this->aCcPlayoutHistory->getValidationFailures());
- }
- }
-
-
- if (($retval = CcPlayoutHistoryMetaDataPeer::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 = CcPlayoutHistoryMetaDataPeer::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->getDbHistoryId();
- break;
- case 2:
- return $this->getDbKey();
- break;
- case 3:
- return $this->getDbValue();
- 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 = CcPlayoutHistoryMetaDataPeer::getFieldNames($keyType);
- $result = array(
- $keys[0] => $this->getDbId(),
- $keys[1] => $this->getDbHistoryId(),
- $keys[2] => $this->getDbKey(),
- $keys[3] => $this->getDbValue(),
- );
- if ($includeForeignObjects) {
- if (null !== $this->aCcPlayoutHistory) {
- $result['CcPlayoutHistory'] = $this->aCcPlayoutHistory->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 = CcPlayoutHistoryMetaDataPeer::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->setDbHistoryId($value);
- break;
- case 2:
- $this->setDbKey($value);
- break;
- case 3:
- $this->setDbValue($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 = CcPlayoutHistoryMetaDataPeer::getFieldNames($keyType);
-
- if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
- if (array_key_exists($keys[1], $arr)) $this->setDbHistoryId($arr[$keys[1]]);
- if (array_key_exists($keys[2], $arr)) $this->setDbKey($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setDbValue($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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
-
- if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::ID)) $criteria->add(CcPlayoutHistoryMetaDataPeer::ID, $this->id);
- if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::HISTORY_ID)) $criteria->add(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $this->history_id);
- if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::KEY)) $criteria->add(CcPlayoutHistoryMetaDataPeer::KEY, $this->key);
- if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::VALUE)) $criteria->add(CcPlayoutHistoryMetaDataPeer::VALUE, $this->value);
-
- 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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
- $criteria->add(CcPlayoutHistoryMetaDataPeer::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 CcPlayoutHistoryMetaData (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->setDbHistoryId($this->history_id);
- $copyObj->setDbKey($this->key);
- $copyObj->setDbValue($this->value);
-
- $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 CcPlayoutHistoryMetaData 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 CcPlayoutHistoryMetaDataPeer
- */
- public function getPeer()
- {
- if (self::$peer === null) {
- self::$peer = new CcPlayoutHistoryMetaDataPeer();
- }
- return self::$peer;
- }
-
- /**
- * Declares an association between this object and a CcPlayoutHistory object.
- *
- * @param CcPlayoutHistory $v
- * @return CcPlayoutHistoryMetaData The current object (for fluent API support)
- * @throws PropelException
- */
- public function setCcPlayoutHistory(CcPlayoutHistory $v = null)
- {
- if ($v === null) {
- $this->setDbHistoryId(NULL);
- } else {
- $this->setDbHistoryId($v->getDbId());
- }
-
- $this->aCcPlayoutHistory = $v;
-
- // Add binding for other direction of this n:n relationship.
- // If this object has already been added to the CcPlayoutHistory object, it will not be re-added.
- if ($v !== null) {
- $v->addCcPlayoutHistoryMetaData($this);
- }
-
- return $this;
- }
-
-
- /**
- * Get the associated CcPlayoutHistory object
- *
- * @param PropelPDO Optional Connection object.
- * @return CcPlayoutHistory The associated CcPlayoutHistory object.
- * @throws PropelException
- */
- public function getCcPlayoutHistory(PropelPDO $con = null)
- {
- if ($this->aCcPlayoutHistory === null && ($this->history_id !== null)) {
- $this->aCcPlayoutHistory = CcPlayoutHistoryQuery::create()->findPk($this->history_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->aCcPlayoutHistory->addCcPlayoutHistoryMetaDatas($this);
- */
- }
- return $this->aCcPlayoutHistory;
- }
-
- /**
- * Clears the current object and sets all attributes to their default values
- */
- public function clear()
- {
- $this->id = null;
- $this->history_id = null;
- $this->key = null;
- $this->value = 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->aCcPlayoutHistory = 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);
- }
-
-} // BaseCcPlayoutHistoryMetaData
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcPlayoutHistoryMetaDataPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcPlayoutHistoryMetaDataPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the history_id field.
+ * @var int
+ */
+ protected $history_id;
+
+ /**
+ * The value for the key field.
+ * @var string
+ */
+ protected $key;
+
+ /**
+ * The value for the value field.
+ * @var string
+ */
+ protected $value;
+
+ /**
+ * @var CcPlayoutHistory
+ */
+ protected $aCcPlayoutHistory;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getDbId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [history_id] column value.
+ *
+ * @return int
+ */
+ public function getDbHistoryId()
+ {
+
+ return $this->history_id;
+ }
+
+ /**
+ * Get the [key] column value.
+ *
+ * @return string
+ */
+ public function getDbKey()
+ {
+
+ return $this->key;
+ }
+
+ /**
+ * Get the [value] column value.
+ *
+ * @return string
+ */
+ public function getDbValue()
+ {
+
+ return $this->value;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistoryMetaData The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [history_id] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistoryMetaData The current object (for fluent API support)
+ */
+ public function setDbHistoryId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->history_id !== $v) {
+ $this->history_id = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::HISTORY_ID;
+ }
+
+ if ($this->aCcPlayoutHistory !== null && $this->aCcPlayoutHistory->getDbId() !== $v) {
+ $this->aCcPlayoutHistory = null;
+ }
+
+
+ return $this;
+ } // setDbHistoryId()
+
+ /**
+ * Set the value of [key] column.
+ *
+ * @param string $v new value
+ * @return CcPlayoutHistoryMetaData The current object (for fluent API support)
+ */
+ public function setDbKey($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->key !== $v) {
+ $this->key = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::KEY;
+ }
+
+
+ return $this;
+ } // setDbKey()
+
+ /**
+ * Set the value of [value] column.
+ *
+ * @param string $v new value
+ * @return CcPlayoutHistoryMetaData The current object (for fluent API support)
+ */
+ public function setDbValue($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->value !== $v) {
+ $this->value = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::VALUE;
+ }
+
+
+ return $this;
+ } // setDbValue()
+
+ /**
+ * 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 resultset 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->history_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
+ $this->key = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->value = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 4; // 4 = CcPlayoutHistoryMetaDataPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcPlayoutHistoryMetaData 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->aCcPlayoutHistory !== null && $this->history_id !== $this->aCcPlayoutHistory->getDbId()) {
+ $this->aCcPlayoutHistory = 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(CcPlayoutHistoryMetaDataPeer::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 = CcPlayoutHistoryMetaDataPeer::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->aCcPlayoutHistory = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = CcPlayoutHistoryMetaDataQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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(CcPlayoutHistoryMetaDataPeer::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);
+ CcPlayoutHistoryMetaDataPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $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 corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcPlayoutHistory !== null) {
+ if ($this->aCcPlayoutHistory->isModified() || $this->aCcPlayoutHistory->isNew()) {
+ $affectedRows += $this->aCcPlayoutHistory->save($con);
+ }
+ $this->setCcPlayoutHistory($this->aCcPlayoutHistory);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcPlayoutHistoryMetaDataPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcPlayoutHistoryMetaDataPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_playout_history_metadata_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::HISTORY_ID)) {
+ $modifiedColumns[':p' . $index++] = '"history_id"';
+ }
+ if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::KEY)) {
+ $modifiedColumns[':p' . $index++] = '"key"';
+ }
+ if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::VALUE)) {
+ $modifiedColumns[':p' . $index++] = '"value"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_playout_history_metadata" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"history_id"':
+ $stmt->bindValue($identifier, $this->history_id, PDO::PARAM_INT);
+ break;
+ case '"key"':
+ $stmt->bindValue($identifier, $this->key, PDO::PARAM_STR);
+ break;
+ case '"value"':
+ $stmt->bindValue($identifier, $this->value, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcPlayoutHistory !== null) {
+ if (!$this->aCcPlayoutHistory->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcPlayoutHistory->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CcPlayoutHistoryMetaDataPeer::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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlayoutHistoryMetaDataPeer::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->getDbHistoryId();
+ break;
+ case 2:
+ return $this->getDbKey();
+ break;
+ case 3:
+ return $this->getDbValue();
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcPlayoutHistoryMetaData'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcPlayoutHistoryMetaData'][$this->getPrimaryKey()] = true;
+ $keys = CcPlayoutHistoryMetaDataPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbHistoryId(),
+ $keys[2] => $this->getDbKey(),
+ $keys[3] => $this->getDbValue(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcPlayoutHistory) {
+ $result['CcPlayoutHistory'] = $this->aCcPlayoutHistory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlayoutHistoryMetaDataPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbHistoryId($value);
+ break;
+ case 2:
+ $this->setDbKey($value);
+ break;
+ case 3:
+ $this->setDbValue($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 BasePeer::TYPE_PHPNAME
+ *
+ * @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 = CcPlayoutHistoryMetaDataPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbHistoryId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbKey($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbValue($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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::ID)) $criteria->add(CcPlayoutHistoryMetaDataPeer::ID, $this->id);
+ if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::HISTORY_ID)) $criteria->add(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $this->history_id);
+ if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::KEY)) $criteria->add(CcPlayoutHistoryMetaDataPeer::KEY, $this->key);
+ if ($this->isColumnModified(CcPlayoutHistoryMetaDataPeer::VALUE)) $criteria->add(CcPlayoutHistoryMetaDataPeer::VALUE, $this->value);
+
+ 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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryMetaDataPeer::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 CcPlayoutHistoryMetaData (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbHistoryId($this->getDbHistoryId());
+ $copyObj->setDbKey($this->getDbKey());
+ $copyObj->setDbValue($this->getDbValue());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 CcPlayoutHistoryMetaData 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 CcPlayoutHistoryMetaDataPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcPlayoutHistoryMetaDataPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcPlayoutHistory object.
+ *
+ * @param CcPlayoutHistory $v
+ * @return CcPlayoutHistoryMetaData The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcPlayoutHistory(CcPlayoutHistory $v = null)
+ {
+ if ($v === null) {
+ $this->setDbHistoryId(NULL);
+ } else {
+ $this->setDbHistoryId($v->getDbId());
+ }
+
+ $this->aCcPlayoutHistory = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcPlayoutHistory object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcPlayoutHistoryMetaData($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcPlayoutHistory object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcPlayoutHistory The associated CcPlayoutHistory object.
+ * @throws PropelException
+ */
+ public function getCcPlayoutHistory(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcPlayoutHistory === null && ($this->history_id !== null) && $doQuery) {
+ $this->aCcPlayoutHistory = CcPlayoutHistoryQuery::create()->findPk($this->history_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->aCcPlayoutHistory->addCcPlayoutHistoryMetaDatas($this);
+ */
+ }
+
+ return $this->aCcPlayoutHistory;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->history_id = null;
+ $this->key = null;
+ $this->value = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->aCcPlayoutHistory instanceof Persistent) {
+ $this->aCcPlayoutHistory->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ $this->aCcPlayoutHistory = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcPlayoutHistoryMetaDataPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaDataPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaDataPeer.php
index 0b980ec4e..f4d8560f8 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaDataPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaDataPeer.php
@@ -4,976 +4,1002 @@
/**
* Base static class for performing query and update operations on the 'cc_playout_history_metadata' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcPlayoutHistoryMetaDataPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_playout_history_metadata';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcPlayoutHistoryMetaData';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcPlayoutHistoryMetaData';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcPlayoutHistoryMetaDataTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 4;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_playout_history_metadata.ID';
-
- /** the column name for the HISTORY_ID field */
- const HISTORY_ID = 'cc_playout_history_metadata.HISTORY_ID';
-
- /** the column name for the KEY field */
- const KEY = 'cc_playout_history_metadata.KEY';
-
- /** the column name for the VALUE field */
- const VALUE = 'cc_playout_history_metadata.VALUE';
-
- /**
- * An identiy map to hold any loaded instances of CcPlayoutHistoryMetaData objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcPlayoutHistoryMetaData[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbHistoryId', 'DbKey', 'DbValue', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbHistoryId', 'dbKey', 'dbValue', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::HISTORY_ID, self::KEY, self::VALUE, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'HISTORY_ID', 'KEY', 'VALUE', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'history_id', 'key', 'value', ),
- 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, 'DbHistoryId' => 1, 'DbKey' => 2, 'DbValue' => 3, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbHistoryId' => 1, 'dbKey' => 2, 'dbValue' => 3, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::HISTORY_ID => 1, self::KEY => 2, self::VALUE => 3, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'HISTORY_ID' => 1, 'KEY' => 2, 'VALUE' => 3, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'history_id' => 1, 'key' => 2, 'value' => 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. CcPlayoutHistoryMetaDataPeer::COLUMN_NAME).
- * @return string
- */
- public static function alias($alias, $column)
- {
- return str_replace(CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::ID);
- $criteria->addSelectColumn(CcPlayoutHistoryMetaDataPeer::HISTORY_ID);
- $criteria->addSelectColumn(CcPlayoutHistoryMetaDataPeer::KEY);
- $criteria->addSelectColumn(CcPlayoutHistoryMetaDataPeer::VALUE);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.HISTORY_ID');
- $criteria->addSelectColumn($alias . '.KEY');
- $criteria->addSelectColumn($alias . '.VALUE');
- }
- }
-
- /**
- * 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(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::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 CcPlayoutHistoryMetaData
- * @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 = CcPlayoutHistoryMetaDataPeer::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 CcPlayoutHistoryMetaDataPeer::populateObjects(CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- if (!$criteria->hasSelectClause()) {
- $criteria = clone $criteria;
- CcPlayoutHistoryMetaDataPeer::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 CcPlayoutHistoryMetaData $value A CcPlayoutHistoryMetaData object.
- * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
- */
- public static function addInstanceToPool(CcPlayoutHistoryMetaData $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 CcPlayoutHistoryMetaData object or a primary key value.
- */
- public static function removeInstanceFromPool($value)
- {
- if (Propel::isInstancePoolingEnabled() && $value !== null) {
- if (is_object($value) && $value instanceof CcPlayoutHistoryMetaData) {
- $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 CcPlayoutHistoryMetaData 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 CcPlayoutHistoryMetaData 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_playout_history_metadata
- * 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 = CcPlayoutHistoryMetaDataPeer::getOMClass(false);
- // populate the object(s)
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key = CcPlayoutHistoryMetaDataPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj = CcPlayoutHistoryMetaDataPeer::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;
- CcPlayoutHistoryMetaDataPeer::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 (CcPlayoutHistoryMetaData object, last column rank)
- */
- public static function populateObject($row, $startcol = 0)
- {
- $key = CcPlayoutHistoryMetaDataPeer::getPrimaryKeyHashFromRow($row, $startcol);
- if (null !== ($obj = CcPlayoutHistoryMetaDataPeer::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 + CcPlayoutHistoryMetaDataPeer::NUM_COLUMNS;
- } else {
- $cls = CcPlayoutHistoryMetaDataPeer::OM_CLASS;
- $obj = new $cls();
- $col = $obj->hydrate($row, $startcol);
- CcPlayoutHistoryMetaDataPeer::addInstanceToPool($obj, $key);
- }
- return array($obj, $col);
- }
-
- /**
- * Returns the number of rows matching criteria, joining the related CcPlayoutHistory 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 doCountJoinCcPlayoutHistory(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(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryPeer::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 CcPlayoutHistoryMetaData objects pre-filled with their CcPlayoutHistory 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 CcPlayoutHistoryMetaData objects.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelectJoinCcPlayoutHistory(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);
- }
-
- CcPlayoutHistoryMetaDataPeer::addSelectColumns($criteria);
- $startcol = (CcPlayoutHistoryMetaDataPeer::NUM_COLUMNS - CcPlayoutHistoryMetaDataPeer::NUM_LAZY_LOAD_COLUMNS);
- CcPlayoutHistoryPeer::addSelectColumns($criteria);
-
- $criteria->addJoin(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryPeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcPlayoutHistoryMetaDataPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcPlayoutHistoryMetaDataPeer::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 = CcPlayoutHistoryMetaDataPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcPlayoutHistoryMetaDataPeer::addInstanceToPool($obj1, $key1);
- } // if $obj1 already loaded
-
- $key2 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, $startcol);
- if ($key2 !== null) {
- $obj2 = CcPlayoutHistoryPeer::getInstanceFromPool($key2);
- if (!$obj2) {
-
- $cls = CcPlayoutHistoryPeer::getOMClass(false);
-
- $obj2 = new $cls();
- $obj2->hydrate($row, $startcol);
- CcPlayoutHistoryPeer::addInstanceToPool($obj2, $key2);
- } // if obj2 already loaded
-
- // Add the $obj1 (CcPlayoutHistoryMetaData) to $obj2 (CcPlayoutHistory)
- $obj2->addCcPlayoutHistoryMetaData($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(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryPeer::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 CcPlayoutHistoryMetaData 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 CcPlayoutHistoryMetaData 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);
- }
-
- CcPlayoutHistoryMetaDataPeer::addSelectColumns($criteria);
- $startcol2 = (CcPlayoutHistoryMetaDataPeer::NUM_COLUMNS - CcPlayoutHistoryMetaDataPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcPlayoutHistoryPeer::addSelectColumns($criteria);
- $startcol3 = $startcol2 + (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryPeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcPlayoutHistoryMetaDataPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcPlayoutHistoryMetaDataPeer::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 = CcPlayoutHistoryMetaDataPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcPlayoutHistoryMetaDataPeer::addInstanceToPool($obj1, $key1);
- } // if obj1 already loaded
-
- // Add objects for joined CcPlayoutHistory rows
-
- $key2 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, $startcol2);
- if ($key2 !== null) {
- $obj2 = CcPlayoutHistoryPeer::getInstanceFromPool($key2);
- if (!$obj2) {
-
- $cls = CcPlayoutHistoryPeer::getOMClass(false);
-
- $obj2 = new $cls();
- $obj2->hydrate($row, $startcol2);
- CcPlayoutHistoryPeer::addInstanceToPool($obj2, $key2);
- } // if obj2 loaded
-
- // Add the $obj1 (CcPlayoutHistoryMetaData) to the collection in $obj2 (CcPlayoutHistory)
- $obj2->addCcPlayoutHistoryMetaData($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(BaseCcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
- if (!$dbMap->hasTable(BaseCcPlayoutHistoryMetaDataPeer::TABLE_NAME))
- {
- $dbMap->addTableObject(new CcPlayoutHistoryMetaDataTableMap());
- }
- }
-
- /**
- * 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 ? CcPlayoutHistoryMetaDataPeer::CLASS_DEFAULT : CcPlayoutHistoryMetaDataPeer::OM_CLASS;
- }
-
- /**
- * Method perform an INSERT on the database, given a CcPlayoutHistoryMetaData or Criteria object.
- *
- * @param mixed $values Criteria or CcPlayoutHistoryMetaData 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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
- } else {
- $criteria = $values->buildCriteria(); // build Criteria from CcPlayoutHistoryMetaData object
- }
-
- if ($criteria->containsKey(CcPlayoutHistoryMetaDataPeer::ID) && $criteria->keyContainsValue(CcPlayoutHistoryMetaDataPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryMetaDataPeer::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 CcPlayoutHistoryMetaData or Criteria object.
- *
- * @param mixed $values Criteria or CcPlayoutHistoryMetaData 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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $selectCriteria = new Criteria(self::DATABASE_NAME);
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
-
- $comparison = $criteria->getComparison(CcPlayoutHistoryMetaDataPeer::ID);
- $value = $criteria->remove(CcPlayoutHistoryMetaDataPeer::ID);
- if ($value) {
- $selectCriteria->add(CcPlayoutHistoryMetaDataPeer::ID, $value, $comparison);
- } else {
- $selectCriteria->setPrimaryTableName(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
- }
-
- } else { // $values is CcPlayoutHistoryMetaData 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_playout_history_metadata 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(CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::TABLE_NAME, $con, CcPlayoutHistoryMetaDataPeer::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).
- CcPlayoutHistoryMetaDataPeer::clearInstancePool();
- CcPlayoutHistoryMetaDataPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Method perform a DELETE on the database, given a CcPlayoutHistoryMetaData or Criteria object OR a primary key value.
- *
- * @param mixed $values Criteria or CcPlayoutHistoryMetaData 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(CcPlayoutHistoryMetaDataPeer::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.
- CcPlayoutHistoryMetaDataPeer::clearInstancePool();
- // rename for clarity
- $criteria = clone $values;
- } elseif ($values instanceof CcPlayoutHistoryMetaData) { // it's a model object
- // invalidate the cache for this single object
- CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::ID, (array) $values, Criteria::IN);
- // invalidate the cache for this object(s)
- foreach ((array) $values as $singleval) {
- CcPlayoutHistoryMetaDataPeer::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);
- CcPlayoutHistoryMetaDataPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Validates all modified columns of given CcPlayoutHistoryMetaData 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 CcPlayoutHistoryMetaData $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(CcPlayoutHistoryMetaData $obj, $cols = null)
- {
- $columns = array();
-
- if ($cols) {
- $dbMap = Propel::getDatabaseMap(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
- $tableMap = $dbMap->getTable(CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, CcPlayoutHistoryMetaDataPeer::TABLE_NAME, $columns);
- }
-
- /**
- * Retrieve a single object by pkey.
- *
- * @param int $pk the primary key.
- * @param PropelPDO $con the connection to use
- * @return CcPlayoutHistoryMetaData
- */
- public static function retrieveByPK($pk, PropelPDO $con = null)
- {
-
- if (null !== ($obj = CcPlayoutHistoryMetaDataPeer::getInstanceFromPool((string) $pk))) {
- return $obj;
- }
-
- if ($con === null) {
- $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria = new Criteria(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
- $criteria->add(CcPlayoutHistoryMetaDataPeer::ID, $pk);
-
- $v = CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $objs = null;
- if (empty($pks)) {
- $objs = array();
- } else {
- $criteria = new Criteria(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
- $criteria->add(CcPlayoutHistoryMetaDataPeer::ID, $pks, Criteria::IN);
- $objs = CcPlayoutHistoryMetaDataPeer::doSelect($criteria, $con);
- }
- return $objs;
- }
+abstract class BaseCcPlayoutHistoryMetaDataPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_playout_history_metadata';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcPlayoutHistoryMetaData';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcPlayoutHistoryMetaDataTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 4;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 4;
+
+ /** the column name for the id field */
+ const ID = 'cc_playout_history_metadata.id';
+
+ /** the column name for the history_id field */
+ const HISTORY_ID = 'cc_playout_history_metadata.history_id';
+
+ /** the column name for the key field */
+ const KEY = 'cc_playout_history_metadata.key';
+
+ /** the column name for the value field */
+ const VALUE = 'cc_playout_history_metadata.value';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcPlayoutHistoryMetaData objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcPlayoutHistoryMetaData[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcPlayoutHistoryMetaDataPeer::$fieldNames[CcPlayoutHistoryMetaDataPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbHistoryId', 'DbKey', 'DbValue', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbHistoryId', 'dbKey', 'dbValue', ),
+ BasePeer::TYPE_COLNAME => array (CcPlayoutHistoryMetaDataPeer::ID, CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryMetaDataPeer::KEY, CcPlayoutHistoryMetaDataPeer::VALUE, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'HISTORY_ID', 'KEY', 'VALUE', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'history_id', 'key', 'value', ),
+ 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. CcPlayoutHistoryMetaDataPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbHistoryId' => 1, 'DbKey' => 2, 'DbValue' => 3, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbHistoryId' => 1, 'dbKey' => 2, 'dbValue' => 3, ),
+ BasePeer::TYPE_COLNAME => array (CcPlayoutHistoryMetaDataPeer::ID => 0, CcPlayoutHistoryMetaDataPeer::HISTORY_ID => 1, CcPlayoutHistoryMetaDataPeer::KEY => 2, CcPlayoutHistoryMetaDataPeer::VALUE => 3, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'HISTORY_ID' => 1, 'KEY' => 2, 'VALUE' => 3, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'history_id' => 1, 'key' => 2, 'value' => 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcPlayoutHistoryMetaDataPeer::getFieldNames($toType);
+ $key = isset(CcPlayoutHistoryMetaDataPeer::$fieldKeys[$fromType][$name]) ? CcPlayoutHistoryMetaDataPeer::$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(CcPlayoutHistoryMetaDataPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcPlayoutHistoryMetaDataPeer::$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 CcPlayoutHistoryMetaDataPeer::$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. CcPlayoutHistoryMetaDataPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::ID);
+ $criteria->addSelectColumn(CcPlayoutHistoryMetaDataPeer::HISTORY_ID);
+ $criteria->addSelectColumn(CcPlayoutHistoryMetaDataPeer::KEY);
+ $criteria->addSelectColumn(CcPlayoutHistoryMetaDataPeer::VALUE);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.history_id');
+ $criteria->addSelectColumn($alias . '.key');
+ $criteria->addSelectColumn($alias . '.value');
+ }
+ }
+
+ /**
+ * 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(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryMetaDataPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::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;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcPlayoutHistoryMetaData
+ * @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 = CcPlayoutHistoryMetaDataPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 CcPlayoutHistoryMetaDataPeer::populateObjects(CcPlayoutHistoryMetaDataPeer::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 directly (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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcPlayoutHistoryMetaDataPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryMetaDataPeer::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 CcPlayoutHistoryMetaData $obj A CcPlayoutHistoryMetaData object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcPlayoutHistoryMetaDataPeer::$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 CcPlayoutHistoryMetaData object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcPlayoutHistoryMetaData) {
+ $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 CcPlayoutHistoryMetaData object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(CcPlayoutHistoryMetaDataPeer::$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 CcPlayoutHistoryMetaData 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(CcPlayoutHistoryMetaDataPeer::$instances[$key])) {
+ return CcPlayoutHistoryMetaDataPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcPlayoutHistoryMetaDataPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcPlayoutHistoryMetaDataPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_playout_history_metadata
+ * 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 = CcPlayoutHistoryMetaDataPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcPlayoutHistoryMetaDataPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcPlayoutHistoryMetaDataPeer::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;
+ CcPlayoutHistoryMetaDataPeer::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 (CcPlayoutHistoryMetaData object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcPlayoutHistoryMetaDataPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcPlayoutHistoryMetaDataPeer::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 + CcPlayoutHistoryMetaDataPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = CcPlayoutHistoryMetaDataPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcPlayoutHistoryMetaDataPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcPlayoutHistory 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 doCountJoinCcPlayoutHistory(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(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryMetaDataPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryPeer::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 CcPlayoutHistoryMetaData objects pre-filled with their CcPlayoutHistory 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 CcPlayoutHistoryMetaData objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcPlayoutHistory(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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryMetaDataPeer::addSelectColumns($criteria);
+ $startcol = CcPlayoutHistoryMetaDataPeer::NUM_HYDRATE_COLUMNS;
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryMetaDataPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryMetaDataPeer::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 = CcPlayoutHistoryMetaDataPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryMetaDataPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcPlayoutHistoryPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcPlayoutHistoryPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcPlayoutHistoryPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcPlayoutHistoryMetaData) to $obj2 (CcPlayoutHistory)
+ $obj2->addCcPlayoutHistoryMetaData($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(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryMetaDataPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryPeer::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 CcPlayoutHistoryMetaData 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 CcPlayoutHistoryMetaData 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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryMetaDataPeer::addSelectColumns($criteria);
+ $startcol2 = CcPlayoutHistoryMetaDataPeer::NUM_HYDRATE_COLUMNS;
+
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcPlayoutHistoryPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, CcPlayoutHistoryPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryMetaDataPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryMetaDataPeer::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 = CcPlayoutHistoryMetaDataPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryMetaDataPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcPlayoutHistory rows
+
+ $key2 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcPlayoutHistoryPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcPlayoutHistoryPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcPlayoutHistoryPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CcPlayoutHistoryMetaData) to the collection in $obj2 (CcPlayoutHistory)
+ $obj2->addCcPlayoutHistoryMetaData($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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME)->getTable(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcPlayoutHistoryMetaDataPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \CcPlayoutHistoryMetaDataTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcPlayoutHistoryMetaDataPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a CcPlayoutHistoryMetaData or Criteria object.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryMetaData 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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcPlayoutHistoryMetaData object
+ }
+
+ if ($criteria->containsKey(CcPlayoutHistoryMetaDataPeer::ID) && $criteria->keyContainsValue(CcPlayoutHistoryMetaDataPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryMetaDataPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryMetaDataPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a CcPlayoutHistoryMetaData or Criteria object.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryMetaData 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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcPlayoutHistoryMetaDataPeer::ID);
+ $value = $criteria->remove(CcPlayoutHistoryMetaDataPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcPlayoutHistoryMetaDataPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcPlayoutHistoryMetaData object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_playout_history_metadata table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::TABLE_NAME, $con, CcPlayoutHistoryMetaDataPeer::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).
+ CcPlayoutHistoryMetaDataPeer::clearInstancePool();
+ CcPlayoutHistoryMetaDataPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a CcPlayoutHistoryMetaData or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryMetaData 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(CcPlayoutHistoryMetaDataPeer::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.
+ CcPlayoutHistoryMetaDataPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcPlayoutHistoryMetaData) { // it's a model object
+ // invalidate the cache for this single object
+ CcPlayoutHistoryMetaDataPeer::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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryMetaDataPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcPlayoutHistoryMetaDataPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryMetaDataPeer::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);
+ CcPlayoutHistoryMetaDataPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcPlayoutHistoryMetaData 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 CcPlayoutHistoryMetaData $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($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcPlayoutHistoryMetaDataPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, CcPlayoutHistoryMetaDataPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcPlayoutHistoryMetaData
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcPlayoutHistoryMetaDataPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryMetaDataPeer::ID, $pk);
+
+ $v = CcPlayoutHistoryMetaDataPeer::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
+ * @return CcPlayoutHistoryMetaData[]
+ * @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(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryMetaDataPeer::ID, $pks, Criteria::IN);
+ $objs = CcPlayoutHistoryMetaDataPeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
} // BaseCcPlayoutHistoryMetaDataPeer
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaDataQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaDataQuery.php
index 7a27c61af..94246ff89 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaDataQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryMetaDataQuery.php
@@ -4,317 +4,467 @@
/**
* Base class that represents a query for the 'cc_playout_history_metadata' table.
*
- *
*
- * @method CcPlayoutHistoryMetaDataQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcPlayoutHistoryMetaDataQuery orderByDbHistoryId($order = Criteria::ASC) Order by the history_id column
- * @method CcPlayoutHistoryMetaDataQuery orderByDbKey($order = Criteria::ASC) Order by the key column
- * @method CcPlayoutHistoryMetaDataQuery orderByDbValue($order = Criteria::ASC) Order by the value column
*
- * @method CcPlayoutHistoryMetaDataQuery groupByDbId() Group by the id column
- * @method CcPlayoutHistoryMetaDataQuery groupByDbHistoryId() Group by the history_id column
- * @method CcPlayoutHistoryMetaDataQuery groupByDbKey() Group by the key column
- * @method CcPlayoutHistoryMetaDataQuery groupByDbValue() Group by the value column
+ * @method CcPlayoutHistoryMetaDataQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcPlayoutHistoryMetaDataQuery orderByDbHistoryId($order = Criteria::ASC) Order by the history_id column
+ * @method CcPlayoutHistoryMetaDataQuery orderByDbKey($order = Criteria::ASC) Order by the key column
+ * @method CcPlayoutHistoryMetaDataQuery orderByDbValue($order = Criteria::ASC) Order by the value column
*
- * @method CcPlayoutHistoryMetaDataQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcPlayoutHistoryMetaDataQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcPlayoutHistoryMetaDataQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcPlayoutHistoryMetaDataQuery groupByDbId() Group by the id column
+ * @method CcPlayoutHistoryMetaDataQuery groupByDbHistoryId() Group by the history_id column
+ * @method CcPlayoutHistoryMetaDataQuery groupByDbKey() Group by the key column
+ * @method CcPlayoutHistoryMetaDataQuery groupByDbValue() Group by the value column
*
- * @method CcPlayoutHistoryMetaDataQuery leftJoinCcPlayoutHistory($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistory relation
- * @method CcPlayoutHistoryMetaDataQuery rightJoinCcPlayoutHistory($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistory relation
- * @method CcPlayoutHistoryMetaDataQuery innerJoinCcPlayoutHistory($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistory relation
+ * @method CcPlayoutHistoryMetaDataQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcPlayoutHistoryMetaDataQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcPlayoutHistoryMetaDataQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcPlayoutHistoryMetaData findOne(PropelPDO $con = null) Return the first CcPlayoutHistoryMetaData matching the query
- * @method CcPlayoutHistoryMetaData findOneOrCreate(PropelPDO $con = null) Return the first CcPlayoutHistoryMetaData matching the query, or a new CcPlayoutHistoryMetaData object populated from the query conditions when no match is found
+ * @method CcPlayoutHistoryMetaDataQuery leftJoinCcPlayoutHistory($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPlayoutHistory relation
+ * @method CcPlayoutHistoryMetaDataQuery rightJoinCcPlayoutHistory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPlayoutHistory relation
+ * @method CcPlayoutHistoryMetaDataQuery innerJoinCcPlayoutHistory($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPlayoutHistory relation
*
- * @method CcPlayoutHistoryMetaData findOneByDbId(int $id) Return the first CcPlayoutHistoryMetaData filtered by the id column
- * @method CcPlayoutHistoryMetaData findOneByDbHistoryId(int $history_id) Return the first CcPlayoutHistoryMetaData filtered by the history_id column
- * @method CcPlayoutHistoryMetaData findOneByDbKey(string $key) Return the first CcPlayoutHistoryMetaData filtered by the key column
- * @method CcPlayoutHistoryMetaData findOneByDbValue(string $value) Return the first CcPlayoutHistoryMetaData filtered by the value column
+ * @method CcPlayoutHistoryMetaData findOne(PropelPDO $con = null) Return the first CcPlayoutHistoryMetaData matching the query
+ * @method CcPlayoutHistoryMetaData findOneOrCreate(PropelPDO $con = null) Return the first CcPlayoutHistoryMetaData matching the query, or a new CcPlayoutHistoryMetaData object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcPlayoutHistoryMetaData objects filtered by the id column
- * @method array findByDbHistoryId(int $history_id) Return CcPlayoutHistoryMetaData objects filtered by the history_id column
- * @method array findByDbKey(string $key) Return CcPlayoutHistoryMetaData objects filtered by the key column
- * @method array findByDbValue(string $value) Return CcPlayoutHistoryMetaData objects filtered by the value column
+ * @method CcPlayoutHistoryMetaData findOneByDbHistoryId(int $history_id) Return the first CcPlayoutHistoryMetaData filtered by the history_id column
+ * @method CcPlayoutHistoryMetaData findOneByDbKey(string $key) Return the first CcPlayoutHistoryMetaData filtered by the key column
+ * @method CcPlayoutHistoryMetaData findOneByDbValue(string $value) Return the first CcPlayoutHistoryMetaData filtered by the value column
+ *
+ * @method array findByDbId(int $id) Return CcPlayoutHistoryMetaData objects filtered by the id column
+ * @method array findByDbHistoryId(int $history_id) Return CcPlayoutHistoryMetaData objects filtered by the history_id column
+ * @method array findByDbKey(string $key) Return CcPlayoutHistoryMetaData objects filtered by the key column
+ * @method array findByDbValue(string $value) Return CcPlayoutHistoryMetaData objects filtered by the value column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlayoutHistoryMetaDataQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcPlayoutHistoryMetaDataQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcPlayoutHistoryMetaData';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcPlayoutHistoryMetaDataQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcPlayoutHistoryMetaData', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcPlayoutHistoryMetaDataQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcPlayoutHistoryMetaDataQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcPlayoutHistoryMetaDataQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcPlayoutHistoryMetaDataQuery) {
+ return $criteria;
+ }
+ $query = new CcPlayoutHistoryMetaDataQuery(null, null, $modelAlias);
- /**
- * Returns a new CcPlayoutHistoryMetaDataQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcPlayoutHistoryMetaDataQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcPlayoutHistoryMetaDataQuery) {
- return $criteria;
- }
- $query = new CcPlayoutHistoryMetaDataQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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 CcPlayoutHistoryMetaData|array|mixed the result, formatted by the current formatter
- */
- public function findPk($key, $con = null)
- {
- if ((null !== ($obj = CcPlayoutHistoryMetaDataPeer::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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcPlayoutHistoryMetaData|CcPlayoutHistoryMetaData[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcPlayoutHistoryMetaDataPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryMetaDataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
- /**
- * Filter the query by primary key
- *
- * @param mixed $key Primary key to use for the query
- *
- * @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
- */
- public function filterByPrimaryKey($key)
- {
- return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::ID, $key, Criteria::EQUAL);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPlayoutHistoryMetaData A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * Filter the query by a list of primary keys
- *
- * @param array $keys The list of primary key to use for the query
- *
- * @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
- */
- public function filterByPrimaryKeys($keys)
- {
- return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::ID, $keys, Criteria::IN);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPlayoutHistoryMetaData A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "history_id", "key", "value" FROM "cc_playout_history_metadata" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcPlayoutHistoryMetaData();
+ $obj->hydrate($row);
+ CcPlayoutHistoryMetaDataPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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 CcPlayoutHistoryMetaDataQuery 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(CcPlayoutHistoryMetaDataPeer::ID, $dbId, $comparison);
- }
+ return $obj;
+ }
- /**
- * Filter the query on the history_id column
- *
- * @param int|array $dbHistoryId 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 CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
- */
- public function filterByDbHistoryId($dbHistoryId = null, $comparison = null)
- {
- if (is_array($dbHistoryId)) {
- $useMinMax = false;
- if (isset($dbHistoryId['min'])) {
- $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $dbHistoryId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbHistoryId['max'])) {
- $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $dbHistoryId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $dbHistoryId, $comparison);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPlayoutHistoryMetaData|CcPlayoutHistoryMetaData[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * Filter the query on the key column
- *
- * @param string $dbKey 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 CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
- */
- public function filterByDbKey($dbKey = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbKey)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbKey)) {
- $dbKey = str_replace('*', '%', $dbKey);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::KEY, $dbKey, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * 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 CcPlayoutHistoryMetaDataQuery 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(CcPlayoutHistoryMetaDataPeer::VALUE, $dbValue, $comparison);
- }
+ /**
+ * 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|CcPlayoutHistoryMetaData[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * Filter the query by a related CcPlayoutHistory object
- *
- * @param CcPlayoutHistory $ccPlayoutHistory the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
- */
- public function filterByCcPlayoutHistory($ccPlayoutHistory, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $ccPlayoutHistory->getDbId(), $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * Adds a JOIN clause to the query using the CcPlayoutHistory relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
- */
- public function joinCcPlayoutHistory($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcPlayoutHistory');
-
- // 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, 'CcPlayoutHistory');
- }
-
- return $this;
- }
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
- /**
- * Use the CcPlayoutHistory relation CcPlayoutHistory 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 CcPlayoutHistoryQuery A secondary query class using the current class as primary query
- */
- public function useCcPlayoutHistoryQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinCcPlayoutHistory($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistory', 'CcPlayoutHistoryQuery');
- }
+ return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * Exclude object from result
- *
- * @param CcPlayoutHistoryMetaData $ccPlayoutHistoryMetaData Object to remove from the list of results
- *
- * @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
- */
- public function prune($ccPlayoutHistoryMetaData = null)
- {
- if ($ccPlayoutHistoryMetaData) {
- $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::ID, $ccPlayoutHistoryMetaData->getDbId(), Criteria::NOT_EQUAL);
- }
-
- return $this;
- }
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
-} // BaseCcPlayoutHistoryMetaDataQuery
+ return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the history_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbHistoryId(1234); // WHERE history_id = 1234
+ * $query->filterByDbHistoryId(array(12, 34)); // WHERE history_id IN (12, 34)
+ * $query->filterByDbHistoryId(array('min' => 12)); // WHERE history_id >= 12
+ * $query->filterByDbHistoryId(array('max' => 12)); // WHERE history_id <= 12
+ *
+ *
+ * @see filterByCcPlayoutHistory()
+ *
+ * @param mixed $dbHistoryId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
+ */
+ public function filterByDbHistoryId($dbHistoryId = null, $comparison = null)
+ {
+ if (is_array($dbHistoryId)) {
+ $useMinMax = false;
+ if (isset($dbHistoryId['min'])) {
+ $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $dbHistoryId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbHistoryId['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $dbHistoryId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $dbHistoryId, $comparison);
+ }
+
+ /**
+ * Filter the query on the key column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbKey('fooValue'); // WHERE key = 'fooValue'
+ * $query->filterByDbKey('%fooValue%'); // WHERE key LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbKey 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 CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
+ */
+ public function filterByDbKey($dbKey = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbKey)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbKey)) {
+ $dbKey = str_replace('*', '%', $dbKey);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::KEY, $dbKey, $comparison);
+ }
+
+ /**
+ * Filter the query on the value column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbValue('fooValue'); // WHERE value = 'fooValue'
+ * $query->filterByDbValue('%fooValue%'); // WHERE value LIKE '%fooValue%'
+ *
+ *
+ * @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 CcPlayoutHistoryMetaDataQuery 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(CcPlayoutHistoryMetaDataPeer::VALUE, $dbValue, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcPlayoutHistory object
+ *
+ * @param CcPlayoutHistory|PropelObjectCollection $ccPlayoutHistory The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcPlayoutHistory($ccPlayoutHistory, $comparison = null)
+ {
+ if ($ccPlayoutHistory instanceof CcPlayoutHistory) {
+ return $this
+ ->addUsingAlias(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $ccPlayoutHistory->getDbId(), $comparison);
+ } elseif ($ccPlayoutHistory instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcPlayoutHistoryMetaDataPeer::HISTORY_ID, $ccPlayoutHistory->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcPlayoutHistory() only accepts arguments of type CcPlayoutHistory or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcPlayoutHistory relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
+ */
+ public function joinCcPlayoutHistory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcPlayoutHistory');
+
+ // 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, 'CcPlayoutHistory');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcPlayoutHistory relation CcPlayoutHistory 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 CcPlayoutHistoryQuery A secondary query class using the current class as primary query
+ */
+ public function useCcPlayoutHistoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcPlayoutHistory($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistory', 'CcPlayoutHistoryQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcPlayoutHistoryMetaData $ccPlayoutHistoryMetaData Object to remove from the list of results
+ *
+ * @return CcPlayoutHistoryMetaDataQuery The current query, for fluid interface
+ */
+ public function prune($ccPlayoutHistoryMetaData = null)
+ {
+ if ($ccPlayoutHistoryMetaData) {
+ $this->addUsingAlias(CcPlayoutHistoryMetaDataPeer::ID, $ccPlayoutHistoryMetaData->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryPeer.php
index 01b944a65..7ff20cbce 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryPeer.php
@@ -4,1371 +4,1403 @@
/**
* Base static class for performing query and update operations on the 'cc_playout_history' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcPlayoutHistoryPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_playout_history';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcPlayoutHistory';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcPlayoutHistory';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcPlayoutHistoryTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 5;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_playout_history.ID';
-
- /** the column name for the FILE_ID field */
- const FILE_ID = 'cc_playout_history.FILE_ID';
-
- /** the column name for the STARTS field */
- const STARTS = 'cc_playout_history.STARTS';
-
- /** the column name for the ENDS field */
- const ENDS = 'cc_playout_history.ENDS';
-
- /** the column name for the INSTANCE_ID field */
- const INSTANCE_ID = 'cc_playout_history.INSTANCE_ID';
-
- /**
- * An identiy map to hold any loaded instances of CcPlayoutHistory objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcPlayoutHistory[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbFileId', 'DbStarts', 'DbEnds', 'DbInstanceId', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbFileId', 'dbStarts', 'dbEnds', 'dbInstanceId', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::FILE_ID, self::STARTS, self::ENDS, self::INSTANCE_ID, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FILE_ID', 'STARTS', 'ENDS', 'INSTANCE_ID', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'file_id', 'starts', 'ends', 'instance_id', ),
- 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 ('DbId' => 0, 'DbFileId' => 1, 'DbStarts' => 2, 'DbEnds' => 3, 'DbInstanceId' => 4, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbFileId' => 1, 'dbStarts' => 2, 'dbEnds' => 3, 'dbInstanceId' => 4, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::FILE_ID => 1, self::STARTS => 2, self::ENDS => 3, self::INSTANCE_ID => 4, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FILE_ID' => 1, 'STARTS' => 2, 'ENDS' => 3, 'INSTANCE_ID' => 4, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'file_id' => 1, 'starts' => 2, 'ends' => 3, 'instance_id' => 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. CcPlayoutHistoryPeer::COLUMN_NAME).
- * @return string
- */
- public static function alias($alias, $column)
- {
- return str_replace(CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::ID);
- $criteria->addSelectColumn(CcPlayoutHistoryPeer::FILE_ID);
- $criteria->addSelectColumn(CcPlayoutHistoryPeer::STARTS);
- $criteria->addSelectColumn(CcPlayoutHistoryPeer::ENDS);
- $criteria->addSelectColumn(CcPlayoutHistoryPeer::INSTANCE_ID);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.FILE_ID');
- $criteria->addSelectColumn($alias . '.STARTS');
- $criteria->addSelectColumn($alias . '.ENDS');
- $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(CcPlayoutHistoryPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::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 CcPlayoutHistory
- * @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 = CcPlayoutHistoryPeer::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 CcPlayoutHistoryPeer::populateObjects(CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- if (!$criteria->hasSelectClause()) {
- $criteria = clone $criteria;
- CcPlayoutHistoryPeer::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 CcPlayoutHistory $value A CcPlayoutHistory object.
- * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
- */
- public static function addInstanceToPool(CcPlayoutHistory $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 CcPlayoutHistory object or a primary key value.
- */
- public static function removeInstanceFromPool($value)
- {
- if (Propel::isInstancePoolingEnabled() && $value !== null) {
- if (is_object($value) && $value instanceof CcPlayoutHistory) {
- $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 CcPlayoutHistory 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 CcPlayoutHistory 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_playout_history
- * by a foreign key with ON DELETE CASCADE
- */
- public static function clearRelatedInstancePool()
- {
- // Invalidate objects in CcPlayoutHistoryMetaDataPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CcPlayoutHistoryMetaDataPeer::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 = CcPlayoutHistoryPeer::getOMClass(false);
- // populate the object(s)
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj = CcPlayoutHistoryPeer::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;
- CcPlayoutHistoryPeer::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 (CcPlayoutHistory object, last column rank)
- */
- public static function populateObject($row, $startcol = 0)
- {
- $key = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, $startcol);
- if (null !== ($obj = CcPlayoutHistoryPeer::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 + CcPlayoutHistoryPeer::NUM_COLUMNS;
- } else {
- $cls = CcPlayoutHistoryPeer::OM_CLASS;
- $obj = new $cls();
- $col = $obj->hydrate($row, $startcol);
- CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcPlayoutHistoryPeer::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 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(CcPlayoutHistoryPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcPlayoutHistoryPeer::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 CcPlayoutHistory 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 CcPlayoutHistory 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);
- }
-
- CcPlayoutHistoryPeer::addSelectColumns($criteria);
- $startcol = (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
- CcFilesPeer::addSelectColumns($criteria);
-
- $criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcPlayoutHistoryPeer::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 = CcPlayoutHistoryPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcPlayoutHistoryPeer::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 (CcPlayoutHistory) to $obj2 (CcFiles)
- $obj2->addCcPlayoutHistory($obj1);
-
- } // if joined row was not null
-
- $results[] = $obj1;
- }
- $stmt->closeCursor();
- return $results;
- }
-
-
- /**
- * Selects a collection of CcPlayoutHistory 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 CcPlayoutHistory 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);
- }
-
- CcPlayoutHistoryPeer::addSelectColumns($criteria);
- $startcol = (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
- CcShowInstancesPeer::addSelectColumns($criteria);
-
- $criteria->addJoin(CcPlayoutHistoryPeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcPlayoutHistoryPeer::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 = CcPlayoutHistoryPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcPlayoutHistoryPeer::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 (CcPlayoutHistory) to $obj2 (CcShowInstances)
- $obj2->addCcPlayoutHistory($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(CcPlayoutHistoryPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
-
- $criteria->addJoin(CcPlayoutHistoryPeer::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 CcPlayoutHistory 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 CcPlayoutHistory 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);
- }
-
- CcPlayoutHistoryPeer::addSelectColumns($criteria);
- $startcol2 = (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcFilesPeer::addSelectColumns($criteria);
- $startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcShowInstancesPeer::addSelectColumns($criteria);
- $startcol4 = $startcol3 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
-
- $criteria->addJoin(CcPlayoutHistoryPeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcPlayoutHistoryPeer::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 = CcPlayoutHistoryPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcPlayoutHistoryPeer::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 (CcPlayoutHistory) to the collection in $obj2 (CcFiles)
- $obj2->addCcPlayoutHistory($obj1);
- } // if joined row not null
-
- // Add objects for joined CcShowInstances rows
-
- $key3 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol3);
- if ($key3 !== null) {
- $obj3 = CcShowInstancesPeer::getInstanceFromPool($key3);
- if (!$obj3) {
-
- $cls = CcShowInstancesPeer::getOMClass(false);
-
- $obj3 = new $cls();
- $obj3->hydrate($row, $startcol3);
- CcShowInstancesPeer::addInstanceToPool($obj3, $key3);
- } // if obj3 loaded
-
- // Add the $obj1 (CcPlayoutHistory) to the collection in $obj3 (CcShowInstances)
- $obj3->addCcPlayoutHistory($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(CcPlayoutHistoryPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcPlayoutHistoryPeer::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 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(CcPlayoutHistoryPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcPlayoutHistoryPeer::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 CcPlayoutHistory 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 CcPlayoutHistory 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);
- }
-
- CcPlayoutHistoryPeer::addSelectColumns($criteria);
- $startcol2 = (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcShowInstancesPeer::addSelectColumns($criteria);
- $startcol3 = $startcol2 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcPlayoutHistoryPeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
-
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcPlayoutHistoryPeer::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 = CcPlayoutHistoryPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcPlayoutHistoryPeer::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 (CcPlayoutHistory) to the collection in $obj2 (CcShowInstances)
- $obj2->addCcPlayoutHistory($obj1);
-
- } // if joined row is not null
-
- $results[] = $obj1;
- }
- $stmt->closeCursor();
- return $results;
- }
-
-
- /**
- * Selects a collection of CcPlayoutHistory 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 CcPlayoutHistory 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);
- }
-
- CcPlayoutHistoryPeer::addSelectColumns($criteria);
- $startcol2 = (CcPlayoutHistoryPeer::NUM_COLUMNS - CcPlayoutHistoryPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcFilesPeer::addSelectColumns($criteria);
- $startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
-
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcPlayoutHistoryPeer::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 = CcPlayoutHistoryPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcPlayoutHistoryPeer::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 (CcPlayoutHistory) to the collection in $obj2 (CcFiles)
- $obj2->addCcPlayoutHistory($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(BaseCcPlayoutHistoryPeer::DATABASE_NAME);
- if (!$dbMap->hasTable(BaseCcPlayoutHistoryPeer::TABLE_NAME))
- {
- $dbMap->addTableObject(new CcPlayoutHistoryTableMap());
- }
- }
-
- /**
- * 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 ? CcPlayoutHistoryPeer::CLASS_DEFAULT : CcPlayoutHistoryPeer::OM_CLASS;
- }
-
- /**
- * Method perform an INSERT on the database, given a CcPlayoutHistory or Criteria object.
- *
- * @param mixed $values Criteria or CcPlayoutHistory 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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
- } else {
- $criteria = $values->buildCriteria(); // build Criteria from CcPlayoutHistory object
- }
-
- if ($criteria->containsKey(CcPlayoutHistoryPeer::ID) && $criteria->keyContainsValue(CcPlayoutHistoryPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryPeer::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 CcPlayoutHistory or Criteria object.
- *
- * @param mixed $values Criteria or CcPlayoutHistory 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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $selectCriteria = new Criteria(self::DATABASE_NAME);
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
-
- $comparison = $criteria->getComparison(CcPlayoutHistoryPeer::ID);
- $value = $criteria->remove(CcPlayoutHistoryPeer::ID);
- if ($value) {
- $selectCriteria->add(CcPlayoutHistoryPeer::ID, $value, $comparison);
- } else {
- $selectCriteria->setPrimaryTableName(CcPlayoutHistoryPeer::TABLE_NAME);
- }
-
- } else { // $values is CcPlayoutHistory 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_playout_history 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(CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::TABLE_NAME, $con, CcPlayoutHistoryPeer::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).
- CcPlayoutHistoryPeer::clearInstancePool();
- CcPlayoutHistoryPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Method perform a DELETE on the database, given a CcPlayoutHistory or Criteria object OR a primary key value.
- *
- * @param mixed $values Criteria or CcPlayoutHistory 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(CcPlayoutHistoryPeer::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.
- CcPlayoutHistoryPeer::clearInstancePool();
- // rename for clarity
- $criteria = clone $values;
- } elseif ($values instanceof CcPlayoutHistory) { // it's a model object
- // invalidate the cache for this single object
- CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::ID, (array) $values, Criteria::IN);
- // invalidate the cache for this object(s)
- foreach ((array) $values as $singleval) {
- CcPlayoutHistoryPeer::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);
- CcPlayoutHistoryPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Validates all modified columns of given CcPlayoutHistory 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 CcPlayoutHistory $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(CcPlayoutHistory $obj, $cols = null)
- {
- $columns = array();
-
- if ($cols) {
- $dbMap = Propel::getDatabaseMap(CcPlayoutHistoryPeer::DATABASE_NAME);
- $tableMap = $dbMap->getTable(CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::DATABASE_NAME, CcPlayoutHistoryPeer::TABLE_NAME, $columns);
- }
-
- /**
- * Retrieve a single object by pkey.
- *
- * @param int $pk the primary key.
- * @param PropelPDO $con the connection to use
- * @return CcPlayoutHistory
- */
- public static function retrieveByPK($pk, PropelPDO $con = null)
- {
-
- if (null !== ($obj = CcPlayoutHistoryPeer::getInstanceFromPool((string) $pk))) {
- return $obj;
- }
-
- if ($con === null) {
- $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria = new Criteria(CcPlayoutHistoryPeer::DATABASE_NAME);
- $criteria->add(CcPlayoutHistoryPeer::ID, $pk);
-
- $v = CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $objs = null;
- if (empty($pks)) {
- $objs = array();
- } else {
- $criteria = new Criteria(CcPlayoutHistoryPeer::DATABASE_NAME);
- $criteria->add(CcPlayoutHistoryPeer::ID, $pks, Criteria::IN);
- $objs = CcPlayoutHistoryPeer::doSelect($criteria, $con);
- }
- return $objs;
- }
+abstract class BaseCcPlayoutHistoryPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_playout_history';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcPlayoutHistory';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcPlayoutHistoryTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 5;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 5;
+
+ /** the column name for the id field */
+ const ID = 'cc_playout_history.id';
+
+ /** the column name for the file_id field */
+ const FILE_ID = 'cc_playout_history.file_id';
+
+ /** the column name for the starts field */
+ const STARTS = 'cc_playout_history.starts';
+
+ /** the column name for the ends field */
+ const ENDS = 'cc_playout_history.ends';
+
+ /** the column name for the instance_id field */
+ const INSTANCE_ID = 'cc_playout_history.instance_id';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcPlayoutHistory objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcPlayoutHistory[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcPlayoutHistoryPeer::$fieldNames[CcPlayoutHistoryPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbFileId', 'DbStarts', 'DbEnds', 'DbInstanceId', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbFileId', 'dbStarts', 'dbEnds', 'dbInstanceId', ),
+ BasePeer::TYPE_COLNAME => array (CcPlayoutHistoryPeer::ID, CcPlayoutHistoryPeer::FILE_ID, CcPlayoutHistoryPeer::STARTS, CcPlayoutHistoryPeer::ENDS, CcPlayoutHistoryPeer::INSTANCE_ID, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FILE_ID', 'STARTS', 'ENDS', 'INSTANCE_ID', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'file_id', 'starts', 'ends', 'instance_id', ),
+ 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. CcPlayoutHistoryPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbFileId' => 1, 'DbStarts' => 2, 'DbEnds' => 3, 'DbInstanceId' => 4, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbFileId' => 1, 'dbStarts' => 2, 'dbEnds' => 3, 'dbInstanceId' => 4, ),
+ BasePeer::TYPE_COLNAME => array (CcPlayoutHistoryPeer::ID => 0, CcPlayoutHistoryPeer::FILE_ID => 1, CcPlayoutHistoryPeer::STARTS => 2, CcPlayoutHistoryPeer::ENDS => 3, CcPlayoutHistoryPeer::INSTANCE_ID => 4, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FILE_ID' => 1, 'STARTS' => 2, 'ENDS' => 3, 'INSTANCE_ID' => 4, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'file_id' => 1, 'starts' => 2, 'ends' => 3, 'instance_id' => 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcPlayoutHistoryPeer::getFieldNames($toType);
+ $key = isset(CcPlayoutHistoryPeer::$fieldKeys[$fromType][$name]) ? CcPlayoutHistoryPeer::$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(CcPlayoutHistoryPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcPlayoutHistoryPeer::$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 CcPlayoutHistoryPeer::$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. CcPlayoutHistoryPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::ID);
+ $criteria->addSelectColumn(CcPlayoutHistoryPeer::FILE_ID);
+ $criteria->addSelectColumn(CcPlayoutHistoryPeer::STARTS);
+ $criteria->addSelectColumn(CcPlayoutHistoryPeer::ENDS);
+ $criteria->addSelectColumn(CcPlayoutHistoryPeer::INSTANCE_ID);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.file_id');
+ $criteria->addSelectColumn($alias . '.starts');
+ $criteria->addSelectColumn($alias . '.ends');
+ $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(CcPlayoutHistoryPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(CcPlayoutHistoryPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::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;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcPlayoutHistory
+ * @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 = CcPlayoutHistoryPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 CcPlayoutHistoryPeer::populateObjects(CcPlayoutHistoryPeer::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 directly (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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryPeer::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 CcPlayoutHistory $obj A CcPlayoutHistory object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcPlayoutHistoryPeer::$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 CcPlayoutHistory object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcPlayoutHistory) {
+ $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 CcPlayoutHistory object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(CcPlayoutHistoryPeer::$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 CcPlayoutHistory 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(CcPlayoutHistoryPeer::$instances[$key])) {
+ return CcPlayoutHistoryPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcPlayoutHistoryPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcPlayoutHistoryPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_playout_history
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ // Invalidate objects in CcPlayoutHistoryMetaDataPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcPlayoutHistoryMetaDataPeer::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 = CcPlayoutHistoryPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcPlayoutHistoryPeer::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;
+ CcPlayoutHistoryPeer::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 (CcPlayoutHistory object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcPlayoutHistoryPeer::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 + CcPlayoutHistoryPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = CcPlayoutHistoryPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::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 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(CcPlayoutHistoryPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::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 CcPlayoutHistory 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 CcPlayoutHistory 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(CcPlayoutHistoryPeer::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ $startcol = CcPlayoutHistoryPeer::NUM_HYDRATE_COLUMNS;
+ CcFilesPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryPeer::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 = CcPlayoutHistoryPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcFilesPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcFilesPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcFilesPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcPlayoutHistory) to $obj2 (CcFiles)
+ $obj2->addCcPlayoutHistory($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Selects a collection of CcPlayoutHistory 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 CcPlayoutHistory 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(CcPlayoutHistoryPeer::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ $startcol = CcPlayoutHistoryPeer::NUM_HYDRATE_COLUMNS;
+ CcShowInstancesPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryPeer::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 = CcPlayoutHistoryPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcShowInstancesPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcShowInstancesPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcShowInstancesPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcPlayoutHistory) to $obj2 (CcShowInstances)
+ $obj2->addCcPlayoutHistory($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(CcPlayoutHistoryPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::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 CcPlayoutHistory 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 CcPlayoutHistory 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(CcPlayoutHistoryPeer::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ $startcol2 = CcPlayoutHistoryPeer::NUM_HYDRATE_COLUMNS;
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcFilesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcShowInstancesPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + CcShowInstancesPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryPeer::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 = CcPlayoutHistoryPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryPeer::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();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcFilesPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CcPlayoutHistory) to the collection in $obj2 (CcFiles)
+ $obj2->addCcPlayoutHistory($obj1);
+ } // if joined row not null
+
+ // Add objects for joined CcShowInstances rows
+
+ $key3 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol3);
+ if ($key3 !== null) {
+ $obj3 = CcShowInstancesPeer::getInstanceFromPool($key3);
+ if (!$obj3) {
+
+ $cls = CcShowInstancesPeer::getOMClass();
+
+ $obj3 = new $cls();
+ $obj3->hydrate($row, $startcol3);
+ CcShowInstancesPeer::addInstanceToPool($obj3, $key3);
+ } // if obj3 loaded
+
+ // Add the $obj1 (CcPlayoutHistory) to the collection in $obj3 (CcShowInstances)
+ $obj3->addCcPlayoutHistory($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(CcPlayoutHistoryPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY should not affect count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::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 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(CcPlayoutHistoryPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY should not affect count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::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 CcPlayoutHistory 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 CcPlayoutHistory 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(CcPlayoutHistoryPeer::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ $startcol2 = CcPlayoutHistoryPeer::NUM_HYDRATE_COLUMNS;
+
+ CcShowInstancesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcShowInstancesPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
+
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryPeer::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 = CcPlayoutHistoryPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryPeer::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();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcShowInstancesPeer::addInstanceToPool($obj2, $key2);
+ } // if $obj2 already loaded
+
+ // Add the $obj1 (CcPlayoutHistory) to the collection in $obj2 (CcShowInstances)
+ $obj2->addCcPlayoutHistory($obj1);
+
+ } // if joined row is not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Selects a collection of CcPlayoutHistory 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 CcPlayoutHistory 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(CcPlayoutHistoryPeer::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryPeer::addSelectColumns($criteria);
+ $startcol2 = CcPlayoutHistoryPeer::NUM_HYDRATE_COLUMNS;
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcFilesPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcPlayoutHistoryPeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryPeer::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 = CcPlayoutHistoryPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryPeer::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();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcFilesPeer::addInstanceToPool($obj2, $key2);
+ } // if $obj2 already loaded
+
+ // Add the $obj1 (CcPlayoutHistory) to the collection in $obj2 (CcFiles)
+ $obj2->addCcPlayoutHistory($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(CcPlayoutHistoryPeer::DATABASE_NAME)->getTable(CcPlayoutHistoryPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcPlayoutHistoryPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcPlayoutHistoryPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \CcPlayoutHistoryTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcPlayoutHistoryPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a CcPlayoutHistory or Criteria object.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistory 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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcPlayoutHistory object
+ }
+
+ if ($criteria->containsKey(CcPlayoutHistoryPeer::ID) && $criteria->keyContainsValue(CcPlayoutHistoryPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a CcPlayoutHistory or Criteria object.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistory 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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(CcPlayoutHistoryPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcPlayoutHistoryPeer::ID);
+ $value = $criteria->remove(CcPlayoutHistoryPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcPlayoutHistoryPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcPlayoutHistoryPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcPlayoutHistory object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_playout_history table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::TABLE_NAME, $con, CcPlayoutHistoryPeer::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).
+ CcPlayoutHistoryPeer::clearInstancePool();
+ CcPlayoutHistoryPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a CcPlayoutHistory or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistory 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(CcPlayoutHistoryPeer::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.
+ CcPlayoutHistoryPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcPlayoutHistory) { // it's a model object
+ // invalidate the cache for this single object
+ CcPlayoutHistoryPeer::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(CcPlayoutHistoryPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcPlayoutHistoryPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryPeer::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);
+ CcPlayoutHistoryPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcPlayoutHistory 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 CcPlayoutHistory $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($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcPlayoutHistoryPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcPlayoutHistoryPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcPlayoutHistoryPeer::DATABASE_NAME, CcPlayoutHistoryPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcPlayoutHistory
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcPlayoutHistoryPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcPlayoutHistoryPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryPeer::ID, $pk);
+
+ $v = CcPlayoutHistoryPeer::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
+ * @return CcPlayoutHistory[]
+ * @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(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcPlayoutHistoryPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryPeer::ID, $pks, Criteria::IN);
+ $objs = CcPlayoutHistoryPeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
} // BaseCcPlayoutHistoryPeer
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryQuery.php
index b772a0d7a..f9fcc3ee6 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryQuery.php
@@ -4,506 +4,701 @@
/**
* Base class that represents a query for the 'cc_playout_history' table.
*
- *
*
- * @method CcPlayoutHistoryQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcPlayoutHistoryQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column
- * @method CcPlayoutHistoryQuery orderByDbStarts($order = Criteria::ASC) Order by the starts column
- * @method CcPlayoutHistoryQuery orderByDbEnds($order = Criteria::ASC) Order by the ends column
- * @method CcPlayoutHistoryQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column
*
- * @method CcPlayoutHistoryQuery groupByDbId() Group by the id column
- * @method CcPlayoutHistoryQuery groupByDbFileId() Group by the file_id column
- * @method CcPlayoutHistoryQuery groupByDbStarts() Group by the starts column
- * @method CcPlayoutHistoryQuery groupByDbEnds() Group by the ends column
- * @method CcPlayoutHistoryQuery groupByDbInstanceId() Group by the instance_id column
+ * @method CcPlayoutHistoryQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcPlayoutHistoryQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column
+ * @method CcPlayoutHistoryQuery orderByDbStarts($order = Criteria::ASC) Order by the starts column
+ * @method CcPlayoutHistoryQuery orderByDbEnds($order = Criteria::ASC) Order by the ends column
+ * @method CcPlayoutHistoryQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column
*
- * @method CcPlayoutHistoryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcPlayoutHistoryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcPlayoutHistoryQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcPlayoutHistoryQuery groupByDbId() Group by the id column
+ * @method CcPlayoutHistoryQuery groupByDbFileId() Group by the file_id column
+ * @method CcPlayoutHistoryQuery groupByDbStarts() Group by the starts column
+ * @method CcPlayoutHistoryQuery groupByDbEnds() Group by the ends column
+ * @method CcPlayoutHistoryQuery groupByDbInstanceId() Group by the instance_id column
*
- * @method CcPlayoutHistoryQuery leftJoinCcFiles($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFiles relation
- * @method CcPlayoutHistoryQuery rightJoinCcFiles($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFiles relation
- * @method CcPlayoutHistoryQuery innerJoinCcFiles($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFiles relation
+ * @method CcPlayoutHistoryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcPlayoutHistoryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcPlayoutHistoryQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcPlayoutHistoryQuery leftJoinCcShowInstances($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowInstances relation
- * @method CcPlayoutHistoryQuery rightJoinCcShowInstances($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowInstances relation
- * @method CcPlayoutHistoryQuery innerJoinCcShowInstances($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowInstances relation
+ * @method CcPlayoutHistoryQuery leftJoinCcFiles($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcFiles relation
+ * @method CcPlayoutHistoryQuery rightJoinCcFiles($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcFiles relation
+ * @method CcPlayoutHistoryQuery innerJoinCcFiles($relationAlias = null) Adds a INNER JOIN clause to the query using the CcFiles relation
*
- * @method CcPlayoutHistoryQuery leftJoinCcPlayoutHistoryMetaData($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistoryMetaData relation
- * @method CcPlayoutHistoryQuery rightJoinCcPlayoutHistoryMetaData($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistoryMetaData relation
- * @method CcPlayoutHistoryQuery innerJoinCcPlayoutHistoryMetaData($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistoryMetaData relation
+ * @method CcPlayoutHistoryQuery leftJoinCcShowInstances($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcShowInstances relation
+ * @method CcPlayoutHistoryQuery rightJoinCcShowInstances($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcShowInstances relation
+ * @method CcPlayoutHistoryQuery innerJoinCcShowInstances($relationAlias = null) Adds a INNER JOIN clause to the query using the CcShowInstances relation
*
- * @method CcPlayoutHistory findOne(PropelPDO $con = null) Return the first CcPlayoutHistory matching the query
- * @method CcPlayoutHistory findOneOrCreate(PropelPDO $con = null) Return the first CcPlayoutHistory matching the query, or a new CcPlayoutHistory object populated from the query conditions when no match is found
+ * @method CcPlayoutHistoryQuery leftJoinCcPlayoutHistoryMetaData($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPlayoutHistoryMetaData relation
+ * @method CcPlayoutHistoryQuery rightJoinCcPlayoutHistoryMetaData($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPlayoutHistoryMetaData relation
+ * @method CcPlayoutHistoryQuery innerJoinCcPlayoutHistoryMetaData($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPlayoutHistoryMetaData relation
*
- * @method CcPlayoutHistory findOneByDbId(int $id) Return the first CcPlayoutHistory filtered by the id column
- * @method CcPlayoutHistory findOneByDbFileId(int $file_id) Return the first CcPlayoutHistory filtered by the file_id column
- * @method CcPlayoutHistory findOneByDbStarts(string $starts) Return the first CcPlayoutHistory filtered by the starts column
- * @method CcPlayoutHistory findOneByDbEnds(string $ends) Return the first CcPlayoutHistory filtered by the ends column
- * @method CcPlayoutHistory findOneByDbInstanceId(int $instance_id) Return the first CcPlayoutHistory filtered by the instance_id column
+ * @method CcPlayoutHistory findOne(PropelPDO $con = null) Return the first CcPlayoutHistory matching the query
+ * @method CcPlayoutHistory findOneOrCreate(PropelPDO $con = null) Return the first CcPlayoutHistory matching the query, or a new CcPlayoutHistory object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcPlayoutHistory objects filtered by the id column
- * @method array findByDbFileId(int $file_id) Return CcPlayoutHistory objects filtered by the file_id column
- * @method array findByDbStarts(string $starts) Return CcPlayoutHistory objects filtered by the starts column
- * @method array findByDbEnds(string $ends) Return CcPlayoutHistory objects filtered by the ends column
- * @method array findByDbInstanceId(int $instance_id) Return CcPlayoutHistory objects filtered by the instance_id column
+ * @method CcPlayoutHistory findOneByDbFileId(int $file_id) Return the first CcPlayoutHistory filtered by the file_id column
+ * @method CcPlayoutHistory findOneByDbStarts(string $starts) Return the first CcPlayoutHistory filtered by the starts column
+ * @method CcPlayoutHistory findOneByDbEnds(string $ends) Return the first CcPlayoutHistory filtered by the ends column
+ * @method CcPlayoutHistory findOneByDbInstanceId(int $instance_id) Return the first CcPlayoutHistory filtered by the instance_id column
+ *
+ * @method array findByDbId(int $id) Return CcPlayoutHistory objects filtered by the id column
+ * @method array findByDbFileId(int $file_id) Return CcPlayoutHistory objects filtered by the file_id column
+ * @method array findByDbStarts(string $starts) Return CcPlayoutHistory objects filtered by the starts column
+ * @method array findByDbEnds(string $ends) Return CcPlayoutHistory objects filtered by the ends column
+ * @method array findByDbInstanceId(int $instance_id) Return CcPlayoutHistory objects filtered by the instance_id column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlayoutHistoryQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcPlayoutHistoryQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcPlayoutHistory';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcPlayoutHistoryQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcPlayoutHistory', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcPlayoutHistoryQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcPlayoutHistoryQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcPlayoutHistoryQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcPlayoutHistoryQuery) {
+ return $criteria;
+ }
+ $query = new CcPlayoutHistoryQuery(null, null, $modelAlias);
- /**
- * Returns a new CcPlayoutHistoryQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcPlayoutHistoryQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcPlayoutHistoryQuery) {
- return $criteria;
- }
- $query = new CcPlayoutHistoryQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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 CcPlayoutHistory|array|mixed the result, formatted by the current formatter
- */
- public function findPk($key, $con = null)
- {
- if ((null !== ($obj = CcPlayoutHistoryPeer::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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcPlayoutHistory|CcPlayoutHistory[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcPlayoutHistoryPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
- /**
- * Filter the query by primary key
- *
- * @param mixed $key Primary key to use for the query
- *
- * @return CcPlayoutHistoryQuery The current query, for fluid interface
- */
- public function filterByPrimaryKey($key)
- {
- return $this->addUsingAlias(CcPlayoutHistoryPeer::ID, $key, Criteria::EQUAL);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPlayoutHistory A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * Filter the query by a list of primary keys
- *
- * @param array $keys The list of primary key to use for the query
- *
- * @return CcPlayoutHistoryQuery The current query, for fluid interface
- */
- public function filterByPrimaryKeys($keys)
- {
- return $this->addUsingAlias(CcPlayoutHistoryPeer::ID, $keys, Criteria::IN);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPlayoutHistory A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "file_id", "starts", "ends", "instance_id" FROM "cc_playout_history" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcPlayoutHistory();
+ $obj->hydrate($row);
+ CcPlayoutHistoryPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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 CcPlayoutHistoryQuery 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(CcPlayoutHistoryPeer::ID, $dbId, $comparison);
- }
+ return $obj;
+ }
- /**
- * 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 CcPlayoutHistoryQuery 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(CcPlayoutHistoryPeer::FILE_ID, $dbFileId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbFileId['max'])) {
- $this->addUsingAlias(CcPlayoutHistoryPeer::FILE_ID, $dbFileId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcPlayoutHistoryPeer::FILE_ID, $dbFileId, $comparison);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPlayoutHistory|CcPlayoutHistory[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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 CcPlayoutHistoryQuery 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(CcPlayoutHistoryPeer::STARTS, $dbStarts['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbStarts['max'])) {
- $this->addUsingAlias(CcPlayoutHistoryPeer::STARTS, $dbStarts['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcPlayoutHistoryPeer::STARTS, $dbStarts, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * 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 CcPlayoutHistoryQuery 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(CcPlayoutHistoryPeer::ENDS, $dbEnds['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbEnds['max'])) {
- $this->addUsingAlias(CcPlayoutHistoryPeer::ENDS, $dbEnds['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcPlayoutHistoryPeer::ENDS, $dbEnds, $comparison);
- }
+ /**
+ * 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|CcPlayoutHistory[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * 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 CcPlayoutHistoryQuery 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(CcPlayoutHistoryPeer::INSTANCE_ID, $dbInstanceId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbInstanceId['max'])) {
- $this->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $dbInstanceId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $dbInstanceId, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * 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 CcPlayoutHistoryQuery The current query, for fluid interface
- */
- public function filterByCcFiles($ccFiles, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcPlayoutHistoryPeer::FILE_ID, $ccFiles->getDbId(), $comparison);
- }
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
- /**
- * 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 CcPlayoutHistoryQuery 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;
- }
+ return $this->addUsingAlias(CcPlayoutHistoryPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * 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 list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
- /**
- * 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 CcPlayoutHistoryQuery The current query, for fluid interface
- */
- public function filterByCcShowInstances($ccShowInstances, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $ccShowInstances->getDbId(), $comparison);
- }
+ return $this->addUsingAlias(CcPlayoutHistoryPeer::ID, $keys, Criteria::IN);
+ }
- /**
- * 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 CcPlayoutHistoryQuery 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;
- }
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcPlayoutHistoryPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * 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');
- }
+ return $this->addUsingAlias(CcPlayoutHistoryPeer::ID, $dbId, $comparison);
+ }
- /**
- * Filter the query by a related CcPlayoutHistoryMetaData object
- *
- * @param CcPlayoutHistoryMetaData $ccPlayoutHistoryMetaData the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return CcPlayoutHistoryQuery The current query, for fluid interface
- */
- public function filterByCcPlayoutHistoryMetaData($ccPlayoutHistoryMetaData, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcPlayoutHistoryPeer::ID, $ccPlayoutHistoryMetaData->getDbHistoryId(), $comparison);
- }
+ /**
+ * Filter the query on the file_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbFileId(1234); // WHERE file_id = 1234
+ * $query->filterByDbFileId(array(12, 34)); // WHERE file_id IN (12, 34)
+ * $query->filterByDbFileId(array('min' => 12)); // WHERE file_id >= 12
+ * $query->filterByDbFileId(array('max' => 12)); // WHERE file_id <= 12
+ *
+ *
+ * @see filterByCcFiles()
+ *
+ * @param mixed $dbFileId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryQuery 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(CcPlayoutHistoryPeer::FILE_ID, $dbFileId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbFileId['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryPeer::FILE_ID, $dbFileId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * Adds a JOIN clause to the query using the CcPlayoutHistoryMetaData relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return CcPlayoutHistoryQuery The current query, for fluid interface
- */
- public function joinCcPlayoutHistoryMetaData($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcPlayoutHistoryMetaData');
-
- // 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, 'CcPlayoutHistoryMetaData');
- }
-
- return $this;
- }
+ return $this->addUsingAlias(CcPlayoutHistoryPeer::FILE_ID, $dbFileId, $comparison);
+ }
- /**
- * Use the CcPlayoutHistoryMetaData relation CcPlayoutHistoryMetaData 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 CcPlayoutHistoryMetaDataQuery A secondary query class using the current class as primary query
- */
- public function useCcPlayoutHistoryMetaDataQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinCcPlayoutHistoryMetaData($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryMetaData', 'CcPlayoutHistoryMetaDataQuery');
- }
+ /**
+ * Filter the query on the starts column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbStarts('2011-03-14'); // WHERE starts = '2011-03-14'
+ * $query->filterByDbStarts('now'); // WHERE starts = '2011-03-14'
+ * $query->filterByDbStarts(array('max' => 'yesterday')); // WHERE starts < '2011-03-13'
+ *
+ *
+ * @param mixed $dbStarts The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryQuery 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(CcPlayoutHistoryPeer::STARTS, $dbStarts['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbStarts['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryPeer::STARTS, $dbStarts['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * Exclude object from result
- *
- * @param CcPlayoutHistory $ccPlayoutHistory Object to remove from the list of results
- *
- * @return CcPlayoutHistoryQuery The current query, for fluid interface
- */
- public function prune($ccPlayoutHistory = null)
- {
- if ($ccPlayoutHistory) {
- $this->addUsingAlias(CcPlayoutHistoryPeer::ID, $ccPlayoutHistory->getDbId(), Criteria::NOT_EQUAL);
- }
-
- return $this;
- }
+ return $this->addUsingAlias(CcPlayoutHistoryPeer::STARTS, $dbStarts, $comparison);
+ }
-} // BaseCcPlayoutHistoryQuery
+ /**
+ * Filter the query on the ends column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbEnds('2011-03-14'); // WHERE ends = '2011-03-14'
+ * $query->filterByDbEnds('now'); // WHERE ends = '2011-03-14'
+ * $query->filterByDbEnds(array('max' => 'yesterday')); // WHERE ends < '2011-03-13'
+ *
+ *
+ * @param mixed $dbEnds The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryQuery 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(CcPlayoutHistoryPeer::ENDS, $dbEnds['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbEnds['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryPeer::ENDS, $dbEnds['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcPlayoutHistoryPeer::ENDS, $dbEnds, $comparison);
+ }
+
+ /**
+ * Filter the query on the instance_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbInstanceId(1234); // WHERE instance_id = 1234
+ * $query->filterByDbInstanceId(array(12, 34)); // WHERE instance_id IN (12, 34)
+ * $query->filterByDbInstanceId(array('min' => 12)); // WHERE instance_id >= 12
+ * $query->filterByDbInstanceId(array('max' => 12)); // WHERE instance_id <= 12
+ *
+ *
+ * @see filterByCcShowInstances()
+ *
+ * @param mixed $dbInstanceId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryQuery 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(CcPlayoutHistoryPeer::INSTANCE_ID, $dbInstanceId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbInstanceId['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $dbInstanceId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $dbInstanceId, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcFiles object
+ *
+ * @param CcFiles|PropelObjectCollection $ccFiles The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcFiles($ccFiles, $comparison = null)
+ {
+ if ($ccFiles instanceof CcFiles) {
+ return $this
+ ->addUsingAlias(CcPlayoutHistoryPeer::FILE_ID, $ccFiles->getDbId(), $comparison);
+ } elseif ($ccFiles instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcPlayoutHistoryPeer::FILE_ID, $ccFiles->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcFiles() only accepts arguments of type CcFiles or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function joinCcFiles($relationAlias = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcFiles($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery');
+ }
+
+ /**
+ * Filter the query by a related CcShowInstances object
+ *
+ * @param CcShowInstances|PropelObjectCollection $ccShowInstances The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcShowInstances($ccShowInstances, $comparison = null)
+ {
+ if ($ccShowInstances instanceof CcShowInstances) {
+ return $this
+ ->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $ccShowInstances->getDbId(), $comparison);
+ } elseif ($ccShowInstances instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcPlayoutHistoryPeer::INSTANCE_ID, $ccShowInstances->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcShowInstances() only accepts arguments of type CcShowInstances or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function joinCcShowInstances($relationAlias = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcShowInstances($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcShowInstances', 'CcShowInstancesQuery');
+ }
+
+ /**
+ * Filter the query by a related CcPlayoutHistoryMetaData object
+ *
+ * @param CcPlayoutHistoryMetaData|PropelObjectCollection $ccPlayoutHistoryMetaData the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcPlayoutHistoryMetaData($ccPlayoutHistoryMetaData, $comparison = null)
+ {
+ if ($ccPlayoutHistoryMetaData instanceof CcPlayoutHistoryMetaData) {
+ return $this
+ ->addUsingAlias(CcPlayoutHistoryPeer::ID, $ccPlayoutHistoryMetaData->getDbHistoryId(), $comparison);
+ } elseif ($ccPlayoutHistoryMetaData instanceof PropelObjectCollection) {
+ return $this
+ ->useCcPlayoutHistoryMetaDataQuery()
+ ->filterByPrimaryKeys($ccPlayoutHistoryMetaData->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcPlayoutHistoryMetaData() only accepts arguments of type CcPlayoutHistoryMetaData or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcPlayoutHistoryMetaData relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function joinCcPlayoutHistoryMetaData($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcPlayoutHistoryMetaData');
+
+ // 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, 'CcPlayoutHistoryMetaData');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcPlayoutHistoryMetaData relation CcPlayoutHistoryMetaData 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 CcPlayoutHistoryMetaDataQuery A secondary query class using the current class as primary query
+ */
+ public function useCcPlayoutHistoryMetaDataQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcPlayoutHistoryMetaData($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryMetaData', 'CcPlayoutHistoryMetaDataQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcPlayoutHistory $ccPlayoutHistory Object to remove from the list of results
+ *
+ * @return CcPlayoutHistoryQuery The current query, for fluid interface
+ */
+ public function prune($ccPlayoutHistory = null)
+ {
+ if ($ccPlayoutHistory) {
+ $this->addUsingAlias(CcPlayoutHistoryPeer::ID, $ccPlayoutHistory->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplate.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplate.php
index 222227af6..6a2b9230f 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplate.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplate.php
@@ -4,913 +4,1194 @@
/**
* Base class that represents a row from the 'cc_playout_history_template' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcPlayoutHistoryTemplate extends BaseObject implements Persistent
+abstract class BaseCcPlayoutHistoryTemplate extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcPlayoutHistoryTemplatePeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcPlayoutHistoryTemplatePeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the name field.
- * @var string
- */
- protected $name;
-
- /**
- * The value for the type field.
- * @var string
- */
- protected $type;
-
- /**
- * @var array CcPlayoutHistoryTemplateField[] Collection to store aggregation of CcPlayoutHistoryTemplateField objects.
- */
- protected $collCcPlayoutHistoryTemplateFields;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * 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 [type] column value.
- *
- * @return string
- */
- public function getDbType()
- {
- return $this->type;
- }
-
- /**
- * Set the value of [id] column.
- *
- * @param int $v new value
- * @return CcPlayoutHistoryTemplate 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[] = CcPlayoutHistoryTemplatePeer::ID;
- }
-
- return $this;
- } // setDbId()
-
- /**
- * Set the value of [name] column.
- *
- * @param string $v new value
- * @return CcPlayoutHistoryTemplate 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[] = CcPlayoutHistoryTemplatePeer::NAME;
- }
-
- return $this;
- } // setDbName()
-
- /**
- * Set the value of [type] column.
- *
- * @param string $v new value
- * @return CcPlayoutHistoryTemplate 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[] = CcPlayoutHistoryTemplatePeer::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->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
- $this->name = ($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 = CcPlayoutHistoryTemplatePeer::NUM_COLUMNS - CcPlayoutHistoryTemplatePeer::NUM_LAZY_LOAD_COLUMNS).
-
- } catch (Exception $e) {
- throw new PropelException("Error populating CcPlayoutHistoryTemplate 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(CcPlayoutHistoryTemplatePeer::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 = CcPlayoutHistoryTemplatePeer::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->collCcPlayoutHistoryTemplateFields = 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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $con->beginTransaction();
- try {
- $ret = $this->preDelete($con);
- if ($ret) {
- CcPlayoutHistoryTemplateQuery::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(CcPlayoutHistoryTemplatePeer::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);
- CcPlayoutHistoryTemplatePeer::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[] = CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryTemplatePeer::ID.')');
- }
-
- $pk = BasePeer::doInsert($criteria, $con);
- $affectedRows = 1;
- $this->setDbId($pk); //[IMV] update autoincrement primary key
- $this->setNew(false);
- } else {
- $affectedRows = CcPlayoutHistoryTemplatePeer::doUpdate($this, $con);
- }
-
- $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
- }
-
- if ($this->collCcPlayoutHistoryTemplateFields !== null) {
- foreach ($this->collCcPlayoutHistoryTemplateFields 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 = CcPlayoutHistoryTemplatePeer::doValidate($this, $columns)) !== true) {
- $failureMap = array_merge($failureMap, $retval);
- }
-
-
- if ($this->collCcPlayoutHistoryTemplateFields !== null) {
- foreach ($this->collCcPlayoutHistoryTemplateFields 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 = CcPlayoutHistoryTemplatePeer::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->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 = CcPlayoutHistoryTemplatePeer::getFieldNames($keyType);
- $result = array(
- $keys[0] => $this->getDbId(),
- $keys[1] => $this->getDbName(),
- $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 = CcPlayoutHistoryTemplatePeer::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->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 = CcPlayoutHistoryTemplatePeer::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->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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
-
- if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::ID)) $criteria->add(CcPlayoutHistoryTemplatePeer::ID, $this->id);
- if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::NAME)) $criteria->add(CcPlayoutHistoryTemplatePeer::NAME, $this->name);
- if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::TYPE)) $criteria->add(CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
- $criteria->add(CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplate (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->setDbType($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->getCcPlayoutHistoryTemplateFields() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addCcPlayoutHistoryTemplateField($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 CcPlayoutHistoryTemplate 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 CcPlayoutHistoryTemplatePeer
- */
- public function getPeer()
- {
- if (self::$peer === null) {
- self::$peer = new CcPlayoutHistoryTemplatePeer();
- }
- return self::$peer;
- }
-
- /**
- * Clears out the collCcPlayoutHistoryTemplateFields 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 addCcPlayoutHistoryTemplateFields()
- */
- public function clearCcPlayoutHistoryTemplateFields()
- {
- $this->collCcPlayoutHistoryTemplateFields = null; // important to set this to NULL since that means it is uninitialized
- }
-
- /**
- * Initializes the collCcPlayoutHistoryTemplateFields collection.
- *
- * By default this just sets the collCcPlayoutHistoryTemplateFields collection to an empty array (like clearcollCcPlayoutHistoryTemplateFields());
- * 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 initCcPlayoutHistoryTemplateFields()
- {
- $this->collCcPlayoutHistoryTemplateFields = new PropelObjectCollection();
- $this->collCcPlayoutHistoryTemplateFields->setModel('CcPlayoutHistoryTemplateField');
- }
-
- /**
- * Gets an array of CcPlayoutHistoryTemplateField 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 CcPlayoutHistoryTemplate 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 CcPlayoutHistoryTemplateField[] List of CcPlayoutHistoryTemplateField objects
- * @throws PropelException
- */
- public function getCcPlayoutHistoryTemplateFields($criteria = null, PropelPDO $con = null)
- {
- if(null === $this->collCcPlayoutHistoryTemplateFields || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcPlayoutHistoryTemplateFields) {
- // return empty collection
- $this->initCcPlayoutHistoryTemplateFields();
- } else {
- $collCcPlayoutHistoryTemplateFields = CcPlayoutHistoryTemplateFieldQuery::create(null, $criteria)
- ->filterByCcPlayoutHistoryTemplate($this)
- ->find($con);
- if (null !== $criteria) {
- return $collCcPlayoutHistoryTemplateFields;
- }
- $this->collCcPlayoutHistoryTemplateFields = $collCcPlayoutHistoryTemplateFields;
- }
- }
- return $this->collCcPlayoutHistoryTemplateFields;
- }
-
- /**
- * Returns the number of related CcPlayoutHistoryTemplateField objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related CcPlayoutHistoryTemplateField objects.
- * @throws PropelException
- */
- public function countCcPlayoutHistoryTemplateFields(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- if(null === $this->collCcPlayoutHistoryTemplateFields || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcPlayoutHistoryTemplateFields) {
- return 0;
- } else {
- $query = CcPlayoutHistoryTemplateFieldQuery::create(null, $criteria);
- if($distinct) {
- $query->distinct();
- }
- return $query
- ->filterByCcPlayoutHistoryTemplate($this)
- ->count($con);
- }
- } else {
- return count($this->collCcPlayoutHistoryTemplateFields);
- }
- }
-
- /**
- * Method called to associate a CcPlayoutHistoryTemplateField object to this object
- * through the CcPlayoutHistoryTemplateField foreign key attribute.
- *
- * @param CcPlayoutHistoryTemplateField $l CcPlayoutHistoryTemplateField
- * @return void
- * @throws PropelException
- */
- public function addCcPlayoutHistoryTemplateField(CcPlayoutHistoryTemplateField $l)
- {
- if ($this->collCcPlayoutHistoryTemplateFields === null) {
- $this->initCcPlayoutHistoryTemplateFields();
- }
- if (!$this->collCcPlayoutHistoryTemplateFields->contains($l)) { // only add it if the **same** object is not already associated
- $this->collCcPlayoutHistoryTemplateFields[]= $l;
- $l->setCcPlayoutHistoryTemplate($this);
- }
- }
-
- /**
- * Clears the current object and sets all attributes to their default values
- */
- public function clear()
- {
- $this->id = null;
- $this->name = 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->collCcPlayoutHistoryTemplateFields) {
- foreach ((array) $this->collCcPlayoutHistoryTemplateFields as $o) {
- $o->clearAllReferences($deep);
- }
- }
- } // if ($deep)
-
- $this->collCcPlayoutHistoryTemplateFields = 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);
- }
-
-} // BaseCcPlayoutHistoryTemplate
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcPlayoutHistoryTemplatePeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcPlayoutHistoryTemplatePeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the name field.
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * The value for the type field.
+ * @var string
+ */
+ protected $type;
+
+ /**
+ * @var PropelObjectCollection|CcPlayoutHistoryTemplateField[] Collection to store aggregation of CcPlayoutHistoryTemplateField objects.
+ */
+ protected $collCcPlayoutHistoryTemplateFields;
+ protected $collCcPlayoutHistoryTemplateFieldsPartial;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccPlayoutHistoryTemplateFieldsScheduledForDeletion = null;
+
+ /**
+ * 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 [type] column value.
+ *
+ * @return string
+ */
+ public function getDbType()
+ {
+
+ return $this->type;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistoryTemplate The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplatePeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [name] column.
+ *
+ * @param string $v new value
+ * @return CcPlayoutHistoryTemplate The current object (for fluent API support)
+ */
+ public function setDbName($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->name !== $v) {
+ $this->name = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplatePeer::NAME;
+ }
+
+
+ return $this;
+ } // setDbName()
+
+ /**
+ * Set the value of [type] column.
+ *
+ * @param string $v new value
+ * @return CcPlayoutHistoryTemplate The current object (for fluent API support)
+ */
+ public function setDbType($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->type !== $v) {
+ $this->type = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplatePeer::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 resultset 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->type = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 3; // 3 = CcPlayoutHistoryTemplatePeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcPlayoutHistoryTemplate 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(CcPlayoutHistoryTemplatePeer::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 = CcPlayoutHistoryTemplatePeer::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->collCcPlayoutHistoryTemplateFields = null;
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = CcPlayoutHistoryTemplateQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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(CcPlayoutHistoryTemplatePeer::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);
+ CcPlayoutHistoryTemplatePeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ if ($this->ccPlayoutHistoryTemplateFieldsScheduledForDeletion !== null) {
+ if (!$this->ccPlayoutHistoryTemplateFieldsScheduledForDeletion->isEmpty()) {
+ CcPlayoutHistoryTemplateFieldQuery::create()
+ ->filterByPrimaryKeys($this->ccPlayoutHistoryTemplateFieldsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccPlayoutHistoryTemplateFieldsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcPlayoutHistoryTemplateFields !== null) {
+ foreach ($this->collCcPlayoutHistoryTemplateFields as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplatePeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcPlayoutHistoryTemplatePeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_playout_history_template_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::NAME)) {
+ $modifiedColumns[':p' . $index++] = '"name"';
+ }
+ if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::TYPE)) {
+ $modifiedColumns[':p' . $index++] = '"type"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_playout_history_template" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"name"':
+ $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
+ break;
+ case '"type"':
+ $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ if (($retval = CcPlayoutHistoryTemplatePeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+ if ($this->collCcPlayoutHistoryTemplateFields !== null) {
+ foreach ($this->collCcPlayoutHistoryTemplateFields 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlayoutHistoryTemplatePeer::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->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.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcPlayoutHistoryTemplate'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcPlayoutHistoryTemplate'][$this->getPrimaryKey()] = true;
+ $keys = CcPlayoutHistoryTemplatePeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbName(),
+ $keys[2] => $this->getDbType(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->collCcPlayoutHistoryTemplateFields) {
+ $result['CcPlayoutHistoryTemplateFields'] = $this->collCcPlayoutHistoryTemplateFields->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ }
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlayoutHistoryTemplatePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->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 BasePeer::TYPE_PHPNAME
+ *
+ * @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 = CcPlayoutHistoryTemplatePeer::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->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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::ID)) $criteria->add(CcPlayoutHistoryTemplatePeer::ID, $this->id);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::NAME)) $criteria->add(CcPlayoutHistoryTemplatePeer::NAME, $this->name);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplatePeer::TYPE)) $criteria->add(CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplate (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbName($this->getDbName());
+ $copyObj->setDbType($this->getDbType());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ foreach ($this->getCcPlayoutHistoryTemplateFields() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcPlayoutHistoryTemplateField($relObj->copy($deepCopy));
+ }
+ }
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 CcPlayoutHistoryTemplate 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 CcPlayoutHistoryTemplatePeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcPlayoutHistoryTemplatePeer();
+ }
+
+ return self::$peer;
+ }
+
+
+ /**
+ * Initializes a collection based on the name of a relation.
+ * Avoids crafting an 'init[$relationName]s' method name
+ * that wouldn't work when StandardEnglishPluralizer is used.
+ *
+ * @param string $relationName The name of the relation to initialize
+ * @return void
+ */
+ public function initRelation($relationName)
+ {
+ if ('CcPlayoutHistoryTemplateField' == $relationName) {
+ $this->initCcPlayoutHistoryTemplateFields();
+ }
+ }
+
+ /**
+ * Clears out the collCcPlayoutHistoryTemplateFields 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 CcPlayoutHistoryTemplate The current object (for fluent API support)
+ * @see addCcPlayoutHistoryTemplateFields()
+ */
+ public function clearCcPlayoutHistoryTemplateFields()
+ {
+ $this->collCcPlayoutHistoryTemplateFields = null; // important to set this to null since that means it is uninitialized
+ $this->collCcPlayoutHistoryTemplateFieldsPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcPlayoutHistoryTemplateFields collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcPlayoutHistoryTemplateFields($v = true)
+ {
+ $this->collCcPlayoutHistoryTemplateFieldsPartial = $v;
+ }
+
+ /**
+ * Initializes the collCcPlayoutHistoryTemplateFields collection.
+ *
+ * By default this just sets the collCcPlayoutHistoryTemplateFields collection to an empty array (like clearcollCcPlayoutHistoryTemplateFields());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcPlayoutHistoryTemplateFields($overrideExisting = true)
+ {
+ if (null !== $this->collCcPlayoutHistoryTemplateFields && !$overrideExisting) {
+ return;
+ }
+ $this->collCcPlayoutHistoryTemplateFields = new PropelObjectCollection();
+ $this->collCcPlayoutHistoryTemplateFields->setModel('CcPlayoutHistoryTemplateField');
+ }
+
+ /**
+ * Gets an array of CcPlayoutHistoryTemplateField 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 CcPlayoutHistoryTemplate 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 PropelObjectCollection|CcPlayoutHistoryTemplateField[] List of CcPlayoutHistoryTemplateField objects
+ * @throws PropelException
+ */
+ public function getCcPlayoutHistoryTemplateFields($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcPlayoutHistoryTemplateFieldsPartial && !$this->isNew();
+ if (null === $this->collCcPlayoutHistoryTemplateFields || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistoryTemplateFields) {
+ // return empty collection
+ $this->initCcPlayoutHistoryTemplateFields();
+ } else {
+ $collCcPlayoutHistoryTemplateFields = CcPlayoutHistoryTemplateFieldQuery::create(null, $criteria)
+ ->filterByCcPlayoutHistoryTemplate($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcPlayoutHistoryTemplateFieldsPartial && count($collCcPlayoutHistoryTemplateFields)) {
+ $this->initCcPlayoutHistoryTemplateFields(false);
+
+ foreach ($collCcPlayoutHistoryTemplateFields as $obj) {
+ if (false == $this->collCcPlayoutHistoryTemplateFields->contains($obj)) {
+ $this->collCcPlayoutHistoryTemplateFields->append($obj);
+ }
+ }
+
+ $this->collCcPlayoutHistoryTemplateFieldsPartial = true;
+ }
+
+ $collCcPlayoutHistoryTemplateFields->getInternalIterator()->rewind();
+
+ return $collCcPlayoutHistoryTemplateFields;
+ }
+
+ if ($partial && $this->collCcPlayoutHistoryTemplateFields) {
+ foreach ($this->collCcPlayoutHistoryTemplateFields as $obj) {
+ if ($obj->isNew()) {
+ $collCcPlayoutHistoryTemplateFields[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcPlayoutHistoryTemplateFields = $collCcPlayoutHistoryTemplateFields;
+ $this->collCcPlayoutHistoryTemplateFieldsPartial = false;
+ }
+ }
+
+ return $this->collCcPlayoutHistoryTemplateFields;
+ }
+
+ /**
+ * Sets a collection of CcPlayoutHistoryTemplateField objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccPlayoutHistoryTemplateFields A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcPlayoutHistoryTemplate The current object (for fluent API support)
+ */
+ public function setCcPlayoutHistoryTemplateFields(PropelCollection $ccPlayoutHistoryTemplateFields, PropelPDO $con = null)
+ {
+ $ccPlayoutHistoryTemplateFieldsToDelete = $this->getCcPlayoutHistoryTemplateFields(new Criteria(), $con)->diff($ccPlayoutHistoryTemplateFields);
+
+
+ $this->ccPlayoutHistoryTemplateFieldsScheduledForDeletion = $ccPlayoutHistoryTemplateFieldsToDelete;
+
+ foreach ($ccPlayoutHistoryTemplateFieldsToDelete as $ccPlayoutHistoryTemplateFieldRemoved) {
+ $ccPlayoutHistoryTemplateFieldRemoved->setCcPlayoutHistoryTemplate(null);
+ }
+
+ $this->collCcPlayoutHistoryTemplateFields = null;
+ foreach ($ccPlayoutHistoryTemplateFields as $ccPlayoutHistoryTemplateField) {
+ $this->addCcPlayoutHistoryTemplateField($ccPlayoutHistoryTemplateField);
+ }
+
+ $this->collCcPlayoutHistoryTemplateFields = $ccPlayoutHistoryTemplateFields;
+ $this->collCcPlayoutHistoryTemplateFieldsPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related CcPlayoutHistoryTemplateField objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcPlayoutHistoryTemplateField objects.
+ * @throws PropelException
+ */
+ public function countCcPlayoutHistoryTemplateFields(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collCcPlayoutHistoryTemplateFieldsPartial && !$this->isNew();
+ if (null === $this->collCcPlayoutHistoryTemplateFields || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistoryTemplateFields) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcPlayoutHistoryTemplateFields());
+ }
+ $query = CcPlayoutHistoryTemplateFieldQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcPlayoutHistoryTemplate($this)
+ ->count($con);
+ }
+
+ return count($this->collCcPlayoutHistoryTemplateFields);
+ }
+
+ /**
+ * Method called to associate a CcPlayoutHistoryTemplateField object to this object
+ * through the CcPlayoutHistoryTemplateField foreign key attribute.
+ *
+ * @param CcPlayoutHistoryTemplateField $l CcPlayoutHistoryTemplateField
+ * @return CcPlayoutHistoryTemplate The current object (for fluent API support)
+ */
+ public function addCcPlayoutHistoryTemplateField(CcPlayoutHistoryTemplateField $l)
+ {
+ if ($this->collCcPlayoutHistoryTemplateFields === null) {
+ $this->initCcPlayoutHistoryTemplateFields();
+ $this->collCcPlayoutHistoryTemplateFieldsPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcPlayoutHistoryTemplateFields->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcPlayoutHistoryTemplateField($l);
+
+ if ($this->ccPlayoutHistoryTemplateFieldsScheduledForDeletion and $this->ccPlayoutHistoryTemplateFieldsScheduledForDeletion->contains($l)) {
+ $this->ccPlayoutHistoryTemplateFieldsScheduledForDeletion->remove($this->ccPlayoutHistoryTemplateFieldsScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcPlayoutHistoryTemplateField $ccPlayoutHistoryTemplateField The ccPlayoutHistoryTemplateField object to add.
+ */
+ protected function doAddCcPlayoutHistoryTemplateField($ccPlayoutHistoryTemplateField)
+ {
+ $this->collCcPlayoutHistoryTemplateFields[]= $ccPlayoutHistoryTemplateField;
+ $ccPlayoutHistoryTemplateField->setCcPlayoutHistoryTemplate($this);
+ }
+
+ /**
+ * @param CcPlayoutHistoryTemplateField $ccPlayoutHistoryTemplateField The ccPlayoutHistoryTemplateField object to remove.
+ * @return CcPlayoutHistoryTemplate The current object (for fluent API support)
+ */
+ public function removeCcPlayoutHistoryTemplateField($ccPlayoutHistoryTemplateField)
+ {
+ if ($this->getCcPlayoutHistoryTemplateFields()->contains($ccPlayoutHistoryTemplateField)) {
+ $this->collCcPlayoutHistoryTemplateFields->remove($this->collCcPlayoutHistoryTemplateFields->search($ccPlayoutHistoryTemplateField));
+ if (null === $this->ccPlayoutHistoryTemplateFieldsScheduledForDeletion) {
+ $this->ccPlayoutHistoryTemplateFieldsScheduledForDeletion = clone $this->collCcPlayoutHistoryTemplateFields;
+ $this->ccPlayoutHistoryTemplateFieldsScheduledForDeletion->clear();
+ }
+ $this->ccPlayoutHistoryTemplateFieldsScheduledForDeletion[]= clone $ccPlayoutHistoryTemplateField;
+ $ccPlayoutHistoryTemplateField->setCcPlayoutHistoryTemplate(null);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->name = null;
+ $this->type = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->collCcPlayoutHistoryTemplateFields) {
+ foreach ($this->collCcPlayoutHistoryTemplateFields as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ if ($this->collCcPlayoutHistoryTemplateFields instanceof PropelCollection) {
+ $this->collCcPlayoutHistoryTemplateFields->clearIterator();
+ }
+ $this->collCcPlayoutHistoryTemplateFields = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcPlayoutHistoryTemplatePeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateField.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateField.php
index 3476aa459..7148c270d 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateField.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateField.php
@@ -4,1073 +4,1251 @@
/**
* Base class that represents a row from the 'cc_playout_history_template_field' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcPlayoutHistoryTemplateField extends BaseObject implements Persistent
+abstract class BaseCcPlayoutHistoryTemplateField extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcPlayoutHistoryTemplateFieldPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcPlayoutHistoryTemplateFieldPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the template_id field.
- * @var int
- */
- protected $template_id;
-
- /**
- * The value for the name field.
- * @var string
- */
- protected $name;
-
- /**
- * The value for the label field.
- * @var string
- */
- protected $label;
-
- /**
- * The value for the type field.
- * @var string
- */
- protected $type;
-
- /**
- * The value for the is_file_md field.
- * Note: this column has a database default value of: false
- * @var boolean
- */
- protected $is_file_md;
-
- /**
- * The value for the position field.
- * @var int
- */
- protected $position;
-
- /**
- * @var CcPlayoutHistoryTemplate
- */
- protected $aCcPlayoutHistoryTemplate;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Applies default values to this object.
- * This method should be called from the object's constructor (or
- * equivalent initialization method).
- * @see __construct()
- */
- public function applyDefaultValues()
- {
- $this->is_file_md = false;
- }
-
- /**
- * Initializes internal state of BaseCcPlayoutHistoryTemplateField 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 [template_id] column value.
- *
- * @return int
- */
- public function getDbTemplateId()
- {
- return $this->template_id;
- }
-
- /**
- * Get the [name] column value.
- *
- * @return string
- */
- public function getDbName()
- {
- return $this->name;
- }
-
- /**
- * Get the [label] column value.
- *
- * @return string
- */
- public function getDbLabel()
- {
- return $this->label;
- }
-
- /**
- * Get the [type] column value.
- *
- * @return string
- */
- public function getDbType()
- {
- return $this->type;
- }
-
- /**
- * Get the [is_file_md] column value.
- *
- * @return boolean
- */
- public function getDbIsFileMD()
- {
- return $this->is_file_md;
- }
-
- /**
- * Get the [position] column value.
- *
- * @return int
- */
- public function getDbPosition()
- {
- return $this->position;
- }
-
- /**
- * Set the value of [id] column.
- *
- * @param int $v new value
- * @return CcPlayoutHistoryTemplateField 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[] = CcPlayoutHistoryTemplateFieldPeer::ID;
- }
-
- return $this;
- } // setDbId()
-
- /**
- * Set the value of [template_id] column.
- *
- * @param int $v new value
- * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
- */
- public function setDbTemplateId($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->template_id !== $v) {
- $this->template_id = $v;
- $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID;
- }
-
- if ($this->aCcPlayoutHistoryTemplate !== null && $this->aCcPlayoutHistoryTemplate->getDbId() !== $v) {
- $this->aCcPlayoutHistoryTemplate = null;
- }
-
- return $this;
- } // setDbTemplateId()
-
- /**
- * Set the value of [name] column.
- *
- * @param string $v new value
- * @return CcPlayoutHistoryTemplateField 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[] = CcPlayoutHistoryTemplateFieldPeer::NAME;
- }
-
- return $this;
- } // setDbName()
-
- /**
- * Set the value of [label] column.
- *
- * @param string $v new value
- * @return CcPlayoutHistoryTemplateField 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[] = CcPlayoutHistoryTemplateFieldPeer::LABEL;
- }
-
- return $this;
- } // setDbLabel()
-
- /**
- * Set the value of [type] column.
- *
- * @param string $v new value
- * @return CcPlayoutHistoryTemplateField 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[] = CcPlayoutHistoryTemplateFieldPeer::TYPE;
- }
-
- return $this;
- } // setDbType()
-
- /**
- * Set the value of [is_file_md] column.
- *
- * @param boolean $v new value
- * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
- */
- public function setDbIsFileMD($v)
- {
- if ($v !== null) {
- $v = (boolean) $v;
- }
-
- if ($this->is_file_md !== $v || $this->isNew()) {
- $this->is_file_md = $v;
- $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD;
- }
-
- return $this;
- } // setDbIsFileMD()
-
- /**
- * Set the value of [position] column.
- *
- * @param int $v new value
- * @return CcPlayoutHistoryTemplateField 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[] = CcPlayoutHistoryTemplateFieldPeer::POSITION;
- }
-
- return $this;
- } // setDbPosition()
-
- /**
- * 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->is_file_md !== 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->template_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
- $this->name = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
- $this->label = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
- $this->type = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
- $this->is_file_md = ($row[$startcol + 5] !== null) ? (boolean) $row[$startcol + 5] : null;
- $this->position = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 7; // 7 = CcPlayoutHistoryTemplateFieldPeer::NUM_COLUMNS - CcPlayoutHistoryTemplateFieldPeer::NUM_LAZY_LOAD_COLUMNS).
-
- } catch (Exception $e) {
- throw new PropelException("Error populating CcPlayoutHistoryTemplateField 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->aCcPlayoutHistoryTemplate !== null && $this->template_id !== $this->aCcPlayoutHistoryTemplate->getDbId()) {
- $this->aCcPlayoutHistoryTemplate = 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(CcPlayoutHistoryTemplateFieldPeer::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 = CcPlayoutHistoryTemplateFieldPeer::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->aCcPlayoutHistoryTemplate = 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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $con->beginTransaction();
- try {
- $ret = $this->preDelete($con);
- if ($ret) {
- CcPlayoutHistoryTemplateFieldQuery::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(CcPlayoutHistoryTemplateFieldPeer::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);
- CcPlayoutHistoryTemplateFieldPeer::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->aCcPlayoutHistoryTemplate !== null) {
- if ($this->aCcPlayoutHistoryTemplate->isModified() || $this->aCcPlayoutHistoryTemplate->isNew()) {
- $affectedRows += $this->aCcPlayoutHistoryTemplate->save($con);
- }
- $this->setCcPlayoutHistoryTemplate($this->aCcPlayoutHistoryTemplate);
- }
-
- if ($this->isNew() ) {
- $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryTemplateFieldPeer::ID.')');
- }
-
- $pk = BasePeer::doInsert($criteria, $con);
- $affectedRows += 1;
- $this->setDbId($pk); //[IMV] update autoincrement primary key
- $this->setNew(false);
- } else {
- $affectedRows += CcPlayoutHistoryTemplateFieldPeer::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->aCcPlayoutHistoryTemplate !== null) {
- if (!$this->aCcPlayoutHistoryTemplate->validate($columns)) {
- $failureMap = array_merge($failureMap, $this->aCcPlayoutHistoryTemplate->getValidationFailures());
- }
- }
-
-
- if (($retval = CcPlayoutHistoryTemplateFieldPeer::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 = CcPlayoutHistoryTemplateFieldPeer::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->getDbTemplateId();
- break;
- case 2:
- return $this->getDbName();
- break;
- case 3:
- return $this->getDbLabel();
- break;
- case 4:
- return $this->getDbType();
- break;
- case 5:
- return $this->getDbIsFileMD();
- break;
- case 6:
- return $this->getDbPosition();
- 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 = CcPlayoutHistoryTemplateFieldPeer::getFieldNames($keyType);
- $result = array(
- $keys[0] => $this->getDbId(),
- $keys[1] => $this->getDbTemplateId(),
- $keys[2] => $this->getDbName(),
- $keys[3] => $this->getDbLabel(),
- $keys[4] => $this->getDbType(),
- $keys[5] => $this->getDbIsFileMD(),
- $keys[6] => $this->getDbPosition(),
- );
- if ($includeForeignObjects) {
- if (null !== $this->aCcPlayoutHistoryTemplate) {
- $result['CcPlayoutHistoryTemplate'] = $this->aCcPlayoutHistoryTemplate->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 = CcPlayoutHistoryTemplateFieldPeer::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->setDbTemplateId($value);
- break;
- case 2:
- $this->setDbName($value);
- break;
- case 3:
- $this->setDbLabel($value);
- break;
- case 4:
- $this->setDbType($value);
- break;
- case 5:
- $this->setDbIsFileMD($value);
- break;
- case 6:
- $this->setDbPosition($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 = CcPlayoutHistoryTemplateFieldPeer::getFieldNames($keyType);
-
- if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
- if (array_key_exists($keys[1], $arr)) $this->setDbTemplateId($arr[$keys[1]]);
- if (array_key_exists($keys[2], $arr)) $this->setDbName($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setDbLabel($arr[$keys[3]]);
- if (array_key_exists($keys[4], $arr)) $this->setDbType($arr[$keys[4]]);
- if (array_key_exists($keys[5], $arr)) $this->setDbIsFileMD($arr[$keys[5]]);
- if (array_key_exists($keys[6], $arr)) $this->setDbPosition($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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
-
- if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::ID)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, $this->id);
- if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $this->template_id);
- if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::NAME)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::NAME, $this->name);
- if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::LABEL)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::LABEL, $this->label);
- if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::TYPE)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::TYPE, $this->type);
- if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD, $this->is_file_md);
- if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::POSITION)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::POSITION, $this->position);
-
- 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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
- $criteria->add(CcPlayoutHistoryTemplateFieldPeer::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 CcPlayoutHistoryTemplateField (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->setDbTemplateId($this->template_id);
- $copyObj->setDbName($this->name);
- $copyObj->setDbLabel($this->label);
- $copyObj->setDbType($this->type);
- $copyObj->setDbIsFileMD($this->is_file_md);
- $copyObj->setDbPosition($this->position);
-
- $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 CcPlayoutHistoryTemplateField 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 CcPlayoutHistoryTemplateFieldPeer
- */
- public function getPeer()
- {
- if (self::$peer === null) {
- self::$peer = new CcPlayoutHistoryTemplateFieldPeer();
- }
- return self::$peer;
- }
-
- /**
- * Declares an association between this object and a CcPlayoutHistoryTemplate object.
- *
- * @param CcPlayoutHistoryTemplate $v
- * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
- * @throws PropelException
- */
- public function setCcPlayoutHistoryTemplate(CcPlayoutHistoryTemplate $v = null)
- {
- if ($v === null) {
- $this->setDbTemplateId(NULL);
- } else {
- $this->setDbTemplateId($v->getDbId());
- }
-
- $this->aCcPlayoutHistoryTemplate = $v;
-
- // Add binding for other direction of this n:n relationship.
- // If this object has already been added to the CcPlayoutHistoryTemplate object, it will not be re-added.
- if ($v !== null) {
- $v->addCcPlayoutHistoryTemplateField($this);
- }
-
- return $this;
- }
-
-
- /**
- * Get the associated CcPlayoutHistoryTemplate object
- *
- * @param PropelPDO Optional Connection object.
- * @return CcPlayoutHistoryTemplate The associated CcPlayoutHistoryTemplate object.
- * @throws PropelException
- */
- public function getCcPlayoutHistoryTemplate(PropelPDO $con = null)
- {
- if ($this->aCcPlayoutHistoryTemplate === null && ($this->template_id !== null)) {
- $this->aCcPlayoutHistoryTemplate = CcPlayoutHistoryTemplateQuery::create()->findPk($this->template_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->aCcPlayoutHistoryTemplate->addCcPlayoutHistoryTemplateFields($this);
- */
- }
- return $this->aCcPlayoutHistoryTemplate;
- }
-
- /**
- * Clears the current object and sets all attributes to their default values
- */
- public function clear()
- {
- $this->id = null;
- $this->template_id = null;
- $this->name = null;
- $this->label = null;
- $this->type = null;
- $this->is_file_md = null;
- $this->position = 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->aCcPlayoutHistoryTemplate = 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);
- }
-
-} // BaseCcPlayoutHistoryTemplateField
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcPlayoutHistoryTemplateFieldPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcPlayoutHistoryTemplateFieldPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the template_id field.
+ * @var int
+ */
+ protected $template_id;
+
+ /**
+ * The value for the name field.
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * The value for the label field.
+ * @var string
+ */
+ protected $label;
+
+ /**
+ * The value for the type field.
+ * @var string
+ */
+ protected $type;
+
+ /**
+ * The value for the is_file_md field.
+ * Note: this column has a database default value of: false
+ * @var boolean
+ */
+ protected $is_file_md;
+
+ /**
+ * The value for the position field.
+ * @var int
+ */
+ protected $position;
+
+ /**
+ * @var CcPlayoutHistoryTemplate
+ */
+ protected $aCcPlayoutHistoryTemplate;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->is_file_md = false;
+ }
+
+ /**
+ * Initializes internal state of BaseCcPlayoutHistoryTemplateField 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 [template_id] column value.
+ *
+ * @return int
+ */
+ public function getDbTemplateId()
+ {
+
+ return $this->template_id;
+ }
+
+ /**
+ * Get the [name] column value.
+ *
+ * @return string
+ */
+ public function getDbName()
+ {
+
+ return $this->name;
+ }
+
+ /**
+ * Get the [label] column value.
+ *
+ * @return string
+ */
+ public function getDbLabel()
+ {
+
+ return $this->label;
+ }
+
+ /**
+ * Get the [type] column value.
+ *
+ * @return string
+ */
+ public function getDbType()
+ {
+
+ return $this->type;
+ }
+
+ /**
+ * Get the [is_file_md] column value.
+ *
+ * @return boolean
+ */
+ public function getDbIsFileMD()
+ {
+
+ return $this->is_file_md;
+ }
+
+ /**
+ * Get the [position] column value.
+ *
+ * @return int
+ */
+ public function getDbPosition()
+ {
+
+ return $this->position;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [template_id] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
+ */
+ public function setDbTemplateId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->template_id !== $v) {
+ $this->template_id = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID;
+ }
+
+ if ($this->aCcPlayoutHistoryTemplate !== null && $this->aCcPlayoutHistoryTemplate->getDbId() !== $v) {
+ $this->aCcPlayoutHistoryTemplate = null;
+ }
+
+
+ return $this;
+ } // setDbTemplateId()
+
+ /**
+ * Set the value of [name] column.
+ *
+ * @param string $v new value
+ * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
+ */
+ public function setDbName($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->name !== $v) {
+ $this->name = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::NAME;
+ }
+
+
+ return $this;
+ } // setDbName()
+
+ /**
+ * Set the value of [label] column.
+ *
+ * @param string $v new value
+ * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
+ */
+ public function setDbLabel($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->label !== $v) {
+ $this->label = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::LABEL;
+ }
+
+
+ return $this;
+ } // setDbLabel()
+
+ /**
+ * Set the value of [type] column.
+ *
+ * @param string $v new value
+ * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
+ */
+ public function setDbType($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->type !== $v) {
+ $this->type = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::TYPE;
+ }
+
+
+ return $this;
+ } // setDbType()
+
+ /**
+ * Sets the value of the [is_file_md] column.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ *
+ * @param boolean|integer|string $v The new value
+ * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
+ */
+ public function setDbIsFileMD($v)
+ {
+ if ($v !== null) {
+ if (is_string($v)) {
+ $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ } else {
+ $v = (boolean) $v;
+ }
+ }
+
+ if ($this->is_file_md !== $v) {
+ $this->is_file_md = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD;
+ }
+
+
+ return $this;
+ } // setDbIsFileMD()
+
+ /**
+ * Set the value of [position] column.
+ *
+ * @param int $v new value
+ * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
+ */
+ public function setDbPosition($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->position !== $v) {
+ $this->position = $v;
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::POSITION;
+ }
+
+
+ return $this;
+ } // setDbPosition()
+
+ /**
+ * 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->is_file_md !== 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 resultset 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->template_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
+ $this->name = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->label = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->type = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->is_file_md = ($row[$startcol + 5] !== null) ? (boolean) $row[$startcol + 5] : null;
+ $this->position = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 7; // 7 = CcPlayoutHistoryTemplateFieldPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcPlayoutHistoryTemplateField 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->aCcPlayoutHistoryTemplate !== null && $this->template_id !== $this->aCcPlayoutHistoryTemplate->getDbId()) {
+ $this->aCcPlayoutHistoryTemplate = 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(CcPlayoutHistoryTemplateFieldPeer::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 = CcPlayoutHistoryTemplateFieldPeer::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->aCcPlayoutHistoryTemplate = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = CcPlayoutHistoryTemplateFieldQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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(CcPlayoutHistoryTemplateFieldPeer::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);
+ CcPlayoutHistoryTemplateFieldPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $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 corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcPlayoutHistoryTemplate !== null) {
+ if ($this->aCcPlayoutHistoryTemplate->isModified() || $this->aCcPlayoutHistoryTemplate->isNew()) {
+ $affectedRows += $this->aCcPlayoutHistoryTemplate->save($con);
+ }
+ $this->setCcPlayoutHistoryTemplate($this->aCcPlayoutHistoryTemplate);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcPlayoutHistoryTemplateFieldPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcPlayoutHistoryTemplateFieldPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_playout_history_template_field_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID)) {
+ $modifiedColumns[':p' . $index++] = '"template_id"';
+ }
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::NAME)) {
+ $modifiedColumns[':p' . $index++] = '"name"';
+ }
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::LABEL)) {
+ $modifiedColumns[':p' . $index++] = '"label"';
+ }
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::TYPE)) {
+ $modifiedColumns[':p' . $index++] = '"type"';
+ }
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD)) {
+ $modifiedColumns[':p' . $index++] = '"is_file_md"';
+ }
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::POSITION)) {
+ $modifiedColumns[':p' . $index++] = '"position"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_playout_history_template_field" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"template_id"':
+ $stmt->bindValue($identifier, $this->template_id, PDO::PARAM_INT);
+ break;
+ case '"name"':
+ $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
+ break;
+ case '"label"':
+ $stmt->bindValue($identifier, $this->label, PDO::PARAM_STR);
+ break;
+ case '"type"':
+ $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR);
+ break;
+ case '"is_file_md"':
+ $stmt->bindValue($identifier, $this->is_file_md, PDO::PARAM_BOOL);
+ break;
+ case '"position"':
+ $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcPlayoutHistoryTemplate !== null) {
+ if (!$this->aCcPlayoutHistoryTemplate->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcPlayoutHistoryTemplate->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CcPlayoutHistoryTemplateFieldPeer::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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlayoutHistoryTemplateFieldPeer::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->getDbTemplateId();
+ break;
+ case 2:
+ return $this->getDbName();
+ break;
+ case 3:
+ return $this->getDbLabel();
+ break;
+ case 4:
+ return $this->getDbType();
+ break;
+ case 5:
+ return $this->getDbIsFileMD();
+ break;
+ case 6:
+ return $this->getDbPosition();
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcPlayoutHistoryTemplateField'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcPlayoutHistoryTemplateField'][$this->getPrimaryKey()] = true;
+ $keys = CcPlayoutHistoryTemplateFieldPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbTemplateId(),
+ $keys[2] => $this->getDbName(),
+ $keys[3] => $this->getDbLabel(),
+ $keys[4] => $this->getDbType(),
+ $keys[5] => $this->getDbIsFileMD(),
+ $keys[6] => $this->getDbPosition(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcPlayoutHistoryTemplate) {
+ $result['CcPlayoutHistoryTemplate'] = $this->aCcPlayoutHistoryTemplate->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPlayoutHistoryTemplateFieldPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbTemplateId($value);
+ break;
+ case 2:
+ $this->setDbName($value);
+ break;
+ case 3:
+ $this->setDbLabel($value);
+ break;
+ case 4:
+ $this->setDbType($value);
+ break;
+ case 5:
+ $this->setDbIsFileMD($value);
+ break;
+ case 6:
+ $this->setDbPosition($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 BasePeer::TYPE_PHPNAME
+ *
+ * @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 = CcPlayoutHistoryTemplateFieldPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbTemplateId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbName($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbLabel($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbType($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDbIsFileMD($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setDbPosition($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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::ID)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, $this->id);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $this->template_id);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::NAME)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::NAME, $this->name);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::LABEL)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::LABEL, $this->label);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::TYPE)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::TYPE, $this->type);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD, $this->is_file_md);
+ if ($this->isColumnModified(CcPlayoutHistoryTemplateFieldPeer::POSITION)) $criteria->add(CcPlayoutHistoryTemplateFieldPeer::POSITION, $this->position);
+
+ 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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplateFieldPeer::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 CcPlayoutHistoryTemplateField (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbTemplateId($this->getDbTemplateId());
+ $copyObj->setDbName($this->getDbName());
+ $copyObj->setDbLabel($this->getDbLabel());
+ $copyObj->setDbType($this->getDbType());
+ $copyObj->setDbIsFileMD($this->getDbIsFileMD());
+ $copyObj->setDbPosition($this->getDbPosition());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 CcPlayoutHistoryTemplateField 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 CcPlayoutHistoryTemplateFieldPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcPlayoutHistoryTemplateFieldPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcPlayoutHistoryTemplate object.
+ *
+ * @param CcPlayoutHistoryTemplate $v
+ * @return CcPlayoutHistoryTemplateField The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcPlayoutHistoryTemplate(CcPlayoutHistoryTemplate $v = null)
+ {
+ if ($v === null) {
+ $this->setDbTemplateId(NULL);
+ } else {
+ $this->setDbTemplateId($v->getDbId());
+ }
+
+ $this->aCcPlayoutHistoryTemplate = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcPlayoutHistoryTemplate object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcPlayoutHistoryTemplateField($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcPlayoutHistoryTemplate object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcPlayoutHistoryTemplate The associated CcPlayoutHistoryTemplate object.
+ * @throws PropelException
+ */
+ public function getCcPlayoutHistoryTemplate(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcPlayoutHistoryTemplate === null && ($this->template_id !== null) && $doQuery) {
+ $this->aCcPlayoutHistoryTemplate = CcPlayoutHistoryTemplateQuery::create()->findPk($this->template_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->aCcPlayoutHistoryTemplate->addCcPlayoutHistoryTemplateFields($this);
+ */
+ }
+
+ return $this->aCcPlayoutHistoryTemplate;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->template_id = null;
+ $this->name = null;
+ $this->label = null;
+ $this->type = null;
+ $this->is_file_md = null;
+ $this->position = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->aCcPlayoutHistoryTemplate instanceof Persistent) {
+ $this->aCcPlayoutHistoryTemplate->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ $this->aCcPlayoutHistoryTemplate = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcPlayoutHistoryTemplateFieldPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateFieldPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateFieldPeer.php
index 91586fa1d..cd33ca808 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateFieldPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateFieldPeer.php
@@ -4,991 +4,1017 @@
/**
* Base static class for performing query and update operations on the 'cc_playout_history_template_field' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcPlayoutHistoryTemplateFieldPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_playout_history_template_field';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcPlayoutHistoryTemplateField';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcPlayoutHistoryTemplateField';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcPlayoutHistoryTemplateFieldTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 7;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_playout_history_template_field.ID';
-
- /** the column name for the TEMPLATE_ID field */
- const TEMPLATE_ID = 'cc_playout_history_template_field.TEMPLATE_ID';
-
- /** the column name for the NAME field */
- const NAME = 'cc_playout_history_template_field.NAME';
-
- /** the column name for the LABEL field */
- const LABEL = 'cc_playout_history_template_field.LABEL';
-
- /** the column name for the TYPE field */
- const TYPE = 'cc_playout_history_template_field.TYPE';
-
- /** the column name for the IS_FILE_MD field */
- const IS_FILE_MD = 'cc_playout_history_template_field.IS_FILE_MD';
-
- /** the column name for the POSITION field */
- const POSITION = 'cc_playout_history_template_field.POSITION';
-
- /**
- * An identiy map to hold any loaded instances of CcPlayoutHistoryTemplateField objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcPlayoutHistoryTemplateField[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbTemplateId', 'DbName', 'DbLabel', 'DbType', 'DbIsFileMD', 'DbPosition', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTemplateId', 'dbName', 'dbLabel', 'dbType', 'dbIsFileMD', 'dbPosition', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::TEMPLATE_ID, self::NAME, self::LABEL, self::TYPE, self::IS_FILE_MD, self::POSITION, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TEMPLATE_ID', 'NAME', 'LABEL', 'TYPE', 'IS_FILE_MD', 'POSITION', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'template_id', 'name', 'label', 'type', 'is_file_md', 'position', ),
- 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, 'DbTemplateId' => 1, 'DbName' => 2, 'DbLabel' => 3, 'DbType' => 4, 'DbIsFileMD' => 5, 'DbPosition' => 6, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTemplateId' => 1, 'dbName' => 2, 'dbLabel' => 3, 'dbType' => 4, 'dbIsFileMD' => 5, 'dbPosition' => 6, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TEMPLATE_ID => 1, self::NAME => 2, self::LABEL => 3, self::TYPE => 4, self::IS_FILE_MD => 5, self::POSITION => 6, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TEMPLATE_ID' => 1, 'NAME' => 2, 'LABEL' => 3, 'TYPE' => 4, 'IS_FILE_MD' => 5, 'POSITION' => 6, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'template_id' => 1, 'name' => 2, 'label' => 3, 'type' => 4, 'is_file_md' => 5, 'position' => 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. CcPlayoutHistoryTemplateFieldPeer::COLUMN_NAME).
- * @return string
- */
- public static function alias($alias, $column)
- {
- return str_replace(CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::ID);
- $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID);
- $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::NAME);
- $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::LABEL);
- $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::TYPE);
- $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD);
- $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::POSITION);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.TEMPLATE_ID');
- $criteria->addSelectColumn($alias . '.NAME');
- $criteria->addSelectColumn($alias . '.LABEL');
- $criteria->addSelectColumn($alias . '.TYPE');
- $criteria->addSelectColumn($alias . '.IS_FILE_MD');
- $criteria->addSelectColumn($alias . '.POSITION');
- }
- }
-
- /**
- * 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(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::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 CcPlayoutHistoryTemplateField
- * @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 = CcPlayoutHistoryTemplateFieldPeer::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 CcPlayoutHistoryTemplateFieldPeer::populateObjects(CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- if (!$criteria->hasSelectClause()) {
- $criteria = clone $criteria;
- CcPlayoutHistoryTemplateFieldPeer::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 CcPlayoutHistoryTemplateField $value A CcPlayoutHistoryTemplateField object.
- * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
- */
- public static function addInstanceToPool(CcPlayoutHistoryTemplateField $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 CcPlayoutHistoryTemplateField object or a primary key value.
- */
- public static function removeInstanceFromPool($value)
- {
- if (Propel::isInstancePoolingEnabled() && $value !== null) {
- if (is_object($value) && $value instanceof CcPlayoutHistoryTemplateField) {
- $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 CcPlayoutHistoryTemplateField 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 CcPlayoutHistoryTemplateField 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_playout_history_template_field
- * 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 = CcPlayoutHistoryTemplateFieldPeer::getOMClass(false);
- // populate the object(s)
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key = CcPlayoutHistoryTemplateFieldPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj = CcPlayoutHistoryTemplateFieldPeer::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;
- CcPlayoutHistoryTemplateFieldPeer::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 (CcPlayoutHistoryTemplateField object, last column rank)
- */
- public static function populateObject($row, $startcol = 0)
- {
- $key = CcPlayoutHistoryTemplateFieldPeer::getPrimaryKeyHashFromRow($row, $startcol);
- if (null !== ($obj = CcPlayoutHistoryTemplateFieldPeer::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 + CcPlayoutHistoryTemplateFieldPeer::NUM_COLUMNS;
- } else {
- $cls = CcPlayoutHistoryTemplateFieldPeer::OM_CLASS;
- $obj = new $cls();
- $col = $obj->hydrate($row, $startcol);
- CcPlayoutHistoryTemplateFieldPeer::addInstanceToPool($obj, $key);
- }
- return array($obj, $col);
- }
-
- /**
- * Returns the number of rows matching criteria, joining the related CcPlayoutHistoryTemplate 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 doCountJoinCcPlayoutHistoryTemplate(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(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplateField objects pre-filled with their CcPlayoutHistoryTemplate 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 CcPlayoutHistoryTemplateField objects.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelectJoinCcPlayoutHistoryTemplate(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);
- }
-
- CcPlayoutHistoryTemplateFieldPeer::addSelectColumns($criteria);
- $startcol = (CcPlayoutHistoryTemplateFieldPeer::NUM_COLUMNS - CcPlayoutHistoryTemplateFieldPeer::NUM_LAZY_LOAD_COLUMNS);
- CcPlayoutHistoryTemplatePeer::addSelectColumns($criteria);
-
- $criteria->addJoin(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcPlayoutHistoryTemplateFieldPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcPlayoutHistoryTemplateFieldPeer::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 = CcPlayoutHistoryTemplateFieldPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcPlayoutHistoryTemplateFieldPeer::addInstanceToPool($obj1, $key1);
- } // if $obj1 already loaded
-
- $key2 = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol);
- if ($key2 !== null) {
- $obj2 = CcPlayoutHistoryTemplatePeer::getInstanceFromPool($key2);
- if (!$obj2) {
-
- $cls = CcPlayoutHistoryTemplatePeer::getOMClass(false);
-
- $obj2 = new $cls();
- $obj2->hydrate($row, $startcol);
- CcPlayoutHistoryTemplatePeer::addInstanceToPool($obj2, $key2);
- } // if obj2 already loaded
-
- // Add the $obj1 (CcPlayoutHistoryTemplateField) to $obj2 (CcPlayoutHistoryTemplate)
- $obj2->addCcPlayoutHistoryTemplateField($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(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplateField 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 CcPlayoutHistoryTemplateField 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);
- }
-
- CcPlayoutHistoryTemplateFieldPeer::addSelectColumns($criteria);
- $startcol2 = (CcPlayoutHistoryTemplateFieldPeer::NUM_COLUMNS - CcPlayoutHistoryTemplateFieldPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcPlayoutHistoryTemplatePeer::addSelectColumns($criteria);
- $startcol3 = $startcol2 + (CcPlayoutHistoryTemplatePeer::NUM_COLUMNS - CcPlayoutHistoryTemplatePeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcPlayoutHistoryTemplateFieldPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcPlayoutHistoryTemplateFieldPeer::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 = CcPlayoutHistoryTemplateFieldPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcPlayoutHistoryTemplateFieldPeer::addInstanceToPool($obj1, $key1);
- } // if obj1 already loaded
-
- // Add objects for joined CcPlayoutHistoryTemplate rows
-
- $key2 = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2);
- if ($key2 !== null) {
- $obj2 = CcPlayoutHistoryTemplatePeer::getInstanceFromPool($key2);
- if (!$obj2) {
-
- $cls = CcPlayoutHistoryTemplatePeer::getOMClass(false);
-
- $obj2 = new $cls();
- $obj2->hydrate($row, $startcol2);
- CcPlayoutHistoryTemplatePeer::addInstanceToPool($obj2, $key2);
- } // if obj2 loaded
-
- // Add the $obj1 (CcPlayoutHistoryTemplateField) to the collection in $obj2 (CcPlayoutHistoryTemplate)
- $obj2->addCcPlayoutHistoryTemplateField($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(BaseCcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
- if (!$dbMap->hasTable(BaseCcPlayoutHistoryTemplateFieldPeer::TABLE_NAME))
- {
- $dbMap->addTableObject(new CcPlayoutHistoryTemplateFieldTableMap());
- }
- }
-
- /**
- * 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 ? CcPlayoutHistoryTemplateFieldPeer::CLASS_DEFAULT : CcPlayoutHistoryTemplateFieldPeer::OM_CLASS;
- }
-
- /**
- * Method perform an INSERT on the database, given a CcPlayoutHistoryTemplateField or Criteria object.
- *
- * @param mixed $values Criteria or CcPlayoutHistoryTemplateField 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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
- } else {
- $criteria = $values->buildCriteria(); // build Criteria from CcPlayoutHistoryTemplateField object
- }
-
- if ($criteria->containsKey(CcPlayoutHistoryTemplateFieldPeer::ID) && $criteria->keyContainsValue(CcPlayoutHistoryTemplateFieldPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryTemplateFieldPeer::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 CcPlayoutHistoryTemplateField or Criteria object.
- *
- * @param mixed $values Criteria or CcPlayoutHistoryTemplateField 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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $selectCriteria = new Criteria(self::DATABASE_NAME);
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
-
- $comparison = $criteria->getComparison(CcPlayoutHistoryTemplateFieldPeer::ID);
- $value = $criteria->remove(CcPlayoutHistoryTemplateFieldPeer::ID);
- if ($value) {
- $selectCriteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, $value, $comparison);
- } else {
- $selectCriteria->setPrimaryTableName(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
- }
-
- } else { // $values is CcPlayoutHistoryTemplateField 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_playout_history_template_field 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(CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME, $con, CcPlayoutHistoryTemplateFieldPeer::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).
- CcPlayoutHistoryTemplateFieldPeer::clearInstancePool();
- CcPlayoutHistoryTemplateFieldPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Method perform a DELETE on the database, given a CcPlayoutHistoryTemplateField or Criteria object OR a primary key value.
- *
- * @param mixed $values Criteria or CcPlayoutHistoryTemplateField 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(CcPlayoutHistoryTemplateFieldPeer::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.
- CcPlayoutHistoryTemplateFieldPeer::clearInstancePool();
- // rename for clarity
- $criteria = clone $values;
- } elseif ($values instanceof CcPlayoutHistoryTemplateField) { // it's a model object
- // invalidate the cache for this single object
- CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::ID, (array) $values, Criteria::IN);
- // invalidate the cache for this object(s)
- foreach ((array) $values as $singleval) {
- CcPlayoutHistoryTemplateFieldPeer::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);
- CcPlayoutHistoryTemplateFieldPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Validates all modified columns of given CcPlayoutHistoryTemplateField 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 CcPlayoutHistoryTemplateField $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(CcPlayoutHistoryTemplateField $obj, $cols = null)
- {
- $columns = array();
-
- if ($cols) {
- $dbMap = Propel::getDatabaseMap(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
- $tableMap = $dbMap->getTable(CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME, $columns);
- }
-
- /**
- * Retrieve a single object by pkey.
- *
- * @param int $pk the primary key.
- * @param PropelPDO $con the connection to use
- * @return CcPlayoutHistoryTemplateField
- */
- public static function retrieveByPK($pk, PropelPDO $con = null)
- {
-
- if (null !== ($obj = CcPlayoutHistoryTemplateFieldPeer::getInstanceFromPool((string) $pk))) {
- return $obj;
- }
-
- if ($con === null) {
- $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria = new Criteria(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
- $criteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, $pk);
-
- $v = CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $objs = null;
- if (empty($pks)) {
- $objs = array();
- } else {
- $criteria = new Criteria(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
- $criteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, $pks, Criteria::IN);
- $objs = CcPlayoutHistoryTemplateFieldPeer::doSelect($criteria, $con);
- }
- return $objs;
- }
+abstract class BaseCcPlayoutHistoryTemplateFieldPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_playout_history_template_field';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcPlayoutHistoryTemplateField';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcPlayoutHistoryTemplateFieldTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 7;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 7;
+
+ /** the column name for the id field */
+ const ID = 'cc_playout_history_template_field.id';
+
+ /** the column name for the template_id field */
+ const TEMPLATE_ID = 'cc_playout_history_template_field.template_id';
+
+ /** the column name for the name field */
+ const NAME = 'cc_playout_history_template_field.name';
+
+ /** the column name for the label field */
+ const LABEL = 'cc_playout_history_template_field.label';
+
+ /** the column name for the type field */
+ const TYPE = 'cc_playout_history_template_field.type';
+
+ /** the column name for the is_file_md field */
+ const IS_FILE_MD = 'cc_playout_history_template_field.is_file_md';
+
+ /** the column name for the position field */
+ const POSITION = 'cc_playout_history_template_field.position';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcPlayoutHistoryTemplateField objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcPlayoutHistoryTemplateField[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcPlayoutHistoryTemplateFieldPeer::$fieldNames[CcPlayoutHistoryTemplateFieldPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbTemplateId', 'DbName', 'DbLabel', 'DbType', 'DbIsFileMD', 'DbPosition', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTemplateId', 'dbName', 'dbLabel', 'dbType', 'dbIsFileMD', 'dbPosition', ),
+ BasePeer::TYPE_COLNAME => array (CcPlayoutHistoryTemplateFieldPeer::ID, CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, CcPlayoutHistoryTemplateFieldPeer::NAME, CcPlayoutHistoryTemplateFieldPeer::LABEL, CcPlayoutHistoryTemplateFieldPeer::TYPE, CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD, CcPlayoutHistoryTemplateFieldPeer::POSITION, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TEMPLATE_ID', 'NAME', 'LABEL', 'TYPE', 'IS_FILE_MD', 'POSITION', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'template_id', 'name', 'label', 'type', 'is_file_md', 'position', ),
+ 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. CcPlayoutHistoryTemplateFieldPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbTemplateId' => 1, 'DbName' => 2, 'DbLabel' => 3, 'DbType' => 4, 'DbIsFileMD' => 5, 'DbPosition' => 6, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTemplateId' => 1, 'dbName' => 2, 'dbLabel' => 3, 'dbType' => 4, 'dbIsFileMD' => 5, 'dbPosition' => 6, ),
+ BasePeer::TYPE_COLNAME => array (CcPlayoutHistoryTemplateFieldPeer::ID => 0, CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID => 1, CcPlayoutHistoryTemplateFieldPeer::NAME => 2, CcPlayoutHistoryTemplateFieldPeer::LABEL => 3, CcPlayoutHistoryTemplateFieldPeer::TYPE => 4, CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD => 5, CcPlayoutHistoryTemplateFieldPeer::POSITION => 6, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TEMPLATE_ID' => 1, 'NAME' => 2, 'LABEL' => 3, 'TYPE' => 4, 'IS_FILE_MD' => 5, 'POSITION' => 6, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'template_id' => 1, 'name' => 2, 'label' => 3, 'type' => 4, 'is_file_md' => 5, 'position' => 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcPlayoutHistoryTemplateFieldPeer::getFieldNames($toType);
+ $key = isset(CcPlayoutHistoryTemplateFieldPeer::$fieldKeys[$fromType][$name]) ? CcPlayoutHistoryTemplateFieldPeer::$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(CcPlayoutHistoryTemplateFieldPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcPlayoutHistoryTemplateFieldPeer::$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 CcPlayoutHistoryTemplateFieldPeer::$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. CcPlayoutHistoryTemplateFieldPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::ID);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::NAME);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::LABEL);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::TYPE);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplateFieldPeer::POSITION);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.template_id');
+ $criteria->addSelectColumn($alias . '.name');
+ $criteria->addSelectColumn($alias . '.label');
+ $criteria->addSelectColumn($alias . '.type');
+ $criteria->addSelectColumn($alias . '.is_file_md');
+ $criteria->addSelectColumn($alias . '.position');
+ }
+ }
+
+ /**
+ * 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(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryTemplateFieldPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::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;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcPlayoutHistoryTemplateField
+ * @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 = CcPlayoutHistoryTemplateFieldPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 CcPlayoutHistoryTemplateFieldPeer::populateObjects(CcPlayoutHistoryTemplateFieldPeer::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 directly (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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcPlayoutHistoryTemplateFieldPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryTemplateFieldPeer::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 CcPlayoutHistoryTemplateField $obj A CcPlayoutHistoryTemplateField object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcPlayoutHistoryTemplateFieldPeer::$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 CcPlayoutHistoryTemplateField object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcPlayoutHistoryTemplateField) {
+ $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 CcPlayoutHistoryTemplateField object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(CcPlayoutHistoryTemplateFieldPeer::$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 CcPlayoutHistoryTemplateField 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(CcPlayoutHistoryTemplateFieldPeer::$instances[$key])) {
+ return CcPlayoutHistoryTemplateFieldPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcPlayoutHistoryTemplateFieldPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcPlayoutHistoryTemplateFieldPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_playout_history_template_field
+ * 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 = CcPlayoutHistoryTemplateFieldPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcPlayoutHistoryTemplateFieldPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcPlayoutHistoryTemplateFieldPeer::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;
+ CcPlayoutHistoryTemplateFieldPeer::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 (CcPlayoutHistoryTemplateField object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcPlayoutHistoryTemplateFieldPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcPlayoutHistoryTemplateFieldPeer::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 + CcPlayoutHistoryTemplateFieldPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = CcPlayoutHistoryTemplateFieldPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcPlayoutHistoryTemplateFieldPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcPlayoutHistoryTemplate 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 doCountJoinCcPlayoutHistoryTemplate(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(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryTemplateFieldPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplateField objects pre-filled with their CcPlayoutHistoryTemplate 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 CcPlayoutHistoryTemplateField objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcPlayoutHistoryTemplate(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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryTemplateFieldPeer::addSelectColumns($criteria);
+ $startcol = CcPlayoutHistoryTemplateFieldPeer::NUM_HYDRATE_COLUMNS;
+ CcPlayoutHistoryTemplatePeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryTemplateFieldPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryTemplateFieldPeer::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 = CcPlayoutHistoryTemplateFieldPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryTemplateFieldPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcPlayoutHistoryTemplatePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcPlayoutHistoryTemplatePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcPlayoutHistoryTemplatePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcPlayoutHistoryTemplateField) to $obj2 (CcPlayoutHistoryTemplate)
+ $obj2->addCcPlayoutHistoryTemplateField($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(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryTemplateFieldPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplateField 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 CcPlayoutHistoryTemplateField 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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+ }
+
+ CcPlayoutHistoryTemplateFieldPeer::addSelectColumns($criteria);
+ $startcol2 = CcPlayoutHistoryTemplateFieldPeer::NUM_HYDRATE_COLUMNS;
+
+ CcPlayoutHistoryTemplatePeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcPlayoutHistoryTemplatePeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, CcPlayoutHistoryTemplatePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcPlayoutHistoryTemplateFieldPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcPlayoutHistoryTemplateFieldPeer::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 = CcPlayoutHistoryTemplateFieldPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcPlayoutHistoryTemplateFieldPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcPlayoutHistoryTemplate rows
+
+ $key2 = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcPlayoutHistoryTemplatePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcPlayoutHistoryTemplatePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcPlayoutHistoryTemplatePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CcPlayoutHistoryTemplateField) to the collection in $obj2 (CcPlayoutHistoryTemplate)
+ $obj2->addCcPlayoutHistoryTemplateField($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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME)->getTable(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcPlayoutHistoryTemplateFieldPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \CcPlayoutHistoryTemplateFieldTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcPlayoutHistoryTemplateFieldPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a CcPlayoutHistoryTemplateField or Criteria object.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryTemplateField 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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcPlayoutHistoryTemplateField object
+ }
+
+ if ($criteria->containsKey(CcPlayoutHistoryTemplateFieldPeer::ID) && $criteria->keyContainsValue(CcPlayoutHistoryTemplateFieldPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryTemplateFieldPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryTemplateFieldPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a CcPlayoutHistoryTemplateField or Criteria object.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryTemplateField 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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcPlayoutHistoryTemplateFieldPeer::ID);
+ $value = $criteria->remove(CcPlayoutHistoryTemplateFieldPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcPlayoutHistoryTemplateField object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_playout_history_template_field table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME, $con, CcPlayoutHistoryTemplateFieldPeer::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).
+ CcPlayoutHistoryTemplateFieldPeer::clearInstancePool();
+ CcPlayoutHistoryTemplateFieldPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a CcPlayoutHistoryTemplateField or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryTemplateField 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(CcPlayoutHistoryTemplateFieldPeer::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.
+ CcPlayoutHistoryTemplateFieldPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcPlayoutHistoryTemplateField) { // it's a model object
+ // invalidate the cache for this single object
+ CcPlayoutHistoryTemplateFieldPeer::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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcPlayoutHistoryTemplateFieldPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryTemplateFieldPeer::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);
+ CcPlayoutHistoryTemplateFieldPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcPlayoutHistoryTemplateField 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 CcPlayoutHistoryTemplateField $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($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, CcPlayoutHistoryTemplateFieldPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcPlayoutHistoryTemplateField
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcPlayoutHistoryTemplateFieldPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, $pk);
+
+ $v = CcPlayoutHistoryTemplateFieldPeer::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
+ * @return CcPlayoutHistoryTemplateField[]
+ * @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(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplateFieldPeer::ID, $pks, Criteria::IN);
+ $objs = CcPlayoutHistoryTemplateFieldPeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
} // BaseCcPlayoutHistoryTemplateFieldPeer
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateFieldQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateFieldQuery.php
index 2bccd58ca..873e19296 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateFieldQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateFieldQuery.php
@@ -4,399 +4,577 @@
/**
* Base class that represents a query for the 'cc_playout_history_template_field' table.
*
- *
*
- * @method CcPlayoutHistoryTemplateFieldQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcPlayoutHistoryTemplateFieldQuery orderByDbTemplateId($order = Criteria::ASC) Order by the template_id column
- * @method CcPlayoutHistoryTemplateFieldQuery orderByDbName($order = Criteria::ASC) Order by the name column
- * @method CcPlayoutHistoryTemplateFieldQuery orderByDbLabel($order = Criteria::ASC) Order by the label column
- * @method CcPlayoutHistoryTemplateFieldQuery orderByDbType($order = Criteria::ASC) Order by the type column
- * @method CcPlayoutHistoryTemplateFieldQuery orderByDbIsFileMD($order = Criteria::ASC) Order by the is_file_md column
- * @method CcPlayoutHistoryTemplateFieldQuery orderByDbPosition($order = Criteria::ASC) Order by the position column
*
- * @method CcPlayoutHistoryTemplateFieldQuery groupByDbId() Group by the id column
- * @method CcPlayoutHistoryTemplateFieldQuery groupByDbTemplateId() Group by the template_id column
- * @method CcPlayoutHistoryTemplateFieldQuery groupByDbName() Group by the name column
- * @method CcPlayoutHistoryTemplateFieldQuery groupByDbLabel() Group by the label column
- * @method CcPlayoutHistoryTemplateFieldQuery groupByDbType() Group by the type column
- * @method CcPlayoutHistoryTemplateFieldQuery groupByDbIsFileMD() Group by the is_file_md column
- * @method CcPlayoutHistoryTemplateFieldQuery groupByDbPosition() Group by the position column
+ * @method CcPlayoutHistoryTemplateFieldQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcPlayoutHistoryTemplateFieldQuery orderByDbTemplateId($order = Criteria::ASC) Order by the template_id column
+ * @method CcPlayoutHistoryTemplateFieldQuery orderByDbName($order = Criteria::ASC) Order by the name column
+ * @method CcPlayoutHistoryTemplateFieldQuery orderByDbLabel($order = Criteria::ASC) Order by the label column
+ * @method CcPlayoutHistoryTemplateFieldQuery orderByDbType($order = Criteria::ASC) Order by the type column
+ * @method CcPlayoutHistoryTemplateFieldQuery orderByDbIsFileMD($order = Criteria::ASC) Order by the is_file_md column
+ * @method CcPlayoutHistoryTemplateFieldQuery orderByDbPosition($order = Criteria::ASC) Order by the position column
*
- * @method CcPlayoutHistoryTemplateFieldQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcPlayoutHistoryTemplateFieldQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcPlayoutHistoryTemplateFieldQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcPlayoutHistoryTemplateFieldQuery groupByDbId() Group by the id column
+ * @method CcPlayoutHistoryTemplateFieldQuery groupByDbTemplateId() Group by the template_id column
+ * @method CcPlayoutHistoryTemplateFieldQuery groupByDbName() Group by the name column
+ * @method CcPlayoutHistoryTemplateFieldQuery groupByDbLabel() Group by the label column
+ * @method CcPlayoutHistoryTemplateFieldQuery groupByDbType() Group by the type column
+ * @method CcPlayoutHistoryTemplateFieldQuery groupByDbIsFileMD() Group by the is_file_md column
+ * @method CcPlayoutHistoryTemplateFieldQuery groupByDbPosition() Group by the position column
*
- * @method CcPlayoutHistoryTemplateFieldQuery leftJoinCcPlayoutHistoryTemplate($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistoryTemplate relation
- * @method CcPlayoutHistoryTemplateFieldQuery rightJoinCcPlayoutHistoryTemplate($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistoryTemplate relation
- * @method CcPlayoutHistoryTemplateFieldQuery innerJoinCcPlayoutHistoryTemplate($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistoryTemplate relation
+ * @method CcPlayoutHistoryTemplateFieldQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcPlayoutHistoryTemplateFieldQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcPlayoutHistoryTemplateFieldQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcPlayoutHistoryTemplateField findOne(PropelPDO $con = null) Return the first CcPlayoutHistoryTemplateField matching the query
- * @method CcPlayoutHistoryTemplateField findOneOrCreate(PropelPDO $con = null) Return the first CcPlayoutHistoryTemplateField matching the query, or a new CcPlayoutHistoryTemplateField object populated from the query conditions when no match is found
+ * @method CcPlayoutHistoryTemplateFieldQuery leftJoinCcPlayoutHistoryTemplate($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPlayoutHistoryTemplate relation
+ * @method CcPlayoutHistoryTemplateFieldQuery rightJoinCcPlayoutHistoryTemplate($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPlayoutHistoryTemplate relation
+ * @method CcPlayoutHistoryTemplateFieldQuery innerJoinCcPlayoutHistoryTemplate($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPlayoutHistoryTemplate relation
*
- * @method CcPlayoutHistoryTemplateField findOneByDbId(int $id) Return the first CcPlayoutHistoryTemplateField filtered by the id column
- * @method CcPlayoutHistoryTemplateField findOneByDbTemplateId(int $template_id) Return the first CcPlayoutHistoryTemplateField filtered by the template_id column
- * @method CcPlayoutHistoryTemplateField findOneByDbName(string $name) Return the first CcPlayoutHistoryTemplateField filtered by the name column
- * @method CcPlayoutHistoryTemplateField findOneByDbLabel(string $label) Return the first CcPlayoutHistoryTemplateField filtered by the label column
- * @method CcPlayoutHistoryTemplateField findOneByDbType(string $type) Return the first CcPlayoutHistoryTemplateField filtered by the type column
- * @method CcPlayoutHistoryTemplateField findOneByDbIsFileMD(boolean $is_file_md) Return the first CcPlayoutHistoryTemplateField filtered by the is_file_md column
- * @method CcPlayoutHistoryTemplateField findOneByDbPosition(int $position) Return the first CcPlayoutHistoryTemplateField filtered by the position column
+ * @method CcPlayoutHistoryTemplateField findOne(PropelPDO $con = null) Return the first CcPlayoutHistoryTemplateField matching the query
+ * @method CcPlayoutHistoryTemplateField findOneOrCreate(PropelPDO $con = null) Return the first CcPlayoutHistoryTemplateField matching the query, or a new CcPlayoutHistoryTemplateField object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcPlayoutHistoryTemplateField objects filtered by the id column
- * @method array findByDbTemplateId(int $template_id) Return CcPlayoutHistoryTemplateField objects filtered by the template_id column
- * @method array findByDbName(string $name) Return CcPlayoutHistoryTemplateField objects filtered by the name column
- * @method array findByDbLabel(string $label) Return CcPlayoutHistoryTemplateField objects filtered by the label column
- * @method array findByDbType(string $type) Return CcPlayoutHistoryTemplateField objects filtered by the type column
- * @method array findByDbIsFileMD(boolean $is_file_md) Return CcPlayoutHistoryTemplateField objects filtered by the is_file_md column
- * @method array findByDbPosition(int $position) Return CcPlayoutHistoryTemplateField objects filtered by the position column
+ * @method CcPlayoutHistoryTemplateField findOneByDbTemplateId(int $template_id) Return the first CcPlayoutHistoryTemplateField filtered by the template_id column
+ * @method CcPlayoutHistoryTemplateField findOneByDbName(string $name) Return the first CcPlayoutHistoryTemplateField filtered by the name column
+ * @method CcPlayoutHistoryTemplateField findOneByDbLabel(string $label) Return the first CcPlayoutHistoryTemplateField filtered by the label column
+ * @method CcPlayoutHistoryTemplateField findOneByDbType(string $type) Return the first CcPlayoutHistoryTemplateField filtered by the type column
+ * @method CcPlayoutHistoryTemplateField findOneByDbIsFileMD(boolean $is_file_md) Return the first CcPlayoutHistoryTemplateField filtered by the is_file_md column
+ * @method CcPlayoutHistoryTemplateField findOneByDbPosition(int $position) Return the first CcPlayoutHistoryTemplateField filtered by the position column
+ *
+ * @method array findByDbId(int $id) Return CcPlayoutHistoryTemplateField objects filtered by the id column
+ * @method array findByDbTemplateId(int $template_id) Return CcPlayoutHistoryTemplateField objects filtered by the template_id column
+ * @method array findByDbName(string $name) Return CcPlayoutHistoryTemplateField objects filtered by the name column
+ * @method array findByDbLabel(string $label) Return CcPlayoutHistoryTemplateField objects filtered by the label column
+ * @method array findByDbType(string $type) Return CcPlayoutHistoryTemplateField objects filtered by the type column
+ * @method array findByDbIsFileMD(boolean $is_file_md) Return CcPlayoutHistoryTemplateField objects filtered by the is_file_md column
+ * @method array findByDbPosition(int $position) Return CcPlayoutHistoryTemplateField objects filtered by the position column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlayoutHistoryTemplateFieldQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcPlayoutHistoryTemplateFieldQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcPlayoutHistoryTemplateField';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcPlayoutHistoryTemplateFieldQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcPlayoutHistoryTemplateField', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcPlayoutHistoryTemplateFieldQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcPlayoutHistoryTemplateFieldQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcPlayoutHistoryTemplateFieldQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcPlayoutHistoryTemplateFieldQuery) {
+ return $criteria;
+ }
+ $query = new CcPlayoutHistoryTemplateFieldQuery(null, null, $modelAlias);
- /**
- * Returns a new CcPlayoutHistoryTemplateFieldQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcPlayoutHistoryTemplateFieldQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcPlayoutHistoryTemplateFieldQuery) {
- return $criteria;
- }
- $query = new CcPlayoutHistoryTemplateFieldQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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 CcPlayoutHistoryTemplateField|array|mixed the result, formatted by the current formatter
- */
- public function findPk($key, $con = null)
- {
- if ((null !== ($obj = CcPlayoutHistoryTemplateFieldPeer::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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcPlayoutHistoryTemplateField|CcPlayoutHistoryTemplateField[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcPlayoutHistoryTemplateFieldPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplateFieldPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
- /**
- * Filter the query by primary key
- *
- * @param mixed $key Primary key to use for the query
- *
- * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
- */
- public function filterByPrimaryKey($key)
- {
- return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::ID, $key, Criteria::EQUAL);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPlayoutHistoryTemplateField A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * Filter the query by a list of primary keys
- *
- * @param array $keys The list of primary key to use for the query
- *
- * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
- */
- public function filterByPrimaryKeys($keys)
- {
- return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::ID, $keys, Criteria::IN);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPlayoutHistoryTemplateField A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "template_id", "name", "label", "type", "is_file_md", "position" FROM "cc_playout_history_template_field" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcPlayoutHistoryTemplateField();
+ $obj->hydrate($row);
+ CcPlayoutHistoryTemplateFieldPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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 CcPlayoutHistoryTemplateFieldQuery 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(CcPlayoutHistoryTemplateFieldPeer::ID, $dbId, $comparison);
- }
+ return $obj;
+ }
- /**
- * Filter the query on the template_id column
- *
- * @param int|array $dbTemplateId 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 CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
- */
- public function filterByDbTemplateId($dbTemplateId = null, $comparison = null)
- {
- if (is_array($dbTemplateId)) {
- $useMinMax = false;
- if (isset($dbTemplateId['min'])) {
- $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $dbTemplateId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbTemplateId['max'])) {
- $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $dbTemplateId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $dbTemplateId, $comparison);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPlayoutHistoryTemplateField|CcPlayoutHistoryTemplateField[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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 CcPlayoutHistoryTemplateFieldQuery 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(CcPlayoutHistoryTemplateFieldPeer::NAME, $dbName, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * 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 CcPlayoutHistoryTemplateFieldQuery 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(CcPlayoutHistoryTemplateFieldPeer::LABEL, $dbLabel, $comparison);
- }
+ /**
+ * 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|CcPlayoutHistoryTemplateField[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * 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 CcPlayoutHistoryTemplateFieldQuery 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(CcPlayoutHistoryTemplateFieldPeer::TYPE, $dbType, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * Filter the query on the is_file_md column
- *
- * @param boolean|string $dbIsFileMD 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 CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
- */
- public function filterByDbIsFileMD($dbIsFileMD = null, $comparison = null)
- {
- if (is_string($dbIsFileMD)) {
- $is_file_md = in_array(strtolower($dbIsFileMD), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
- }
- return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD, $dbIsFileMD, $comparison);
- }
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
- /**
- * 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 CcPlayoutHistoryTemplateFieldQuery 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(CcPlayoutHistoryTemplateFieldPeer::POSITION, $dbPosition['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbPosition['max'])) {
- $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::POSITION, $dbPosition['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::POSITION, $dbPosition, $comparison);
- }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * Filter the query by a related CcPlayoutHistoryTemplate object
- *
- * @param CcPlayoutHistoryTemplate $ccPlayoutHistoryTemplate the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
- */
- public function filterByCcPlayoutHistoryTemplate($ccPlayoutHistoryTemplate, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $ccPlayoutHistoryTemplate->getDbId(), $comparison);
- }
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
- /**
- * Adds a JOIN clause to the query using the CcPlayoutHistoryTemplate relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
- */
- public function joinCcPlayoutHistoryTemplate($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcPlayoutHistoryTemplate');
-
- // 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, 'CcPlayoutHistoryTemplate');
- }
-
- return $this;
- }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::ID, $keys, Criteria::IN);
+ }
- /**
- * Use the CcPlayoutHistoryTemplate relation CcPlayoutHistoryTemplate 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 CcPlayoutHistoryTemplateQuery A secondary query class using the current class as primary query
- */
- public function useCcPlayoutHistoryTemplateQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinCcPlayoutHistoryTemplate($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryTemplate', 'CcPlayoutHistoryTemplateQuery');
- }
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * Exclude object from result
- *
- * @param CcPlayoutHistoryTemplateField $ccPlayoutHistoryTemplateField Object to remove from the list of results
- *
- * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
- */
- public function prune($ccPlayoutHistoryTemplateField = null)
- {
- if ($ccPlayoutHistoryTemplateField) {
- $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::ID, $ccPlayoutHistoryTemplateField->getDbId(), Criteria::NOT_EQUAL);
- }
-
- return $this;
- }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::ID, $dbId, $comparison);
+ }
-} // BaseCcPlayoutHistoryTemplateFieldQuery
+ /**
+ * Filter the query on the template_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbTemplateId(1234); // WHERE template_id = 1234
+ * $query->filterByDbTemplateId(array(12, 34)); // WHERE template_id IN (12, 34)
+ * $query->filterByDbTemplateId(array('min' => 12)); // WHERE template_id >= 12
+ * $query->filterByDbTemplateId(array('max' => 12)); // WHERE template_id <= 12
+ *
+ *
+ * @see filterByCcPlayoutHistoryTemplate()
+ *
+ * @param mixed $dbTemplateId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function filterByDbTemplateId($dbTemplateId = null, $comparison = null)
+ {
+ if (is_array($dbTemplateId)) {
+ $useMinMax = false;
+ if (isset($dbTemplateId['min'])) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $dbTemplateId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbTemplateId['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $dbTemplateId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $dbTemplateId, $comparison);
+ }
+
+ /**
+ * Filter the query on the name column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbName('fooValue'); // WHERE name = 'fooValue'
+ * $query->filterByDbName('%fooValue%'); // WHERE name LIKE '%fooValue%'
+ *
+ *
+ * @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 CcPlayoutHistoryTemplateFieldQuery 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(CcPlayoutHistoryTemplateFieldPeer::NAME, $dbName, $comparison);
+ }
+
+ /**
+ * Filter the query on the label column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLabel('fooValue'); // WHERE label = 'fooValue'
+ * $query->filterByDbLabel('%fooValue%'); // WHERE label LIKE '%fooValue%'
+ *
+ *
+ * @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 CcPlayoutHistoryTemplateFieldQuery 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(CcPlayoutHistoryTemplateFieldPeer::LABEL, $dbLabel, $comparison);
+ }
+
+ /**
+ * Filter the query on the type column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbType('fooValue'); // WHERE type = 'fooValue'
+ * $query->filterByDbType('%fooValue%'); // WHERE type LIKE '%fooValue%'
+ *
+ *
+ * @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 CcPlayoutHistoryTemplateFieldQuery 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(CcPlayoutHistoryTemplateFieldPeer::TYPE, $dbType, $comparison);
+ }
+
+ /**
+ * Filter the query on the is_file_md column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbIsFileMD(true); // WHERE is_file_md = true
+ * $query->filterByDbIsFileMD('yes'); // WHERE is_file_md = true
+ *
+ *
+ * @param boolean|string $dbIsFileMD The value to use as filter.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function filterByDbIsFileMD($dbIsFileMD = null, $comparison = null)
+ {
+ if (is_string($dbIsFileMD)) {
+ $dbIsFileMD = in_array(strtolower($dbIsFileMD), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
+
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::IS_FILE_MD, $dbIsFileMD, $comparison);
+ }
+
+ /**
+ * Filter the query on the position column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbPosition(1234); // WHERE position = 1234
+ * $query->filterByDbPosition(array(12, 34)); // WHERE position IN (12, 34)
+ * $query->filterByDbPosition(array('min' => 12)); // WHERE position >= 12
+ * $query->filterByDbPosition(array('max' => 12)); // WHERE position <= 12
+ *
+ *
+ * @param mixed $dbPosition The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryTemplateFieldQuery 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(CcPlayoutHistoryTemplateFieldPeer::POSITION, $dbPosition['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbPosition['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::POSITION, $dbPosition['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::POSITION, $dbPosition, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcPlayoutHistoryTemplate object
+ *
+ * @param CcPlayoutHistoryTemplate|PropelObjectCollection $ccPlayoutHistoryTemplate The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcPlayoutHistoryTemplate($ccPlayoutHistoryTemplate, $comparison = null)
+ {
+ if ($ccPlayoutHistoryTemplate instanceof CcPlayoutHistoryTemplate) {
+ return $this
+ ->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $ccPlayoutHistoryTemplate->getDbId(), $comparison);
+ } elseif ($ccPlayoutHistoryTemplate instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::TEMPLATE_ID, $ccPlayoutHistoryTemplate->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcPlayoutHistoryTemplate() only accepts arguments of type CcPlayoutHistoryTemplate or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcPlayoutHistoryTemplate relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function joinCcPlayoutHistoryTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcPlayoutHistoryTemplate');
+
+ // 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, 'CcPlayoutHistoryTemplate');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcPlayoutHistoryTemplate relation CcPlayoutHistoryTemplate 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 CcPlayoutHistoryTemplateQuery A secondary query class using the current class as primary query
+ */
+ public function useCcPlayoutHistoryTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcPlayoutHistoryTemplate($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryTemplate', 'CcPlayoutHistoryTemplateQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcPlayoutHistoryTemplateField $ccPlayoutHistoryTemplateField Object to remove from the list of results
+ *
+ * @return CcPlayoutHistoryTemplateFieldQuery The current query, for fluid interface
+ */
+ public function prune($ccPlayoutHistoryTemplateField = null)
+ {
+ if ($ccPlayoutHistoryTemplateField) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplateFieldPeer::ID, $ccPlayoutHistoryTemplateField->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplatePeer.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplatePeer.php
index 9e1d216f1..89c7cdc9d 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplatePeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplatePeer.php
@@ -4,740 +4,762 @@
/**
* Base static class for performing query and update operations on the 'cc_playout_history_template' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcPlayoutHistoryTemplatePeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_playout_history_template';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcPlayoutHistoryTemplate';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcPlayoutHistoryTemplate';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcPlayoutHistoryTemplateTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 3;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_playout_history_template.ID';
-
- /** the column name for the NAME field */
- const NAME = 'cc_playout_history_template.NAME';
-
- /** the column name for the TYPE field */
- const TYPE = 'cc_playout_history_template.TYPE';
-
- /**
- * An identiy map to hold any loaded instances of CcPlayoutHistoryTemplate objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcPlayoutHistoryTemplate[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbType', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbType', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::TYPE, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'TYPE', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'name', '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 ('DbId' => 0, 'DbName' => 1, 'DbType' => 2, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbType' => 2, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::TYPE => 2, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'TYPE' => 2, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 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. CcPlayoutHistoryTemplatePeer::COLUMN_NAME).
- * @return string
- */
- public static function alias($alias, $column)
- {
- return str_replace(CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::ID);
- $criteria->addSelectColumn(CcPlayoutHistoryTemplatePeer::NAME);
- $criteria->addSelectColumn(CcPlayoutHistoryTemplatePeer::TYPE);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.NAME');
- $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(CcPlayoutHistoryTemplatePeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplate
- * @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 = CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplatePeer::populateObjects(CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- if (!$criteria->hasSelectClause()) {
- $criteria = clone $criteria;
- CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplate $value A CcPlayoutHistoryTemplate object.
- * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
- */
- public static function addInstanceToPool(CcPlayoutHistoryTemplate $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 CcPlayoutHistoryTemplate object or a primary key value.
- */
- public static function removeInstanceFromPool($value)
- {
- if (Propel::isInstancePoolingEnabled() && $value !== null) {
- if (is_object($value) && $value instanceof CcPlayoutHistoryTemplate) {
- $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 CcPlayoutHistoryTemplate 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 CcPlayoutHistoryTemplate 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_playout_history_template
- * by a foreign key with ON DELETE CASCADE
- */
- public static function clearRelatedInstancePool()
- {
- // Invalidate objects in CcPlayoutHistoryTemplateFieldPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CcPlayoutHistoryTemplateFieldPeer::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 = CcPlayoutHistoryTemplatePeer::getOMClass(false);
- // populate the object(s)
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj = CcPlayoutHistoryTemplatePeer::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;
- CcPlayoutHistoryTemplatePeer::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 (CcPlayoutHistoryTemplate object, last column rank)
- */
- public static function populateObject($row, $startcol = 0)
- {
- $key = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol);
- if (null !== ($obj = CcPlayoutHistoryTemplatePeer::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 + CcPlayoutHistoryTemplatePeer::NUM_COLUMNS;
- } else {
- $cls = CcPlayoutHistoryTemplatePeer::OM_CLASS;
- $obj = new $cls();
- $col = $obj->hydrate($row, $startcol);
- CcPlayoutHistoryTemplatePeer::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(BaseCcPlayoutHistoryTemplatePeer::DATABASE_NAME);
- if (!$dbMap->hasTable(BaseCcPlayoutHistoryTemplatePeer::TABLE_NAME))
- {
- $dbMap->addTableObject(new CcPlayoutHistoryTemplateTableMap());
- }
- }
-
- /**
- * 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 ? CcPlayoutHistoryTemplatePeer::CLASS_DEFAULT : CcPlayoutHistoryTemplatePeer::OM_CLASS;
- }
-
- /**
- * Method perform an INSERT on the database, given a CcPlayoutHistoryTemplate or Criteria object.
- *
- * @param mixed $values Criteria or CcPlayoutHistoryTemplate 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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
- } else {
- $criteria = $values->buildCriteria(); // build Criteria from CcPlayoutHistoryTemplate object
- }
-
- if ($criteria->containsKey(CcPlayoutHistoryTemplatePeer::ID) && $criteria->keyContainsValue(CcPlayoutHistoryTemplatePeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplate or Criteria object.
- *
- * @param mixed $values Criteria or CcPlayoutHistoryTemplate 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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $selectCriteria = new Criteria(self::DATABASE_NAME);
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
-
- $comparison = $criteria->getComparison(CcPlayoutHistoryTemplatePeer::ID);
- $value = $criteria->remove(CcPlayoutHistoryTemplatePeer::ID);
- if ($value) {
- $selectCriteria->add(CcPlayoutHistoryTemplatePeer::ID, $value, $comparison);
- } else {
- $selectCriteria->setPrimaryTableName(CcPlayoutHistoryTemplatePeer::TABLE_NAME);
- }
-
- } else { // $values is CcPlayoutHistoryTemplate 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_playout_history_template 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(CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::TABLE_NAME, $con, CcPlayoutHistoryTemplatePeer::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).
- CcPlayoutHistoryTemplatePeer::clearInstancePool();
- CcPlayoutHistoryTemplatePeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Method perform a DELETE on the database, given a CcPlayoutHistoryTemplate or Criteria object OR a primary key value.
- *
- * @param mixed $values Criteria or CcPlayoutHistoryTemplate 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(CcPlayoutHistoryTemplatePeer::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.
- CcPlayoutHistoryTemplatePeer::clearInstancePool();
- // rename for clarity
- $criteria = clone $values;
- } elseif ($values instanceof CcPlayoutHistoryTemplate) { // it's a model object
- // invalidate the cache for this single object
- CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::ID, (array) $values, Criteria::IN);
- // invalidate the cache for this object(s)
- foreach ((array) $values as $singleval) {
- CcPlayoutHistoryTemplatePeer::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);
- CcPlayoutHistoryTemplatePeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Validates all modified columns of given CcPlayoutHistoryTemplate 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 CcPlayoutHistoryTemplate $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(CcPlayoutHistoryTemplate $obj, $cols = null)
- {
- $columns = array();
-
- if ($cols) {
- $dbMap = Propel::getDatabaseMap(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
- $tableMap = $dbMap->getTable(CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, CcPlayoutHistoryTemplatePeer::TABLE_NAME, $columns);
- }
-
- /**
- * Retrieve a single object by pkey.
- *
- * @param int $pk the primary key.
- * @param PropelPDO $con the connection to use
- * @return CcPlayoutHistoryTemplate
- */
- public static function retrieveByPK($pk, PropelPDO $con = null)
- {
-
- if (null !== ($obj = CcPlayoutHistoryTemplatePeer::getInstanceFromPool((string) $pk))) {
- return $obj;
- }
-
- if ($con === null) {
- $con = Propel::getConnection(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria = new Criteria(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
- $criteria->add(CcPlayoutHistoryTemplatePeer::ID, $pk);
-
- $v = CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $objs = null;
- if (empty($pks)) {
- $objs = array();
- } else {
- $criteria = new Criteria(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
- $criteria->add(CcPlayoutHistoryTemplatePeer::ID, $pks, Criteria::IN);
- $objs = CcPlayoutHistoryTemplatePeer::doSelect($criteria, $con);
- }
- return $objs;
- }
+abstract class BaseCcPlayoutHistoryTemplatePeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_playout_history_template';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcPlayoutHistoryTemplate';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcPlayoutHistoryTemplateTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 3;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 3;
+
+ /** the column name for the id field */
+ const ID = 'cc_playout_history_template.id';
+
+ /** the column name for the name field */
+ const NAME = 'cc_playout_history_template.name';
+
+ /** the column name for the type field */
+ const TYPE = 'cc_playout_history_template.type';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcPlayoutHistoryTemplate objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcPlayoutHistoryTemplate[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcPlayoutHistoryTemplatePeer::$fieldNames[CcPlayoutHistoryTemplatePeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbType', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbType', ),
+ BasePeer::TYPE_COLNAME => array (CcPlayoutHistoryTemplatePeer::ID, CcPlayoutHistoryTemplatePeer::NAME, CcPlayoutHistoryTemplatePeer::TYPE, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'TYPE', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'name', '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. CcPlayoutHistoryTemplatePeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbType' => 2, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbType' => 2, ),
+ BasePeer::TYPE_COLNAME => array (CcPlayoutHistoryTemplatePeer::ID => 0, CcPlayoutHistoryTemplatePeer::NAME => 1, CcPlayoutHistoryTemplatePeer::TYPE => 2, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'TYPE' => 2, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcPlayoutHistoryTemplatePeer::getFieldNames($toType);
+ $key = isset(CcPlayoutHistoryTemplatePeer::$fieldKeys[$fromType][$name]) ? CcPlayoutHistoryTemplatePeer::$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(CcPlayoutHistoryTemplatePeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcPlayoutHistoryTemplatePeer::$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 CcPlayoutHistoryTemplatePeer::$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. CcPlayoutHistoryTemplatePeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::ID);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplatePeer::NAME);
+ $criteria->addSelectColumn(CcPlayoutHistoryTemplatePeer::TYPE);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.name');
+ $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(CcPlayoutHistoryTemplatePeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcPlayoutHistoryTemplatePeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(CcPlayoutHistoryTemplatePeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplatePeer::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;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcPlayoutHistoryTemplate
+ * @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 = CcPlayoutHistoryTemplatePeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 CcPlayoutHistoryTemplatePeer::populateObjects(CcPlayoutHistoryTemplatePeer::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 directly (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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcPlayoutHistoryTemplatePeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryTemplatePeer::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 CcPlayoutHistoryTemplate $obj A CcPlayoutHistoryTemplate object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcPlayoutHistoryTemplatePeer::$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 CcPlayoutHistoryTemplate object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcPlayoutHistoryTemplate) {
+ $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 CcPlayoutHistoryTemplate object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(CcPlayoutHistoryTemplatePeer::$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 CcPlayoutHistoryTemplate 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(CcPlayoutHistoryTemplatePeer::$instances[$key])) {
+ return CcPlayoutHistoryTemplatePeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcPlayoutHistoryTemplatePeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcPlayoutHistoryTemplatePeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_playout_history_template
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ // Invalidate objects in CcPlayoutHistoryTemplateFieldPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcPlayoutHistoryTemplateFieldPeer::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 = CcPlayoutHistoryTemplatePeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcPlayoutHistoryTemplatePeer::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;
+ CcPlayoutHistoryTemplatePeer::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 (CcPlayoutHistoryTemplate object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcPlayoutHistoryTemplatePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcPlayoutHistoryTemplatePeer::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 + CcPlayoutHistoryTemplatePeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = CcPlayoutHistoryTemplatePeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME)->getTable(CcPlayoutHistoryTemplatePeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcPlayoutHistoryTemplatePeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcPlayoutHistoryTemplatePeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \CcPlayoutHistoryTemplateTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcPlayoutHistoryTemplatePeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a CcPlayoutHistoryTemplate or Criteria object.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryTemplate 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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcPlayoutHistoryTemplate object
+ }
+
+ if ($criteria->containsKey(CcPlayoutHistoryTemplatePeer::ID) && $criteria->keyContainsValue(CcPlayoutHistoryTemplatePeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcPlayoutHistoryTemplatePeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryTemplatePeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a CcPlayoutHistoryTemplate or Criteria object.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryTemplate 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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcPlayoutHistoryTemplatePeer::ID);
+ $value = $criteria->remove(CcPlayoutHistoryTemplatePeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcPlayoutHistoryTemplatePeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcPlayoutHistoryTemplatePeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcPlayoutHistoryTemplate object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_playout_history_template table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::TABLE_NAME, $con, CcPlayoutHistoryTemplatePeer::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).
+ CcPlayoutHistoryTemplatePeer::clearInstancePool();
+ CcPlayoutHistoryTemplatePeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a CcPlayoutHistoryTemplate or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcPlayoutHistoryTemplate 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(CcPlayoutHistoryTemplatePeer::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.
+ CcPlayoutHistoryTemplatePeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcPlayoutHistoryTemplate) { // it's a model object
+ // invalidate the cache for this single object
+ CcPlayoutHistoryTemplatePeer::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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplatePeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcPlayoutHistoryTemplatePeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcPlayoutHistoryTemplatePeer::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);
+ CcPlayoutHistoryTemplatePeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcPlayoutHistoryTemplate 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 CcPlayoutHistoryTemplate $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($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcPlayoutHistoryTemplatePeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, CcPlayoutHistoryTemplatePeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcPlayoutHistoryTemplate
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcPlayoutHistoryTemplatePeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplatePeer::ID, $pk);
+
+ $v = CcPlayoutHistoryTemplatePeer::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
+ * @return CcPlayoutHistoryTemplate[]
+ * @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(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcPlayoutHistoryTemplatePeer::DATABASE_NAME);
+ $criteria->add(CcPlayoutHistoryTemplatePeer::ID, $pks, Criteria::IN);
+ $objs = CcPlayoutHistoryTemplatePeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
} // BaseCcPlayoutHistoryTemplatePeer
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateQuery.php
index ca2f84229..262b0ee2c 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlayoutHistoryTemplateQuery.php
@@ -4,282 +4,417 @@
/**
* Base class that represents a query for the 'cc_playout_history_template' table.
*
- *
*
- * @method CcPlayoutHistoryTemplateQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcPlayoutHistoryTemplateQuery orderByDbName($order = Criteria::ASC) Order by the name column
- * @method CcPlayoutHistoryTemplateQuery orderByDbType($order = Criteria::ASC) Order by the type column
*
- * @method CcPlayoutHistoryTemplateQuery groupByDbId() Group by the id column
- * @method CcPlayoutHistoryTemplateQuery groupByDbName() Group by the name column
- * @method CcPlayoutHistoryTemplateQuery groupByDbType() Group by the type column
+ * @method CcPlayoutHistoryTemplateQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcPlayoutHistoryTemplateQuery orderByDbName($order = Criteria::ASC) Order by the name column
+ * @method CcPlayoutHistoryTemplateQuery orderByDbType($order = Criteria::ASC) Order by the type column
*
- * @method CcPlayoutHistoryTemplateQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcPlayoutHistoryTemplateQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcPlayoutHistoryTemplateQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcPlayoutHistoryTemplateQuery groupByDbId() Group by the id column
+ * @method CcPlayoutHistoryTemplateQuery groupByDbName() Group by the name column
+ * @method CcPlayoutHistoryTemplateQuery groupByDbType() Group by the type column
*
- * @method CcPlayoutHistoryTemplateQuery leftJoinCcPlayoutHistoryTemplateField($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistoryTemplateField relation
- * @method CcPlayoutHistoryTemplateQuery rightJoinCcPlayoutHistoryTemplateField($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistoryTemplateField relation
- * @method CcPlayoutHistoryTemplateQuery innerJoinCcPlayoutHistoryTemplateField($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistoryTemplateField relation
+ * @method CcPlayoutHistoryTemplateQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcPlayoutHistoryTemplateQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcPlayoutHistoryTemplateQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcPlayoutHistoryTemplate findOne(PropelPDO $con = null) Return the first CcPlayoutHistoryTemplate matching the query
- * @method CcPlayoutHistoryTemplate findOneOrCreate(PropelPDO $con = null) Return the first CcPlayoutHistoryTemplate matching the query, or a new CcPlayoutHistoryTemplate object populated from the query conditions when no match is found
+ * @method CcPlayoutHistoryTemplateQuery leftJoinCcPlayoutHistoryTemplateField($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPlayoutHistoryTemplateField relation
+ * @method CcPlayoutHistoryTemplateQuery rightJoinCcPlayoutHistoryTemplateField($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPlayoutHistoryTemplateField relation
+ * @method CcPlayoutHistoryTemplateQuery innerJoinCcPlayoutHistoryTemplateField($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPlayoutHistoryTemplateField relation
*
- * @method CcPlayoutHistoryTemplate findOneByDbId(int $id) Return the first CcPlayoutHistoryTemplate filtered by the id column
- * @method CcPlayoutHistoryTemplate findOneByDbName(string $name) Return the first CcPlayoutHistoryTemplate filtered by the name column
- * @method CcPlayoutHistoryTemplate findOneByDbType(string $type) Return the first CcPlayoutHistoryTemplate filtered by the type column
+ * @method CcPlayoutHistoryTemplate findOne(PropelPDO $con = null) Return the first CcPlayoutHistoryTemplate matching the query
+ * @method CcPlayoutHistoryTemplate findOneOrCreate(PropelPDO $con = null) Return the first CcPlayoutHistoryTemplate matching the query, or a new CcPlayoutHistoryTemplate object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcPlayoutHistoryTemplate objects filtered by the id column
- * @method array findByDbName(string $name) Return CcPlayoutHistoryTemplate objects filtered by the name column
- * @method array findByDbType(string $type) Return CcPlayoutHistoryTemplate objects filtered by the type column
+ * @method CcPlayoutHistoryTemplate findOneByDbName(string $name) Return the first CcPlayoutHistoryTemplate filtered by the name column
+ * @method CcPlayoutHistoryTemplate findOneByDbType(string $type) Return the first CcPlayoutHistoryTemplate filtered by the type column
+ *
+ * @method array findByDbId(int $id) Return CcPlayoutHistoryTemplate objects filtered by the id column
+ * @method array findByDbName(string $name) Return CcPlayoutHistoryTemplate objects filtered by the name column
+ * @method array findByDbType(string $type) Return CcPlayoutHistoryTemplate objects filtered by the type column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPlayoutHistoryTemplateQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcPlayoutHistoryTemplateQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcPlayoutHistoryTemplate';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcPlayoutHistoryTemplateQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcPlayoutHistoryTemplate', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcPlayoutHistoryTemplateQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcPlayoutHistoryTemplateQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcPlayoutHistoryTemplateQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcPlayoutHistoryTemplateQuery) {
+ return $criteria;
+ }
+ $query = new CcPlayoutHistoryTemplateQuery(null, null, $modelAlias);
- /**
- * Returns a new CcPlayoutHistoryTemplateQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcPlayoutHistoryTemplateQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcPlayoutHistoryTemplateQuery) {
- return $criteria;
- }
- $query = new CcPlayoutHistoryTemplateQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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 CcPlayoutHistoryTemplate|array|mixed the result, formatted by the current formatter
- */
- public function findPk($key, $con = null)
- {
- if ((null !== ($obj = CcPlayoutHistoryTemplatePeer::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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcPlayoutHistoryTemplate|CcPlayoutHistoryTemplate[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcPlayoutHistoryTemplatePeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcPlayoutHistoryTemplatePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
- /**
- * Filter the query by primary key
- *
- * @param mixed $key Primary key to use for the query
- *
- * @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
- */
- public function filterByPrimaryKey($key)
- {
- return $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $key, Criteria::EQUAL);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPlayoutHistoryTemplate A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * Filter the query by a list of primary keys
- *
- * @param array $keys The list of primary key to use for the query
- *
- * @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
- */
- public function filterByPrimaryKeys($keys)
- {
- return $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $keys, Criteria::IN);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPlayoutHistoryTemplate A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "name", "type" FROM "cc_playout_history_template" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcPlayoutHistoryTemplate();
+ $obj->hydrate($row);
+ CcPlayoutHistoryTemplatePeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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 CcPlayoutHistoryTemplateQuery 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(CcPlayoutHistoryTemplatePeer::ID, $dbId, $comparison);
- }
+ return $obj;
+ }
- /**
- * 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 CcPlayoutHistoryTemplateQuery 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(CcPlayoutHistoryTemplatePeer::NAME, $dbName, $comparison);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPlayoutHistoryTemplate|CcPlayoutHistoryTemplate[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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 CcPlayoutHistoryTemplateQuery 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(CcPlayoutHistoryTemplatePeer::TYPE, $dbType, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * Filter the query by a related CcPlayoutHistoryTemplateField object
- *
- * @param CcPlayoutHistoryTemplateField $ccPlayoutHistoryTemplateField the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
- */
- public function filterByCcPlayoutHistoryTemplateField($ccPlayoutHistoryTemplateField, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $ccPlayoutHistoryTemplateField->getDbTemplateId(), $comparison);
- }
+ /**
+ * 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|CcPlayoutHistoryTemplate[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * Adds a JOIN clause to the query using the CcPlayoutHistoryTemplateField relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
- */
- public function joinCcPlayoutHistoryTemplateField($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcPlayoutHistoryTemplateField');
-
- // 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, 'CcPlayoutHistoryTemplateField');
- }
-
- return $this;
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * Use the CcPlayoutHistoryTemplateField relation CcPlayoutHistoryTemplateField 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 CcPlayoutHistoryTemplateFieldQuery A secondary query class using the current class as primary query
- */
- public function useCcPlayoutHistoryTemplateFieldQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinCcPlayoutHistoryTemplateField($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryTemplateField', 'CcPlayoutHistoryTemplateFieldQuery');
- }
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
- /**
- * Exclude object from result
- *
- * @param CcPlayoutHistoryTemplate $ccPlayoutHistoryTemplate Object to remove from the list of results
- *
- * @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
- */
- public function prune($ccPlayoutHistoryTemplate = null)
- {
- if ($ccPlayoutHistoryTemplate) {
- $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $ccPlayoutHistoryTemplate->getDbId(), Criteria::NOT_EQUAL);
- }
-
- return $this;
- }
+ return $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $key, Criteria::EQUAL);
+ }
-} // BaseCcPlayoutHistoryTemplateQuery
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the name column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbName('fooValue'); // WHERE name = 'fooValue'
+ * $query->filterByDbName('%fooValue%'); // WHERE name LIKE '%fooValue%'
+ *
+ *
+ * @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 CcPlayoutHistoryTemplateQuery 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(CcPlayoutHistoryTemplatePeer::NAME, $dbName, $comparison);
+ }
+
+ /**
+ * Filter the query on the type column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbType('fooValue'); // WHERE type = 'fooValue'
+ * $query->filterByDbType('%fooValue%'); // WHERE type LIKE '%fooValue%'
+ *
+ *
+ * @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 CcPlayoutHistoryTemplateQuery 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(CcPlayoutHistoryTemplatePeer::TYPE, $dbType, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcPlayoutHistoryTemplateField object
+ *
+ * @param CcPlayoutHistoryTemplateField|PropelObjectCollection $ccPlayoutHistoryTemplateField the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcPlayoutHistoryTemplateField($ccPlayoutHistoryTemplateField, $comparison = null)
+ {
+ if ($ccPlayoutHistoryTemplateField instanceof CcPlayoutHistoryTemplateField) {
+ return $this
+ ->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $ccPlayoutHistoryTemplateField->getDbTemplateId(), $comparison);
+ } elseif ($ccPlayoutHistoryTemplateField instanceof PropelObjectCollection) {
+ return $this
+ ->useCcPlayoutHistoryTemplateFieldQuery()
+ ->filterByPrimaryKeys($ccPlayoutHistoryTemplateField->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcPlayoutHistoryTemplateField() only accepts arguments of type CcPlayoutHistoryTemplateField or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcPlayoutHistoryTemplateField relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
+ */
+ public function joinCcPlayoutHistoryTemplateField($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcPlayoutHistoryTemplateField');
+
+ // 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, 'CcPlayoutHistoryTemplateField');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcPlayoutHistoryTemplateField relation CcPlayoutHistoryTemplateField 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 CcPlayoutHistoryTemplateFieldQuery A secondary query class using the current class as primary query
+ */
+ public function useCcPlayoutHistoryTemplateFieldQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcPlayoutHistoryTemplateField($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistoryTemplateField', 'CcPlayoutHistoryTemplateFieldQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcPlayoutHistoryTemplate $ccPlayoutHistoryTemplate Object to remove from the list of results
+ *
+ * @return CcPlayoutHistoryTemplateQuery The current query, for fluid interface
+ */
+ public function prune($ccPlayoutHistoryTemplate = null)
+ {
+ if ($ccPlayoutHistoryTemplate) {
+ $this->addUsingAlias(CcPlayoutHistoryTemplatePeer::ID, $ccPlayoutHistoryTemplate->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPref.php b/airtime_mvc/application/models/airtime/om/BaseCcPref.php
index b1d9a307e..ce56f1f30 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPref.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPref.php
@@ -4,902 +4,1048 @@
/**
* Base class that represents a row from the 'cc_pref' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcPref extends BaseObject implements Persistent
+abstract class BaseCcPref extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcPrefPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcPrefPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the subjid field.
- * @var int
- */
- protected $subjid;
-
- /**
- * The value for the keystr field.
- * @var string
- */
- protected $keystr;
-
- /**
- * The value for the valstr field.
- * @var string
- */
- protected $valstr;
-
- /**
- * @var CcSubjs
- */
- protected $aCcSubjs;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Get the [id] column value.
- *
- * @return int
- */
- public function getId()
- {
- return $this->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
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcPrefPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcPrefPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the subjid field.
+ * @var int
+ */
+ protected $subjid;
+
+ /**
+ * The value for the keystr field.
+ * @var string
+ */
+ protected $keystr;
+
+ /**
+ * The value for the valstr field.
+ * @var string
+ */
+ protected $valstr;
+
+ /**
+ * @var CcSubjs
+ */
+ protected $aCcSubjs;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+
+ return $this->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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 resultset 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();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 4; // 4 = CcPrefPeer::NUM_HYDRATE_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
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcPrefQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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 (Exception $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 corresponding 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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcPrefPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcPrefPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_pref_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcPrefPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcPrefPeer::SUBJID)) {
+ $modifiedColumns[':p' . $index++] = '"subjid"';
+ }
+ if ($this->isColumnModified(CcPrefPeer::KEYSTR)) {
+ $modifiedColumns[':p' . $index++] = '"keystr"';
+ }
+ if ($this->isColumnModified(CcPrefPeer::VALSTR)) {
+ $modifiedColumns[':p' . $index++] = '"valstr"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_pref" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"subjid"':
+ $stmt->bindValue($identifier, $this->subjid, PDO::PARAM_INT);
+ break;
+ case '"keystr"':
+ $stmt->bindValue($identifier, $this->keystr, PDO::PARAM_STR);
+ break;
+ case '"valstr"':
+ $stmt->bindValue($identifier, $this->valstr, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcPref'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcPref'][$this->getPrimaryKey()] = true;
+ $keys = CcPrefPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getSubjid(),
+ $keys[2] => $this->getKeystr(),
+ $keys[3] => $this->getValstr(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcSubjs) {
+ $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcPrefPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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 BasePeer::TYPE_PHPNAME
+ *
+ * @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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setSubjid($this->getSubjid());
+ $copyObj->setKeystr($this->getKeystr());
+ $copyObj->setValstr($this->getValstr());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcSubjs The associated CcSubjs object.
+ * @throws PropelException
+ */
+ public function getCcSubjs(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcSubjs === null && ($this->subjid !== null) && $doQuery) {
+ $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->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->aCcSubjs instanceof Persistent) {
+ $this->aCcSubjs->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ $this->aCcSubjs = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcPrefPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPrefPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcPrefPeer.php
index cb6345eac..4dceb1f21 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPrefPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPrefPeer.php
@@ -4,976 +4,1002 @@
/**
* Base static class for performing query and update operations on the 'cc_pref' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcPrefPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_pref';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcPref';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcPref';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcPrefTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 4;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_pref.ID';
-
- /** the column name for the SUBJID field */
- const SUBJID = 'cc_pref.SUBJID';
-
- /** the column name for the KEYSTR field */
- const KEYSTR = 'cc_pref.KEYSTR';
-
- /** the column name for the VALSTR field */
- const VALSTR = 'cc_pref.VALSTR';
-
- /**
- * An identiy map to hold any loaded instances of CcPref objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcPref[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => 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;
- }
+abstract class BaseCcPrefPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_pref';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcPref';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcPrefTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 4;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 4;
+
+ /** the column name for the id field */
+ const ID = 'cc_pref.id';
+
+ /** the column name for the subjid field */
+ const SUBJID = 'cc_pref.subjid';
+
+ /** the column name for the keystr field */
+ const KEYSTR = 'cc_pref.keystr';
+
+ /** the column name for the valstr field */
+ const VALSTR = 'cc_pref.valstr';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcPref objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcPref[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcPrefPeer::$fieldNames[CcPrefPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Id', 'Subjid', 'Keystr', 'Valstr', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'subjid', 'keystr', 'valstr', ),
+ BasePeer::TYPE_COLNAME => array (CcPrefPeer::ID, CcPrefPeer::SUBJID, CcPrefPeer::KEYSTR, CcPrefPeer::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. CcPrefPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected 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 (CcPrefPeer::ID => 0, CcPrefPeer::SUBJID => 1, CcPrefPeer::KEYSTR => 2, CcPrefPeer::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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcPrefPeer::getFieldNames($toType);
+ $key = isset(CcPrefPeer::$fieldKeys[$fromType][$name]) ? CcPrefPeer::$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(CcPrefPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcPrefPeer::$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 CcPrefPeer::$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(CcPrefPeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcPrefPeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getId();
+ } // if key === null
+ CcPrefPeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcPrefPeer::$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(CcPrefPeer::$instances[$key])) {
+ return CcPrefPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcPrefPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcPrefPeer::$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();
+ // 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_HYDRATE_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(CcPrefPeer::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(CcPrefPeer::DATABASE_NAME);
+ }
+
+ CcPrefPeer::addSelectColumns($criteria);
+ $startcol = CcPrefPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcPrefPeer::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(CcPrefPeer::DATABASE_NAME);
+ }
+
+ CcPrefPeer::addSelectColumns($criteria);
+ $startcol2 = CcPrefPeer::NUM_HYDRATE_COLUMNS;
+
+ CcSubjsPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcSubjsPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcPrefPeer::DATABASE_NAME)->getTable(CcPrefPeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcPrefPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcPrefPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcPrefPeer::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(CcPrefPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_pref table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcPrefPeer::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(CcPrefPeer::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 (Exception $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($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->hasColumn($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
+ * @return CcPref[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPrefQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPrefQuery.php
index 473bafc98..5e300ab69 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPrefQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPrefQuery.php
@@ -4,317 +4,467 @@
/**
* Base class that represents a query for the 'cc_pref' table.
*
- *
*
- * @method CcPrefQuery orderById($order = Criteria::ASC) Order by the id column
- * @method CcPrefQuery orderBySubjid($order = Criteria::ASC) Order by the subjid column
- * @method CcPrefQuery orderByKeystr($order = Criteria::ASC) Order by the keystr column
- * @method CcPrefQuery orderByValstr($order = Criteria::ASC) Order by the valstr column
*
- * @method CcPrefQuery groupById() Group by the id column
- * @method CcPrefQuery groupBySubjid() Group by the subjid column
- * @method CcPrefQuery groupByKeystr() Group by the keystr column
- * @method CcPrefQuery groupByValstr() Group by the valstr column
+ * @method CcPrefQuery orderById($order = Criteria::ASC) Order by the id column
+ * @method CcPrefQuery orderBySubjid($order = Criteria::ASC) Order by the subjid column
+ * @method CcPrefQuery orderByKeystr($order = Criteria::ASC) Order by the keystr column
+ * @method CcPrefQuery orderByValstr($order = Criteria::ASC) Order by the valstr column
*
- * @method CcPrefQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcPrefQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcPrefQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcPrefQuery groupById() Group by the id column
+ * @method CcPrefQuery groupBySubjid() Group by the subjid column
+ * @method CcPrefQuery groupByKeystr() Group by the keystr column
+ * @method CcPrefQuery groupByValstr() Group by the valstr column
*
- * @method CcPrefQuery leftJoinCcSubjs($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjs relation
- * @method CcPrefQuery rightJoinCcSubjs($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjs relation
- * @method CcPrefQuery innerJoinCcSubjs($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjs relation
+ * @method CcPrefQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcPrefQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcPrefQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcPref findOne(PropelPDO $con = null) Return the first CcPref matching the query
- * @method CcPref findOneOrCreate(PropelPDO $con = null) Return the first CcPref matching the query, or a new CcPref object populated from the query conditions when no match is found
+ * @method CcPrefQuery leftJoinCcSubjs($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSubjs relation
+ * @method CcPrefQuery rightJoinCcSubjs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjs relation
+ * @method CcPrefQuery innerJoinCcSubjs($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjs relation
*
- * @method CcPref findOneById(int $id) Return the first CcPref filtered by the id column
- * @method CcPref findOneBySubjid(int $subjid) Return the first CcPref filtered by the subjid column
- * @method CcPref findOneByKeystr(string $keystr) Return the first CcPref filtered by the keystr column
- * @method CcPref findOneByValstr(string $valstr) Return the first CcPref filtered by the valstr column
+ * @method CcPref findOne(PropelPDO $con = null) Return the first CcPref matching the query
+ * @method CcPref findOneOrCreate(PropelPDO $con = null) Return the first CcPref matching the query, or a new CcPref object populated from the query conditions when no match is found
*
- * @method array findById(int $id) Return CcPref objects filtered by the id column
- * @method array findBySubjid(int $subjid) Return CcPref objects filtered by the subjid column
- * @method array findByKeystr(string $keystr) Return CcPref objects filtered by the keystr column
- * @method array findByValstr(string $valstr) Return CcPref objects filtered by the valstr column
+ * @method CcPref findOneBySubjid(int $subjid) Return the first CcPref filtered by the subjid column
+ * @method CcPref findOneByKeystr(string $keystr) Return the first CcPref filtered by the keystr column
+ * @method CcPref findOneByValstr(string $valstr) Return the first CcPref filtered by the valstr column
+ *
+ * @method array findById(int $id) Return CcPref objects filtered by the id column
+ * @method array findBySubjid(int $subjid) Return CcPref objects filtered by the subjid column
+ * @method array findByKeystr(string $keystr) Return CcPref objects filtered by the keystr column
+ * @method array findByValstr(string $valstr) Return CcPref objects filtered by the valstr column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcPrefQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcPrefQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcPref';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcPrefQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcPref', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcPrefQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcPrefQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcPrefQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcPrefQuery) {
+ return $criteria;
+ }
+ $query = new CcPrefQuery(null, null, $modelAlias);
- /**
- * Returns a new CcPrefQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcPrefQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcPrefQuery) {
- return $criteria;
- }
- $query = new CcPrefQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcPref|CcPref[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcPrefPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcPrefPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $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);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPref A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneById($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPref A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "subjid", "keystr", "valstr" FROM "cc_pref" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcPref();
+ $obj->hydrate($row);
+ CcPrefPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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);
- }
+ return $obj;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcPref|CcPref[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * 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);
- }
+ /**
+ * 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|CcPref[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * 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;
- }
+ /**
+ * 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)
+ {
- /**
- * 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');
- }
+ return $this->addUsingAlias(CcPrefPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * 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;
- }
+ /**
+ * 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)
+ {
-} // BaseCcPrefQuery
+ return $this->addUsingAlias(CcPrefPeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id >= 12
+ * $query->filterById(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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)) {
+ $useMinMax = false;
+ if (isset($id['min'])) {
+ $this->addUsingAlias(CcPrefPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(CcPrefPeer::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcPrefPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the subjid column
+ *
+ * Example usage:
+ *
+ * $query->filterBySubjid(1234); // WHERE subjid = 1234
+ * $query->filterBySubjid(array(12, 34)); // WHERE subjid IN (12, 34)
+ * $query->filterBySubjid(array('min' => 12)); // WHERE subjid >= 12
+ * $query->filterBySubjid(array('max' => 12)); // WHERE subjid <= 12
+ *
+ *
+ * @see filterByCcSubjs()
+ *
+ * @param mixed $subjid The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByKeystr('fooValue'); // WHERE keystr = 'fooValue'
+ * $query->filterByKeystr('%fooValue%'); // WHERE keystr LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByValstr('fooValue'); // WHERE valstr = 'fooValue'
+ * $query->filterByValstr('%fooValue%'); // WHERE valstr LIKE '%fooValue%'
+ *
+ *
+ * @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|PropelObjectCollection $ccSubjs The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcSubjs($ccSubjs, $comparison = null)
+ {
+ if ($ccSubjs instanceof CcSubjs) {
+ return $this
+ ->addUsingAlias(CcPrefPeer::SUBJID, $ccSubjs->getDbId(), $comparison);
+ } elseif ($ccSubjs instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcPrefPeer::SUBJID, $ccSubjs->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcSubjs() only accepts arguments of type CcSubjs or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $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;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php b/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php
index ceb5008d8..1bc842b13 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php
@@ -4,2013 +4,2311 @@
/**
* Base class that represents a row from the 'cc_schedule' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcSchedule extends BaseObject implements Persistent
+abstract class BaseCcSchedule extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcSchedulePeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcSchedulePeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the starts field.
- * @var string
- */
- protected $starts;
-
- /**
- * The value for the ends field.
- * @var string
- */
- protected $ends;
-
- /**
- * The value for the file_id field.
- * @var int
- */
- protected $file_id;
-
- /**
- * The value for the stream_id field.
- * @var int
- */
- protected $stream_id;
-
- /**
- * The value for the clip_length field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $clip_length;
-
- /**
- * The value for the fade_in field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $fade_in;
-
- /**
- * The value for the fade_out field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $fade_out;
-
- /**
- * The value for the cue_in field.
- * @var string
- */
- protected $cue_in;
-
- /**
- * The value for the cue_out field.
- * @var string
- */
- protected $cue_out;
-
- /**
- * The value for the media_item_played field.
- * Note: this column has a database default value of: false
- * @var boolean
- */
- protected $media_item_played;
-
- /**
- * The value for the instance_id field.
- * @var int
- */
- protected $instance_id;
-
- /**
- * The value for the playout_status field.
- * Note: this column has a database default value of: 1
- * @var int
- */
- protected $playout_status;
-
- /**
- * The value for the broadcasted field.
- * Note: this column has a database default value of: 0
- * @var int
- */
- protected $broadcasted;
-
- /**
- * The value for the position field.
- * Note: this column has a database default value of: 0
- * @var int
- */
- protected $position;
-
- /**
- * @var CcShowInstances
- */
- protected $aCcShowInstances;
-
- /**
- * @var CcFiles
- */
- protected $aCcFiles;
-
- /**
- * @var CcWebstream
- */
- protected $aCcWebstream;
-
- /**
- * @var array CcWebstreamMetadata[] Collection to store aggregation of CcWebstreamMetadata objects.
- */
- protected $collCcWebstreamMetadatas;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Applies default values to this object.
- * This method should be called from the object's constructor (or
- * equivalent initialization method).
- * @see __construct()
- */
- public function applyDefaultValues()
- {
- $this->clip_length = '00:00:00';
- $this->fade_in = '00:00:00';
- $this->fade_out = '00:00:00';
- $this->media_item_played = false;
- $this->playout_status = 1;
- $this->broadcasted = 0;
- $this->position = 0;
- }
-
- /**
- * 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 [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 [file_id] column value.
- *
- * @return int
- */
- public function getDbFileId()
- {
- return $this->file_id;
- }
-
- /**
- * Get the [stream_id] column value.
- *
- * @return int
- */
- public function getDbStreamId()
- {
- return $this->stream_id;
- }
-
- /**
- * Get the [clip_length] column value.
- *
- * @return string
- */
- public function getDbClipLength()
- {
- return $this->clip_length;
- }
-
- /**
- * 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 [cue_in] column value.
- *
- * @return string
- */
- public function getDbCueIn()
- {
- return $this->cue_in;
- }
-
- /**
- * Get the [cue_out] column value.
- *
- * @return string
- */
- public function getDbCueOut()
- {
- return $this->cue_out;
- }
-
- /**
- * 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;
- }
-
- /**
- * Get the [playout_status] column value.
- *
- * @return int
- */
- public function getDbPlayoutStatus()
- {
- return $this->playout_status;
- }
-
- /**
- * Get the [broadcasted] column value.
- *
- * @return int
- */
- public function getDbBroadcasted()
- {
- return $this->broadcasted;
- }
-
- /**
- * Get the [position] column value.
- *
- * @return int
- */
- public function getDbPosition()
- {
- return $this->position;
- }
-
- /**
- * 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()
-
- /**
- * 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 [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()
-
- /**
- * Set the value of [stream_id] column.
- *
- * @param int $v new value
- * @return CcSchedule The current object (for fluent API support)
- */
- public function setDbStreamId($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->stream_id !== $v) {
- $this->stream_id = $v;
- $this->modifiedColumns[] = CcSchedulePeer::STREAM_ID;
- }
-
- if ($this->aCcWebstream !== null && $this->aCcWebstream->getDbId() !== $v) {
- $this->aCcWebstream = null;
- }
-
- return $this;
- } // setDbStreamId()
-
- /**
- * Set the value of [clip_length] column.
- *
- * @param string $v new value
- * @return CcSchedule The current object (for fluent API support)
- */
- public function setDbClipLength($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->clip_length !== $v || $this->isNew()) {
- $this->clip_length = $v;
- $this->modifiedColumns[] = CcSchedulePeer::CLIP_LENGTH;
- }
-
- 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()
-
- /**
- * Set the value of [cue_in] column.
- *
- * @param string $v new value
- * @return CcSchedule The current object (for fluent API support)
- */
- public function setDbCueIn($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->cue_in !== $v) {
- $this->cue_in = $v;
- $this->modifiedColumns[] = CcSchedulePeer::CUE_IN;
- }
-
- return $this;
- } // setDbCueIn()
-
- /**
- * Set the value of [cue_out] column.
- *
- * @param string $v new value
- * @return CcSchedule The current object (for fluent API support)
- */
- public function setDbCueOut($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->cue_out !== $v) {
- $this->cue_out = $v;
- $this->modifiedColumns[] = CcSchedulePeer::CUE_OUT;
- }
-
- return $this;
- } // setDbCueOut()
-
- /**
- * 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()
-
- /**
- * Set the value of [playout_status] column.
- *
- * @param int $v new value
- * @return CcSchedule The current object (for fluent API support)
- */
- public function setDbPlayoutStatus($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->playout_status !== $v || $this->isNew()) {
- $this->playout_status = $v;
- $this->modifiedColumns[] = CcSchedulePeer::PLAYOUT_STATUS;
- }
-
- return $this;
- } // setDbPlayoutStatus()
-
- /**
- * Set the value of [broadcasted] column.
- *
- * @param int $v new value
- * @return CcSchedule The current object (for fluent API support)
- */
- public function setDbBroadcasted($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->broadcasted !== $v || $this->isNew()) {
- $this->broadcasted = $v;
- $this->modifiedColumns[] = CcSchedulePeer::BROADCASTED;
- }
-
- return $this;
- } // setDbBroadcasted()
-
- /**
- * Set the value of [position] column.
- *
- * @param int $v new value
- * @return CcSchedule The current object (for fluent API support)
- */
- public function setDbPosition($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->position !== $v || $this->isNew()) {
- $this->position = $v;
- $this->modifiedColumns[] = CcSchedulePeer::POSITION;
- }
-
- return $this;
- } // setDbPosition()
-
- /**
- * 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->media_item_played !== false) {
- return false;
- }
-
- if ($this->playout_status !== 1) {
- return false;
- }
-
- if ($this->broadcasted !== 0) {
- return false;
- }
-
- if ($this->position !== 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->starts = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
- $this->ends = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
- $this->file_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
- $this->stream_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
- $this->clip_length = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
- $this->fade_in = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
- $this->fade_out = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
- $this->cue_in = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
- $this->cue_out = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
- $this->media_item_played = ($row[$startcol + 10] !== null) ? (boolean) $row[$startcol + 10] : null;
- $this->instance_id = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null;
- $this->playout_status = ($row[$startcol + 12] !== null) ? (int) $row[$startcol + 12] : null;
- $this->broadcasted = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null;
- $this->position = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 15; // 15 = 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->aCcWebstream !== null && $this->stream_id !== $this->aCcWebstream->getDbId()) {
- $this->aCcWebstream = 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;
- $this->aCcWebstream = null;
- $this->collCcWebstreamMetadatas = 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);
- 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->aCcWebstream !== null) {
- if ($this->aCcWebstream->isModified() || $this->aCcWebstream->isNew()) {
- $affectedRows += $this->aCcWebstream->save($con);
- }
- $this->setCcWebstream($this->aCcWebstream);
- }
-
- 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'
- }
-
- if ($this->collCcWebstreamMetadatas !== null) {
- foreach ($this->collCcWebstreamMetadatas 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->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 ($this->aCcWebstream !== null) {
- if (!$this->aCcWebstream->validate($columns)) {
- $failureMap = array_merge($failureMap, $this->aCcWebstream->getValidationFailures());
- }
- }
-
-
- if (($retval = CcSchedulePeer::doValidate($this, $columns)) !== true) {
- $failureMap = array_merge($failureMap, $retval);
- }
-
-
- if ($this->collCcWebstreamMetadatas !== null) {
- foreach ($this->collCcWebstreamMetadatas 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 = 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->getDbStarts();
- break;
- case 2:
- return $this->getDbEnds();
- break;
- case 3:
- return $this->getDbFileId();
- break;
- case 4:
- return $this->getDbStreamId();
- break;
- case 5:
- return $this->getDbClipLength();
- break;
- case 6:
- return $this->getDbFadeIn();
- break;
- case 7:
- return $this->getDbFadeOut();
- break;
- case 8:
- return $this->getDbCueIn();
- break;
- case 9:
- return $this->getDbCueOut();
- break;
- case 10:
- return $this->getDbMediaItemPlayed();
- break;
- case 11:
- return $this->getDbInstanceId();
- break;
- case 12:
- return $this->getDbPlayoutStatus();
- break;
- case 13:
- return $this->getDbBroadcasted();
- break;
- case 14:
- return $this->getDbPosition();
- 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->getDbStarts(),
- $keys[2] => $this->getDbEnds(),
- $keys[3] => $this->getDbFileId(),
- $keys[4] => $this->getDbStreamId(),
- $keys[5] => $this->getDbClipLength(),
- $keys[6] => $this->getDbFadeIn(),
- $keys[7] => $this->getDbFadeOut(),
- $keys[8] => $this->getDbCueIn(),
- $keys[9] => $this->getDbCueOut(),
- $keys[10] => $this->getDbMediaItemPlayed(),
- $keys[11] => $this->getDbInstanceId(),
- $keys[12] => $this->getDbPlayoutStatus(),
- $keys[13] => $this->getDbBroadcasted(),
- $keys[14] => $this->getDbPosition(),
- );
- 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);
- }
- if (null !== $this->aCcWebstream) {
- $result['CcWebstream'] = $this->aCcWebstream->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->setDbStarts($value);
- break;
- case 2:
- $this->setDbEnds($value);
- break;
- case 3:
- $this->setDbFileId($value);
- break;
- case 4:
- $this->setDbStreamId($value);
- break;
- case 5:
- $this->setDbClipLength($value);
- break;
- case 6:
- $this->setDbFadeIn($value);
- break;
- case 7:
- $this->setDbFadeOut($value);
- break;
- case 8:
- $this->setDbCueIn($value);
- break;
- case 9:
- $this->setDbCueOut($value);
- break;
- case 10:
- $this->setDbMediaItemPlayed($value);
- break;
- case 11:
- $this->setDbInstanceId($value);
- break;
- case 12:
- $this->setDbPlayoutStatus($value);
- break;
- case 13:
- $this->setDbBroadcasted($value);
- break;
- case 14:
- $this->setDbPosition($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->setDbStarts($arr[$keys[1]]);
- if (array_key_exists($keys[2], $arr)) $this->setDbEnds($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setDbFileId($arr[$keys[3]]);
- if (array_key_exists($keys[4], $arr)) $this->setDbStreamId($arr[$keys[4]]);
- if (array_key_exists($keys[5], $arr)) $this->setDbClipLength($arr[$keys[5]]);
- if (array_key_exists($keys[6], $arr)) $this->setDbFadeIn($arr[$keys[6]]);
- if (array_key_exists($keys[7], $arr)) $this->setDbFadeOut($arr[$keys[7]]);
- if (array_key_exists($keys[8], $arr)) $this->setDbCueIn($arr[$keys[8]]);
- if (array_key_exists($keys[9], $arr)) $this->setDbCueOut($arr[$keys[9]]);
- if (array_key_exists($keys[10], $arr)) $this->setDbMediaItemPlayed($arr[$keys[10]]);
- if (array_key_exists($keys[11], $arr)) $this->setDbInstanceId($arr[$keys[11]]);
- if (array_key_exists($keys[12], $arr)) $this->setDbPlayoutStatus($arr[$keys[12]]);
- if (array_key_exists($keys[13], $arr)) $this->setDbBroadcasted($arr[$keys[13]]);
- if (array_key_exists($keys[14], $arr)) $this->setDbPosition($arr[$keys[14]]);
- }
-
- /**
- * 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::STARTS)) $criteria->add(CcSchedulePeer::STARTS, $this->starts);
- if ($this->isColumnModified(CcSchedulePeer::ENDS)) $criteria->add(CcSchedulePeer::ENDS, $this->ends);
- if ($this->isColumnModified(CcSchedulePeer::FILE_ID)) $criteria->add(CcSchedulePeer::FILE_ID, $this->file_id);
- if ($this->isColumnModified(CcSchedulePeer::STREAM_ID)) $criteria->add(CcSchedulePeer::STREAM_ID, $this->stream_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::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);
- if ($this->isColumnModified(CcSchedulePeer::PLAYOUT_STATUS)) $criteria->add(CcSchedulePeer::PLAYOUT_STATUS, $this->playout_status);
- if ($this->isColumnModified(CcSchedulePeer::BROADCASTED)) $criteria->add(CcSchedulePeer::BROADCASTED, $this->broadcasted);
- if ($this->isColumnModified(CcSchedulePeer::POSITION)) $criteria->add(CcSchedulePeer::POSITION, $this->position);
-
- 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->setDbStarts($this->starts);
- $copyObj->setDbEnds($this->ends);
- $copyObj->setDbFileId($this->file_id);
- $copyObj->setDbStreamId($this->stream_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->setDbMediaItemPlayed($this->media_item_played);
- $copyObj->setDbInstanceId($this->instance_id);
- $copyObj->setDbPlayoutStatus($this->playout_status);
- $copyObj->setDbBroadcasted($this->broadcasted);
- $copyObj->setDbPosition($this->position);
-
- 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->getCcWebstreamMetadatas() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addCcWebstreamMetadata($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 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)
- {
- 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;
- }
-
- /**
- * Declares an association between this object and a CcWebstream object.
- *
- * @param CcWebstream $v
- * @return CcSchedule The current object (for fluent API support)
- * @throws PropelException
- */
- public function setCcWebstream(CcWebstream $v = null)
- {
- if ($v === null) {
- $this->setDbStreamId(NULL);
- } else {
- $this->setDbStreamId($v->getDbId());
- }
-
- $this->aCcWebstream = $v;
-
- // Add binding for other direction of this n:n relationship.
- // If this object has already been added to the CcWebstream object, it will not be re-added.
- if ($v !== null) {
- $v->addCcSchedule($this);
- }
-
- return $this;
- }
-
-
- /**
- * Get the associated CcWebstream object
- *
- * @param PropelPDO Optional Connection object.
- * @return CcWebstream The associated CcWebstream object.
- * @throws PropelException
- */
- public function getCcWebstream(PropelPDO $con = null)
- {
- if ($this->aCcWebstream === null && ($this->stream_id !== null)) {
- $this->aCcWebstream = CcWebstreamQuery::create()->findPk($this->stream_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->aCcWebstream->addCcSchedules($this);
- */
- }
- return $this->aCcWebstream;
- }
-
- /**
- * Clears out the collCcWebstreamMetadatas 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 addCcWebstreamMetadatas()
- */
- public function clearCcWebstreamMetadatas()
- {
- $this->collCcWebstreamMetadatas = null; // important to set this to NULL since that means it is uninitialized
- }
-
- /**
- * Initializes the collCcWebstreamMetadatas collection.
- *
- * By default this just sets the collCcWebstreamMetadatas collection to an empty array (like clearcollCcWebstreamMetadatas());
- * 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 initCcWebstreamMetadatas()
- {
- $this->collCcWebstreamMetadatas = new PropelObjectCollection();
- $this->collCcWebstreamMetadatas->setModel('CcWebstreamMetadata');
- }
-
- /**
- * Gets an array of CcWebstreamMetadata 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 CcSchedule 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 CcWebstreamMetadata[] List of CcWebstreamMetadata objects
- * @throws PropelException
- */
- public function getCcWebstreamMetadatas($criteria = null, PropelPDO $con = null)
- {
- if(null === $this->collCcWebstreamMetadatas || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcWebstreamMetadatas) {
- // return empty collection
- $this->initCcWebstreamMetadatas();
- } else {
- $collCcWebstreamMetadatas = CcWebstreamMetadataQuery::create(null, $criteria)
- ->filterByCcSchedule($this)
- ->find($con);
- if (null !== $criteria) {
- return $collCcWebstreamMetadatas;
- }
- $this->collCcWebstreamMetadatas = $collCcWebstreamMetadatas;
- }
- }
- return $this->collCcWebstreamMetadatas;
- }
-
- /**
- * Returns the number of related CcWebstreamMetadata objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related CcWebstreamMetadata objects.
- * @throws PropelException
- */
- public function countCcWebstreamMetadatas(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- if(null === $this->collCcWebstreamMetadatas || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcWebstreamMetadatas) {
- return 0;
- } else {
- $query = CcWebstreamMetadataQuery::create(null, $criteria);
- if($distinct) {
- $query->distinct();
- }
- return $query
- ->filterByCcSchedule($this)
- ->count($con);
- }
- } else {
- return count($this->collCcWebstreamMetadatas);
- }
- }
-
- /**
- * Method called to associate a CcWebstreamMetadata object to this object
- * through the CcWebstreamMetadata foreign key attribute.
- *
- * @param CcWebstreamMetadata $l CcWebstreamMetadata
- * @return void
- * @throws PropelException
- */
- public function addCcWebstreamMetadata(CcWebstreamMetadata $l)
- {
- if ($this->collCcWebstreamMetadatas === null) {
- $this->initCcWebstreamMetadatas();
- }
- if (!$this->collCcWebstreamMetadatas->contains($l)) { // only add it if the **same** object is not already associated
- $this->collCcWebstreamMetadatas[]= $l;
- $l->setCcSchedule($this);
- }
- }
-
- /**
- * 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->file_id = null;
- $this->stream_id = null;
- $this->clip_length = null;
- $this->fade_in = null;
- $this->fade_out = null;
- $this->cue_in = null;
- $this->cue_out = null;
- $this->media_item_played = null;
- $this->instance_id = null;
- $this->playout_status = null;
- $this->broadcasted = null;
- $this->position = 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->collCcWebstreamMetadatas) {
- foreach ((array) $this->collCcWebstreamMetadatas as $o) {
- $o->clearAllReferences($deep);
- }
- }
- } // if ($deep)
-
- $this->collCcWebstreamMetadatas = null;
- $this->aCcShowInstances = null;
- $this->aCcFiles = null;
- $this->aCcWebstream = 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
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcSchedulePeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcSchedulePeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the starts field.
+ * @var string
+ */
+ protected $starts;
+
+ /**
+ * The value for the ends field.
+ * @var string
+ */
+ protected $ends;
+
+ /**
+ * The value for the file_id field.
+ * @var int
+ */
+ protected $file_id;
+
+ /**
+ * The value for the stream_id field.
+ * @var int
+ */
+ protected $stream_id;
+
+ /**
+ * The value for the clip_length field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $clip_length;
+
+ /**
+ * The value for the fade_in field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $fade_in;
+
+ /**
+ * The value for the fade_out field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $fade_out;
+
+ /**
+ * The value for the cue_in field.
+ * @var string
+ */
+ protected $cue_in;
+
+ /**
+ * The value for the cue_out field.
+ * @var string
+ */
+ protected $cue_out;
+
+ /**
+ * The value for the media_item_played field.
+ * Note: this column has a database default value of: false
+ * @var boolean
+ */
+ protected $media_item_played;
+
+ /**
+ * The value for the instance_id field.
+ * @var int
+ */
+ protected $instance_id;
+
+ /**
+ * The value for the playout_status field.
+ * Note: this column has a database default value of: 1
+ * @var int
+ */
+ protected $playout_status;
+
+ /**
+ * The value for the broadcasted field.
+ * Note: this column has a database default value of: 0
+ * @var int
+ */
+ protected $broadcasted;
+
+ /**
+ * The value for the position field.
+ * Note: this column has a database default value of: 0
+ * @var int
+ */
+ protected $position;
+
+ /**
+ * @var CcShowInstances
+ */
+ protected $aCcShowInstances;
+
+ /**
+ * @var CcFiles
+ */
+ protected $aCcFiles;
+
+ /**
+ * @var CcWebstream
+ */
+ protected $aCcWebstream;
+
+ /**
+ * @var PropelObjectCollection|CcWebstreamMetadata[] Collection to store aggregation of CcWebstreamMetadata objects.
+ */
+ protected $collCcWebstreamMetadatas;
+ protected $collCcWebstreamMetadatasPartial;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccWebstreamMetadatasScheduledForDeletion = null;
+
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->clip_length = '00:00:00';
+ $this->fade_in = '00:00:00';
+ $this->fade_out = '00:00:00';
+ $this->media_item_played = false;
+ $this->playout_status = 1;
+ $this->broadcasted = 0;
+ $this->position = 0;
+ }
+
+ /**
+ * 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 [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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ 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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Get the [file_id] column value.
+ *
+ * @return int
+ */
+ public function getDbFileId()
+ {
+
+ return $this->file_id;
+ }
+
+ /**
+ * Get the [stream_id] column value.
+ *
+ * @return int
+ */
+ public function getDbStreamId()
+ {
+
+ return $this->stream_id;
+ }
+
+ /**
+ * Get the [clip_length] column value.
+ *
+ * @return string
+ */
+ public function getDbClipLength()
+ {
+
+ return $this->clip_length;
+ }
+
+ /**
+ * 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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ 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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Get the [cue_in] column value.
+ *
+ * @return string
+ */
+ public function getDbCueIn()
+ {
+
+ return $this->cue_in;
+ }
+
+ /**
+ * Get the [cue_out] column value.
+ *
+ * @return string
+ */
+ public function getDbCueOut()
+ {
+
+ return $this->cue_out;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * Get the [playout_status] column value.
+ *
+ * @return int
+ */
+ public function getDbPlayoutStatus()
+ {
+
+ return $this->playout_status;
+ }
+
+ /**
+ * Get the [broadcasted] column value.
+ *
+ * @return int
+ */
+ public function getDbBroadcasted()
+ {
+
+ return $this->broadcasted;
+ }
+
+ /**
+ * Get the [position] column value.
+ *
+ * @return int
+ */
+ public function getDbPosition()
+ {
+
+ return $this->position;
+ }
+
+ /**
+ * 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 && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcSchedulePeer::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 strings are treated as null.
+ * @return CcSchedule The current object (for fluent API support)
+ */
+ public function setDbStarts($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->starts !== null || $dt !== null) {
+ $currentDateAsString = ($this->starts !== null && $tmpDt = new DateTime($this->starts)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->starts = $newDateAsString;
+ $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 strings are treated as null.
+ * @return CcSchedule The current object (for fluent API support)
+ */
+ public function setDbEnds($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->ends !== null || $dt !== null) {
+ $currentDateAsString = ($this->ends !== null && $tmpDt = new DateTime($this->ends)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->ends = $newDateAsString;
+ $this->modifiedColumns[] = CcSchedulePeer::ENDS;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbEnds()
+
+ /**
+ * 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 && is_numeric($v)) {
+ $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()
+
+ /**
+ * Set the value of [stream_id] column.
+ *
+ * @param int $v new value
+ * @return CcSchedule The current object (for fluent API support)
+ */
+ public function setDbStreamId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->stream_id !== $v) {
+ $this->stream_id = $v;
+ $this->modifiedColumns[] = CcSchedulePeer::STREAM_ID;
+ }
+
+ if ($this->aCcWebstream !== null && $this->aCcWebstream->getDbId() !== $v) {
+ $this->aCcWebstream = null;
+ }
+
+
+ return $this;
+ } // setDbStreamId()
+
+ /**
+ * Set the value of [clip_length] column.
+ *
+ * @param string $v new value
+ * @return CcSchedule The current object (for fluent API support)
+ */
+ public function setDbClipLength($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->clip_length !== $v) {
+ $this->clip_length = $v;
+ $this->modifiedColumns[] = CcSchedulePeer::CLIP_LENGTH;
+ }
+
+
+ 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 strings are treated as null.
+ * @return CcSchedule The current object (for fluent API support)
+ */
+ public function setDbFadeIn($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->fade_in !== null || $dt !== null) {
+ $currentDateAsString = ($this->fade_in !== null && $tmpDt = new DateTime($this->fade_in)) ? $tmpDt->format('H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('H:i:s') : null;
+ if ( ($currentDateAsString !== $newDateAsString) // normalized values don't match
+ || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
+ ) {
+ $this->fade_in = $newDateAsString;
+ $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 strings are treated as null.
+ * @return CcSchedule The current object (for fluent API support)
+ */
+ public function setDbFadeOut($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->fade_out !== null || $dt !== null) {
+ $currentDateAsString = ($this->fade_out !== null && $tmpDt = new DateTime($this->fade_out)) ? $tmpDt->format('H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('H:i:s') : null;
+ if ( ($currentDateAsString !== $newDateAsString) // normalized values don't match
+ || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
+ ) {
+ $this->fade_out = $newDateAsString;
+ $this->modifiedColumns[] = CcSchedulePeer::FADE_OUT;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbFadeOut()
+
+ /**
+ * Set the value of [cue_in] column.
+ *
+ * @param string $v new value
+ * @return CcSchedule The current object (for fluent API support)
+ */
+ public function setDbCueIn($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->cue_in !== $v) {
+ $this->cue_in = $v;
+ $this->modifiedColumns[] = CcSchedulePeer::CUE_IN;
+ }
+
+
+ return $this;
+ } // setDbCueIn()
+
+ /**
+ * Set the value of [cue_out] column.
+ *
+ * @param string $v new value
+ * @return CcSchedule The current object (for fluent API support)
+ */
+ public function setDbCueOut($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->cue_out !== $v) {
+ $this->cue_out = $v;
+ $this->modifiedColumns[] = CcSchedulePeer::CUE_OUT;
+ }
+
+
+ return $this;
+ } // setDbCueOut()
+
+ /**
+ * Sets the value of the [media_item_played] column.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ *
+ * @param boolean|integer|string $v The new value
+ * @return CcSchedule The current object (for fluent API support)
+ */
+ public function setDbMediaItemPlayed($v)
+ {
+ if ($v !== null) {
+ if (is_string($v)) {
+ $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ } else {
+ $v = (boolean) $v;
+ }
+ }
+
+ if ($this->media_item_played !== $v) {
+ $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 && is_numeric($v)) {
+ $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()
+
+ /**
+ * Set the value of [playout_status] column.
+ *
+ * @param int $v new value
+ * @return CcSchedule The current object (for fluent API support)
+ */
+ public function setDbPlayoutStatus($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->playout_status !== $v) {
+ $this->playout_status = $v;
+ $this->modifiedColumns[] = CcSchedulePeer::PLAYOUT_STATUS;
+ }
+
+
+ return $this;
+ } // setDbPlayoutStatus()
+
+ /**
+ * Set the value of [broadcasted] column.
+ *
+ * @param int $v new value
+ * @return CcSchedule The current object (for fluent API support)
+ */
+ public function setDbBroadcasted($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->broadcasted !== $v) {
+ $this->broadcasted = $v;
+ $this->modifiedColumns[] = CcSchedulePeer::BROADCASTED;
+ }
+
+
+ return $this;
+ } // setDbBroadcasted()
+
+ /**
+ * Set the value of [position] column.
+ *
+ * @param int $v new value
+ * @return CcSchedule The current object (for fluent API support)
+ */
+ public function setDbPosition($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->position !== $v) {
+ $this->position = $v;
+ $this->modifiedColumns[] = CcSchedulePeer::POSITION;
+ }
+
+
+ return $this;
+ } // setDbPosition()
+
+ /**
+ * 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->media_item_played !== false) {
+ return false;
+ }
+
+ if ($this->playout_status !== 1) {
+ return false;
+ }
+
+ if ($this->broadcasted !== 0) {
+ return false;
+ }
+
+ if ($this->position !== 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 resultset 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->file_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
+ $this->stream_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
+ $this->clip_length = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->fade_in = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
+ $this->fade_out = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
+ $this->cue_in = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
+ $this->cue_out = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
+ $this->media_item_played = ($row[$startcol + 10] !== null) ? (boolean) $row[$startcol + 10] : null;
+ $this->instance_id = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null;
+ $this->playout_status = ($row[$startcol + 12] !== null) ? (int) $row[$startcol + 12] : null;
+ $this->broadcasted = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null;
+ $this->position = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 15; // 15 = CcSchedulePeer::NUM_HYDRATE_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->aCcWebstream !== null && $this->stream_id !== $this->aCcWebstream->getDbId()) {
+ $this->aCcWebstream = 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;
+ $this->aCcWebstream = null;
+ $this->collCcWebstreamMetadatas = null;
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcScheduleQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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);
+ CcSchedulePeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $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 corresponding 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->aCcWebstream !== null) {
+ if ($this->aCcWebstream->isModified() || $this->aCcWebstream->isNew()) {
+ $affectedRows += $this->aCcWebstream->save($con);
+ }
+ $this->setCcWebstream($this->aCcWebstream);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ if ($this->ccWebstreamMetadatasScheduledForDeletion !== null) {
+ if (!$this->ccWebstreamMetadatasScheduledForDeletion->isEmpty()) {
+ CcWebstreamMetadataQuery::create()
+ ->filterByPrimaryKeys($this->ccWebstreamMetadatasScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccWebstreamMetadatasScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcWebstreamMetadatas !== null) {
+ foreach ($this->collCcWebstreamMetadatas as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcSchedulePeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcSchedulePeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_schedule_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcSchedulePeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcSchedulePeer::STARTS)) {
+ $modifiedColumns[':p' . $index++] = '"starts"';
+ }
+ if ($this->isColumnModified(CcSchedulePeer::ENDS)) {
+ $modifiedColumns[':p' . $index++] = '"ends"';
+ }
+ if ($this->isColumnModified(CcSchedulePeer::FILE_ID)) {
+ $modifiedColumns[':p' . $index++] = '"file_id"';
+ }
+ if ($this->isColumnModified(CcSchedulePeer::STREAM_ID)) {
+ $modifiedColumns[':p' . $index++] = '"stream_id"';
+ }
+ if ($this->isColumnModified(CcSchedulePeer::CLIP_LENGTH)) {
+ $modifiedColumns[':p' . $index++] = '"clip_length"';
+ }
+ if ($this->isColumnModified(CcSchedulePeer::FADE_IN)) {
+ $modifiedColumns[':p' . $index++] = '"fade_in"';
+ }
+ if ($this->isColumnModified(CcSchedulePeer::FADE_OUT)) {
+ $modifiedColumns[':p' . $index++] = '"fade_out"';
+ }
+ if ($this->isColumnModified(CcSchedulePeer::CUE_IN)) {
+ $modifiedColumns[':p' . $index++] = '"cue_in"';
+ }
+ if ($this->isColumnModified(CcSchedulePeer::CUE_OUT)) {
+ $modifiedColumns[':p' . $index++] = '"cue_out"';
+ }
+ if ($this->isColumnModified(CcSchedulePeer::MEDIA_ITEM_PLAYED)) {
+ $modifiedColumns[':p' . $index++] = '"media_item_played"';
+ }
+ if ($this->isColumnModified(CcSchedulePeer::INSTANCE_ID)) {
+ $modifiedColumns[':p' . $index++] = '"instance_id"';
+ }
+ if ($this->isColumnModified(CcSchedulePeer::PLAYOUT_STATUS)) {
+ $modifiedColumns[':p' . $index++] = '"playout_status"';
+ }
+ if ($this->isColumnModified(CcSchedulePeer::BROADCASTED)) {
+ $modifiedColumns[':p' . $index++] = '"broadcasted"';
+ }
+ if ($this->isColumnModified(CcSchedulePeer::POSITION)) {
+ $modifiedColumns[':p' . $index++] = '"position"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_schedule" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"starts"':
+ $stmt->bindValue($identifier, $this->starts, PDO::PARAM_STR);
+ break;
+ case '"ends"':
+ $stmt->bindValue($identifier, $this->ends, PDO::PARAM_STR);
+ break;
+ case '"file_id"':
+ $stmt->bindValue($identifier, $this->file_id, PDO::PARAM_INT);
+ break;
+ case '"stream_id"':
+ $stmt->bindValue($identifier, $this->stream_id, PDO::PARAM_INT);
+ break;
+ case '"clip_length"':
+ $stmt->bindValue($identifier, $this->clip_length, PDO::PARAM_STR);
+ break;
+ case '"fade_in"':
+ $stmt->bindValue($identifier, $this->fade_in, PDO::PARAM_STR);
+ break;
+ case '"fade_out"':
+ $stmt->bindValue($identifier, $this->fade_out, PDO::PARAM_STR);
+ break;
+ case '"cue_in"':
+ $stmt->bindValue($identifier, $this->cue_in, PDO::PARAM_STR);
+ break;
+ case '"cue_out"':
+ $stmt->bindValue($identifier, $this->cue_out, PDO::PARAM_STR);
+ break;
+ case '"media_item_played"':
+ $stmt->bindValue($identifier, $this->media_item_played, PDO::PARAM_BOOL);
+ break;
+ case '"instance_id"':
+ $stmt->bindValue($identifier, $this->instance_id, PDO::PARAM_INT);
+ break;
+ case '"playout_status"':
+ $stmt->bindValue($identifier, $this->playout_status, PDO::PARAM_INT);
+ break;
+ case '"broadcasted"':
+ $stmt->bindValue($identifier, $this->broadcasted, PDO::PARAM_INT);
+ break;
+ case '"position"':
+ $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding 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 ($this->aCcWebstream !== null) {
+ if (!$this->aCcWebstream->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcWebstream->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CcSchedulePeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+ if ($this->collCcWebstreamMetadatas !== null) {
+ foreach ($this->collCcWebstreamMetadatas 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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->getDbStarts();
+ break;
+ case 2:
+ return $this->getDbEnds();
+ break;
+ case 3:
+ return $this->getDbFileId();
+ break;
+ case 4:
+ return $this->getDbStreamId();
+ break;
+ case 5:
+ return $this->getDbClipLength();
+ break;
+ case 6:
+ return $this->getDbFadeIn();
+ break;
+ case 7:
+ return $this->getDbFadeOut();
+ break;
+ case 8:
+ return $this->getDbCueIn();
+ break;
+ case 9:
+ return $this->getDbCueOut();
+ break;
+ case 10:
+ return $this->getDbMediaItemPlayed();
+ break;
+ case 11:
+ return $this->getDbInstanceId();
+ break;
+ case 12:
+ return $this->getDbPlayoutStatus();
+ break;
+ case 13:
+ return $this->getDbBroadcasted();
+ break;
+ case 14:
+ return $this->getDbPosition();
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcSchedule'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcSchedule'][$this->getPrimaryKey()] = true;
+ $keys = CcSchedulePeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbStarts(),
+ $keys[2] => $this->getDbEnds(),
+ $keys[3] => $this->getDbFileId(),
+ $keys[4] => $this->getDbStreamId(),
+ $keys[5] => $this->getDbClipLength(),
+ $keys[6] => $this->getDbFadeIn(),
+ $keys[7] => $this->getDbFadeOut(),
+ $keys[8] => $this->getDbCueIn(),
+ $keys[9] => $this->getDbCueOut(),
+ $keys[10] => $this->getDbMediaItemPlayed(),
+ $keys[11] => $this->getDbInstanceId(),
+ $keys[12] => $this->getDbPlayoutStatus(),
+ $keys[13] => $this->getDbBroadcasted(),
+ $keys[14] => $this->getDbPosition(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcShowInstances) {
+ $result['CcShowInstances'] = $this->aCcShowInstances->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->aCcFiles) {
+ $result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->aCcWebstream) {
+ $result['CcWebstream'] = $this->aCcWebstream->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->collCcWebstreamMetadatas) {
+ $result['CcWebstreamMetadatas'] = $this->collCcWebstreamMetadatas->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ }
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcSchedulePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbFileId($value);
+ break;
+ case 4:
+ $this->setDbStreamId($value);
+ break;
+ case 5:
+ $this->setDbClipLength($value);
+ break;
+ case 6:
+ $this->setDbFadeIn($value);
+ break;
+ case 7:
+ $this->setDbFadeOut($value);
+ break;
+ case 8:
+ $this->setDbCueIn($value);
+ break;
+ case 9:
+ $this->setDbCueOut($value);
+ break;
+ case 10:
+ $this->setDbMediaItemPlayed($value);
+ break;
+ case 11:
+ $this->setDbInstanceId($value);
+ break;
+ case 12:
+ $this->setDbPlayoutStatus($value);
+ break;
+ case 13:
+ $this->setDbBroadcasted($value);
+ break;
+ case 14:
+ $this->setDbPosition($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 BasePeer::TYPE_PHPNAME
+ *
+ * @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->setDbStarts($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbEnds($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbFileId($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbStreamId($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDbClipLength($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setDbFadeIn($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setDbFadeOut($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setDbCueIn($arr[$keys[8]]);
+ if (array_key_exists($keys[9], $arr)) $this->setDbCueOut($arr[$keys[9]]);
+ if (array_key_exists($keys[10], $arr)) $this->setDbMediaItemPlayed($arr[$keys[10]]);
+ if (array_key_exists($keys[11], $arr)) $this->setDbInstanceId($arr[$keys[11]]);
+ if (array_key_exists($keys[12], $arr)) $this->setDbPlayoutStatus($arr[$keys[12]]);
+ if (array_key_exists($keys[13], $arr)) $this->setDbBroadcasted($arr[$keys[13]]);
+ if (array_key_exists($keys[14], $arr)) $this->setDbPosition($arr[$keys[14]]);
+ }
+
+ /**
+ * 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::STARTS)) $criteria->add(CcSchedulePeer::STARTS, $this->starts);
+ if ($this->isColumnModified(CcSchedulePeer::ENDS)) $criteria->add(CcSchedulePeer::ENDS, $this->ends);
+ if ($this->isColumnModified(CcSchedulePeer::FILE_ID)) $criteria->add(CcSchedulePeer::FILE_ID, $this->file_id);
+ if ($this->isColumnModified(CcSchedulePeer::STREAM_ID)) $criteria->add(CcSchedulePeer::STREAM_ID, $this->stream_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::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);
+ if ($this->isColumnModified(CcSchedulePeer::PLAYOUT_STATUS)) $criteria->add(CcSchedulePeer::PLAYOUT_STATUS, $this->playout_status);
+ if ($this->isColumnModified(CcSchedulePeer::BROADCASTED)) $criteria->add(CcSchedulePeer::BROADCASTED, $this->broadcasted);
+ if ($this->isColumnModified(CcSchedulePeer::POSITION)) $criteria->add(CcSchedulePeer::POSITION, $this->position);
+
+ 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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbStarts($this->getDbStarts());
+ $copyObj->setDbEnds($this->getDbEnds());
+ $copyObj->setDbFileId($this->getDbFileId());
+ $copyObj->setDbStreamId($this->getDbStreamId());
+ $copyObj->setDbClipLength($this->getDbClipLength());
+ $copyObj->setDbFadeIn($this->getDbFadeIn());
+ $copyObj->setDbFadeOut($this->getDbFadeOut());
+ $copyObj->setDbCueIn($this->getDbCueIn());
+ $copyObj->setDbCueOut($this->getDbCueOut());
+ $copyObj->setDbMediaItemPlayed($this->getDbMediaItemPlayed());
+ $copyObj->setDbInstanceId($this->getDbInstanceId());
+ $copyObj->setDbPlayoutStatus($this->getDbPlayoutStatus());
+ $copyObj->setDbBroadcasted($this->getDbBroadcasted());
+ $copyObj->setDbPosition($this->getDbPosition());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ foreach ($this->getCcWebstreamMetadatas() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcWebstreamMetadata($relObj->copy($deepCopy));
+ }
+ }
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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)
+ {
+ 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 $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcShowInstances The associated CcShowInstances object.
+ * @throws PropelException
+ */
+ public function getCcShowInstances(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcShowInstances === null && ($this->instance_id !== null) && $doQuery) {
+ $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 $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcFiles The associated CcFiles object.
+ * @throws PropelException
+ */
+ public function getCcFiles(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcFiles === null && ($this->file_id !== null) && $doQuery) {
+ $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;
+ }
+
+ /**
+ * Declares an association between this object and a CcWebstream object.
+ *
+ * @param CcWebstream $v
+ * @return CcSchedule The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcWebstream(CcWebstream $v = null)
+ {
+ if ($v === null) {
+ $this->setDbStreamId(NULL);
+ } else {
+ $this->setDbStreamId($v->getDbId());
+ }
+
+ $this->aCcWebstream = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcWebstream object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcSchedule($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcWebstream object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcWebstream The associated CcWebstream object.
+ * @throws PropelException
+ */
+ public function getCcWebstream(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcWebstream === null && ($this->stream_id !== null) && $doQuery) {
+ $this->aCcWebstream = CcWebstreamQuery::create()->findPk($this->stream_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->aCcWebstream->addCcSchedules($this);
+ */
+ }
+
+ return $this->aCcWebstream;
+ }
+
+
+ /**
+ * Initializes a collection based on the name of a relation.
+ * Avoids crafting an 'init[$relationName]s' method name
+ * that wouldn't work when StandardEnglishPluralizer is used.
+ *
+ * @param string $relationName The name of the relation to initialize
+ * @return void
+ */
+ public function initRelation($relationName)
+ {
+ if ('CcWebstreamMetadata' == $relationName) {
+ $this->initCcWebstreamMetadatas();
+ }
+ }
+
+ /**
+ * Clears out the collCcWebstreamMetadatas 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 CcSchedule The current object (for fluent API support)
+ * @see addCcWebstreamMetadatas()
+ */
+ public function clearCcWebstreamMetadatas()
+ {
+ $this->collCcWebstreamMetadatas = null; // important to set this to null since that means it is uninitialized
+ $this->collCcWebstreamMetadatasPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcWebstreamMetadatas collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcWebstreamMetadatas($v = true)
+ {
+ $this->collCcWebstreamMetadatasPartial = $v;
+ }
+
+ /**
+ * Initializes the collCcWebstreamMetadatas collection.
+ *
+ * By default this just sets the collCcWebstreamMetadatas collection to an empty array (like clearcollCcWebstreamMetadatas());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcWebstreamMetadatas($overrideExisting = true)
+ {
+ if (null !== $this->collCcWebstreamMetadatas && !$overrideExisting) {
+ return;
+ }
+ $this->collCcWebstreamMetadatas = new PropelObjectCollection();
+ $this->collCcWebstreamMetadatas->setModel('CcWebstreamMetadata');
+ }
+
+ /**
+ * Gets an array of CcWebstreamMetadata 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 CcSchedule 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 PropelObjectCollection|CcWebstreamMetadata[] List of CcWebstreamMetadata objects
+ * @throws PropelException
+ */
+ public function getCcWebstreamMetadatas($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcWebstreamMetadatasPartial && !$this->isNew();
+ if (null === $this->collCcWebstreamMetadatas || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcWebstreamMetadatas) {
+ // return empty collection
+ $this->initCcWebstreamMetadatas();
+ } else {
+ $collCcWebstreamMetadatas = CcWebstreamMetadataQuery::create(null, $criteria)
+ ->filterByCcSchedule($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcWebstreamMetadatasPartial && count($collCcWebstreamMetadatas)) {
+ $this->initCcWebstreamMetadatas(false);
+
+ foreach ($collCcWebstreamMetadatas as $obj) {
+ if (false == $this->collCcWebstreamMetadatas->contains($obj)) {
+ $this->collCcWebstreamMetadatas->append($obj);
+ }
+ }
+
+ $this->collCcWebstreamMetadatasPartial = true;
+ }
+
+ $collCcWebstreamMetadatas->getInternalIterator()->rewind();
+
+ return $collCcWebstreamMetadatas;
+ }
+
+ if ($partial && $this->collCcWebstreamMetadatas) {
+ foreach ($this->collCcWebstreamMetadatas as $obj) {
+ if ($obj->isNew()) {
+ $collCcWebstreamMetadatas[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcWebstreamMetadatas = $collCcWebstreamMetadatas;
+ $this->collCcWebstreamMetadatasPartial = false;
+ }
+ }
+
+ return $this->collCcWebstreamMetadatas;
+ }
+
+ /**
+ * Sets a collection of CcWebstreamMetadata objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccWebstreamMetadatas A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcSchedule The current object (for fluent API support)
+ */
+ public function setCcWebstreamMetadatas(PropelCollection $ccWebstreamMetadatas, PropelPDO $con = null)
+ {
+ $ccWebstreamMetadatasToDelete = $this->getCcWebstreamMetadatas(new Criteria(), $con)->diff($ccWebstreamMetadatas);
+
+
+ $this->ccWebstreamMetadatasScheduledForDeletion = $ccWebstreamMetadatasToDelete;
+
+ foreach ($ccWebstreamMetadatasToDelete as $ccWebstreamMetadataRemoved) {
+ $ccWebstreamMetadataRemoved->setCcSchedule(null);
+ }
+
+ $this->collCcWebstreamMetadatas = null;
+ foreach ($ccWebstreamMetadatas as $ccWebstreamMetadata) {
+ $this->addCcWebstreamMetadata($ccWebstreamMetadata);
+ }
+
+ $this->collCcWebstreamMetadatas = $ccWebstreamMetadatas;
+ $this->collCcWebstreamMetadatasPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related CcWebstreamMetadata objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcWebstreamMetadata objects.
+ * @throws PropelException
+ */
+ public function countCcWebstreamMetadatas(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collCcWebstreamMetadatasPartial && !$this->isNew();
+ if (null === $this->collCcWebstreamMetadatas || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcWebstreamMetadatas) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcWebstreamMetadatas());
+ }
+ $query = CcWebstreamMetadataQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcSchedule($this)
+ ->count($con);
+ }
+
+ return count($this->collCcWebstreamMetadatas);
+ }
+
+ /**
+ * Method called to associate a CcWebstreamMetadata object to this object
+ * through the CcWebstreamMetadata foreign key attribute.
+ *
+ * @param CcWebstreamMetadata $l CcWebstreamMetadata
+ * @return CcSchedule The current object (for fluent API support)
+ */
+ public function addCcWebstreamMetadata(CcWebstreamMetadata $l)
+ {
+ if ($this->collCcWebstreamMetadatas === null) {
+ $this->initCcWebstreamMetadatas();
+ $this->collCcWebstreamMetadatasPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcWebstreamMetadatas->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcWebstreamMetadata($l);
+
+ if ($this->ccWebstreamMetadatasScheduledForDeletion and $this->ccWebstreamMetadatasScheduledForDeletion->contains($l)) {
+ $this->ccWebstreamMetadatasScheduledForDeletion->remove($this->ccWebstreamMetadatasScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcWebstreamMetadata $ccWebstreamMetadata The ccWebstreamMetadata object to add.
+ */
+ protected function doAddCcWebstreamMetadata($ccWebstreamMetadata)
+ {
+ $this->collCcWebstreamMetadatas[]= $ccWebstreamMetadata;
+ $ccWebstreamMetadata->setCcSchedule($this);
+ }
+
+ /**
+ * @param CcWebstreamMetadata $ccWebstreamMetadata The ccWebstreamMetadata object to remove.
+ * @return CcSchedule The current object (for fluent API support)
+ */
+ public function removeCcWebstreamMetadata($ccWebstreamMetadata)
+ {
+ if ($this->getCcWebstreamMetadatas()->contains($ccWebstreamMetadata)) {
+ $this->collCcWebstreamMetadatas->remove($this->collCcWebstreamMetadatas->search($ccWebstreamMetadata));
+ if (null === $this->ccWebstreamMetadatasScheduledForDeletion) {
+ $this->ccWebstreamMetadatasScheduledForDeletion = clone $this->collCcWebstreamMetadatas;
+ $this->ccWebstreamMetadatasScheduledForDeletion->clear();
+ }
+ $this->ccWebstreamMetadatasScheduledForDeletion[]= clone $ccWebstreamMetadata;
+ $ccWebstreamMetadata->setCcSchedule(null);
+ }
+
+ return $this;
+ }
+
+ /**
+ * 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->file_id = null;
+ $this->stream_id = null;
+ $this->clip_length = null;
+ $this->fade_in = null;
+ $this->fade_out = null;
+ $this->cue_in = null;
+ $this->cue_out = null;
+ $this->media_item_played = null;
+ $this->instance_id = null;
+ $this->playout_status = null;
+ $this->broadcasted = null;
+ $this->position = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->collCcWebstreamMetadatas) {
+ foreach ($this->collCcWebstreamMetadatas as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->aCcShowInstances instanceof Persistent) {
+ $this->aCcShowInstances->clearAllReferences($deep);
+ }
+ if ($this->aCcFiles instanceof Persistent) {
+ $this->aCcFiles->clearAllReferences($deep);
+ }
+ if ($this->aCcWebstream instanceof Persistent) {
+ $this->aCcWebstream->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ if ($this->collCcWebstreamMetadatas instanceof PropelCollection) {
+ $this->collCcWebstreamMetadatas->clearIterator();
+ }
+ $this->collCcWebstreamMetadatas = null;
+ $this->aCcShowInstances = null;
+ $this->aCcFiles = null;
+ $this->aCcWebstream = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcSchedulePeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php b/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php
index 164830444..981588831 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php
@@ -4,1763 +4,1799 @@
/**
* Base static class for performing query and update operations on the 'cc_schedule' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcSchedulePeer {
+abstract class BaseCcSchedulePeer
+{
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_schedule';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcSchedule';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcSchedule';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcScheduleTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 15;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_schedule.ID';
-
- /** the column name for the STARTS field */
- const STARTS = 'cc_schedule.STARTS';
-
- /** the column name for the ENDS field */
- const ENDS = 'cc_schedule.ENDS';
-
- /** the column name for the FILE_ID field */
- const FILE_ID = 'cc_schedule.FILE_ID';
-
- /** the column name for the STREAM_ID field */
- const STREAM_ID = 'cc_schedule.STREAM_ID';
-
- /** the column name for the CLIP_LENGTH field */
- const CLIP_LENGTH = 'cc_schedule.CLIP_LENGTH';
-
- /** the column name for the FADE_IN field */
- const FADE_IN = 'cc_schedule.FADE_IN';
-
- /** the column name for the FADE_OUT field */
- const FADE_OUT = 'cc_schedule.FADE_OUT';
-
- /** the column name for the CUE_IN field */
- const CUE_IN = 'cc_schedule.CUE_IN';
-
- /** the column name for the CUE_OUT field */
- const CUE_OUT = 'cc_schedule.CUE_OUT';
-
- /** the column name for the MEDIA_ITEM_PLAYED field */
- const MEDIA_ITEM_PLAYED = 'cc_schedule.MEDIA_ITEM_PLAYED';
-
- /** the column name for the INSTANCE_ID field */
- const INSTANCE_ID = 'cc_schedule.INSTANCE_ID';
-
- /** the column name for the PLAYOUT_STATUS field */
- const PLAYOUT_STATUS = 'cc_schedule.PLAYOUT_STATUS';
-
- /** the column name for the BROADCASTED field */
- const BROADCASTED = 'cc_schedule.BROADCASTED';
-
- /** the column name for the POSITION field */
- const POSITION = 'cc_schedule.POSITION';
-
- /**
- * An identiy map to hold any loaded instances of CcSchedule objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcSchedule[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbFileId', 'DbStreamId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbMediaItemPlayed', 'DbInstanceId', 'DbPlayoutStatus', 'DbBroadcasted', 'DbPosition', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbFileId', 'dbStreamId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbMediaItemPlayed', 'dbInstanceId', 'dbPlayoutStatus', 'dbBroadcasted', 'dbPosition', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::FILE_ID, self::STREAM_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, self::PLAYOUT_STATUS, self::BROADCASTED, self::POSITION, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'FILE_ID', 'STREAM_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', 'PLAYOUT_STATUS', 'BROADCASTED', 'POSITION', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'file_id', 'stream_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'media_item_played', 'instance_id', 'playout_status', 'broadcasted', 'position', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
- );
-
- /**
- * 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, 'DbFileId' => 3, 'DbStreamId' => 4, 'DbClipLength' => 5, 'DbFadeIn' => 6, 'DbFadeOut' => 7, 'DbCueIn' => 8, 'DbCueOut' => 9, 'DbMediaItemPlayed' => 10, 'DbInstanceId' => 11, 'DbPlayoutStatus' => 12, 'DbBroadcasted' => 13, 'DbPosition' => 14, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbFileId' => 3, 'dbStreamId' => 4, 'dbClipLength' => 5, 'dbFadeIn' => 6, 'dbFadeOut' => 7, 'dbCueIn' => 8, 'dbCueOut' => 9, 'dbMediaItemPlayed' => 10, 'dbInstanceId' => 11, 'dbPlayoutStatus' => 12, 'dbBroadcasted' => 13, 'dbPosition' => 14, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::FILE_ID => 3, self::STREAM_ID => 4, self::CLIP_LENGTH => 5, self::FADE_IN => 6, self::FADE_OUT => 7, self::CUE_IN => 8, self::CUE_OUT => 9, self::MEDIA_ITEM_PLAYED => 10, self::INSTANCE_ID => 11, self::PLAYOUT_STATUS => 12, self::BROADCASTED => 13, self::POSITION => 14, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'FILE_ID' => 3, 'STREAM_ID' => 4, 'CLIP_LENGTH' => 5, 'FADE_IN' => 6, 'FADE_OUT' => 7, 'CUE_IN' => 8, 'CUE_OUT' => 9, 'MEDIA_ITEM_PLAYED' => 10, 'INSTANCE_ID' => 11, 'PLAYOUT_STATUS' => 12, 'BROADCASTED' => 13, 'POSITION' => 14, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'file_id' => 3, 'stream_id' => 4, 'clip_length' => 5, 'fade_in' => 6, 'fade_out' => 7, 'cue_in' => 8, 'cue_out' => 9, 'media_item_played' => 10, 'instance_id' => 11, 'playout_status' => 12, 'broadcasted' => 13, 'position' => 14, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
- );
-
- /**
- * 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::STARTS);
- $criteria->addSelectColumn(CcSchedulePeer::ENDS);
- $criteria->addSelectColumn(CcSchedulePeer::FILE_ID);
- $criteria->addSelectColumn(CcSchedulePeer::STREAM_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::MEDIA_ITEM_PLAYED);
- $criteria->addSelectColumn(CcSchedulePeer::INSTANCE_ID);
- $criteria->addSelectColumn(CcSchedulePeer::PLAYOUT_STATUS);
- $criteria->addSelectColumn(CcSchedulePeer::BROADCASTED);
- $criteria->addSelectColumn(CcSchedulePeer::POSITION);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.STARTS');
- $criteria->addSelectColumn($alias . '.ENDS');
- $criteria->addSelectColumn($alias . '.FILE_ID');
- $criteria->addSelectColumn($alias . '.STREAM_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 . '.MEDIA_ITEM_PLAYED');
- $criteria->addSelectColumn($alias . '.INSTANCE_ID');
- $criteria->addSelectColumn($alias . '.PLAYOUT_STATUS');
- $criteria->addSelectColumn($alias . '.BROADCASTED');
- $criteria->addSelectColumn($alias . '.POSITION');
- }
- }
-
- /**
- * 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()
- {
- // Invalidate objects in CcWebstreamMetadataPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CcWebstreamMetadataPeer::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 = 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;
- }
-
-
- /**
- * Returns the number of rows matching criteria, joining the related CcWebstream 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 doCountJoinCcWebstream(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::STREAM_ID, CcWebstreamPeer::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;
- }
-
-
- /**
- * Selects a collection of CcSchedule objects pre-filled with their CcWebstream 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 doSelectJoinCcWebstream(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);
- CcWebstreamPeer::addSelectColumns($criteria);
-
- $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::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 = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, $startcol);
- if ($key2 !== null) {
- $obj2 = CcWebstreamPeer::getInstanceFromPool($key2);
- if (!$obj2) {
-
- $cls = CcWebstreamPeer::getOMClass(false);
-
- $obj2 = new $cls();
- $obj2->hydrate($row, $startcol);
- CcWebstreamPeer::addInstanceToPool($obj2, $key2);
- } // if obj2 already loaded
-
- // Add the $obj1 (CcSchedule) to $obj2 (CcWebstream)
- $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);
-
- $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::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);
-
- CcWebstreamPeer::addSelectColumns($criteria);
- $startcol5 = $startcol4 + (CcWebstreamPeer::NUM_COLUMNS - CcWebstreamPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
-
- $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
-
- $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::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
-
- // Add objects for joined CcWebstream rows
-
- $key4 = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, $startcol4);
- if ($key4 !== null) {
- $obj4 = CcWebstreamPeer::getInstanceFromPool($key4);
- if (!$obj4) {
-
- $cls = CcWebstreamPeer::getOMClass(false);
-
- $obj4 = new $cls();
- $obj4->hydrate($row, $startcol4);
- CcWebstreamPeer::addInstanceToPool($obj4, $key4);
- } // if obj4 loaded
-
- // Add the $obj1 (CcSchedule) to the collection in $obj4 (CcWebstream)
- $obj4->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);
-
- $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::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);
-
- $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::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 CcWebstream 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 doCountJoinAllExceptCcWebstream(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);
-
- $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 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);
-
- CcWebstreamPeer::addSelectColumns($criteria);
- $startcol4 = $startcol3 + (CcWebstreamPeer::NUM_COLUMNS - CcWebstreamPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
-
- $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::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
-
- // Add objects for joined CcWebstream rows
-
- $key3 = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, $startcol3);
- if ($key3 !== null) {
- $obj3 = CcWebstreamPeer::getInstanceFromPool($key3);
- if (!$obj3) {
-
- $cls = CcWebstreamPeer::getOMClass(false);
-
- $obj3 = new $cls();
- $obj3->hydrate($row, $startcol3);
- CcWebstreamPeer::addInstanceToPool($obj3, $key3);
- } // if $obj3 already loaded
-
- // Add the $obj1 (CcSchedule) to the collection in $obj3 (CcWebstream)
- $obj3->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);
-
- CcWebstreamPeer::addSelectColumns($criteria);
- $startcol4 = $startcol3 + (CcWebstreamPeer::NUM_COLUMNS - CcWebstreamPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
-
- $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::ID, $join_behavior);
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_schedule';
- $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
-
- // Add objects for joined CcWebstream rows
-
- $key3 = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, $startcol3);
- if ($key3 !== null) {
- $obj3 = CcWebstreamPeer::getInstanceFromPool($key3);
- if (!$obj3) {
-
- $cls = CcWebstreamPeer::getOMClass(false);
-
- $obj3 = new $cls();
- $obj3->hydrate($row, $startcol3);
- CcWebstreamPeer::addInstanceToPool($obj3, $key3);
- } // if $obj3 already loaded
-
- // Add the $obj1 (CcSchedule) to the collection in $obj3 (CcWebstream)
- $obj3->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 CcWebstream.
- *
- * @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 doSelectJoinAllExceptCcWebstream(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);
-
- 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 already loaded
-
- // Add the $obj1 (CcSchedule) to the collection in $obj2 (CcShowInstances)
- $obj2->addCcSchedule($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 (CcSchedule) to the collection in $obj3 (CcFiles)
- $obj3->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;
- }
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcSchedule';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcScheduleTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 15;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 15;
+
+ /** the column name for the id field */
+ const ID = 'cc_schedule.id';
+
+ /** the column name for the starts field */
+ const STARTS = 'cc_schedule.starts';
+
+ /** the column name for the ends field */
+ const ENDS = 'cc_schedule.ends';
+
+ /** the column name for the file_id field */
+ const FILE_ID = 'cc_schedule.file_id';
+
+ /** the column name for the stream_id field */
+ const STREAM_ID = 'cc_schedule.stream_id';
+
+ /** the column name for the clip_length field */
+ const CLIP_LENGTH = 'cc_schedule.clip_length';
+
+ /** the column name for the fade_in field */
+ const FADE_IN = 'cc_schedule.fade_in';
+
+ /** the column name for the fade_out field */
+ const FADE_OUT = 'cc_schedule.fade_out';
+
+ /** the column name for the cue_in field */
+ const CUE_IN = 'cc_schedule.cue_in';
+
+ /** the column name for the cue_out field */
+ const CUE_OUT = 'cc_schedule.cue_out';
+
+ /** the column name for the media_item_played field */
+ const MEDIA_ITEM_PLAYED = 'cc_schedule.media_item_played';
+
+ /** the column name for the instance_id field */
+ const INSTANCE_ID = 'cc_schedule.instance_id';
+
+ /** the column name for the playout_status field */
+ const PLAYOUT_STATUS = 'cc_schedule.playout_status';
+
+ /** the column name for the broadcasted field */
+ const BROADCASTED = 'cc_schedule.broadcasted';
+
+ /** the column name for the position field */
+ const POSITION = 'cc_schedule.position';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcSchedule objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcSchedule[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcSchedulePeer::$fieldNames[CcSchedulePeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbFileId', 'DbStreamId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbMediaItemPlayed', 'DbInstanceId', 'DbPlayoutStatus', 'DbBroadcasted', 'DbPosition', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbFileId', 'dbStreamId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbMediaItemPlayed', 'dbInstanceId', 'dbPlayoutStatus', 'dbBroadcasted', 'dbPosition', ),
+ BasePeer::TYPE_COLNAME => array (CcSchedulePeer::ID, CcSchedulePeer::STARTS, CcSchedulePeer::ENDS, CcSchedulePeer::FILE_ID, CcSchedulePeer::STREAM_ID, CcSchedulePeer::CLIP_LENGTH, CcSchedulePeer::FADE_IN, CcSchedulePeer::FADE_OUT, CcSchedulePeer::CUE_IN, CcSchedulePeer::CUE_OUT, CcSchedulePeer::MEDIA_ITEM_PLAYED, CcSchedulePeer::INSTANCE_ID, CcSchedulePeer::PLAYOUT_STATUS, CcSchedulePeer::BROADCASTED, CcSchedulePeer::POSITION, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'FILE_ID', 'STREAM_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', 'PLAYOUT_STATUS', 'BROADCASTED', 'POSITION', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'file_id', 'stream_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'media_item_played', 'instance_id', 'playout_status', 'broadcasted', 'position', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. CcSchedulePeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbFileId' => 3, 'DbStreamId' => 4, 'DbClipLength' => 5, 'DbFadeIn' => 6, 'DbFadeOut' => 7, 'DbCueIn' => 8, 'DbCueOut' => 9, 'DbMediaItemPlayed' => 10, 'DbInstanceId' => 11, 'DbPlayoutStatus' => 12, 'DbBroadcasted' => 13, 'DbPosition' => 14, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbFileId' => 3, 'dbStreamId' => 4, 'dbClipLength' => 5, 'dbFadeIn' => 6, 'dbFadeOut' => 7, 'dbCueIn' => 8, 'dbCueOut' => 9, 'dbMediaItemPlayed' => 10, 'dbInstanceId' => 11, 'dbPlayoutStatus' => 12, 'dbBroadcasted' => 13, 'dbPosition' => 14, ),
+ BasePeer::TYPE_COLNAME => array (CcSchedulePeer::ID => 0, CcSchedulePeer::STARTS => 1, CcSchedulePeer::ENDS => 2, CcSchedulePeer::FILE_ID => 3, CcSchedulePeer::STREAM_ID => 4, CcSchedulePeer::CLIP_LENGTH => 5, CcSchedulePeer::FADE_IN => 6, CcSchedulePeer::FADE_OUT => 7, CcSchedulePeer::CUE_IN => 8, CcSchedulePeer::CUE_OUT => 9, CcSchedulePeer::MEDIA_ITEM_PLAYED => 10, CcSchedulePeer::INSTANCE_ID => 11, CcSchedulePeer::PLAYOUT_STATUS => 12, CcSchedulePeer::BROADCASTED => 13, CcSchedulePeer::POSITION => 14, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'FILE_ID' => 3, 'STREAM_ID' => 4, 'CLIP_LENGTH' => 5, 'FADE_IN' => 6, 'FADE_OUT' => 7, 'CUE_IN' => 8, 'CUE_OUT' => 9, 'MEDIA_ITEM_PLAYED' => 10, 'INSTANCE_ID' => 11, 'PLAYOUT_STATUS' => 12, 'BROADCASTED' => 13, 'POSITION' => 14, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'file_id' => 3, 'stream_id' => 4, 'clip_length' => 5, 'fade_in' => 6, 'fade_out' => 7, 'cue_in' => 8, 'cue_out' => 9, 'media_item_played' => 10, 'instance_id' => 11, 'playout_status' => 12, 'broadcasted' => 13, 'position' => 14, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
+ );
+
+ /**
+ * 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcSchedulePeer::getFieldNames($toType);
+ $key = isset(CcSchedulePeer::$fieldKeys[$fromType][$name]) ? CcSchedulePeer::$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(CcSchedulePeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcSchedulePeer::$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 CcSchedulePeer::$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::STARTS);
+ $criteria->addSelectColumn(CcSchedulePeer::ENDS);
+ $criteria->addSelectColumn(CcSchedulePeer::FILE_ID);
+ $criteria->addSelectColumn(CcSchedulePeer::STREAM_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::MEDIA_ITEM_PLAYED);
+ $criteria->addSelectColumn(CcSchedulePeer::INSTANCE_ID);
+ $criteria->addSelectColumn(CcSchedulePeer::PLAYOUT_STATUS);
+ $criteria->addSelectColumn(CcSchedulePeer::BROADCASTED);
+ $criteria->addSelectColumn(CcSchedulePeer::POSITION);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.starts');
+ $criteria->addSelectColumn($alias . '.ends');
+ $criteria->addSelectColumn($alias . '.file_id');
+ $criteria->addSelectColumn($alias . '.stream_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 . '.media_item_played');
+ $criteria->addSelectColumn($alias . '.instance_id');
+ $criteria->addSelectColumn($alias . '.playout_status');
+ $criteria->addSelectColumn($alias . '.broadcasted');
+ $criteria->addSelectColumn($alias . '.position');
+ }
+ }
+
+ /**
+ * 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(CcSchedulePeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcSchedulePeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcSchedulePeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcSchedulePeer::$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(CcSchedulePeer::$instances[$key])) {
+ return CcSchedulePeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcSchedulePeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcSchedulePeer::$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()
+ {
+ // Invalidate objects in CcWebstreamMetadataPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcWebstreamMetadataPeer::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 = CcSchedulePeer::getOMClass();
+ // 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_HYDRATE_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(CcSchedulePeer::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(CcSchedulePeer::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 CcWebstream 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 doCountJoinCcWebstream(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(CcSchedulePeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::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(CcSchedulePeer::DATABASE_NAME);
+ }
+
+ CcSchedulePeer::addSelectColumns($criteria);
+ $startcol = CcSchedulePeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcSchedulePeer::DATABASE_NAME);
+ }
+
+ CcSchedulePeer::addSelectColumns($criteria);
+ $startcol = CcSchedulePeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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;
+ }
+
+
+ /**
+ * Selects a collection of CcSchedule objects pre-filled with their CcWebstream 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 doSelectJoinCcWebstream(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(CcSchedulePeer::DATABASE_NAME);
+ }
+
+ CcSchedulePeer::addSelectColumns($criteria);
+ $startcol = CcSchedulePeer::NUM_HYDRATE_COLUMNS;
+ CcWebstreamPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::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();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcSchedulePeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcWebstreamPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcWebstreamPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcWebstreamPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcSchedule) to $obj2 (CcWebstream)
+ $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(CcSchedulePeer::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);
+
+ $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::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(CcSchedulePeer::DATABASE_NAME);
+ }
+
+ CcSchedulePeer::addSelectColumns($criteria);
+ $startcol2 = CcSchedulePeer::NUM_HYDRATE_COLUMNS;
+
+ CcShowInstancesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcShowInstancesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + CcFilesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcWebstreamPeer::addSelectColumns($criteria);
+ $startcol5 = $startcol4 + CcWebstreamPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::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();
+
+ $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();
+
+ $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();
+
+ $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
+
+ // Add objects for joined CcWebstream rows
+
+ $key4 = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, $startcol4);
+ if ($key4 !== null) {
+ $obj4 = CcWebstreamPeer::getInstanceFromPool($key4);
+ if (!$obj4) {
+
+ $cls = CcWebstreamPeer::getOMClass();
+
+ $obj4 = new $cls();
+ $obj4->hydrate($row, $startcol4);
+ CcWebstreamPeer::addInstanceToPool($obj4, $key4);
+ } // if obj4 loaded
+
+ // Add the $obj1 (CcSchedule) to the collection in $obj4 (CcWebstream)
+ $obj4->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(CcSchedulePeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::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(CcSchedulePeer::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::STREAM_ID, CcWebstreamPeer::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 CcWebstream 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 doCountJoinAllExceptCcWebstream(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(CcSchedulePeer::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 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(CcSchedulePeer::DATABASE_NAME);
+ }
+
+ CcSchedulePeer::addSelectColumns($criteria);
+ $startcol2 = CcSchedulePeer::NUM_HYDRATE_COLUMNS;
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcFilesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcWebstreamPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + CcWebstreamPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::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();
+
+ $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();
+
+ $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
+
+ // Add objects for joined CcWebstream rows
+
+ $key3 = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, $startcol3);
+ if ($key3 !== null) {
+ $obj3 = CcWebstreamPeer::getInstanceFromPool($key3);
+ if (!$obj3) {
+
+ $cls = CcWebstreamPeer::getOMClass();
+
+ $obj3 = new $cls();
+ $obj3->hydrate($row, $startcol3);
+ CcWebstreamPeer::addInstanceToPool($obj3, $key3);
+ } // if $obj3 already loaded
+
+ // Add the $obj1 (CcSchedule) to the collection in $obj3 (CcWebstream)
+ $obj3->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(CcSchedulePeer::DATABASE_NAME);
+ }
+
+ CcSchedulePeer::addSelectColumns($criteria);
+ $startcol2 = CcSchedulePeer::NUM_HYDRATE_COLUMNS;
+
+ CcShowInstancesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcShowInstancesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcWebstreamPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + CcWebstreamPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
+
+ $criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::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();
+
+ $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();
+
+ $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
+
+ // Add objects for joined CcWebstream rows
+
+ $key3 = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, $startcol3);
+ if ($key3 !== null) {
+ $obj3 = CcWebstreamPeer::getInstanceFromPool($key3);
+ if (!$obj3) {
+
+ $cls = CcWebstreamPeer::getOMClass();
+
+ $obj3 = new $cls();
+ $obj3->hydrate($row, $startcol3);
+ CcWebstreamPeer::addInstanceToPool($obj3, $key3);
+ } // if $obj3 already loaded
+
+ // Add the $obj1 (CcSchedule) to the collection in $obj3 (CcWebstream)
+ $obj3->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 CcWebstream.
+ *
+ * @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 doSelectJoinAllExceptCcWebstream(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(CcSchedulePeer::DATABASE_NAME);
+ }
+
+ CcSchedulePeer::addSelectColumns($criteria);
+ $startcol2 = CcSchedulePeer::NUM_HYDRATE_COLUMNS;
+
+ CcShowInstancesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcShowInstancesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + CcFilesPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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
+
+ // Add objects for joined CcFiles rows
+
+ $key3 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol3);
+ if ($key3 !== null) {
+ $obj3 = CcFilesPeer::getInstanceFromPool($key3);
+ if (!$obj3) {
+
+ $cls = CcFilesPeer::getOMClass();
+
+ $obj3 = new $cls();
+ $obj3->hydrate($row, $startcol3);
+ CcFilesPeer::addInstanceToPool($obj3, $key3);
+ } // if $obj3 already loaded
+
+ // Add the $obj1 (CcSchedule) to the collection in $obj3 (CcFiles)
+ $obj3->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(CcSchedulePeer::DATABASE_NAME)->getTable(CcSchedulePeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcSchedulePeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcSchedulePeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcSchedulePeer::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(CcSchedulePeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_schedule table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcSchedulePeer::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(CcSchedulePeer::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 (Exception $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($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->hasColumn($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
+ * @return CcSchedule[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php
index 45448d510..a7f4ea02a 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php
@@ -4,883 +4,1191 @@
/**
* Base class that represents a query for the 'cc_schedule' table.
*
- *
*
- * @method CcScheduleQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcScheduleQuery orderByDbStarts($order = Criteria::ASC) Order by the starts column
- * @method CcScheduleQuery orderByDbEnds($order = Criteria::ASC) Order by the ends column
- * @method CcScheduleQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column
- * @method CcScheduleQuery orderByDbStreamId($order = Criteria::ASC) Order by the stream_id column
- * @method CcScheduleQuery orderByDbClipLength($order = Criteria::ASC) Order by the clip_length column
- * @method CcScheduleQuery orderByDbFadeIn($order = Criteria::ASC) Order by the fade_in column
- * @method CcScheduleQuery orderByDbFadeOut($order = Criteria::ASC) Order by the fade_out column
- * @method CcScheduleQuery orderByDbCueIn($order = Criteria::ASC) Order by the cue_in column
- * @method CcScheduleQuery orderByDbCueOut($order = Criteria::ASC) Order by the cue_out column
- * @method CcScheduleQuery orderByDbMediaItemPlayed($order = Criteria::ASC) Order by the media_item_played column
- * @method CcScheduleQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column
- * @method CcScheduleQuery orderByDbPlayoutStatus($order = Criteria::ASC) Order by the playout_status column
- * @method CcScheduleQuery orderByDbBroadcasted($order = Criteria::ASC) Order by the broadcasted column
- * @method CcScheduleQuery orderByDbPosition($order = Criteria::ASC) Order by the position column
*
- * @method CcScheduleQuery groupByDbId() Group by the id column
- * @method CcScheduleQuery groupByDbStarts() Group by the starts column
- * @method CcScheduleQuery groupByDbEnds() Group by the ends column
- * @method CcScheduleQuery groupByDbFileId() Group by the file_id column
- * @method CcScheduleQuery groupByDbStreamId() Group by the stream_id column
- * @method CcScheduleQuery groupByDbClipLength() Group by the clip_length column
- * @method CcScheduleQuery groupByDbFadeIn() Group by the fade_in column
- * @method CcScheduleQuery groupByDbFadeOut() Group by the fade_out column
- * @method CcScheduleQuery groupByDbCueIn() Group by the cue_in column
- * @method CcScheduleQuery groupByDbCueOut() Group by the cue_out column
- * @method CcScheduleQuery groupByDbMediaItemPlayed() Group by the media_item_played column
- * @method CcScheduleQuery groupByDbInstanceId() Group by the instance_id column
- * @method CcScheduleQuery groupByDbPlayoutStatus() Group by the playout_status column
- * @method CcScheduleQuery groupByDbBroadcasted() Group by the broadcasted column
- * @method CcScheduleQuery groupByDbPosition() Group by the position column
+ * @method CcScheduleQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcScheduleQuery orderByDbStarts($order = Criteria::ASC) Order by the starts column
+ * @method CcScheduleQuery orderByDbEnds($order = Criteria::ASC) Order by the ends column
+ * @method CcScheduleQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column
+ * @method CcScheduleQuery orderByDbStreamId($order = Criteria::ASC) Order by the stream_id column
+ * @method CcScheduleQuery orderByDbClipLength($order = Criteria::ASC) Order by the clip_length column
+ * @method CcScheduleQuery orderByDbFadeIn($order = Criteria::ASC) Order by the fade_in column
+ * @method CcScheduleQuery orderByDbFadeOut($order = Criteria::ASC) Order by the fade_out column
+ * @method CcScheduleQuery orderByDbCueIn($order = Criteria::ASC) Order by the cue_in column
+ * @method CcScheduleQuery orderByDbCueOut($order = Criteria::ASC) Order by the cue_out column
+ * @method CcScheduleQuery orderByDbMediaItemPlayed($order = Criteria::ASC) Order by the media_item_played column
+ * @method CcScheduleQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column
+ * @method CcScheduleQuery orderByDbPlayoutStatus($order = Criteria::ASC) Order by the playout_status column
+ * @method CcScheduleQuery orderByDbBroadcasted($order = Criteria::ASC) Order by the broadcasted column
+ * @method CcScheduleQuery orderByDbPosition($order = Criteria::ASC) Order by the position column
*
- * @method CcScheduleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcScheduleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcScheduleQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcScheduleQuery groupByDbId() Group by the id column
+ * @method CcScheduleQuery groupByDbStarts() Group by the starts column
+ * @method CcScheduleQuery groupByDbEnds() Group by the ends column
+ * @method CcScheduleQuery groupByDbFileId() Group by the file_id column
+ * @method CcScheduleQuery groupByDbStreamId() Group by the stream_id column
+ * @method CcScheduleQuery groupByDbClipLength() Group by the clip_length column
+ * @method CcScheduleQuery groupByDbFadeIn() Group by the fade_in column
+ * @method CcScheduleQuery groupByDbFadeOut() Group by the fade_out column
+ * @method CcScheduleQuery groupByDbCueIn() Group by the cue_in column
+ * @method CcScheduleQuery groupByDbCueOut() Group by the cue_out column
+ * @method CcScheduleQuery groupByDbMediaItemPlayed() Group by the media_item_played column
+ * @method CcScheduleQuery groupByDbInstanceId() Group by the instance_id column
+ * @method CcScheduleQuery groupByDbPlayoutStatus() Group by the playout_status column
+ * @method CcScheduleQuery groupByDbBroadcasted() Group by the broadcasted column
+ * @method CcScheduleQuery groupByDbPosition() Group by the position column
*
- * @method CcScheduleQuery leftJoinCcShowInstances($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowInstances relation
- * @method CcScheduleQuery rightJoinCcShowInstances($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowInstances relation
- * @method CcScheduleQuery innerJoinCcShowInstances($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowInstances relation
+ * @method CcScheduleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcScheduleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcScheduleQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcScheduleQuery leftJoinCcFiles($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFiles relation
- * @method CcScheduleQuery rightJoinCcFiles($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFiles relation
- * @method CcScheduleQuery innerJoinCcFiles($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFiles relation
+ * @method CcScheduleQuery leftJoinCcShowInstances($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcShowInstances relation
+ * @method CcScheduleQuery rightJoinCcShowInstances($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcShowInstances relation
+ * @method CcScheduleQuery innerJoinCcShowInstances($relationAlias = null) Adds a INNER JOIN clause to the query using the CcShowInstances relation
*
- * @method CcScheduleQuery leftJoinCcWebstream($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcWebstream relation
- * @method CcScheduleQuery rightJoinCcWebstream($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcWebstream relation
- * @method CcScheduleQuery innerJoinCcWebstream($relationAlias = '') Adds a INNER JOIN clause to the query using the CcWebstream relation
+ * @method CcScheduleQuery leftJoinCcFiles($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcFiles relation
+ * @method CcScheduleQuery rightJoinCcFiles($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcFiles relation
+ * @method CcScheduleQuery innerJoinCcFiles($relationAlias = null) Adds a INNER JOIN clause to the query using the CcFiles relation
*
- * @method CcScheduleQuery leftJoinCcWebstreamMetadata($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcWebstreamMetadata relation
- * @method CcScheduleQuery rightJoinCcWebstreamMetadata($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcWebstreamMetadata relation
- * @method CcScheduleQuery innerJoinCcWebstreamMetadata($relationAlias = '') Adds a INNER JOIN clause to the query using the CcWebstreamMetadata relation
+ * @method CcScheduleQuery leftJoinCcWebstream($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcWebstream relation
+ * @method CcScheduleQuery rightJoinCcWebstream($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcWebstream relation
+ * @method CcScheduleQuery innerJoinCcWebstream($relationAlias = null) Adds a INNER JOIN clause to the query using the CcWebstream relation
*
- * @method CcSchedule findOne(PropelPDO $con = null) Return the first CcSchedule matching the query
- * @method CcSchedule findOneOrCreate(PropelPDO $con = null) Return the first CcSchedule matching the query, or a new CcSchedule object populated from the query conditions when no match is found
+ * @method CcScheduleQuery leftJoinCcWebstreamMetadata($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcWebstreamMetadata relation
+ * @method CcScheduleQuery rightJoinCcWebstreamMetadata($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcWebstreamMetadata relation
+ * @method CcScheduleQuery innerJoinCcWebstreamMetadata($relationAlias = null) Adds a INNER JOIN clause to the query using the CcWebstreamMetadata relation
*
- * @method CcSchedule findOneByDbId(int $id) Return the first CcSchedule filtered by the id column
- * @method CcSchedule findOneByDbStarts(string $starts) Return the first CcSchedule filtered by the starts column
- * @method CcSchedule findOneByDbEnds(string $ends) Return the first CcSchedule filtered by the ends column
- * @method CcSchedule findOneByDbFileId(int $file_id) Return the first CcSchedule filtered by the file_id column
- * @method CcSchedule findOneByDbStreamId(int $stream_id) Return the first CcSchedule filtered by the stream_id column
- * @method CcSchedule findOneByDbClipLength(string $clip_length) Return the first CcSchedule filtered by the clip_length column
- * @method CcSchedule findOneByDbFadeIn(string $fade_in) Return the first CcSchedule filtered by the fade_in column
- * @method CcSchedule findOneByDbFadeOut(string $fade_out) Return the first CcSchedule filtered by the fade_out column
- * @method CcSchedule findOneByDbCueIn(string $cue_in) Return the first CcSchedule filtered by the cue_in column
- * @method CcSchedule findOneByDbCueOut(string $cue_out) Return the first CcSchedule filtered by the cue_out column
- * @method CcSchedule findOneByDbMediaItemPlayed(boolean $media_item_played) Return the first CcSchedule filtered by the media_item_played column
- * @method CcSchedule findOneByDbInstanceId(int $instance_id) Return the first CcSchedule filtered by the instance_id column
- * @method CcSchedule findOneByDbPlayoutStatus(int $playout_status) Return the first CcSchedule filtered by the playout_status column
- * @method CcSchedule findOneByDbBroadcasted(int $broadcasted) Return the first CcSchedule filtered by the broadcasted column
- * @method CcSchedule findOneByDbPosition(int $position) Return the first CcSchedule filtered by the position column
+ * @method CcSchedule findOne(PropelPDO $con = null) Return the first CcSchedule matching the query
+ * @method CcSchedule findOneOrCreate(PropelPDO $con = null) Return the first CcSchedule matching the query, or a new CcSchedule object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcSchedule objects filtered by the id column
- * @method array findByDbStarts(string $starts) Return CcSchedule objects filtered by the starts column
- * @method array findByDbEnds(string $ends) Return CcSchedule objects filtered by the ends column
- * @method array findByDbFileId(int $file_id) Return CcSchedule objects filtered by the file_id column
- * @method array findByDbStreamId(int $stream_id) Return CcSchedule objects filtered by the stream_id column
- * @method array findByDbClipLength(string $clip_length) Return CcSchedule objects filtered by the clip_length column
- * @method array findByDbFadeIn(string $fade_in) Return CcSchedule objects filtered by the fade_in column
- * @method array findByDbFadeOut(string $fade_out) Return CcSchedule objects filtered by the fade_out column
- * @method array findByDbCueIn(string $cue_in) Return CcSchedule objects filtered by the cue_in column
- * @method array findByDbCueOut(string $cue_out) Return CcSchedule objects filtered by the cue_out column
- * @method array findByDbMediaItemPlayed(boolean $media_item_played) Return CcSchedule objects filtered by the media_item_played column
- * @method array findByDbInstanceId(int $instance_id) Return CcSchedule objects filtered by the instance_id column
- * @method array findByDbPlayoutStatus(int $playout_status) Return CcSchedule objects filtered by the playout_status column
- * @method array findByDbBroadcasted(int $broadcasted) Return CcSchedule objects filtered by the broadcasted column
- * @method array findByDbPosition(int $position) Return CcSchedule objects filtered by the position column
+ * @method CcSchedule findOneByDbStarts(string $starts) Return the first CcSchedule filtered by the starts column
+ * @method CcSchedule findOneByDbEnds(string $ends) Return the first CcSchedule filtered by the ends column
+ * @method CcSchedule findOneByDbFileId(int $file_id) Return the first CcSchedule filtered by the file_id column
+ * @method CcSchedule findOneByDbStreamId(int $stream_id) Return the first CcSchedule filtered by the stream_id column
+ * @method CcSchedule findOneByDbClipLength(string $clip_length) Return the first CcSchedule filtered by the clip_length column
+ * @method CcSchedule findOneByDbFadeIn(string $fade_in) Return the first CcSchedule filtered by the fade_in column
+ * @method CcSchedule findOneByDbFadeOut(string $fade_out) Return the first CcSchedule filtered by the fade_out column
+ * @method CcSchedule findOneByDbCueIn(string $cue_in) Return the first CcSchedule filtered by the cue_in column
+ * @method CcSchedule findOneByDbCueOut(string $cue_out) Return the first CcSchedule filtered by the cue_out column
+ * @method CcSchedule findOneByDbMediaItemPlayed(boolean $media_item_played) Return the first CcSchedule filtered by the media_item_played column
+ * @method CcSchedule findOneByDbInstanceId(int $instance_id) Return the first CcSchedule filtered by the instance_id column
+ * @method CcSchedule findOneByDbPlayoutStatus(int $playout_status) Return the first CcSchedule filtered by the playout_status column
+ * @method CcSchedule findOneByDbBroadcasted(int $broadcasted) Return the first CcSchedule filtered by the broadcasted column
+ * @method CcSchedule findOneByDbPosition(int $position) Return the first CcSchedule filtered by the position column
+ *
+ * @method array findByDbId(int $id) Return CcSchedule objects filtered by the id column
+ * @method array findByDbStarts(string $starts) Return CcSchedule objects filtered by the starts column
+ * @method array findByDbEnds(string $ends) Return CcSchedule objects filtered by the ends column
+ * @method array findByDbFileId(int $file_id) Return CcSchedule objects filtered by the file_id column
+ * @method array findByDbStreamId(int $stream_id) Return CcSchedule objects filtered by the stream_id column
+ * @method array findByDbClipLength(string $clip_length) Return CcSchedule objects filtered by the clip_length column
+ * @method array findByDbFadeIn(string $fade_in) Return CcSchedule objects filtered by the fade_in column
+ * @method array findByDbFadeOut(string $fade_out) Return CcSchedule objects filtered by the fade_out column
+ * @method array findByDbCueIn(string $cue_in) Return CcSchedule objects filtered by the cue_in column
+ * @method array findByDbCueOut(string $cue_out) Return CcSchedule objects filtered by the cue_out column
+ * @method array findByDbMediaItemPlayed(boolean $media_item_played) Return CcSchedule objects filtered by the media_item_played column
+ * @method array findByDbInstanceId(int $instance_id) Return CcSchedule objects filtered by the instance_id column
+ * @method array findByDbPlayoutStatus(int $playout_status) Return CcSchedule objects filtered by the playout_status column
+ * @method array findByDbBroadcasted(int $broadcasted) Return CcSchedule objects filtered by the broadcasted column
+ * @method array findByDbPosition(int $position) Return CcSchedule objects filtered by the position column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcScheduleQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcScheduleQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcSchedule';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcScheduleQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcSchedule', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcScheduleQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcScheduleQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcScheduleQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcScheduleQuery) {
+ return $criteria;
+ }
+ $query = new CcScheduleQuery(null, null, $modelAlias);
- /**
- * Returns a new CcScheduleQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcScheduleQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcScheduleQuery) {
- return $criteria;
- }
- $query = new CcScheduleQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcSchedule|CcSchedule[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcSchedulePeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $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);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcSchedule A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcSchedule A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "starts", "ends", "file_id", "stream_id", "clip_length", "fade_in", "fade_out", "cue_in", "cue_out", "media_item_played", "instance_id", "playout_status", "broadcasted", "position" FROM "cc_schedule" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcSchedule();
+ $obj->hydrate($row);
+ CcSchedulePeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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);
- }
+ return $obj;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcSchedule|CcSchedule[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * 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);
- }
+ /**
+ * 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|CcSchedule[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * Filter the query on the stream_id column
- *
- * @param int|array $dbStreamId 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 filterByDbStreamId($dbStreamId = null, $comparison = null)
- {
- if (is_array($dbStreamId)) {
- $useMinMax = false;
- if (isset($dbStreamId['min'])) {
- $this->addUsingAlias(CcSchedulePeer::STREAM_ID, $dbStreamId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbStreamId['max'])) {
- $this->addUsingAlias(CcSchedulePeer::STREAM_ID, $dbStreamId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcSchedulePeer::STREAM_ID, $dbStreamId, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * Filter the query on the clip_length column
- *
- * @param string $dbClipLength 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 CcScheduleQuery The current query, for fluid interface
- */
- public function filterByDbClipLength($dbClipLength = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbClipLength)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbClipLength)) {
- $dbClipLength = str_replace('*', '%', $dbClipLength);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $dbClipLength, $comparison);
- }
+ /**
+ * 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)
+ {
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcSchedulePeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * 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 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)
+ {
- /**
- * Filter the query on the cue_in column
- *
- * @param string $dbCueIn 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 CcScheduleQuery The current query, for fluid interface
- */
- public function filterByDbCueIn($dbCueIn = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbCueIn)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbCueIn)) {
- $dbCueIn = str_replace('*', '%', $dbCueIn);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcSchedulePeer::CUE_IN, $dbCueIn, $comparison);
- }
+ return $this->addUsingAlias(CcSchedulePeer::ID, $keys, Criteria::IN);
+ }
- /**
- * Filter the query on the cue_out column
- *
- * @param string $dbCueOut 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 CcScheduleQuery The current query, for fluid interface
- */
- public function filterByDbCueOut($dbCueOut = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbCueOut)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbCueOut)) {
- $dbCueOut = str_replace('*', '%', $dbCueOut);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $dbCueOut, $comparison);
- }
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcSchedulePeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcSchedulePeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcSchedulePeer::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 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 on the starts column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbStarts('2011-03-14'); // WHERE starts = '2011-03-14'
+ * $query->filterByDbStarts('now'); // WHERE starts = '2011-03-14'
+ * $query->filterByDbStarts(array('max' => 'yesterday')); // WHERE starts < '2011-03-13'
+ *
+ *
+ * @param mixed $dbStarts The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * Filter the query on the playout_status column
- *
- * @param int|array $dbPlayoutStatus 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 filterByDbPlayoutStatus($dbPlayoutStatus = null, $comparison = null)
- {
- if (is_array($dbPlayoutStatus)) {
- $useMinMax = false;
- if (isset($dbPlayoutStatus['min'])) {
- $this->addUsingAlias(CcSchedulePeer::PLAYOUT_STATUS, $dbPlayoutStatus['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbPlayoutStatus['max'])) {
- $this->addUsingAlias(CcSchedulePeer::PLAYOUT_STATUS, $dbPlayoutStatus['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcSchedulePeer::PLAYOUT_STATUS, $dbPlayoutStatus, $comparison);
- }
+ return $this->addUsingAlias(CcSchedulePeer::STARTS, $dbStarts, $comparison);
+ }
- /**
- * Filter the query on the broadcasted column
- *
- * @param int|array $dbBroadcasted 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 filterByDbBroadcasted($dbBroadcasted = null, $comparison = null)
- {
- if (is_array($dbBroadcasted)) {
- $useMinMax = false;
- if (isset($dbBroadcasted['min'])) {
- $this->addUsingAlias(CcSchedulePeer::BROADCASTED, $dbBroadcasted['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbBroadcasted['max'])) {
- $this->addUsingAlias(CcSchedulePeer::BROADCASTED, $dbBroadcasted['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcSchedulePeer::BROADCASTED, $dbBroadcasted, $comparison);
- }
+ /**
+ * Filter the query on the ends column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbEnds('2011-03-14'); // WHERE ends = '2011-03-14'
+ * $query->filterByDbEnds('now'); // WHERE ends = '2011-03-14'
+ * $query->filterByDbEnds(array('max' => 'yesterday')); // WHERE ends < '2011-03-13'
+ *
+ *
+ * @param mixed $dbEnds The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * 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 CcScheduleQuery 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(CcSchedulePeer::POSITION, $dbPosition['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbPosition['max'])) {
- $this->addUsingAlias(CcSchedulePeer::POSITION, $dbPosition['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcSchedulePeer::POSITION, $dbPosition, $comparison);
- }
+ return $this->addUsingAlias(CcSchedulePeer::ENDS, $dbEnds, $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);
- }
+ /**
+ * Filter the query on the file_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbFileId(1234); // WHERE file_id = 1234
+ * $query->filterByDbFileId(array(12, 34)); // WHERE file_id IN (12, 34)
+ * $query->filterByDbFileId(array('min' => 12)); // WHERE file_id >= 12
+ * $query->filterByDbFileId(array('max' => 12)); // WHERE file_id <= 12
+ *
+ *
+ * @see filterByCcFiles()
+ *
+ * @param mixed $dbFileId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcSchedulePeer::FILE_ID, $dbFileId, $comparison);
+ }
- /**
- * 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 on the stream_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbStreamId(1234); // WHERE stream_id = 1234
+ * $query->filterByDbStreamId(array(12, 34)); // WHERE stream_id IN (12, 34)
+ * $query->filterByDbStreamId(array('min' => 12)); // WHERE stream_id >= 12
+ * $query->filterByDbStreamId(array('max' => 12)); // WHERE stream_id <= 12
+ *
+ *
+ * @see filterByCcWebstream()
+ *
+ * @param mixed $dbStreamId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcScheduleQuery The current query, for fluid interface
+ */
+ public function filterByDbStreamId($dbStreamId = null, $comparison = null)
+ {
+ if (is_array($dbStreamId)) {
+ $useMinMax = false;
+ if (isset($dbStreamId['min'])) {
+ $this->addUsingAlias(CcSchedulePeer::STREAM_ID, $dbStreamId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbStreamId['max'])) {
+ $this->addUsingAlias(CcSchedulePeer::STREAM_ID, $dbStreamId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcSchedulePeer::STREAM_ID, $dbStreamId, $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;
- }
+ /**
+ * Filter the query on the clip_length column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbClipLength('fooValue'); // WHERE clip_length = 'fooValue'
+ * $query->filterByDbClipLength('%fooValue%'); // WHERE clip_length LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbClipLength 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 CcScheduleQuery The current query, for fluid interface
+ */
+ public function filterByDbClipLength($dbClipLength = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbClipLength)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbClipLength)) {
+ $dbClipLength = str_replace('*', '%', $dbClipLength);
+ $comparison = Criteria::LIKE;
+ }
+ }
- /**
- * 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');
- }
+ return $this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $dbClipLength, $comparison);
+ }
- /**
- * Filter the query by a related CcWebstream object
- *
- * @param CcWebstream $ccWebstream 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 filterByCcWebstream($ccWebstream, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcSchedulePeer::STREAM_ID, $ccWebstream->getDbId(), $comparison);
- }
+ /**
+ * Filter the query on the fade_in column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbFadeIn('2011-03-14'); // WHERE fade_in = '2011-03-14'
+ * $query->filterByDbFadeIn('now'); // WHERE fade_in = '2011-03-14'
+ * $query->filterByDbFadeIn(array('max' => 'yesterday')); // WHERE fade_in < '2011-03-13'
+ *
+ *
+ * @param mixed $dbFadeIn The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * Adds a JOIN clause to the query using the CcWebstream 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 joinCcWebstream($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcWebstream');
-
- // 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, 'CcWebstream');
- }
-
- return $this;
- }
+ return $this->addUsingAlias(CcSchedulePeer::FADE_IN, $dbFadeIn, $comparison);
+ }
- /**
- * Use the CcWebstream relation CcWebstream 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 CcWebstreamQuery A secondary query class using the current class as primary query
- */
- public function useCcWebstreamQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- return $this
- ->joinCcWebstream($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcWebstream', 'CcWebstreamQuery');
- }
+ /**
+ * Filter the query on the fade_out column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbFadeOut('2011-03-14'); // WHERE fade_out = '2011-03-14'
+ * $query->filterByDbFadeOut('now'); // WHERE fade_out = '2011-03-14'
+ * $query->filterByDbFadeOut(array('max' => 'yesterday')); // WHERE fade_out < '2011-03-13'
+ *
+ *
+ * @param mixed $dbFadeOut The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * Filter the query by a related CcWebstreamMetadata object
- *
- * @param CcWebstreamMetadata $ccWebstreamMetadata 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 filterByCcWebstreamMetadata($ccWebstreamMetadata, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcSchedulePeer::ID, $ccWebstreamMetadata->getDbInstanceId(), $comparison);
- }
+ return $this->addUsingAlias(CcSchedulePeer::FADE_OUT, $dbFadeOut, $comparison);
+ }
- /**
- * Adds a JOIN clause to the query using the CcWebstreamMetadata 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 joinCcWebstreamMetadata($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcWebstreamMetadata');
-
- // 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, 'CcWebstreamMetadata');
- }
-
- return $this;
- }
+ /**
+ * Filter the query on the cue_in column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCueIn('fooValue'); // WHERE cue_in = 'fooValue'
+ * $query->filterByDbCueIn('%fooValue%'); // WHERE cue_in LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbCueIn 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 CcScheduleQuery The current query, for fluid interface
+ */
+ public function filterByDbCueIn($dbCueIn = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbCueIn)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCueIn)) {
+ $dbCueIn = str_replace('*', '%', $dbCueIn);
+ $comparison = Criteria::LIKE;
+ }
+ }
- /**
- * Use the CcWebstreamMetadata relation CcWebstreamMetadata 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 CcWebstreamMetadataQuery A secondary query class using the current class as primary query
- */
- public function useCcWebstreamMetadataQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinCcWebstreamMetadata($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcWebstreamMetadata', 'CcWebstreamMetadataQuery');
- }
+ return $this->addUsingAlias(CcSchedulePeer::CUE_IN, $dbCueIn, $comparison);
+ }
- /**
- * 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;
- }
+ /**
+ * Filter the query on the cue_out column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCueOut('fooValue'); // WHERE cue_out = 'fooValue'
+ * $query->filterByDbCueOut('%fooValue%'); // WHERE cue_out LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbCueOut 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 CcScheduleQuery The current query, for fluid interface
+ */
+ public function filterByDbCueOut($dbCueOut = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbCueOut)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCueOut)) {
+ $dbCueOut = str_replace('*', '%', $dbCueOut);
+ $comparison = Criteria::LIKE;
+ }
+ }
-} // BaseCcScheduleQuery
+ return $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $dbCueOut, $comparison);
+ }
+
+ /**
+ * Filter the query on the media_item_played column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbMediaItemPlayed(true); // WHERE media_item_played = true
+ * $query->filterByDbMediaItemPlayed('yes'); // WHERE media_item_played = true
+ *
+ *
+ * @param boolean|string $dbMediaItemPlayed The value to use as filter.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ * @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)) {
+ $dbMediaItemPlayed = 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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbInstanceId(1234); // WHERE instance_id = 1234
+ * $query->filterByDbInstanceId(array(12, 34)); // WHERE instance_id IN (12, 34)
+ * $query->filterByDbInstanceId(array('min' => 12)); // WHERE instance_id >= 12
+ * $query->filterByDbInstanceId(array('max' => 12)); // WHERE instance_id <= 12
+ *
+ *
+ * @see filterByCcShowInstances()
+ *
+ * @param mixed $dbInstanceId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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 on the playout_status column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbPlayoutStatus(1234); // WHERE playout_status = 1234
+ * $query->filterByDbPlayoutStatus(array(12, 34)); // WHERE playout_status IN (12, 34)
+ * $query->filterByDbPlayoutStatus(array('min' => 12)); // WHERE playout_status >= 12
+ * $query->filterByDbPlayoutStatus(array('max' => 12)); // WHERE playout_status <= 12
+ *
+ *
+ * @param mixed $dbPlayoutStatus The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcScheduleQuery The current query, for fluid interface
+ */
+ public function filterByDbPlayoutStatus($dbPlayoutStatus = null, $comparison = null)
+ {
+ if (is_array($dbPlayoutStatus)) {
+ $useMinMax = false;
+ if (isset($dbPlayoutStatus['min'])) {
+ $this->addUsingAlias(CcSchedulePeer::PLAYOUT_STATUS, $dbPlayoutStatus['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbPlayoutStatus['max'])) {
+ $this->addUsingAlias(CcSchedulePeer::PLAYOUT_STATUS, $dbPlayoutStatus['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcSchedulePeer::PLAYOUT_STATUS, $dbPlayoutStatus, $comparison);
+ }
+
+ /**
+ * Filter the query on the broadcasted column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbBroadcasted(1234); // WHERE broadcasted = 1234
+ * $query->filterByDbBroadcasted(array(12, 34)); // WHERE broadcasted IN (12, 34)
+ * $query->filterByDbBroadcasted(array('min' => 12)); // WHERE broadcasted >= 12
+ * $query->filterByDbBroadcasted(array('max' => 12)); // WHERE broadcasted <= 12
+ *
+ *
+ * @param mixed $dbBroadcasted The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcScheduleQuery The current query, for fluid interface
+ */
+ public function filterByDbBroadcasted($dbBroadcasted = null, $comparison = null)
+ {
+ if (is_array($dbBroadcasted)) {
+ $useMinMax = false;
+ if (isset($dbBroadcasted['min'])) {
+ $this->addUsingAlias(CcSchedulePeer::BROADCASTED, $dbBroadcasted['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbBroadcasted['max'])) {
+ $this->addUsingAlias(CcSchedulePeer::BROADCASTED, $dbBroadcasted['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcSchedulePeer::BROADCASTED, $dbBroadcasted, $comparison);
+ }
+
+ /**
+ * Filter the query on the position column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbPosition(1234); // WHERE position = 1234
+ * $query->filterByDbPosition(array(12, 34)); // WHERE position IN (12, 34)
+ * $query->filterByDbPosition(array('min' => 12)); // WHERE position >= 12
+ * $query->filterByDbPosition(array('max' => 12)); // WHERE position <= 12
+ *
+ *
+ * @param mixed $dbPosition The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcScheduleQuery 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(CcSchedulePeer::POSITION, $dbPosition['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbPosition['max'])) {
+ $this->addUsingAlias(CcSchedulePeer::POSITION, $dbPosition['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcSchedulePeer::POSITION, $dbPosition, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcShowInstances object
+ *
+ * @param CcShowInstances|PropelObjectCollection $ccShowInstances The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcShowInstances($ccShowInstances, $comparison = null)
+ {
+ if ($ccShowInstances instanceof CcShowInstances) {
+ return $this
+ ->addUsingAlias(CcSchedulePeer::INSTANCE_ID, $ccShowInstances->getDbId(), $comparison);
+ } elseif ($ccShowInstances instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcSchedulePeer::INSTANCE_ID, $ccShowInstances->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcShowInstances() only accepts arguments of type CcShowInstances or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcShowInstances($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcShowInstances', 'CcShowInstancesQuery');
+ }
+
+ /**
+ * Filter the query by a related CcFiles object
+ *
+ * @param CcFiles|PropelObjectCollection $ccFiles The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcFiles($ccFiles, $comparison = null)
+ {
+ if ($ccFiles instanceof CcFiles) {
+ return $this
+ ->addUsingAlias(CcSchedulePeer::FILE_ID, $ccFiles->getDbId(), $comparison);
+ } elseif ($ccFiles instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcSchedulePeer::FILE_ID, $ccFiles->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcFiles() only accepts arguments of type CcFiles or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcFiles($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery');
+ }
+
+ /**
+ * Filter the query by a related CcWebstream object
+ *
+ * @param CcWebstream|PropelObjectCollection $ccWebstream The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcWebstream($ccWebstream, $comparison = null)
+ {
+ if ($ccWebstream instanceof CcWebstream) {
+ return $this
+ ->addUsingAlias(CcSchedulePeer::STREAM_ID, $ccWebstream->getDbId(), $comparison);
+ } elseif ($ccWebstream instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcSchedulePeer::STREAM_ID, $ccWebstream->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcWebstream() only accepts arguments of type CcWebstream or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcWebstream 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 joinCcWebstream($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcWebstream');
+
+ // 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, 'CcWebstream');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcWebstream relation CcWebstream 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 CcWebstreamQuery A secondary query class using the current class as primary query
+ */
+ public function useCcWebstreamQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcWebstream($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcWebstream', 'CcWebstreamQuery');
+ }
+
+ /**
+ * Filter the query by a related CcWebstreamMetadata object
+ *
+ * @param CcWebstreamMetadata|PropelObjectCollection $ccWebstreamMetadata 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcWebstreamMetadata($ccWebstreamMetadata, $comparison = null)
+ {
+ if ($ccWebstreamMetadata instanceof CcWebstreamMetadata) {
+ return $this
+ ->addUsingAlias(CcSchedulePeer::ID, $ccWebstreamMetadata->getDbInstanceId(), $comparison);
+ } elseif ($ccWebstreamMetadata instanceof PropelObjectCollection) {
+ return $this
+ ->useCcWebstreamMetadataQuery()
+ ->filterByPrimaryKeys($ccWebstreamMetadata->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcWebstreamMetadata() only accepts arguments of type CcWebstreamMetadata or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcWebstreamMetadata 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 joinCcWebstreamMetadata($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcWebstreamMetadata');
+
+ // 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, 'CcWebstreamMetadata');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcWebstreamMetadata relation CcWebstreamMetadata 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 CcWebstreamMetadataQuery A secondary query class using the current class as primary query
+ */
+ public function useCcWebstreamMetadataQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcWebstreamMetadata($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcWebstreamMetadata', 'CcWebstreamMetadataQuery');
+ }
+
+ /**
+ * 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;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcServiceRegister.php b/airtime_mvc/application/models/airtime/om/BaseCcServiceRegister.php
index dbb3aa6a2..20ba3c962 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcServiceRegister.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcServiceRegister.php
@@ -4,705 +4,811 @@
/**
* Base class that represents a row from the 'cc_service_register' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcServiceRegister extends BaseObject implements Persistent
+abstract class BaseCcServiceRegister extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcServiceRegisterPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcServiceRegisterPeer
- */
- protected static $peer;
-
- /**
- * The value for the name field.
- * @var string
- */
- protected $name;
-
- /**
- * The value for the ip field.
- * @var string
- */
- protected $ip;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Get the [name] column value.
- *
- * @return string
- */
- public function getDbName()
- {
- return $this->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
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcServiceRegisterPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcServiceRegisterPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the name field.
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * The value for the ip field.
+ * @var string
+ */
+ protected $ip;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Get the [name] column value.
+ *
+ * @return string
+ */
+ public function getDbName()
+ {
+
+ return $this->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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 resultset 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();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 2; // 2 = CcServiceRegisterPeer::NUM_HYDRATE_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
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcServiceRegisterQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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 (Exception $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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcServiceRegisterPeer::NAME)) {
+ $modifiedColumns[':p' . $index++] = '"name"';
+ }
+ if ($this->isColumnModified(CcServiceRegisterPeer::IP)) {
+ $modifiedColumns[':p' . $index++] = '"ip"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_service_register" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"name"':
+ $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
+ break;
+ case '"ip"':
+ $stmt->bindValue($identifier, $this->ip, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
+ {
+ if (isset($alreadyDumpedObjects['CcServiceRegister'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcServiceRegister'][$this->getPrimaryKey()] = true;
+ $keys = CcServiceRegisterPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbName(),
+ $keys[1] => $this->getDbIp(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcServiceRegisterPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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 BasePeer::TYPE_PHPNAME
+ *
+ * @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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbIp($this->getDbIp());
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setDbName(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 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->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcServiceRegisterPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcServiceRegisterPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcServiceRegisterPeer.php
index ab7d35634..7fd300190 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcServiceRegisterPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcServiceRegisterPeer.php
@@ -4,728 +4,750 @@
/**
* Base static class for performing query and update operations on the 'cc_service_register' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcServiceRegisterPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_service_register';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcServiceRegister';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcServiceRegister';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcServiceRegisterTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 2;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the NAME field */
- const NAME = 'cc_service_register.NAME';
-
- /** the column name for the IP field */
- const IP = 'cc_service_register.IP';
-
- /**
- * An identiy map to hold any loaded instances of CcServiceRegister objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcServiceRegister[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => 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;
- }
+abstract class BaseCcServiceRegisterPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_service_register';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcServiceRegister';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcServiceRegisterTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 2;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 2;
+
+ /** the column name for the name field */
+ const NAME = 'cc_service_register.name';
+
+ /** the column name for the ip field */
+ const IP = 'cc_service_register.ip';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcServiceRegister objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcServiceRegister[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcServiceRegisterPeer::$fieldNames[CcServiceRegisterPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbName', 'DbIp', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbName', 'dbIp', ),
+ BasePeer::TYPE_COLNAME => array (CcServiceRegisterPeer::NAME, CcServiceRegisterPeer::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. CcServiceRegisterPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbName' => 0, 'DbIp' => 1, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbName' => 0, 'dbIp' => 1, ),
+ BasePeer::TYPE_COLNAME => array (CcServiceRegisterPeer::NAME => 0, CcServiceRegisterPeer::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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcServiceRegisterPeer::getFieldNames($toType);
+ $key = isset(CcServiceRegisterPeer::$fieldKeys[$fromType][$name]) ? CcServiceRegisterPeer::$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(CcServiceRegisterPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcServiceRegisterPeer::$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 CcServiceRegisterPeer::$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(CcServiceRegisterPeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcServiceRegisterPeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbName();
+ } // if key === null
+ CcServiceRegisterPeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcServiceRegisterPeer::$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(CcServiceRegisterPeer::$instances[$key])) {
+ return CcServiceRegisterPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcServiceRegisterPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcServiceRegisterPeer::$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();
+ // 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_HYDRATE_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(CcServiceRegisterPeer::DATABASE_NAME)->getTable(CcServiceRegisterPeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcServiceRegisterPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcServiceRegisterPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcServiceRegisterPeer::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(CcServiceRegisterPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_service_register table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcServiceRegisterPeer::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(CcServiceRegisterPeer::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 (Exception $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($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->hasColumn($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
+ * @return CcServiceRegister[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcServiceRegisterQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcServiceRegisterQuery.php
index a8df529a7..68f1166c6 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcServiceRegisterQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcServiceRegisterQuery.php
@@ -4,193 +4,293 @@
/**
* Base class that represents a query for the 'cc_service_register' table.
*
- *
*
- * @method CcServiceRegisterQuery orderByDbName($order = Criteria::ASC) Order by the name column
- * @method CcServiceRegisterQuery orderByDbIp($order = Criteria::ASC) Order by the ip column
*
- * @method CcServiceRegisterQuery groupByDbName() Group by the name column
- * @method CcServiceRegisterQuery groupByDbIp() Group by the ip column
+ * @method CcServiceRegisterQuery orderByDbName($order = Criteria::ASC) Order by the name column
+ * @method CcServiceRegisterQuery orderByDbIp($order = Criteria::ASC) Order by the ip column
*
- * @method CcServiceRegisterQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcServiceRegisterQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcServiceRegisterQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcServiceRegisterQuery groupByDbName() Group by the name column
+ * @method CcServiceRegisterQuery groupByDbIp() Group by the ip column
*
- * @method CcServiceRegister findOne(PropelPDO $con = null) Return the first CcServiceRegister matching the query
- * @method CcServiceRegister findOneOrCreate(PropelPDO $con = null) Return the first CcServiceRegister matching the query, or a new CcServiceRegister object populated from the query conditions when no match is found
+ * @method CcServiceRegisterQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcServiceRegisterQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcServiceRegisterQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcServiceRegister findOneByDbName(string $name) Return the first CcServiceRegister filtered by the name column
- * @method CcServiceRegister findOneByDbIp(string $ip) Return the first CcServiceRegister filtered by the ip column
+ * @method CcServiceRegister findOne(PropelPDO $con = null) Return the first CcServiceRegister matching the query
+ * @method CcServiceRegister findOneOrCreate(PropelPDO $con = null) Return the first CcServiceRegister matching the query, or a new CcServiceRegister object populated from the query conditions when no match is found
*
- * @method array findByDbName(string $name) Return CcServiceRegister objects filtered by the name column
- * @method array findByDbIp(string $ip) Return CcServiceRegister objects filtered by the ip column
+ * @method CcServiceRegister findOneByDbIp(string $ip) Return the first CcServiceRegister filtered by the ip column
+ *
+ * @method array findByDbName(string $name) Return CcServiceRegister objects filtered by the name column
+ * @method array findByDbIp(string $ip) Return CcServiceRegister objects filtered by the ip column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcServiceRegisterQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcServiceRegisterQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcServiceRegister';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcServiceRegisterQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcServiceRegister', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcServiceRegisterQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcServiceRegisterQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcServiceRegisterQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcServiceRegisterQuery) {
+ return $criteria;
+ }
+ $query = new CcServiceRegisterQuery(null, null, $modelAlias);
- /**
- * Returns a new CcServiceRegisterQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcServiceRegisterQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcServiceRegisterQuery) {
- return $criteria;
- }
- $query = new CcServiceRegisterQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcServiceRegister|CcServiceRegister[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcServiceRegisterPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcServiceRegisterPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $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);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcServiceRegister A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbName($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcServiceRegister A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "name", "ip" FROM "cc_service_register" WHERE "name" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcServiceRegister();
+ $obj->hydrate($row);
+ CcServiceRegisterPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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);
- }
+ return $obj;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcServiceRegister|CcServiceRegister[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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;
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
-} // BaseCcServiceRegisterQuery
+ /**
+ * 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|CcServiceRegister[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * 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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbName('fooValue'); // WHERE name = 'fooValue'
+ * $query->filterByDbName('%fooValue%'); // WHERE name LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbIp('fooValue'); // WHERE ip = 'fooValue'
+ * $query->filterByDbIp('%fooValue%'); // WHERE ip LIKE '%fooValue%'
+ *
+ *
+ * @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;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSess.php b/airtime_mvc/application/models/airtime/om/BaseCcSess.php
index 8ae2463af..692f742ca 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSess.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSess.php
@@ -4,946 +4,1060 @@
/**
* Base class that represents a row from the 'cc_sess' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcSess extends BaseObject implements Persistent
+abstract class BaseCcSess extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcSessPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcSessPeer
- */
- protected static $peer;
-
- /**
- * The value for the sessid field.
- * @var string
- */
- protected $sessid;
-
- /**
- * The value for the userid field.
- * @var int
- */
- protected $userid;
-
- /**
- * The value for the login field.
- * @var string
- */
- protected $login;
-
- /**
- * The value for the ts field.
- * @var string
- */
- protected $ts;
-
- /**
- * @var CcSubjs
- */
- protected $aCcSubjs;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Get the [sessid] column value.
- *
- * @return string
- */
- public function getSessid()
- {
- return $this->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
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcSessPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcSessPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the sessid field.
+ * @var string
+ */
+ protected $sessid;
+
+ /**
+ * The value for the userid field.
+ * @var int
+ */
+ protected $userid;
+
+ /**
+ * The value for the login field.
+ * @var string
+ */
+ protected $login;
+
+ /**
+ * The value for the ts field.
+ * @var string
+ */
+ protected $ts;
+
+ /**
+ * @var CcSubjs
+ */
+ protected $aCcSubjs;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Get the [sessid] column value.
+ *
+ * @return string
+ */
+ public function getSessid()
+ {
+
+ return $this->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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ 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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 strings are treated as null.
+ * @return CcSess The current object (for fluent API support)
+ */
+ public function setTs($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->ts !== null || $dt !== null) {
+ $currentDateAsString = ($this->ts !== null && $tmpDt = new DateTime($this->ts)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->ts = $newDateAsString;
+ $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 resultset 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();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 4; // 4 = CcSessPeer::NUM_HYDRATE_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
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcSessQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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 (Exception $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 corresponding 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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcSessPeer::SESSID)) {
+ $modifiedColumns[':p' . $index++] = '"sessid"';
+ }
+ if ($this->isColumnModified(CcSessPeer::USERID)) {
+ $modifiedColumns[':p' . $index++] = '"userid"';
+ }
+ if ($this->isColumnModified(CcSessPeer::LOGIN)) {
+ $modifiedColumns[':p' . $index++] = '"login"';
+ }
+ if ($this->isColumnModified(CcSessPeer::TS)) {
+ $modifiedColumns[':p' . $index++] = '"ts"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_sess" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"sessid"':
+ $stmt->bindValue($identifier, $this->sessid, PDO::PARAM_STR);
+ break;
+ case '"userid"':
+ $stmt->bindValue($identifier, $this->userid, PDO::PARAM_INT);
+ break;
+ case '"login"':
+ $stmt->bindValue($identifier, $this->login, PDO::PARAM_STR);
+ break;
+ case '"ts"':
+ $stmt->bindValue($identifier, $this->ts, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcSess'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcSess'][$this->getPrimaryKey()] = true;
+ $keys = CcSessPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getSessid(),
+ $keys[1] => $this->getUserid(),
+ $keys[2] => $this->getLogin(),
+ $keys[3] => $this->getTs(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcSubjs) {
+ $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcSessPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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 BasePeer::TYPE_PHPNAME
+ *
+ * @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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setUserid($this->getUserid());
+ $copyObj->setLogin($this->getLogin());
+ $copyObj->setTs($this->getTs());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setSessid(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 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 $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcSubjs The associated CcSubjs object.
+ * @throws PropelException
+ */
+ public function getCcSubjs(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcSubjs === null && ($this->userid !== null) && $doQuery) {
+ $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->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->aCcSubjs instanceof Persistent) {
+ $this->aCcSubjs->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ $this->aCcSubjs = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcSessPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSessPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcSessPeer.php
index 70eab561a..219315ed9 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSessPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSessPeer.php
@@ -4,972 +4,998 @@
/**
* Base static class for performing query and update operations on the 'cc_sess' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcSessPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_sess';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcSess';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcSess';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcSessTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 4;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the SESSID field */
- const SESSID = 'cc_sess.SESSID';
-
- /** the column name for the USERID field */
- const USERID = 'cc_sess.USERID';
-
- /** the column name for the LOGIN field */
- const LOGIN = 'cc_sess.LOGIN';
-
- /** the column name for the TS field */
- const TS = 'cc_sess.TS';
-
- /**
- * An identiy map to hold any loaded instances of CcSess objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcSess[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => 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;
- }
+abstract class BaseCcSessPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_sess';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcSess';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcSessTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 4;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 4;
+
+ /** the column name for the sessid field */
+ const SESSID = 'cc_sess.sessid';
+
+ /** the column name for the userid field */
+ const USERID = 'cc_sess.userid';
+
+ /** the column name for the login field */
+ const LOGIN = 'cc_sess.login';
+
+ /** the column name for the ts field */
+ const TS = 'cc_sess.ts';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcSess objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcSess[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcSessPeer::$fieldNames[CcSessPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Sessid', 'Userid', 'Login', 'Ts', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('sessid', 'userid', 'login', 'ts', ),
+ BasePeer::TYPE_COLNAME => array (CcSessPeer::SESSID, CcSessPeer::USERID, CcSessPeer::LOGIN, CcSessPeer::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. CcSessPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected 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 (CcSessPeer::SESSID => 0, CcSessPeer::USERID => 1, CcSessPeer::LOGIN => 2, CcSessPeer::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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcSessPeer::getFieldNames($toType);
+ $key = isset(CcSessPeer::$fieldKeys[$fromType][$name]) ? CcSessPeer::$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(CcSessPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcSessPeer::$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 CcSessPeer::$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(CcSessPeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcSessPeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getSessid();
+ } // if key === null
+ CcSessPeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcSessPeer::$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(CcSessPeer::$instances[$key])) {
+ return CcSessPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcSessPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcSessPeer::$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();
+ // 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_HYDRATE_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(CcSessPeer::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(CcSessPeer::DATABASE_NAME);
+ }
+
+ CcSessPeer::addSelectColumns($criteria);
+ $startcol = CcSessPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcSessPeer::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(CcSessPeer::DATABASE_NAME);
+ }
+
+ CcSessPeer::addSelectColumns($criteria);
+ $startcol2 = CcSessPeer::NUM_HYDRATE_COLUMNS;
+
+ CcSubjsPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcSubjsPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcSessPeer::DATABASE_NAME)->getTable(CcSessPeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcSessPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcSessPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcSessPeer::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(CcSessPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_sess table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcSessPeer::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(CcSessPeer::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 (Exception $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($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->hasColumn($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
+ * @return CcSess[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSessQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcSessQuery.php
index f0b500f83..c2397f286 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSessQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSessQuery.php
@@ -4,331 +4,468 @@
/**
* Base class that represents a query for the 'cc_sess' table.
*
- *
*
- * @method CcSessQuery orderBySessid($order = Criteria::ASC) Order by the sessid column
- * @method CcSessQuery orderByUserid($order = Criteria::ASC) Order by the userid column
- * @method CcSessQuery orderByLogin($order = Criteria::ASC) Order by the login column
- * @method CcSessQuery orderByTs($order = Criteria::ASC) Order by the ts column
*
- * @method CcSessQuery groupBySessid() Group by the sessid column
- * @method CcSessQuery groupByUserid() Group by the userid column
- * @method CcSessQuery groupByLogin() Group by the login column
- * @method CcSessQuery groupByTs() Group by the ts column
+ * @method CcSessQuery orderBySessid($order = Criteria::ASC) Order by the sessid column
+ * @method CcSessQuery orderByUserid($order = Criteria::ASC) Order by the userid column
+ * @method CcSessQuery orderByLogin($order = Criteria::ASC) Order by the login column
+ * @method CcSessQuery orderByTs($order = Criteria::ASC) Order by the ts column
*
- * @method CcSessQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcSessQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcSessQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcSessQuery groupBySessid() Group by the sessid column
+ * @method CcSessQuery groupByUserid() Group by the userid column
+ * @method CcSessQuery groupByLogin() Group by the login column
+ * @method CcSessQuery groupByTs() Group by the ts column
*
- * @method CcSessQuery leftJoinCcSubjs($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjs relation
- * @method CcSessQuery rightJoinCcSubjs($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjs relation
- * @method CcSessQuery innerJoinCcSubjs($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjs relation
+ * @method CcSessQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcSessQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcSessQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcSess findOne(PropelPDO $con = null) Return the first CcSess matching the query
- * @method CcSess findOneOrCreate(PropelPDO $con = null) Return the first CcSess matching the query, or a new CcSess object populated from the query conditions when no match is found
+ * @method CcSessQuery leftJoinCcSubjs($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSubjs relation
+ * @method CcSessQuery rightJoinCcSubjs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjs relation
+ * @method CcSessQuery innerJoinCcSubjs($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjs relation
*
- * @method CcSess findOneBySessid(string $sessid) Return the first CcSess filtered by the sessid column
- * @method CcSess findOneByUserid(int $userid) Return the first CcSess filtered by the userid column
- * @method CcSess findOneByLogin(string $login) Return the first CcSess filtered by the login column
- * @method CcSess findOneByTs(string $ts) Return the first CcSess filtered by the ts column
+ * @method CcSess findOne(PropelPDO $con = null) Return the first CcSess matching the query
+ * @method CcSess findOneOrCreate(PropelPDO $con = null) Return the first CcSess matching the query, or a new CcSess object populated from the query conditions when no match is found
*
- * @method array findBySessid(string $sessid) Return CcSess objects filtered by the sessid column
- * @method array findByUserid(int $userid) Return CcSess objects filtered by the userid column
- * @method array findByLogin(string $login) Return CcSess objects filtered by the login column
- * @method array findByTs(string $ts) Return CcSess objects filtered by the ts column
+ * @method CcSess findOneByUserid(int $userid) Return the first CcSess filtered by the userid column
+ * @method CcSess findOneByLogin(string $login) Return the first CcSess filtered by the login column
+ * @method CcSess findOneByTs(string $ts) Return the first CcSess filtered by the ts column
+ *
+ * @method array findBySessid(string $sessid) Return CcSess objects filtered by the sessid column
+ * @method array findByUserid(int $userid) Return CcSess objects filtered by the userid column
+ * @method array findByLogin(string $login) Return CcSess objects filtered by the login column
+ * @method array findByTs(string $ts) Return CcSess objects filtered by the ts column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcSessQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcSessQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcSess';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcSessQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcSess', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcSessQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcSessQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcSessQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcSessQuery) {
+ return $criteria;
+ }
+ $query = new CcSessQuery(null, null, $modelAlias);
- /**
- * Returns a new CcSessQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcSessQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcSessQuery) {
- return $criteria;
- }
- $query = new CcSessQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcSess|CcSess[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcSessPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcSessPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $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);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcSess A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneBySessid($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcSess A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "sessid", "userid", "login", "ts" FROM "cc_sess" WHERE "sessid" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcSess();
+ $obj->hydrate($row);
+ CcSessPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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);
- }
+ return $obj;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcSess|CcSess[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * 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);
- }
+ /**
+ * 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|CcSess[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * 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;
- }
+ /**
+ * 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)
+ {
- /**
- * 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');
- }
+ return $this->addUsingAlias(CcSessPeer::SESSID, $key, Criteria::EQUAL);
+ }
- /**
- * 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;
- }
+ /**
+ * 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)
+ {
-} // BaseCcSessQuery
+ return $this->addUsingAlias(CcSessPeer::SESSID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the sessid column
+ *
+ * Example usage:
+ *
+ * $query->filterBySessid('fooValue'); // WHERE sessid = 'fooValue'
+ * $query->filterBySessid('%fooValue%'); // WHERE sessid LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByUserid(1234); // WHERE userid = 1234
+ * $query->filterByUserid(array(12, 34)); // WHERE userid IN (12, 34)
+ * $query->filterByUserid(array('min' => 12)); // WHERE userid >= 12
+ * $query->filterByUserid(array('max' => 12)); // WHERE userid <= 12
+ *
+ *
+ * @see filterByCcSubjs()
+ *
+ * @param mixed $userid The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByLogin('fooValue'); // WHERE login = 'fooValue'
+ * $query->filterByLogin('%fooValue%'); // WHERE login LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByTs('2011-03-14'); // WHERE ts = '2011-03-14'
+ * $query->filterByTs('now'); // WHERE ts = '2011-03-14'
+ * $query->filterByTs(array('max' => 'yesterday')); // WHERE ts < '2011-03-13'
+ *
+ *
+ * @param mixed $ts The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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|PropelObjectCollection $ccSubjs The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcSubjs($ccSubjs, $comparison = null)
+ {
+ if ($ccSubjs instanceof CcSubjs) {
+ return $this
+ ->addUsingAlias(CcSessPeer::USERID, $ccSubjs->getDbId(), $comparison);
+ } elseif ($ccSubjs instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcSessPeer::USERID, $ccSubjs->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcSubjs() only accepts arguments of type CcSubjs or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $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;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShow.php b/airtime_mvc/application/models/airtime/om/BaseCcShow.php
index 3cf4dab1f..172ad31a9 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShow.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShow.php
@@ -4,1963 +4,2779 @@
/**
* Base class that represents a row from the 'cc_show' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcShow extends BaseObject implements Persistent
+abstract class BaseCcShow extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcShowPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcShowPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the name field.
- * Note: this column has a database default value of: ''
- * @var string
- */
- protected $name;
-
- /**
- * The value for the url field.
- * Note: this column has a database default value of: ''
- * @var string
- */
- protected $url;
-
- /**
- * The value for the genre field.
- * Note: this column has a database default value of: ''
- * @var string
- */
- protected $genre;
-
- /**
- * The value for the description field.
- * @var string
- */
- protected $description;
-
- /**
- * The value for the color field.
- * @var string
- */
- protected $color;
-
- /**
- * The value for the background_color field.
- * @var string
- */
- protected $background_color;
-
- /**
- * The value for the live_stream_using_airtime_auth field.
- * Note: this column has a database default value of: false
- * @var boolean
- */
- protected $live_stream_using_airtime_auth;
-
- /**
- * The value for the live_stream_using_custom_auth field.
- * Note: this column has a database default value of: false
- * @var boolean
- */
- protected $live_stream_using_custom_auth;
-
- /**
- * The value for the live_stream_user field.
- * @var string
- */
- protected $live_stream_user;
-
- /**
- * The value for the live_stream_pass field.
- * @var string
- */
- protected $live_stream_pass;
-
- /**
- * The value for the linked field.
- * Note: this column has a database default value of: false
- * @var boolean
- */
- protected $linked;
-
- /**
- * The value for the is_linkable field.
- * Note: this column has a database default value of: true
- * @var boolean
- */
- protected $is_linkable;
-
- /**
- * @var array CcShowInstances[] Collection to store aggregation of CcShowInstances objects.
- */
- protected $collCcShowInstancess;
-
- /**
- * @var array CcShowDays[] Collection to store aggregation of CcShowDays objects.
- */
- protected $collCcShowDayss;
-
- /**
- * @var array CcShowRebroadcast[] Collection to store aggregation of CcShowRebroadcast objects.
- */
- protected $collCcShowRebroadcasts;
-
- /**
- * @var array CcShowHosts[] Collection to store aggregation of CcShowHosts objects.
- */
- protected $collCcShowHostss;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Applies default values to this object.
- * This method should be called from the object's constructor (or
- * equivalent initialization method).
- * @see __construct()
- */
- public function applyDefaultValues()
- {
- $this->name = '';
- $this->url = '';
- $this->genre = '';
- $this->live_stream_using_airtime_auth = false;
- $this->live_stream_using_custom_auth = false;
- $this->linked = false;
- $this->is_linkable = true;
- }
-
- /**
- * 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;
- }
-
- /**
- * Get the [live_stream_using_airtime_auth] column value.
- *
- * @return boolean
- */
- public function getDbLiveStreamUsingAirtimeAuth()
- {
- return $this->live_stream_using_airtime_auth;
- }
-
- /**
- * Get the [live_stream_using_custom_auth] column value.
- *
- * @return boolean
- */
- public function getDbLiveStreamUsingCustomAuth()
- {
- return $this->live_stream_using_custom_auth;
- }
-
- /**
- * Get the [live_stream_user] column value.
- *
- * @return string
- */
- public function getDbLiveStreamUser()
- {
- return $this->live_stream_user;
- }
-
- /**
- * Get the [live_stream_pass] column value.
- *
- * @return string
- */
- public function getDbLiveStreamPass()
- {
- return $this->live_stream_pass;
- }
-
- /**
- * Get the [linked] column value.
- *
- * @return boolean
- */
- public function getDbLinked()
- {
- return $this->linked;
- }
-
- /**
- * Get the [is_linkable] column value.
- *
- * @return boolean
- */
- public function getDbIsLinkable()
- {
- return $this->is_linkable;
- }
-
- /**
- * 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()
-
- /**
- * Set the value of [live_stream_using_airtime_auth] column.
- *
- * @param boolean $v new value
- * @return CcShow The current object (for fluent API support)
- */
- public function setDbLiveStreamUsingAirtimeAuth($v)
- {
- if ($v !== null) {
- $v = (boolean) $v;
- }
-
- if ($this->live_stream_using_airtime_auth !== $v || $this->isNew()) {
- $this->live_stream_using_airtime_auth = $v;
- $this->modifiedColumns[] = CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH;
- }
-
- return $this;
- } // setDbLiveStreamUsingAirtimeAuth()
-
- /**
- * Set the value of [live_stream_using_custom_auth] column.
- *
- * @param boolean $v new value
- * @return CcShow The current object (for fluent API support)
- */
- public function setDbLiveStreamUsingCustomAuth($v)
- {
- if ($v !== null) {
- $v = (boolean) $v;
- }
-
- if ($this->live_stream_using_custom_auth !== $v || $this->isNew()) {
- $this->live_stream_using_custom_auth = $v;
- $this->modifiedColumns[] = CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH;
- }
-
- return $this;
- } // setDbLiveStreamUsingCustomAuth()
-
- /**
- * Set the value of [live_stream_user] column.
- *
- * @param string $v new value
- * @return CcShow The current object (for fluent API support)
- */
- public function setDbLiveStreamUser($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->live_stream_user !== $v) {
- $this->live_stream_user = $v;
- $this->modifiedColumns[] = CcShowPeer::LIVE_STREAM_USER;
- }
-
- return $this;
- } // setDbLiveStreamUser()
-
- /**
- * Set the value of [live_stream_pass] column.
- *
- * @param string $v new value
- * @return CcShow The current object (for fluent API support)
- */
- public function setDbLiveStreamPass($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->live_stream_pass !== $v) {
- $this->live_stream_pass = $v;
- $this->modifiedColumns[] = CcShowPeer::LIVE_STREAM_PASS;
- }
-
- return $this;
- } // setDbLiveStreamPass()
-
- /**
- * Set the value of [linked] column.
- *
- * @param boolean $v new value
- * @return CcShow The current object (for fluent API support)
- */
- public function setDbLinked($v)
- {
- if ($v !== null) {
- $v = (boolean) $v;
- }
-
- if ($this->linked !== $v || $this->isNew()) {
- $this->linked = $v;
- $this->modifiedColumns[] = CcShowPeer::LINKED;
- }
-
- return $this;
- } // setDbLinked()
-
- /**
- * Set the value of [is_linkable] column.
- *
- * @param boolean $v new value
- * @return CcShow The current object (for fluent API support)
- */
- public function setDbIsLinkable($v)
- {
- if ($v !== null) {
- $v = (boolean) $v;
- }
-
- if ($this->is_linkable !== $v || $this->isNew()) {
- $this->is_linkable = $v;
- $this->modifiedColumns[] = CcShowPeer::IS_LINKABLE;
- }
-
- return $this;
- } // setDbIsLinkable()
-
- /**
- * 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;
- }
-
- if ($this->live_stream_using_airtime_auth !== false) {
- return false;
- }
-
- if ($this->live_stream_using_custom_auth !== false) {
- return false;
- }
-
- if ($this->linked !== false) {
- return false;
- }
-
- if ($this->is_linkable !== true) {
- 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->live_stream_using_airtime_auth = ($row[$startcol + 7] !== null) ? (boolean) $row[$startcol + 7] : null;
- $this->live_stream_using_custom_auth = ($row[$startcol + 8] !== null) ? (boolean) $row[$startcol + 8] : null;
- $this->live_stream_user = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
- $this->live_stream_pass = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
- $this->linked = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null;
- $this->is_linkable = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 13; // 13 = 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;
- case 7:
- return $this->getDbLiveStreamUsingAirtimeAuth();
- break;
- case 8:
- return $this->getDbLiveStreamUsingCustomAuth();
- break;
- case 9:
- return $this->getDbLiveStreamUser();
- break;
- case 10:
- return $this->getDbLiveStreamPass();
- break;
- case 11:
- return $this->getDbLinked();
- break;
- case 12:
- return $this->getDbIsLinkable();
- 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(),
- $keys[7] => $this->getDbLiveStreamUsingAirtimeAuth(),
- $keys[8] => $this->getDbLiveStreamUsingCustomAuth(),
- $keys[9] => $this->getDbLiveStreamUser(),
- $keys[10] => $this->getDbLiveStreamPass(),
- $keys[11] => $this->getDbLinked(),
- $keys[12] => $this->getDbIsLinkable(),
- );
- 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;
- case 7:
- $this->setDbLiveStreamUsingAirtimeAuth($value);
- break;
- case 8:
- $this->setDbLiveStreamUsingCustomAuth($value);
- break;
- case 9:
- $this->setDbLiveStreamUser($value);
- break;
- case 10:
- $this->setDbLiveStreamPass($value);
- break;
- case 11:
- $this->setDbLinked($value);
- break;
- case 12:
- $this->setDbIsLinkable($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]]);
- if (array_key_exists($keys[7], $arr)) $this->setDbLiveStreamUsingAirtimeAuth($arr[$keys[7]]);
- if (array_key_exists($keys[8], $arr)) $this->setDbLiveStreamUsingCustomAuth($arr[$keys[8]]);
- if (array_key_exists($keys[9], $arr)) $this->setDbLiveStreamUser($arr[$keys[9]]);
- if (array_key_exists($keys[10], $arr)) $this->setDbLiveStreamPass($arr[$keys[10]]);
- if (array_key_exists($keys[11], $arr)) $this->setDbLinked($arr[$keys[11]]);
- if (array_key_exists($keys[12], $arr)) $this->setDbIsLinkable($arr[$keys[12]]);
- }
-
- /**
- * 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);
- if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH)) $criteria->add(CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH, $this->live_stream_using_airtime_auth);
- if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH)) $criteria->add(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH, $this->live_stream_using_custom_auth);
- if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_USER)) $criteria->add(CcShowPeer::LIVE_STREAM_USER, $this->live_stream_user);
- if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_PASS)) $criteria->add(CcShowPeer::LIVE_STREAM_PASS, $this->live_stream_pass);
- if ($this->isColumnModified(CcShowPeer::LINKED)) $criteria->add(CcShowPeer::LINKED, $this->linked);
- if ($this->isColumnModified(CcShowPeer::IS_LINKABLE)) $criteria->add(CcShowPeer::IS_LINKABLE, $this->is_linkable);
-
- 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);
- $copyObj->setDbLiveStreamUsingAirtimeAuth($this->live_stream_using_airtime_auth);
- $copyObj->setDbLiveStreamUsingCustomAuth($this->live_stream_using_custom_auth);
- $copyObj->setDbLiveStreamUser($this->live_stream_user);
- $copyObj->setDbLiveStreamPass($this->live_stream_pass);
- $copyObj->setDbLinked($this->linked);
- $copyObj->setDbIsLinkable($this->is_linkable);
-
- 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->live_stream_using_airtime_auth = null;
- $this->live_stream_using_custom_auth = null;
- $this->live_stream_user = null;
- $this->live_stream_pass = null;
- $this->linked = null;
- $this->is_linkable = 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
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcShowPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcShowPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the name field.
+ * Note: this column has a database default value of: ''
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * The value for the url field.
+ * Note: this column has a database default value of: ''
+ * @var string
+ */
+ protected $url;
+
+ /**
+ * The value for the genre field.
+ * Note: this column has a database default value of: ''
+ * @var string
+ */
+ protected $genre;
+
+ /**
+ * The value for the description field.
+ * @var string
+ */
+ protected $description;
+
+ /**
+ * The value for the color field.
+ * @var string
+ */
+ protected $color;
+
+ /**
+ * The value for the background_color field.
+ * @var string
+ */
+ protected $background_color;
+
+ /**
+ * The value for the live_stream_using_airtime_auth field.
+ * Note: this column has a database default value of: false
+ * @var boolean
+ */
+ protected $live_stream_using_airtime_auth;
+
+ /**
+ * The value for the live_stream_using_custom_auth field.
+ * Note: this column has a database default value of: false
+ * @var boolean
+ */
+ protected $live_stream_using_custom_auth;
+
+ /**
+ * The value for the live_stream_user field.
+ * @var string
+ */
+ protected $live_stream_user;
+
+ /**
+ * The value for the live_stream_pass field.
+ * @var string
+ */
+ protected $live_stream_pass;
+
+ /**
+ * The value for the linked field.
+ * Note: this column has a database default value of: false
+ * @var boolean
+ */
+ protected $linked;
+
+ /**
+ * The value for the is_linkable field.
+ * Note: this column has a database default value of: true
+ * @var boolean
+ */
+ protected $is_linkable;
+
+ /**
+ * @var PropelObjectCollection|CcShowInstances[] Collection to store aggregation of CcShowInstances objects.
+ */
+ protected $collCcShowInstancess;
+ protected $collCcShowInstancessPartial;
+
+ /**
+ * @var PropelObjectCollection|CcShowDays[] Collection to store aggregation of CcShowDays objects.
+ */
+ protected $collCcShowDayss;
+ protected $collCcShowDayssPartial;
+
+ /**
+ * @var PropelObjectCollection|CcShowRebroadcast[] Collection to store aggregation of CcShowRebroadcast objects.
+ */
+ protected $collCcShowRebroadcasts;
+ protected $collCcShowRebroadcastsPartial;
+
+ /**
+ * @var PropelObjectCollection|CcShowHosts[] Collection to store aggregation of CcShowHosts objects.
+ */
+ protected $collCcShowHostss;
+ protected $collCcShowHostssPartial;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccShowInstancessScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccShowDayssScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccShowRebroadcastsScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccShowHostssScheduledForDeletion = null;
+
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->name = '';
+ $this->url = '';
+ $this->genre = '';
+ $this->live_stream_using_airtime_auth = false;
+ $this->live_stream_using_custom_auth = false;
+ $this->linked = false;
+ $this->is_linkable = true;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * Get the [live_stream_using_airtime_auth] column value.
+ *
+ * @return boolean
+ */
+ public function getDbLiveStreamUsingAirtimeAuth()
+ {
+
+ return $this->live_stream_using_airtime_auth;
+ }
+
+ /**
+ * Get the [live_stream_using_custom_auth] column value.
+ *
+ * @return boolean
+ */
+ public function getDbLiveStreamUsingCustomAuth()
+ {
+
+ return $this->live_stream_using_custom_auth;
+ }
+
+ /**
+ * Get the [live_stream_user] column value.
+ *
+ * @return string
+ */
+ public function getDbLiveStreamUser()
+ {
+
+ return $this->live_stream_user;
+ }
+
+ /**
+ * Get the [live_stream_pass] column value.
+ *
+ * @return string
+ */
+ public function getDbLiveStreamPass()
+ {
+
+ return $this->live_stream_pass;
+ }
+
+ /**
+ * Get the [linked] column value.
+ *
+ * @return boolean
+ */
+ public function getDbLinked()
+ {
+
+ return $this->linked;
+ }
+
+ /**
+ * Get the [is_linkable] column value.
+ *
+ * @return boolean
+ */
+ public function getDbIsLinkable()
+ {
+
+ return $this->is_linkable;
+ }
+
+ /**
+ * 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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->name !== $v) {
+ $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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->url !== $v) {
+ $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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->genre !== $v) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->background_color !== $v) {
+ $this->background_color = $v;
+ $this->modifiedColumns[] = CcShowPeer::BACKGROUND_COLOR;
+ }
+
+
+ return $this;
+ } // setDbBackgroundColor()
+
+ /**
+ * Sets the value of the [live_stream_using_airtime_auth] column.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ *
+ * @param boolean|integer|string $v The new value
+ * @return CcShow The current object (for fluent API support)
+ */
+ public function setDbLiveStreamUsingAirtimeAuth($v)
+ {
+ if ($v !== null) {
+ if (is_string($v)) {
+ $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ } else {
+ $v = (boolean) $v;
+ }
+ }
+
+ if ($this->live_stream_using_airtime_auth !== $v) {
+ $this->live_stream_using_airtime_auth = $v;
+ $this->modifiedColumns[] = CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH;
+ }
+
+
+ return $this;
+ } // setDbLiveStreamUsingAirtimeAuth()
+
+ /**
+ * Sets the value of the [live_stream_using_custom_auth] column.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ *
+ * @param boolean|integer|string $v The new value
+ * @return CcShow The current object (for fluent API support)
+ */
+ public function setDbLiveStreamUsingCustomAuth($v)
+ {
+ if ($v !== null) {
+ if (is_string($v)) {
+ $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ } else {
+ $v = (boolean) $v;
+ }
+ }
+
+ if ($this->live_stream_using_custom_auth !== $v) {
+ $this->live_stream_using_custom_auth = $v;
+ $this->modifiedColumns[] = CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH;
+ }
+
+
+ return $this;
+ } // setDbLiveStreamUsingCustomAuth()
+
+ /**
+ * Set the value of [live_stream_user] column.
+ *
+ * @param string $v new value
+ * @return CcShow The current object (for fluent API support)
+ */
+ public function setDbLiveStreamUser($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->live_stream_user !== $v) {
+ $this->live_stream_user = $v;
+ $this->modifiedColumns[] = CcShowPeer::LIVE_STREAM_USER;
+ }
+
+
+ return $this;
+ } // setDbLiveStreamUser()
+
+ /**
+ * Set the value of [live_stream_pass] column.
+ *
+ * @param string $v new value
+ * @return CcShow The current object (for fluent API support)
+ */
+ public function setDbLiveStreamPass($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->live_stream_pass !== $v) {
+ $this->live_stream_pass = $v;
+ $this->modifiedColumns[] = CcShowPeer::LIVE_STREAM_PASS;
+ }
+
+
+ return $this;
+ } // setDbLiveStreamPass()
+
+ /**
+ * Sets the value of the [linked] column.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ *
+ * @param boolean|integer|string $v The new value
+ * @return CcShow The current object (for fluent API support)
+ */
+ public function setDbLinked($v)
+ {
+ if ($v !== null) {
+ if (is_string($v)) {
+ $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ } else {
+ $v = (boolean) $v;
+ }
+ }
+
+ if ($this->linked !== $v) {
+ $this->linked = $v;
+ $this->modifiedColumns[] = CcShowPeer::LINKED;
+ }
+
+
+ return $this;
+ } // setDbLinked()
+
+ /**
+ * Sets the value of the [is_linkable] column.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ *
+ * @param boolean|integer|string $v The new value
+ * @return CcShow The current object (for fluent API support)
+ */
+ public function setDbIsLinkable($v)
+ {
+ if ($v !== null) {
+ if (is_string($v)) {
+ $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ } else {
+ $v = (boolean) $v;
+ }
+ }
+
+ if ($this->is_linkable !== $v) {
+ $this->is_linkable = $v;
+ $this->modifiedColumns[] = CcShowPeer::IS_LINKABLE;
+ }
+
+
+ return $this;
+ } // setDbIsLinkable()
+
+ /**
+ * 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;
+ }
+
+ if ($this->live_stream_using_airtime_auth !== false) {
+ return false;
+ }
+
+ if ($this->live_stream_using_custom_auth !== false) {
+ return false;
+ }
+
+ if ($this->linked !== false) {
+ return false;
+ }
+
+ if ($this->is_linkable !== true) {
+ 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 resultset 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->live_stream_using_airtime_auth = ($row[$startcol + 7] !== null) ? (boolean) $row[$startcol + 7] : null;
+ $this->live_stream_using_custom_auth = ($row[$startcol + 8] !== null) ? (boolean) $row[$startcol + 8] : null;
+ $this->live_stream_user = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
+ $this->live_stream_pass = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
+ $this->linked = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null;
+ $this->is_linkable = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 13; // 13 = CcShowPeer::NUM_HYDRATE_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
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcShowQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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 (Exception $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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ if ($this->ccShowInstancessScheduledForDeletion !== null) {
+ if (!$this->ccShowInstancessScheduledForDeletion->isEmpty()) {
+ CcShowInstancesQuery::create()
+ ->filterByPrimaryKeys($this->ccShowInstancessScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccShowInstancessScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcShowInstancess !== null) {
+ foreach ($this->collCcShowInstancess as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccShowDayssScheduledForDeletion !== null) {
+ if (!$this->ccShowDayssScheduledForDeletion->isEmpty()) {
+ CcShowDaysQuery::create()
+ ->filterByPrimaryKeys($this->ccShowDayssScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccShowDayssScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcShowDayss !== null) {
+ foreach ($this->collCcShowDayss as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccShowRebroadcastsScheduledForDeletion !== null) {
+ if (!$this->ccShowRebroadcastsScheduledForDeletion->isEmpty()) {
+ CcShowRebroadcastQuery::create()
+ ->filterByPrimaryKeys($this->ccShowRebroadcastsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccShowRebroadcastsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcShowRebroadcasts !== null) {
+ foreach ($this->collCcShowRebroadcasts as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccShowHostssScheduledForDeletion !== null) {
+ if (!$this->ccShowHostssScheduledForDeletion->isEmpty()) {
+ CcShowHostsQuery::create()
+ ->filterByPrimaryKeys($this->ccShowHostssScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccShowHostssScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcShowHostss !== null) {
+ foreach ($this->collCcShowHostss as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcShowPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcShowPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_show_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcShowPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcShowPeer::NAME)) {
+ $modifiedColumns[':p' . $index++] = '"name"';
+ }
+ if ($this->isColumnModified(CcShowPeer::URL)) {
+ $modifiedColumns[':p' . $index++] = '"url"';
+ }
+ if ($this->isColumnModified(CcShowPeer::GENRE)) {
+ $modifiedColumns[':p' . $index++] = '"genre"';
+ }
+ if ($this->isColumnModified(CcShowPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '"description"';
+ }
+ if ($this->isColumnModified(CcShowPeer::COLOR)) {
+ $modifiedColumns[':p' . $index++] = '"color"';
+ }
+ if ($this->isColumnModified(CcShowPeer::BACKGROUND_COLOR)) {
+ $modifiedColumns[':p' . $index++] = '"background_color"';
+ }
+ if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH)) {
+ $modifiedColumns[':p' . $index++] = '"live_stream_using_airtime_auth"';
+ }
+ if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH)) {
+ $modifiedColumns[':p' . $index++] = '"live_stream_using_custom_auth"';
+ }
+ if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_USER)) {
+ $modifiedColumns[':p' . $index++] = '"live_stream_user"';
+ }
+ if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_PASS)) {
+ $modifiedColumns[':p' . $index++] = '"live_stream_pass"';
+ }
+ if ($this->isColumnModified(CcShowPeer::LINKED)) {
+ $modifiedColumns[':p' . $index++] = '"linked"';
+ }
+ if ($this->isColumnModified(CcShowPeer::IS_LINKABLE)) {
+ $modifiedColumns[':p' . $index++] = '"is_linkable"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_show" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"name"':
+ $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
+ break;
+ case '"url"':
+ $stmt->bindValue($identifier, $this->url, PDO::PARAM_STR);
+ break;
+ case '"genre"':
+ $stmt->bindValue($identifier, $this->genre, PDO::PARAM_STR);
+ break;
+ case '"description"':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '"color"':
+ $stmt->bindValue($identifier, $this->color, PDO::PARAM_STR);
+ break;
+ case '"background_color"':
+ $stmt->bindValue($identifier, $this->background_color, PDO::PARAM_STR);
+ break;
+ case '"live_stream_using_airtime_auth"':
+ $stmt->bindValue($identifier, $this->live_stream_using_airtime_auth, PDO::PARAM_BOOL);
+ break;
+ case '"live_stream_using_custom_auth"':
+ $stmt->bindValue($identifier, $this->live_stream_using_custom_auth, PDO::PARAM_BOOL);
+ break;
+ case '"live_stream_user"':
+ $stmt->bindValue($identifier, $this->live_stream_user, PDO::PARAM_STR);
+ break;
+ case '"live_stream_pass"':
+ $stmt->bindValue($identifier, $this->live_stream_pass, PDO::PARAM_STR);
+ break;
+ case '"linked"':
+ $stmt->bindValue($identifier, $this->linked, PDO::PARAM_BOOL);
+ break;
+ case '"is_linkable"':
+ $stmt->bindValue($identifier, $this->is_linkable, PDO::PARAM_BOOL);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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;
+ case 7:
+ return $this->getDbLiveStreamUsingAirtimeAuth();
+ break;
+ case 8:
+ return $this->getDbLiveStreamUsingCustomAuth();
+ break;
+ case 9:
+ return $this->getDbLiveStreamUser();
+ break;
+ case 10:
+ return $this->getDbLiveStreamPass();
+ break;
+ case 11:
+ return $this->getDbLinked();
+ break;
+ case 12:
+ return $this->getDbIsLinkable();
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcShow'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcShow'][$this->getPrimaryKey()] = 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(),
+ $keys[7] => $this->getDbLiveStreamUsingAirtimeAuth(),
+ $keys[8] => $this->getDbLiveStreamUsingCustomAuth(),
+ $keys[9] => $this->getDbLiveStreamUser(),
+ $keys[10] => $this->getDbLiveStreamPass(),
+ $keys[11] => $this->getDbLinked(),
+ $keys[12] => $this->getDbIsLinkable(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->collCcShowInstancess) {
+ $result['CcShowInstancess'] = $this->collCcShowInstancess->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcShowDayss) {
+ $result['CcShowDayss'] = $this->collCcShowDayss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcShowRebroadcasts) {
+ $result['CcShowRebroadcasts'] = $this->collCcShowRebroadcasts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcShowHostss) {
+ $result['CcShowHostss'] = $this->collCcShowHostss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ }
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcShowPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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;
+ case 7:
+ $this->setDbLiveStreamUsingAirtimeAuth($value);
+ break;
+ case 8:
+ $this->setDbLiveStreamUsingCustomAuth($value);
+ break;
+ case 9:
+ $this->setDbLiveStreamUser($value);
+ break;
+ case 10:
+ $this->setDbLiveStreamPass($value);
+ break;
+ case 11:
+ $this->setDbLinked($value);
+ break;
+ case 12:
+ $this->setDbIsLinkable($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 BasePeer::TYPE_PHPNAME
+ *
+ * @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]]);
+ if (array_key_exists($keys[7], $arr)) $this->setDbLiveStreamUsingAirtimeAuth($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setDbLiveStreamUsingCustomAuth($arr[$keys[8]]);
+ if (array_key_exists($keys[9], $arr)) $this->setDbLiveStreamUser($arr[$keys[9]]);
+ if (array_key_exists($keys[10], $arr)) $this->setDbLiveStreamPass($arr[$keys[10]]);
+ if (array_key_exists($keys[11], $arr)) $this->setDbLinked($arr[$keys[11]]);
+ if (array_key_exists($keys[12], $arr)) $this->setDbIsLinkable($arr[$keys[12]]);
+ }
+
+ /**
+ * 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);
+ if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH)) $criteria->add(CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH, $this->live_stream_using_airtime_auth);
+ if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH)) $criteria->add(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH, $this->live_stream_using_custom_auth);
+ if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_USER)) $criteria->add(CcShowPeer::LIVE_STREAM_USER, $this->live_stream_user);
+ if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_PASS)) $criteria->add(CcShowPeer::LIVE_STREAM_PASS, $this->live_stream_pass);
+ if ($this->isColumnModified(CcShowPeer::LINKED)) $criteria->add(CcShowPeer::LINKED, $this->linked);
+ if ($this->isColumnModified(CcShowPeer::IS_LINKABLE)) $criteria->add(CcShowPeer::IS_LINKABLE, $this->is_linkable);
+
+ 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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbName($this->getDbName());
+ $copyObj->setDbUrl($this->getDbUrl());
+ $copyObj->setDbGenre($this->getDbGenre());
+ $copyObj->setDbDescription($this->getDbDescription());
+ $copyObj->setDbColor($this->getDbColor());
+ $copyObj->setDbBackgroundColor($this->getDbBackgroundColor());
+ $copyObj->setDbLiveStreamUsingAirtimeAuth($this->getDbLiveStreamUsingAirtimeAuth());
+ $copyObj->setDbLiveStreamUsingCustomAuth($this->getDbLiveStreamUsingCustomAuth());
+ $copyObj->setDbLiveStreamUser($this->getDbLiveStreamUser());
+ $copyObj->setDbLiveStreamPass($this->getDbLiveStreamPass());
+ $copyObj->setDbLinked($this->getDbLinked());
+ $copyObj->setDbIsLinkable($this->getDbIsLinkable());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ 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));
+ }
+ }
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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;
+ }
+
+
+ /**
+ * Initializes a collection based on the name of a relation.
+ * Avoids crafting an 'init[$relationName]s' method name
+ * that wouldn't work when StandardEnglishPluralizer is used.
+ *
+ * @param string $relationName The name of the relation to initialize
+ * @return void
+ */
+ public function initRelation($relationName)
+ {
+ if ('CcShowInstances' == $relationName) {
+ $this->initCcShowInstancess();
+ }
+ if ('CcShowDays' == $relationName) {
+ $this->initCcShowDayss();
+ }
+ if ('CcShowRebroadcast' == $relationName) {
+ $this->initCcShowRebroadcasts();
+ }
+ if ('CcShowHosts' == $relationName) {
+ $this->initCcShowHostss();
+ }
+ }
+
+ /**
+ * 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 CcShow The current object (for fluent API support)
+ * @see addCcShowInstancess()
+ */
+ public function clearCcShowInstancess()
+ {
+ $this->collCcShowInstancess = null; // important to set this to null since that means it is uninitialized
+ $this->collCcShowInstancessPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcShowInstancess collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcShowInstancess($v = true)
+ {
+ $this->collCcShowInstancessPartial = $v;
+ }
+
+ /**
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcShowInstancess($overrideExisting = true)
+ {
+ if (null !== $this->collCcShowInstancess && !$overrideExisting) {
+ return;
+ }
+ $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 PropelObjectCollection|CcShowInstances[] List of CcShowInstances objects
+ * @throws PropelException
+ */
+ public function getCcShowInstancess($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcShowInstancessPartial && !$this->isNew();
+ if (null === $this->collCcShowInstancess || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcShowInstancess) {
+ // return empty collection
+ $this->initCcShowInstancess();
+ } else {
+ $collCcShowInstancess = CcShowInstancesQuery::create(null, $criteria)
+ ->filterByCcShow($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcShowInstancessPartial && count($collCcShowInstancess)) {
+ $this->initCcShowInstancess(false);
+
+ foreach ($collCcShowInstancess as $obj) {
+ if (false == $this->collCcShowInstancess->contains($obj)) {
+ $this->collCcShowInstancess->append($obj);
+ }
+ }
+
+ $this->collCcShowInstancessPartial = true;
+ }
+
+ $collCcShowInstancess->getInternalIterator()->rewind();
+
+ return $collCcShowInstancess;
+ }
+
+ if ($partial && $this->collCcShowInstancess) {
+ foreach ($this->collCcShowInstancess as $obj) {
+ if ($obj->isNew()) {
+ $collCcShowInstancess[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcShowInstancess = $collCcShowInstancess;
+ $this->collCcShowInstancessPartial = false;
+ }
+ }
+
+ return $this->collCcShowInstancess;
+ }
+
+ /**
+ * Sets a collection of CcShowInstances objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccShowInstancess A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcShow The current object (for fluent API support)
+ */
+ public function setCcShowInstancess(PropelCollection $ccShowInstancess, PropelPDO $con = null)
+ {
+ $ccShowInstancessToDelete = $this->getCcShowInstancess(new Criteria(), $con)->diff($ccShowInstancess);
+
+
+ $this->ccShowInstancessScheduledForDeletion = $ccShowInstancessToDelete;
+
+ foreach ($ccShowInstancessToDelete as $ccShowInstancesRemoved) {
+ $ccShowInstancesRemoved->setCcShow(null);
+ }
+
+ $this->collCcShowInstancess = null;
+ foreach ($ccShowInstancess as $ccShowInstances) {
+ $this->addCcShowInstances($ccShowInstances);
+ }
+
+ $this->collCcShowInstancess = $ccShowInstancess;
+ $this->collCcShowInstancessPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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)
+ {
+ $partial = $this->collCcShowInstancessPartial && !$this->isNew();
+ if (null === $this->collCcShowInstancess || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcShowInstancess) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcShowInstancess());
+ }
+ $query = CcShowInstancesQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcShow($this)
+ ->count($con);
+ }
+
+ 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 CcShow The current object (for fluent API support)
+ */
+ public function addCcShowInstances(CcShowInstances $l)
+ {
+ if ($this->collCcShowInstancess === null) {
+ $this->initCcShowInstancess();
+ $this->collCcShowInstancessPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcShowInstancess->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcShowInstances($l);
+
+ if ($this->ccShowInstancessScheduledForDeletion and $this->ccShowInstancessScheduledForDeletion->contains($l)) {
+ $this->ccShowInstancessScheduledForDeletion->remove($this->ccShowInstancessScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcShowInstances $ccShowInstances The ccShowInstances object to add.
+ */
+ protected function doAddCcShowInstances($ccShowInstances)
+ {
+ $this->collCcShowInstancess[]= $ccShowInstances;
+ $ccShowInstances->setCcShow($this);
+ }
+
+ /**
+ * @param CcShowInstances $ccShowInstances The ccShowInstances object to remove.
+ * @return CcShow The current object (for fluent API support)
+ */
+ public function removeCcShowInstances($ccShowInstances)
+ {
+ if ($this->getCcShowInstancess()->contains($ccShowInstances)) {
+ $this->collCcShowInstancess->remove($this->collCcShowInstancess->search($ccShowInstances));
+ if (null === $this->ccShowInstancessScheduledForDeletion) {
+ $this->ccShowInstancessScheduledForDeletion = clone $this->collCcShowInstancess;
+ $this->ccShowInstancessScheduledForDeletion->clear();
+ }
+ $this->ccShowInstancessScheduledForDeletion[]= clone $ccShowInstances;
+ $ccShowInstances->setCcShow(null);
+ }
+
+ return $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 PropelObjectCollection|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 PropelObjectCollection|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 CcShow The current object (for fluent API support)
+ * @see addCcShowDayss()
+ */
+ public function clearCcShowDayss()
+ {
+ $this->collCcShowDayss = null; // important to set this to null since that means it is uninitialized
+ $this->collCcShowDayssPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcShowDayss collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcShowDayss($v = true)
+ {
+ $this->collCcShowDayssPartial = $v;
+ }
+
+ /**
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcShowDayss($overrideExisting = true)
+ {
+ if (null !== $this->collCcShowDayss && !$overrideExisting) {
+ return;
+ }
+ $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 PropelObjectCollection|CcShowDays[] List of CcShowDays objects
+ * @throws PropelException
+ */
+ public function getCcShowDayss($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcShowDayssPartial && !$this->isNew();
+ if (null === $this->collCcShowDayss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcShowDayss) {
+ // return empty collection
+ $this->initCcShowDayss();
+ } else {
+ $collCcShowDayss = CcShowDaysQuery::create(null, $criteria)
+ ->filterByCcShow($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcShowDayssPartial && count($collCcShowDayss)) {
+ $this->initCcShowDayss(false);
+
+ foreach ($collCcShowDayss as $obj) {
+ if (false == $this->collCcShowDayss->contains($obj)) {
+ $this->collCcShowDayss->append($obj);
+ }
+ }
+
+ $this->collCcShowDayssPartial = true;
+ }
+
+ $collCcShowDayss->getInternalIterator()->rewind();
+
+ return $collCcShowDayss;
+ }
+
+ if ($partial && $this->collCcShowDayss) {
+ foreach ($this->collCcShowDayss as $obj) {
+ if ($obj->isNew()) {
+ $collCcShowDayss[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcShowDayss = $collCcShowDayss;
+ $this->collCcShowDayssPartial = false;
+ }
+ }
+
+ return $this->collCcShowDayss;
+ }
+
+ /**
+ * Sets a collection of CcShowDays objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccShowDayss A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcShow The current object (for fluent API support)
+ */
+ public function setCcShowDayss(PropelCollection $ccShowDayss, PropelPDO $con = null)
+ {
+ $ccShowDayssToDelete = $this->getCcShowDayss(new Criteria(), $con)->diff($ccShowDayss);
+
+
+ $this->ccShowDayssScheduledForDeletion = $ccShowDayssToDelete;
+
+ foreach ($ccShowDayssToDelete as $ccShowDaysRemoved) {
+ $ccShowDaysRemoved->setCcShow(null);
+ }
+
+ $this->collCcShowDayss = null;
+ foreach ($ccShowDayss as $ccShowDays) {
+ $this->addCcShowDays($ccShowDays);
+ }
+
+ $this->collCcShowDayss = $ccShowDayss;
+ $this->collCcShowDayssPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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)
+ {
+ $partial = $this->collCcShowDayssPartial && !$this->isNew();
+ if (null === $this->collCcShowDayss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcShowDayss) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcShowDayss());
+ }
+ $query = CcShowDaysQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcShow($this)
+ ->count($con);
+ }
+
+ 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 CcShow The current object (for fluent API support)
+ */
+ public function addCcShowDays(CcShowDays $l)
+ {
+ if ($this->collCcShowDayss === null) {
+ $this->initCcShowDayss();
+ $this->collCcShowDayssPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcShowDayss->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcShowDays($l);
+
+ if ($this->ccShowDayssScheduledForDeletion and $this->ccShowDayssScheduledForDeletion->contains($l)) {
+ $this->ccShowDayssScheduledForDeletion->remove($this->ccShowDayssScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcShowDays $ccShowDays The ccShowDays object to add.
+ */
+ protected function doAddCcShowDays($ccShowDays)
+ {
+ $this->collCcShowDayss[]= $ccShowDays;
+ $ccShowDays->setCcShow($this);
+ }
+
+ /**
+ * @param CcShowDays $ccShowDays The ccShowDays object to remove.
+ * @return CcShow The current object (for fluent API support)
+ */
+ public function removeCcShowDays($ccShowDays)
+ {
+ if ($this->getCcShowDayss()->contains($ccShowDays)) {
+ $this->collCcShowDayss->remove($this->collCcShowDayss->search($ccShowDays));
+ if (null === $this->ccShowDayssScheduledForDeletion) {
+ $this->ccShowDayssScheduledForDeletion = clone $this->collCcShowDayss;
+ $this->ccShowDayssScheduledForDeletion->clear();
+ }
+ $this->ccShowDayssScheduledForDeletion[]= clone $ccShowDays;
+ $ccShowDays->setCcShow(null);
+ }
+
+ return $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 CcShow The current object (for fluent API support)
+ * @see addCcShowRebroadcasts()
+ */
+ public function clearCcShowRebroadcasts()
+ {
+ $this->collCcShowRebroadcasts = null; // important to set this to null since that means it is uninitialized
+ $this->collCcShowRebroadcastsPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcShowRebroadcasts collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcShowRebroadcasts($v = true)
+ {
+ $this->collCcShowRebroadcastsPartial = $v;
+ }
+
+ /**
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcShowRebroadcasts($overrideExisting = true)
+ {
+ if (null !== $this->collCcShowRebroadcasts && !$overrideExisting) {
+ return;
+ }
+ $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 PropelObjectCollection|CcShowRebroadcast[] List of CcShowRebroadcast objects
+ * @throws PropelException
+ */
+ public function getCcShowRebroadcasts($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcShowRebroadcastsPartial && !$this->isNew();
+ if (null === $this->collCcShowRebroadcasts || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcShowRebroadcasts) {
+ // return empty collection
+ $this->initCcShowRebroadcasts();
+ } else {
+ $collCcShowRebroadcasts = CcShowRebroadcastQuery::create(null, $criteria)
+ ->filterByCcShow($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcShowRebroadcastsPartial && count($collCcShowRebroadcasts)) {
+ $this->initCcShowRebroadcasts(false);
+
+ foreach ($collCcShowRebroadcasts as $obj) {
+ if (false == $this->collCcShowRebroadcasts->contains($obj)) {
+ $this->collCcShowRebroadcasts->append($obj);
+ }
+ }
+
+ $this->collCcShowRebroadcastsPartial = true;
+ }
+
+ $collCcShowRebroadcasts->getInternalIterator()->rewind();
+
+ return $collCcShowRebroadcasts;
+ }
+
+ if ($partial && $this->collCcShowRebroadcasts) {
+ foreach ($this->collCcShowRebroadcasts as $obj) {
+ if ($obj->isNew()) {
+ $collCcShowRebroadcasts[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcShowRebroadcasts = $collCcShowRebroadcasts;
+ $this->collCcShowRebroadcastsPartial = false;
+ }
+ }
+
+ return $this->collCcShowRebroadcasts;
+ }
+
+ /**
+ * Sets a collection of CcShowRebroadcast objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccShowRebroadcasts A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcShow The current object (for fluent API support)
+ */
+ public function setCcShowRebroadcasts(PropelCollection $ccShowRebroadcasts, PropelPDO $con = null)
+ {
+ $ccShowRebroadcastsToDelete = $this->getCcShowRebroadcasts(new Criteria(), $con)->diff($ccShowRebroadcasts);
+
+
+ $this->ccShowRebroadcastsScheduledForDeletion = $ccShowRebroadcastsToDelete;
+
+ foreach ($ccShowRebroadcastsToDelete as $ccShowRebroadcastRemoved) {
+ $ccShowRebroadcastRemoved->setCcShow(null);
+ }
+
+ $this->collCcShowRebroadcasts = null;
+ foreach ($ccShowRebroadcasts as $ccShowRebroadcast) {
+ $this->addCcShowRebroadcast($ccShowRebroadcast);
+ }
+
+ $this->collCcShowRebroadcasts = $ccShowRebroadcasts;
+ $this->collCcShowRebroadcastsPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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)
+ {
+ $partial = $this->collCcShowRebroadcastsPartial && !$this->isNew();
+ if (null === $this->collCcShowRebroadcasts || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcShowRebroadcasts) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcShowRebroadcasts());
+ }
+ $query = CcShowRebroadcastQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcShow($this)
+ ->count($con);
+ }
+
+ 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 CcShow The current object (for fluent API support)
+ */
+ public function addCcShowRebroadcast(CcShowRebroadcast $l)
+ {
+ if ($this->collCcShowRebroadcasts === null) {
+ $this->initCcShowRebroadcasts();
+ $this->collCcShowRebroadcastsPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcShowRebroadcasts->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcShowRebroadcast($l);
+
+ if ($this->ccShowRebroadcastsScheduledForDeletion and $this->ccShowRebroadcastsScheduledForDeletion->contains($l)) {
+ $this->ccShowRebroadcastsScheduledForDeletion->remove($this->ccShowRebroadcastsScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcShowRebroadcast $ccShowRebroadcast The ccShowRebroadcast object to add.
+ */
+ protected function doAddCcShowRebroadcast($ccShowRebroadcast)
+ {
+ $this->collCcShowRebroadcasts[]= $ccShowRebroadcast;
+ $ccShowRebroadcast->setCcShow($this);
+ }
+
+ /**
+ * @param CcShowRebroadcast $ccShowRebroadcast The ccShowRebroadcast object to remove.
+ * @return CcShow The current object (for fluent API support)
+ */
+ public function removeCcShowRebroadcast($ccShowRebroadcast)
+ {
+ if ($this->getCcShowRebroadcasts()->contains($ccShowRebroadcast)) {
+ $this->collCcShowRebroadcasts->remove($this->collCcShowRebroadcasts->search($ccShowRebroadcast));
+ if (null === $this->ccShowRebroadcastsScheduledForDeletion) {
+ $this->ccShowRebroadcastsScheduledForDeletion = clone $this->collCcShowRebroadcasts;
+ $this->ccShowRebroadcastsScheduledForDeletion->clear();
+ }
+ $this->ccShowRebroadcastsScheduledForDeletion[]= clone $ccShowRebroadcast;
+ $ccShowRebroadcast->setCcShow(null);
+ }
+
+ return $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 CcShow The current object (for fluent API support)
+ * @see addCcShowHostss()
+ */
+ public function clearCcShowHostss()
+ {
+ $this->collCcShowHostss = null; // important to set this to null since that means it is uninitialized
+ $this->collCcShowHostssPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcShowHostss collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcShowHostss($v = true)
+ {
+ $this->collCcShowHostssPartial = $v;
+ }
+
+ /**
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcShowHostss($overrideExisting = true)
+ {
+ if (null !== $this->collCcShowHostss && !$overrideExisting) {
+ return;
+ }
+ $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 PropelObjectCollection|CcShowHosts[] List of CcShowHosts objects
+ * @throws PropelException
+ */
+ public function getCcShowHostss($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcShowHostssPartial && !$this->isNew();
+ if (null === $this->collCcShowHostss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcShowHostss) {
+ // return empty collection
+ $this->initCcShowHostss();
+ } else {
+ $collCcShowHostss = CcShowHostsQuery::create(null, $criteria)
+ ->filterByCcShow($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcShowHostssPartial && count($collCcShowHostss)) {
+ $this->initCcShowHostss(false);
+
+ foreach ($collCcShowHostss as $obj) {
+ if (false == $this->collCcShowHostss->contains($obj)) {
+ $this->collCcShowHostss->append($obj);
+ }
+ }
+
+ $this->collCcShowHostssPartial = true;
+ }
+
+ $collCcShowHostss->getInternalIterator()->rewind();
+
+ return $collCcShowHostss;
+ }
+
+ if ($partial && $this->collCcShowHostss) {
+ foreach ($this->collCcShowHostss as $obj) {
+ if ($obj->isNew()) {
+ $collCcShowHostss[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcShowHostss = $collCcShowHostss;
+ $this->collCcShowHostssPartial = false;
+ }
+ }
+
+ return $this->collCcShowHostss;
+ }
+
+ /**
+ * Sets a collection of CcShowHosts objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccShowHostss A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcShow The current object (for fluent API support)
+ */
+ public function setCcShowHostss(PropelCollection $ccShowHostss, PropelPDO $con = null)
+ {
+ $ccShowHostssToDelete = $this->getCcShowHostss(new Criteria(), $con)->diff($ccShowHostss);
+
+
+ $this->ccShowHostssScheduledForDeletion = $ccShowHostssToDelete;
+
+ foreach ($ccShowHostssToDelete as $ccShowHostsRemoved) {
+ $ccShowHostsRemoved->setCcShow(null);
+ }
+
+ $this->collCcShowHostss = null;
+ foreach ($ccShowHostss as $ccShowHosts) {
+ $this->addCcShowHosts($ccShowHosts);
+ }
+
+ $this->collCcShowHostss = $ccShowHostss;
+ $this->collCcShowHostssPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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)
+ {
+ $partial = $this->collCcShowHostssPartial && !$this->isNew();
+ if (null === $this->collCcShowHostss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcShowHostss) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcShowHostss());
+ }
+ $query = CcShowHostsQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcShow($this)
+ ->count($con);
+ }
+
+ 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 CcShow The current object (for fluent API support)
+ */
+ public function addCcShowHosts(CcShowHosts $l)
+ {
+ if ($this->collCcShowHostss === null) {
+ $this->initCcShowHostss();
+ $this->collCcShowHostssPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcShowHostss->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcShowHosts($l);
+
+ if ($this->ccShowHostssScheduledForDeletion and $this->ccShowHostssScheduledForDeletion->contains($l)) {
+ $this->ccShowHostssScheduledForDeletion->remove($this->ccShowHostssScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcShowHosts $ccShowHosts The ccShowHosts object to add.
+ */
+ protected function doAddCcShowHosts($ccShowHosts)
+ {
+ $this->collCcShowHostss[]= $ccShowHosts;
+ $ccShowHosts->setCcShow($this);
+ }
+
+ /**
+ * @param CcShowHosts $ccShowHosts The ccShowHosts object to remove.
+ * @return CcShow The current object (for fluent API support)
+ */
+ public function removeCcShowHosts($ccShowHosts)
+ {
+ if ($this->getCcShowHostss()->contains($ccShowHosts)) {
+ $this->collCcShowHostss->remove($this->collCcShowHostss->search($ccShowHosts));
+ if (null === $this->ccShowHostssScheduledForDeletion) {
+ $this->ccShowHostssScheduledForDeletion = clone $this->collCcShowHostss;
+ $this->ccShowHostssScheduledForDeletion->clear();
+ }
+ $this->ccShowHostssScheduledForDeletion[]= clone $ccShowHosts;
+ $ccShowHosts->setCcShow(null);
+ }
+
+ return $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 PropelObjectCollection|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->live_stream_using_airtime_auth = null;
+ $this->live_stream_using_custom_auth = null;
+ $this->live_stream_user = null;
+ $this->live_stream_pass = null;
+ $this->linked = null;
+ $this->is_linkable = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->collCcShowInstancess) {
+ foreach ($this->collCcShowInstancess as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcShowDayss) {
+ foreach ($this->collCcShowDayss as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcShowRebroadcasts) {
+ foreach ($this->collCcShowRebroadcasts as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcShowHostss) {
+ foreach ($this->collCcShowHostss as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ if ($this->collCcShowInstancess instanceof PropelCollection) {
+ $this->collCcShowInstancess->clearIterator();
+ }
+ $this->collCcShowInstancess = null;
+ if ($this->collCcShowDayss instanceof PropelCollection) {
+ $this->collCcShowDayss->clearIterator();
+ }
+ $this->collCcShowDayss = null;
+ if ($this->collCcShowRebroadcasts instanceof PropelCollection) {
+ $this->collCcShowRebroadcasts->clearIterator();
+ }
+ $this->collCcShowRebroadcasts = null;
+ if ($this->collCcShowHostss instanceof PropelCollection) {
+ $this->collCcShowHostss->clearIterator();
+ }
+ $this->collCcShowHostss = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcShowPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowDays.php b/airtime_mvc/application/models/airtime/om/BaseCcShowDays.php
index be9f66086..8a13db98b 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowDays.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowDays.php
@@ -4,1473 +4,1571 @@
/**
* Base class that represents a row from the 'cc_show_days' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcShowDays extends BaseObject implements Persistent
+abstract class BaseCcShowDays extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcShowDaysPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcShowDaysPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the first_show field.
- * @var string
- */
- protected $first_show;
-
- /**
- * The value for the last_show field.
- * @var string
- */
- protected $last_show;
-
- /**
- * The value for the start_time field.
- * @var string
- */
- protected $start_time;
-
- /**
- * The value for the timezone field.
- * @var string
- */
- protected $timezone;
-
- /**
- * The value for the duration field.
- * @var string
- */
- protected $duration;
-
- /**
- * The value for the day field.
- * @var int
- */
- protected $day;
-
- /**
- * The value for the repeat_type field.
- * @var int
- */
- protected $repeat_type;
-
- /**
- * The value for the next_pop_date field.
- * @var string
- */
- protected $next_pop_date;
-
- /**
- * The value for the show_id field.
- * @var int
- */
- protected $show_id;
-
- /**
- * The value for the record field.
- * Note: this column has a database default value of: 0
- * @var int
- */
- protected $record;
-
- /**
- * @var CcShow
- */
- protected $aCcShow;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Applies default values to this object.
- * This method should be called from the object's constructor (or
- * equivalent initialization method).
- * @see __construct()
- */
- public function applyDefaultValues()
- {
- $this->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
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcShowDaysPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcShowDaysPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the first_show field.
+ * @var string
+ */
+ protected $first_show;
+
+ /**
+ * The value for the last_show field.
+ * @var string
+ */
+ protected $last_show;
+
+ /**
+ * The value for the start_time field.
+ * @var string
+ */
+ protected $start_time;
+
+ /**
+ * The value for the timezone field.
+ * @var string
+ */
+ protected $timezone;
+
+ /**
+ * The value for the duration field.
+ * @var string
+ */
+ protected $duration;
+
+ /**
+ * The value for the day field.
+ * @var int
+ */
+ protected $day;
+
+ /**
+ * The value for the repeat_type field.
+ * @var int
+ */
+ protected $repeat_type;
+
+ /**
+ * The value for the next_pop_date field.
+ * @var string
+ */
+ protected $next_pop_date;
+
+ /**
+ * The value for the show_id field.
+ * @var int
+ */
+ protected $show_id;
+
+ /**
+ * The value for the record field.
+ * Note: this column has a database default value of: 0
+ * @var int
+ */
+ protected $record;
+
+ /**
+ * @var CcShow
+ */
+ protected $aCcShow;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ 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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ 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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ 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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ 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 && is_numeric($v)) {
+ $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 strings are treated as null.
+ * @return CcShowDays The current object (for fluent API support)
+ */
+ public function setDbFirstShow($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->first_show !== null || $dt !== null) {
+ $currentDateAsString = ($this->first_show !== null && $tmpDt = new DateTime($this->first_show)) ? $tmpDt->format('Y-m-d') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->first_show = $newDateAsString;
+ $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 strings are treated as null.
+ * @return CcShowDays The current object (for fluent API support)
+ */
+ public function setDbLastShow($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->last_show !== null || $dt !== null) {
+ $currentDateAsString = ($this->last_show !== null && $tmpDt = new DateTime($this->last_show)) ? $tmpDt->format('Y-m-d') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->last_show = $newDateAsString;
+ $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 strings are treated as null.
+ * @return CcShowDays The current object (for fluent API support)
+ */
+ public function setDbStartTime($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->start_time !== null || $dt !== null) {
+ $currentDateAsString = ($this->start_time !== null && $tmpDt = new DateTime($this->start_time)) ? $tmpDt->format('H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->start_time = $newDateAsString;
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 strings are treated as null.
+ * @return CcShowDays The current object (for fluent API support)
+ */
+ public function setDbNextPopDate($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->next_pop_date !== null || $dt !== null) {
+ $currentDateAsString = ($this->next_pop_date !== null && $tmpDt = new DateTime($this->next_pop_date)) ? $tmpDt->format('Y-m-d') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->next_pop_date = $newDateAsString;
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->record !== $v) {
+ $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 resultset 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();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 11; // 11 = CcShowDaysPeer::NUM_HYDRATE_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
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcShowDaysQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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 (Exception $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 corresponding 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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcShowDaysPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcShowDaysPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_show_days_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcShowDaysPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcShowDaysPeer::FIRST_SHOW)) {
+ $modifiedColumns[':p' . $index++] = '"first_show"';
+ }
+ if ($this->isColumnModified(CcShowDaysPeer::LAST_SHOW)) {
+ $modifiedColumns[':p' . $index++] = '"last_show"';
+ }
+ if ($this->isColumnModified(CcShowDaysPeer::START_TIME)) {
+ $modifiedColumns[':p' . $index++] = '"start_time"';
+ }
+ if ($this->isColumnModified(CcShowDaysPeer::TIMEZONE)) {
+ $modifiedColumns[':p' . $index++] = '"timezone"';
+ }
+ if ($this->isColumnModified(CcShowDaysPeer::DURATION)) {
+ $modifiedColumns[':p' . $index++] = '"duration"';
+ }
+ if ($this->isColumnModified(CcShowDaysPeer::DAY)) {
+ $modifiedColumns[':p' . $index++] = '"day"';
+ }
+ if ($this->isColumnModified(CcShowDaysPeer::REPEAT_TYPE)) {
+ $modifiedColumns[':p' . $index++] = '"repeat_type"';
+ }
+ if ($this->isColumnModified(CcShowDaysPeer::NEXT_POP_DATE)) {
+ $modifiedColumns[':p' . $index++] = '"next_pop_date"';
+ }
+ if ($this->isColumnModified(CcShowDaysPeer::SHOW_ID)) {
+ $modifiedColumns[':p' . $index++] = '"show_id"';
+ }
+ if ($this->isColumnModified(CcShowDaysPeer::RECORD)) {
+ $modifiedColumns[':p' . $index++] = '"record"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_show_days" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"first_show"':
+ $stmt->bindValue($identifier, $this->first_show, PDO::PARAM_STR);
+ break;
+ case '"last_show"':
+ $stmt->bindValue($identifier, $this->last_show, PDO::PARAM_STR);
+ break;
+ case '"start_time"':
+ $stmt->bindValue($identifier, $this->start_time, PDO::PARAM_STR);
+ break;
+ case '"timezone"':
+ $stmt->bindValue($identifier, $this->timezone, PDO::PARAM_STR);
+ break;
+ case '"duration"':
+ $stmt->bindValue($identifier, $this->duration, PDO::PARAM_STR);
+ break;
+ case '"day"':
+ $stmt->bindValue($identifier, $this->day, PDO::PARAM_INT);
+ break;
+ case '"repeat_type"':
+ $stmt->bindValue($identifier, $this->repeat_type, PDO::PARAM_INT);
+ break;
+ case '"next_pop_date"':
+ $stmt->bindValue($identifier, $this->next_pop_date, PDO::PARAM_STR);
+ break;
+ case '"show_id"':
+ $stmt->bindValue($identifier, $this->show_id, PDO::PARAM_INT);
+ break;
+ case '"record"':
+ $stmt->bindValue($identifier, $this->record, PDO::PARAM_INT);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcShowDays'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcShowDays'][$this->getPrimaryKey()] = true;
+ $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(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcShow) {
+ $result['CcShow'] = $this->aCcShow->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcShowDaysPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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 BasePeer::TYPE_PHPNAME
+ *
+ * @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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbFirstShow($this->getDbFirstShow());
+ $copyObj->setDbLastShow($this->getDbLastShow());
+ $copyObj->setDbStartTime($this->getDbStartTime());
+ $copyObj->setDbTimezone($this->getDbTimezone());
+ $copyObj->setDbDuration($this->getDbDuration());
+ $copyObj->setDbDay($this->getDbDay());
+ $copyObj->setDbRepeatType($this->getDbRepeatType());
+ $copyObj->setDbNextPopDate($this->getDbNextPopDate());
+ $copyObj->setDbShowId($this->getDbShowId());
+ $copyObj->setDbRecord($this->getDbRecord());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcShow The associated CcShow object.
+ * @throws PropelException
+ */
+ public function getCcShow(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcShow === null && ($this->show_id !== null) && $doQuery) {
+ $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->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->aCcShow instanceof Persistent) {
+ $this->aCcShow->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ $this->aCcShow = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcShowDaysPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowDaysPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcShowDaysPeer.php
index df6b9081d..cb76ec2a3 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowDaysPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowDaysPeer.php
@@ -4,1011 +4,1037 @@
/**
* Base static class for performing query and update operations on the 'cc_show_days' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcShowDaysPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_show_days';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcShowDays';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcShowDays';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcShowDaysTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 11;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_show_days.ID';
-
- /** the column name for the FIRST_SHOW field */
- const FIRST_SHOW = 'cc_show_days.FIRST_SHOW';
-
- /** the column name for the LAST_SHOW field */
- const LAST_SHOW = 'cc_show_days.LAST_SHOW';
-
- /** the column name for the START_TIME field */
- const START_TIME = 'cc_show_days.START_TIME';
-
- /** the column name for the TIMEZONE field */
- const TIMEZONE = 'cc_show_days.TIMEZONE';
-
- /** the column name for the DURATION field */
- const DURATION = 'cc_show_days.DURATION';
-
- /** the column name for the DAY field */
- const DAY = 'cc_show_days.DAY';
-
- /** the column name for the REPEAT_TYPE field */
- const REPEAT_TYPE = 'cc_show_days.REPEAT_TYPE';
-
- /** the column name for the NEXT_POP_DATE field */
- const NEXT_POP_DATE = 'cc_show_days.NEXT_POP_DATE';
-
- /** the column name for the SHOW_ID field */
- const SHOW_ID = 'cc_show_days.SHOW_ID';
-
- /** the column name for the RECORD field */
- const RECORD = 'cc_show_days.RECORD';
-
- /**
- * An identiy map to hold any loaded instances of CcShowDays objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcShowDays[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => 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;
- }
+abstract class BaseCcShowDaysPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_show_days';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcShowDays';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcShowDaysTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 11;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 11;
+
+ /** the column name for the id field */
+ const ID = 'cc_show_days.id';
+
+ /** the column name for the first_show field */
+ const FIRST_SHOW = 'cc_show_days.first_show';
+
+ /** the column name for the last_show field */
+ const LAST_SHOW = 'cc_show_days.last_show';
+
+ /** the column name for the start_time field */
+ const START_TIME = 'cc_show_days.start_time';
+
+ /** the column name for the timezone field */
+ const TIMEZONE = 'cc_show_days.timezone';
+
+ /** the column name for the duration field */
+ const DURATION = 'cc_show_days.duration';
+
+ /** the column name for the day field */
+ const DAY = 'cc_show_days.day';
+
+ /** the column name for the repeat_type field */
+ const REPEAT_TYPE = 'cc_show_days.repeat_type';
+
+ /** the column name for the next_pop_date field */
+ const NEXT_POP_DATE = 'cc_show_days.next_pop_date';
+
+ /** the column name for the show_id field */
+ const SHOW_ID = 'cc_show_days.show_id';
+
+ /** the column name for the record field */
+ const RECORD = 'cc_show_days.record';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcShowDays objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcShowDays[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcShowDaysPeer::$fieldNames[CcShowDaysPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => 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 (CcShowDaysPeer::ID, CcShowDaysPeer::FIRST_SHOW, CcShowDaysPeer::LAST_SHOW, CcShowDaysPeer::START_TIME, CcShowDaysPeer::TIMEZONE, CcShowDaysPeer::DURATION, CcShowDaysPeer::DAY, CcShowDaysPeer::REPEAT_TYPE, CcShowDaysPeer::NEXT_POP_DATE, CcShowDaysPeer::SHOW_ID, CcShowDaysPeer::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. CcShowDaysPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected 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 (CcShowDaysPeer::ID => 0, CcShowDaysPeer::FIRST_SHOW => 1, CcShowDaysPeer::LAST_SHOW => 2, CcShowDaysPeer::START_TIME => 3, CcShowDaysPeer::TIMEZONE => 4, CcShowDaysPeer::DURATION => 5, CcShowDaysPeer::DAY => 6, CcShowDaysPeer::REPEAT_TYPE => 7, CcShowDaysPeer::NEXT_POP_DATE => 8, CcShowDaysPeer::SHOW_ID => 9, CcShowDaysPeer::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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcShowDaysPeer::getFieldNames($toType);
+ $key = isset(CcShowDaysPeer::$fieldKeys[$fromType][$name]) ? CcShowDaysPeer::$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(CcShowDaysPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcShowDaysPeer::$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 CcShowDaysPeer::$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(CcShowDaysPeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcShowDaysPeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcShowDaysPeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcShowDaysPeer::$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(CcShowDaysPeer::$instances[$key])) {
+ return CcShowDaysPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcShowDaysPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcShowDaysPeer::$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();
+ // 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_HYDRATE_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(CcShowDaysPeer::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(CcShowDaysPeer::DATABASE_NAME);
+ }
+
+ CcShowDaysPeer::addSelectColumns($criteria);
+ $startcol = CcShowDaysPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcShowDaysPeer::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(CcShowDaysPeer::DATABASE_NAME);
+ }
+
+ CcShowDaysPeer::addSelectColumns($criteria);
+ $startcol2 = CcShowDaysPeer::NUM_HYDRATE_COLUMNS;
+
+ CcShowPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcShowPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcShowDaysPeer::DATABASE_NAME)->getTable(CcShowDaysPeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcShowDaysPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcShowDaysPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcShowDaysPeer::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(CcShowDaysPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_show_days table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcShowDaysPeer::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(CcShowDaysPeer::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 (Exception $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($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->hasColumn($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
+ * @return CcShowDays[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowDaysQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcShowDaysQuery.php
index 18653bd70..1bac6d018 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowDaysQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowDaysQuery.php
@@ -4,562 +4,793 @@
/**
* Base class that represents a query for the 'cc_show_days' table.
*
- *
*
- * @method CcShowDaysQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcShowDaysQuery orderByDbFirstShow($order = Criteria::ASC) Order by the first_show column
- * @method CcShowDaysQuery orderByDbLastShow($order = Criteria::ASC) Order by the last_show column
- * @method CcShowDaysQuery orderByDbStartTime($order = Criteria::ASC) Order by the start_time column
- * @method CcShowDaysQuery orderByDbTimezone($order = Criteria::ASC) Order by the timezone column
- * @method CcShowDaysQuery orderByDbDuration($order = Criteria::ASC) Order by the duration column
- * @method CcShowDaysQuery orderByDbDay($order = Criteria::ASC) Order by the day column
- * @method CcShowDaysQuery orderByDbRepeatType($order = Criteria::ASC) Order by the repeat_type column
- * @method CcShowDaysQuery orderByDbNextPopDate($order = Criteria::ASC) Order by the next_pop_date column
- * @method CcShowDaysQuery orderByDbShowId($order = Criteria::ASC) Order by the show_id column
- * @method CcShowDaysQuery orderByDbRecord($order = Criteria::ASC) Order by the record column
*
- * @method CcShowDaysQuery groupByDbId() Group by the id column
- * @method CcShowDaysQuery groupByDbFirstShow() Group by the first_show column
- * @method CcShowDaysQuery groupByDbLastShow() Group by the last_show column
- * @method CcShowDaysQuery groupByDbStartTime() Group by the start_time column
- * @method CcShowDaysQuery groupByDbTimezone() Group by the timezone column
- * @method CcShowDaysQuery groupByDbDuration() Group by the duration column
- * @method CcShowDaysQuery groupByDbDay() Group by the day column
- * @method CcShowDaysQuery groupByDbRepeatType() Group by the repeat_type column
- * @method CcShowDaysQuery groupByDbNextPopDate() Group by the next_pop_date column
- * @method CcShowDaysQuery groupByDbShowId() Group by the show_id column
- * @method CcShowDaysQuery groupByDbRecord() Group by the record column
+ * @method CcShowDaysQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcShowDaysQuery orderByDbFirstShow($order = Criteria::ASC) Order by the first_show column
+ * @method CcShowDaysQuery orderByDbLastShow($order = Criteria::ASC) Order by the last_show column
+ * @method CcShowDaysQuery orderByDbStartTime($order = Criteria::ASC) Order by the start_time column
+ * @method CcShowDaysQuery orderByDbTimezone($order = Criteria::ASC) Order by the timezone column
+ * @method CcShowDaysQuery orderByDbDuration($order = Criteria::ASC) Order by the duration column
+ * @method CcShowDaysQuery orderByDbDay($order = Criteria::ASC) Order by the day column
+ * @method CcShowDaysQuery orderByDbRepeatType($order = Criteria::ASC) Order by the repeat_type column
+ * @method CcShowDaysQuery orderByDbNextPopDate($order = Criteria::ASC) Order by the next_pop_date column
+ * @method CcShowDaysQuery orderByDbShowId($order = Criteria::ASC) Order by the show_id column
+ * @method CcShowDaysQuery orderByDbRecord($order = Criteria::ASC) Order by the record column
*
- * @method CcShowDaysQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcShowDaysQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcShowDaysQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcShowDaysQuery groupByDbId() Group by the id column
+ * @method CcShowDaysQuery groupByDbFirstShow() Group by the first_show column
+ * @method CcShowDaysQuery groupByDbLastShow() Group by the last_show column
+ * @method CcShowDaysQuery groupByDbStartTime() Group by the start_time column
+ * @method CcShowDaysQuery groupByDbTimezone() Group by the timezone column
+ * @method CcShowDaysQuery groupByDbDuration() Group by the duration column
+ * @method CcShowDaysQuery groupByDbDay() Group by the day column
+ * @method CcShowDaysQuery groupByDbRepeatType() Group by the repeat_type column
+ * @method CcShowDaysQuery groupByDbNextPopDate() Group by the next_pop_date column
+ * @method CcShowDaysQuery groupByDbShowId() Group by the show_id column
+ * @method CcShowDaysQuery groupByDbRecord() Group by the record column
*
- * @method CcShowDaysQuery leftJoinCcShow($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShow relation
- * @method CcShowDaysQuery rightJoinCcShow($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShow relation
- * @method CcShowDaysQuery innerJoinCcShow($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShow relation
+ * @method CcShowDaysQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcShowDaysQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcShowDaysQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcShowDays findOne(PropelPDO $con = null) Return the first CcShowDays matching the query
- * @method CcShowDays findOneOrCreate(PropelPDO $con = null) Return the first CcShowDays matching the query, or a new CcShowDays object populated from the query conditions when no match is found
+ * @method CcShowDaysQuery leftJoinCcShow($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcShow relation
+ * @method CcShowDaysQuery rightJoinCcShow($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcShow relation
+ * @method CcShowDaysQuery innerJoinCcShow($relationAlias = null) Adds a INNER JOIN clause to the query using the CcShow relation
*
- * @method CcShowDays findOneByDbId(int $id) Return the first CcShowDays filtered by the id column
- * @method CcShowDays findOneByDbFirstShow(string $first_show) Return the first CcShowDays filtered by the first_show column
- * @method CcShowDays findOneByDbLastShow(string $last_show) Return the first CcShowDays filtered by the last_show column
- * @method CcShowDays findOneByDbStartTime(string $start_time) Return the first CcShowDays filtered by the start_time column
- * @method CcShowDays findOneByDbTimezone(string $timezone) Return the first CcShowDays filtered by the timezone column
- * @method CcShowDays findOneByDbDuration(string $duration) Return the first CcShowDays filtered by the duration column
- * @method CcShowDays findOneByDbDay(int $day) Return the first CcShowDays filtered by the day column
- * @method CcShowDays findOneByDbRepeatType(int $repeat_type) Return the first CcShowDays filtered by the repeat_type column
- * @method CcShowDays findOneByDbNextPopDate(string $next_pop_date) Return the first CcShowDays filtered by the next_pop_date column
- * @method CcShowDays findOneByDbShowId(int $show_id) Return the first CcShowDays filtered by the show_id column
- * @method CcShowDays findOneByDbRecord(int $record) Return the first CcShowDays filtered by the record column
+ * @method CcShowDays findOne(PropelPDO $con = null) Return the first CcShowDays matching the query
+ * @method CcShowDays findOneOrCreate(PropelPDO $con = null) Return the first CcShowDays matching the query, or a new CcShowDays object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcShowDays objects filtered by the id column
- * @method array findByDbFirstShow(string $first_show) Return CcShowDays objects filtered by the first_show column
- * @method array findByDbLastShow(string $last_show) Return CcShowDays objects filtered by the last_show column
- * @method array findByDbStartTime(string $start_time) Return CcShowDays objects filtered by the start_time column
- * @method array findByDbTimezone(string $timezone) Return CcShowDays objects filtered by the timezone column
- * @method array findByDbDuration(string $duration) Return CcShowDays objects filtered by the duration column
- * @method array findByDbDay(int $day) Return CcShowDays objects filtered by the day column
- * @method array findByDbRepeatType(int $repeat_type) Return CcShowDays objects filtered by the repeat_type column
- * @method array findByDbNextPopDate(string $next_pop_date) Return CcShowDays objects filtered by the next_pop_date column
- * @method array findByDbShowId(int $show_id) Return CcShowDays objects filtered by the show_id column
- * @method array findByDbRecord(int $record) Return CcShowDays objects filtered by the record column
+ * @method CcShowDays findOneByDbFirstShow(string $first_show) Return the first CcShowDays filtered by the first_show column
+ * @method CcShowDays findOneByDbLastShow(string $last_show) Return the first CcShowDays filtered by the last_show column
+ * @method CcShowDays findOneByDbStartTime(string $start_time) Return the first CcShowDays filtered by the start_time column
+ * @method CcShowDays findOneByDbTimezone(string $timezone) Return the first CcShowDays filtered by the timezone column
+ * @method CcShowDays findOneByDbDuration(string $duration) Return the first CcShowDays filtered by the duration column
+ * @method CcShowDays findOneByDbDay(int $day) Return the first CcShowDays filtered by the day column
+ * @method CcShowDays findOneByDbRepeatType(int $repeat_type) Return the first CcShowDays filtered by the repeat_type column
+ * @method CcShowDays findOneByDbNextPopDate(string $next_pop_date) Return the first CcShowDays filtered by the next_pop_date column
+ * @method CcShowDays findOneByDbShowId(int $show_id) Return the first CcShowDays filtered by the show_id column
+ * @method CcShowDays findOneByDbRecord(int $record) Return the first CcShowDays filtered by the record column
+ *
+ * @method array findByDbId(int $id) Return CcShowDays objects filtered by the id column
+ * @method array findByDbFirstShow(string $first_show) Return CcShowDays objects filtered by the first_show column
+ * @method array findByDbLastShow(string $last_show) Return CcShowDays objects filtered by the last_show column
+ * @method array findByDbStartTime(string $start_time) Return CcShowDays objects filtered by the start_time column
+ * @method array findByDbTimezone(string $timezone) Return CcShowDays objects filtered by the timezone column
+ * @method array findByDbDuration(string $duration) Return CcShowDays objects filtered by the duration column
+ * @method array findByDbDay(int $day) Return CcShowDays objects filtered by the day column
+ * @method array findByDbRepeatType(int $repeat_type) Return CcShowDays objects filtered by the repeat_type column
+ * @method array findByDbNextPopDate(string $next_pop_date) Return CcShowDays objects filtered by the next_pop_date column
+ * @method array findByDbShowId(int $show_id) Return CcShowDays objects filtered by the show_id column
+ * @method array findByDbRecord(int $record) Return CcShowDays objects filtered by the record column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcShowDaysQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcShowDaysQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcShowDays';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcShowDaysQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcShowDays', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcShowDaysQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcShowDaysQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcShowDaysQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcShowDaysQuery) {
+ return $criteria;
+ }
+ $query = new CcShowDaysQuery(null, null, $modelAlias);
- /**
- * Returns a new CcShowDaysQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcShowDaysQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcShowDaysQuery) {
- return $criteria;
- }
- $query = new CcShowDaysQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcShowDays|CcShowDays[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcShowDaysPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcShowDaysPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $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);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcShowDays A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcShowDays A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "first_show", "last_show", "start_time", "timezone", "duration", "day", "repeat_type", "next_pop_date", "show_id", "record" FROM "cc_show_days" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcShowDays();
+ $obj->hydrate($row);
+ CcShowDaysPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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);
- }
+ return $obj;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcShowDays|CcShowDays[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * 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);
- }
+ /**
+ * 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|CcShowDays[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * 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 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)
+ {
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcShowDaysPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * 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 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)
+ {
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcShowDaysPeer::ID, $keys, Criteria::IN);
+ }
- /**
- * 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 id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcShowDaysPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcShowDaysPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcShowDaysPeer::ID, $dbId, $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);
- }
+ /**
+ * Filter the query on the first_show column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbFirstShow('2011-03-14'); // WHERE first_show = '2011-03-14'
+ * $query->filterByDbFirstShow('now'); // WHERE first_show = '2011-03-14'
+ * $query->filterByDbFirstShow(array('max' => 'yesterday')); // WHERE first_show < '2011-03-13'
+ *
+ *
+ * @param mixed $dbFirstShow The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcShowDaysPeer::FIRST_SHOW, $dbFirstShow, $comparison);
+ }
- /**
- * 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 on the last_show column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLastShow('2011-03-14'); // WHERE last_show = '2011-03-14'
+ * $query->filterByDbLastShow('now'); // WHERE last_show = '2011-03-14'
+ * $query->filterByDbLastShow(array('max' => 'yesterday')); // WHERE last_show < '2011-03-13'
+ *
+ *
+ * @param mixed $dbLastShow The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcShowDaysPeer::LAST_SHOW, $dbLastShow, $comparison);
+ }
-} // BaseCcShowDaysQuery
+ /**
+ * Filter the query on the start_time column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbStartTime('2011-03-14'); // WHERE start_time = '2011-03-14'
+ * $query->filterByDbStartTime('now'); // WHERE start_time = '2011-03-14'
+ * $query->filterByDbStartTime(array('max' => 'yesterday')); // WHERE start_time < '2011-03-13'
+ *
+ *
+ * @param mixed $dbStartTime The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbTimezone('fooValue'); // WHERE timezone = 'fooValue'
+ * $query->filterByDbTimezone('%fooValue%'); // WHERE timezone LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbDuration('fooValue'); // WHERE duration = 'fooValue'
+ * $query->filterByDbDuration('%fooValue%'); // WHERE duration LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbDay(1234); // WHERE day = 1234
+ * $query->filterByDbDay(array(12, 34)); // WHERE day IN (12, 34)
+ * $query->filterByDbDay(array('min' => 12)); // WHERE day >= 12
+ * $query->filterByDbDay(array('max' => 12)); // WHERE day <= 12
+ *
+ *
+ * @param mixed $dbDay The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbRepeatType(1234); // WHERE repeat_type = 1234
+ * $query->filterByDbRepeatType(array(12, 34)); // WHERE repeat_type IN (12, 34)
+ * $query->filterByDbRepeatType(array('min' => 12)); // WHERE repeat_type >= 12
+ * $query->filterByDbRepeatType(array('max' => 12)); // WHERE repeat_type <= 12
+ *
+ *
+ * @param mixed $dbRepeatType The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbNextPopDate('2011-03-14'); // WHERE next_pop_date = '2011-03-14'
+ * $query->filterByDbNextPopDate('now'); // WHERE next_pop_date = '2011-03-14'
+ * $query->filterByDbNextPopDate(array('max' => 'yesterday')); // WHERE next_pop_date < '2011-03-13'
+ *
+ *
+ * @param mixed $dbNextPopDate The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbShowId(1234); // WHERE show_id = 1234
+ * $query->filterByDbShowId(array(12, 34)); // WHERE show_id IN (12, 34)
+ * $query->filterByDbShowId(array('min' => 12)); // WHERE show_id >= 12
+ * $query->filterByDbShowId(array('max' => 12)); // WHERE show_id <= 12
+ *
+ *
+ * @see filterByCcShow()
+ *
+ * @param mixed $dbShowId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbRecord(1234); // WHERE record = 1234
+ * $query->filterByDbRecord(array(12, 34)); // WHERE record IN (12, 34)
+ * $query->filterByDbRecord(array('min' => 12)); // WHERE record >= 12
+ * $query->filterByDbRecord(array('max' => 12)); // WHERE record <= 12
+ *
+ *
+ * @param mixed $dbRecord The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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|PropelObjectCollection $ccShow The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcShow($ccShow, $comparison = null)
+ {
+ if ($ccShow instanceof CcShow) {
+ return $this
+ ->addUsingAlias(CcShowDaysPeer::SHOW_ID, $ccShow->getDbId(), $comparison);
+ } elseif ($ccShow instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcShowDaysPeer::SHOW_ID, $ccShow->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcShow() only accepts arguments of type CcShow or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $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;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowHosts.php b/airtime_mvc/application/models/airtime/om/BaseCcShowHosts.php
index ca4d11449..6b6e5eb23 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowHosts.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowHosts.php
@@ -4,933 +4,1077 @@
/**
* Base class that represents a row from the 'cc_show_hosts' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcShowHosts extends BaseObject implements Persistent
+abstract class BaseCcShowHosts extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcShowHostsPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcShowHostsPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the show_id field.
- * @var int
- */
- protected $show_id;
-
- /**
- * The value for the subjs_id field.
- * @var int
- */
- protected $subjs_id;
-
- /**
- * @var CcShow
- */
- protected $aCcShow;
-
- /**
- * @var CcSubjs
- */
- protected $aCcSubjs;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Get the [id] column value.
- *
- * @return int
- */
- public function getDbId()
- {
- return $this->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
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcShowHostsPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcShowHostsPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the show_id field.
+ * @var int
+ */
+ protected $show_id;
+
+ /**
+ * The value for the subjs_id field.
+ * @var int
+ */
+ protected $subjs_id;
+
+ /**
+ * @var CcShow
+ */
+ protected $aCcShow;
+
+ /**
+ * @var CcSubjs
+ */
+ protected $aCcSubjs;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getDbId()
+ {
+
+ return $this->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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 resultset 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();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 3; // 3 = CcShowHostsPeer::NUM_HYDRATE_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
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcShowHostsQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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 (Exception $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 corresponding 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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcShowHostsPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcShowHostsPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_show_hosts_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcShowHostsPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcShowHostsPeer::SHOW_ID)) {
+ $modifiedColumns[':p' . $index++] = '"show_id"';
+ }
+ if ($this->isColumnModified(CcShowHostsPeer::SUBJS_ID)) {
+ $modifiedColumns[':p' . $index++] = '"subjs_id"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_show_hosts" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"show_id"':
+ $stmt->bindValue($identifier, $this->show_id, PDO::PARAM_INT);
+ break;
+ case '"subjs_id"':
+ $stmt->bindValue($identifier, $this->subjs_id, PDO::PARAM_INT);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcShowHosts'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcShowHosts'][$this->getPrimaryKey()] = true;
+ $keys = CcShowHostsPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbShow(),
+ $keys[2] => $this->getDbHost(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcShow) {
+ $result['CcShow'] = $this->aCcShow->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->aCcSubjs) {
+ $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcShowHostsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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 BasePeer::TYPE_PHPNAME
+ *
+ * @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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbShow($this->getDbShow());
+ $copyObj->setDbHost($this->getDbHost());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcShow The associated CcShow object.
+ * @throws PropelException
+ */
+ public function getCcShow(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcShow === null && ($this->show_id !== null) && $doQuery) {
+ $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 $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcSubjs The associated CcSubjs object.
+ * @throws PropelException
+ */
+ public function getCcSubjs(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcSubjs === null && ($this->subjs_id !== null) && $doQuery) {
+ $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->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->aCcShow instanceof Persistent) {
+ $this->aCcShow->clearAllReferences($deep);
+ }
+ if ($this->aCcSubjs instanceof Persistent) {
+ $this->aCcSubjs->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ $this->aCcShow = null;
+ $this->aCcSubjs = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcShowHostsPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowHostsPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcShowHostsPeer.php
index 33a82f0d9..c21c3e985 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowHostsPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowHostsPeer.php
@@ -4,1358 +4,1390 @@
/**
* Base static class for performing query and update operations on the 'cc_show_hosts' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcShowHostsPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_show_hosts';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcShowHosts';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcShowHosts';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcShowHostsTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 3;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_show_hosts.ID';
-
- /** the column name for the SHOW_ID field */
- const SHOW_ID = 'cc_show_hosts.SHOW_ID';
-
- /** the column name for the SUBJS_ID field */
- const SUBJS_ID = 'cc_show_hosts.SUBJS_ID';
-
- /**
- * An identiy map to hold any loaded instances of CcShowHosts objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcShowHosts[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => 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;
- }
+abstract class BaseCcShowHostsPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_show_hosts';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcShowHosts';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcShowHostsTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 3;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 3;
+
+ /** the column name for the id field */
+ const ID = 'cc_show_hosts.id';
+
+ /** the column name for the show_id field */
+ const SHOW_ID = 'cc_show_hosts.show_id';
+
+ /** the column name for the subjs_id field */
+ const SUBJS_ID = 'cc_show_hosts.subjs_id';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcShowHosts objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcShowHosts[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcShowHostsPeer::$fieldNames[CcShowHostsPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbShow', 'DbHost', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbShow', 'dbHost', ),
+ BasePeer::TYPE_COLNAME => array (CcShowHostsPeer::ID, CcShowHostsPeer::SHOW_ID, CcShowHostsPeer::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. CcShowHostsPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected 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 (CcShowHostsPeer::ID => 0, CcShowHostsPeer::SHOW_ID => 1, CcShowHostsPeer::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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcShowHostsPeer::getFieldNames($toType);
+ $key = isset(CcShowHostsPeer::$fieldKeys[$fromType][$name]) ? CcShowHostsPeer::$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(CcShowHostsPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcShowHostsPeer::$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 CcShowHostsPeer::$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(CcShowHostsPeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcShowHostsPeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcShowHostsPeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcShowHostsPeer::$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(CcShowHostsPeer::$instances[$key])) {
+ return CcShowHostsPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcShowHostsPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcShowHostsPeer::$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();
+ // 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_HYDRATE_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(CcShowHostsPeer::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(CcShowHostsPeer::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(CcShowHostsPeer::DATABASE_NAME);
+ }
+
+ CcShowHostsPeer::addSelectColumns($criteria);
+ $startcol = CcShowHostsPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcShowHostsPeer::DATABASE_NAME);
+ }
+
+ CcShowHostsPeer::addSelectColumns($criteria);
+ $startcol = CcShowHostsPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcShowHostsPeer::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(CcShowHostsPeer::DATABASE_NAME);
+ }
+
+ CcShowHostsPeer::addSelectColumns($criteria);
+ $startcol2 = CcShowHostsPeer::NUM_HYDRATE_COLUMNS;
+
+ CcShowPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcShowPeer::NUM_HYDRATE_COLUMNS;
+
+ CcSubjsPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + CcSubjsPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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();
+
+ $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(CcShowHostsPeer::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(CcShowHostsPeer::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(CcShowHostsPeer::DATABASE_NAME);
+ }
+
+ CcShowHostsPeer::addSelectColumns($criteria);
+ $startcol2 = CcShowHostsPeer::NUM_HYDRATE_COLUMNS;
+
+ CcSubjsPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcSubjsPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcShowHostsPeer::DATABASE_NAME);
+ }
+
+ CcShowHostsPeer::addSelectColumns($criteria);
+ $startcol2 = CcShowHostsPeer::NUM_HYDRATE_COLUMNS;
+
+ CcShowPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcShowPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcShowHostsPeer::DATABASE_NAME)->getTable(CcShowHostsPeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcShowHostsPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcShowHostsPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcShowHostsPeer::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(CcShowHostsPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_show_hosts table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcShowHostsPeer::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(CcShowHostsPeer::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 (Exception $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($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->hasColumn($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
+ * @return CcShowHosts[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowHostsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcShowHostsQuery.php
index 2b910a52b..22410c852 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowHostsQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowHostsQuery.php
@@ -4,368 +4,529 @@
/**
* Base class that represents a query for the 'cc_show_hosts' table.
*
- *
*
- * @method CcShowHostsQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcShowHostsQuery orderByDbShow($order = Criteria::ASC) Order by the show_id column
- * @method CcShowHostsQuery orderByDbHost($order = Criteria::ASC) Order by the subjs_id column
*
- * @method CcShowHostsQuery groupByDbId() Group by the id column
- * @method CcShowHostsQuery groupByDbShow() Group by the show_id column
- * @method CcShowHostsQuery groupByDbHost() Group by the subjs_id column
+ * @method CcShowHostsQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcShowHostsQuery orderByDbShow($order = Criteria::ASC) Order by the show_id column
+ * @method CcShowHostsQuery orderByDbHost($order = Criteria::ASC) Order by the subjs_id column
*
- * @method CcShowHostsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcShowHostsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcShowHostsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcShowHostsQuery groupByDbId() Group by the id column
+ * @method CcShowHostsQuery groupByDbShow() Group by the show_id column
+ * @method CcShowHostsQuery groupByDbHost() Group by the subjs_id column
*
- * @method CcShowHostsQuery leftJoinCcShow($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShow relation
- * @method CcShowHostsQuery rightJoinCcShow($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShow relation
- * @method CcShowHostsQuery innerJoinCcShow($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShow relation
+ * @method CcShowHostsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcShowHostsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcShowHostsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcShowHostsQuery leftJoinCcSubjs($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjs relation
- * @method CcShowHostsQuery rightJoinCcSubjs($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjs relation
- * @method CcShowHostsQuery innerJoinCcSubjs($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjs relation
+ * @method CcShowHostsQuery leftJoinCcShow($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcShow relation
+ * @method CcShowHostsQuery rightJoinCcShow($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcShow relation
+ * @method CcShowHostsQuery innerJoinCcShow($relationAlias = null) Adds a INNER JOIN clause to the query using the CcShow relation
*
- * @method CcShowHosts findOne(PropelPDO $con = null) Return the first CcShowHosts matching the query
- * @method CcShowHosts findOneOrCreate(PropelPDO $con = null) Return the first CcShowHosts matching the query, or a new CcShowHosts object populated from the query conditions when no match is found
+ * @method CcShowHostsQuery leftJoinCcSubjs($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSubjs relation
+ * @method CcShowHostsQuery rightJoinCcSubjs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjs relation
+ * @method CcShowHostsQuery innerJoinCcSubjs($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjs relation
*
- * @method CcShowHosts findOneByDbId(int $id) Return the first CcShowHosts filtered by the id column
- * @method CcShowHosts findOneByDbShow(int $show_id) Return the first CcShowHosts filtered by the show_id column
- * @method CcShowHosts findOneByDbHost(int $subjs_id) Return the first CcShowHosts filtered by the subjs_id column
+ * @method CcShowHosts findOne(PropelPDO $con = null) Return the first CcShowHosts matching the query
+ * @method CcShowHosts findOneOrCreate(PropelPDO $con = null) Return the first CcShowHosts matching the query, or a new CcShowHosts object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcShowHosts objects filtered by the id column
- * @method array findByDbShow(int $show_id) Return CcShowHosts objects filtered by the show_id column
- * @method array findByDbHost(int $subjs_id) Return CcShowHosts objects filtered by the subjs_id column
+ * @method CcShowHosts findOneByDbShow(int $show_id) Return the first CcShowHosts filtered by the show_id column
+ * @method CcShowHosts findOneByDbHost(int $subjs_id) Return the first CcShowHosts filtered by the subjs_id column
+ *
+ * @method array findByDbId(int $id) Return CcShowHosts objects filtered by the id column
+ * @method array findByDbShow(int $show_id) Return CcShowHosts objects filtered by the show_id column
+ * @method array findByDbHost(int $subjs_id) Return CcShowHosts objects filtered by the subjs_id column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcShowHostsQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcShowHostsQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcShowHosts';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcShowHostsQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcShowHosts', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcShowHostsQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcShowHostsQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcShowHostsQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcShowHostsQuery) {
+ return $criteria;
+ }
+ $query = new CcShowHostsQuery(null, null, $modelAlias);
- /**
- * Returns a new CcShowHostsQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcShowHostsQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcShowHostsQuery) {
- return $criteria;
- }
- $query = new CcShowHostsQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcShowHosts|CcShowHosts[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcShowHostsPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $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);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcShowHosts A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcShowHosts A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "show_id", "subjs_id" FROM "cc_show_hosts" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcShowHosts();
+ $obj->hydrate($row);
+ CcShowHostsPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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);
- }
+ return $obj;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcShowHosts|CcShowHosts[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * 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);
- }
+ /**
+ * 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|CcShowHosts[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * 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;
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * 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 primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcShowHostsQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcShowHostsPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * 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;
- }
+ /**
+ * 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)
+ {
- /**
- * 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');
- }
+ return $this->addUsingAlias(CcShowHostsPeer::ID, $keys, Criteria::IN);
+ }
- /**
- * 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;
- }
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcShowHostsPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcShowHostsPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
-} // BaseCcShowHostsQuery
+ return $this->addUsingAlias(CcShowHostsPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the show_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbShow(1234); // WHERE show_id = 1234
+ * $query->filterByDbShow(array(12, 34)); // WHERE show_id IN (12, 34)
+ * $query->filterByDbShow(array('min' => 12)); // WHERE show_id >= 12
+ * $query->filterByDbShow(array('max' => 12)); // WHERE show_id <= 12
+ *
+ *
+ * @see filterByCcShow()
+ *
+ * @param mixed $dbShow The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbHost(1234); // WHERE subjs_id = 1234
+ * $query->filterByDbHost(array(12, 34)); // WHERE subjs_id IN (12, 34)
+ * $query->filterByDbHost(array('min' => 12)); // WHERE subjs_id >= 12
+ * $query->filterByDbHost(array('max' => 12)); // WHERE subjs_id <= 12
+ *
+ *
+ * @see filterByCcSubjs()
+ *
+ * @param mixed $dbHost The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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|PropelObjectCollection $ccShow The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcShow($ccShow, $comparison = null)
+ {
+ if ($ccShow instanceof CcShow) {
+ return $this
+ ->addUsingAlias(CcShowHostsPeer::SHOW_ID, $ccShow->getDbId(), $comparison);
+ } elseif ($ccShow instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcShowHostsPeer::SHOW_ID, $ccShow->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcShow() only accepts arguments of type CcShow or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcShow($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcShow', 'CcShowQuery');
+ }
+
+ /**
+ * Filter the query by a related CcSubjs object
+ *
+ * @param CcSubjs|PropelObjectCollection $ccSubjs The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcSubjs($ccSubjs, $comparison = null)
+ {
+ if ($ccSubjs instanceof CcSubjs) {
+ return $this
+ ->addUsingAlias(CcShowHostsPeer::SUBJS_ID, $ccSubjs->getDbId(), $comparison);
+ } elseif ($ccSubjs instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcShowHostsPeer::SUBJS_ID, $ccSubjs->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcSubjs() only accepts arguments of type CcSubjs or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $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;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php b/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php
index a783a8e20..1b4a38c4f 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowInstances.php
@@ -4,2262 +4,2817 @@
/**
* Base class that represents a row from the 'cc_show_instances' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcShowInstances extends BaseObject implements Persistent
+abstract class BaseCcShowInstances extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcShowInstancesPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcShowInstancesPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the starts field.
- * @var string
- */
- protected $starts;
-
- /**
- * The value for the ends field.
- * @var string
- */
- protected $ends;
-
- /**
- * The value for the show_id field.
- * @var int
- */
- protected $show_id;
-
- /**
- * The value for the record field.
- * Note: this column has a database default value of: 0
- * @var int
- */
- protected $record;
-
- /**
- * The value for the rebroadcast field.
- * Note: this column has a database default value of: 0
- * @var int
- */
- protected $rebroadcast;
-
- /**
- * The value for the instance_id field.
- * @var int
- */
- protected $instance_id;
-
- /**
- * The value for the file_id field.
- * @var int
- */
- protected $file_id;
-
- /**
- * The value for the time_filled field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $time_filled;
-
- /**
- * The value for the created field.
- * @var string
- */
- protected $created;
-
- /**
- * The value for the last_scheduled field.
- * @var string
- */
- protected $last_scheduled;
-
- /**
- * The value for the modified_instance field.
- * Note: this column has a database default value of: false
- * @var boolean
- */
- protected $modified_instance;
-
- /**
- * @var CcShow
- */
- protected $aCcShow;
-
- /**
- * @var CcShowInstances
- */
- protected $aCcShowInstancesRelatedByDbOriginalShow;
-
- /**
- * @var CcFiles
- */
- protected $aCcFiles;
-
- /**
- * @var array CcShowInstances[] Collection to store aggregation of CcShowInstances objects.
- */
- protected $collCcShowInstancessRelatedByDbId;
-
- /**
- * @var array CcSchedule[] Collection to store aggregation of CcSchedule objects.
- */
- protected $collCcSchedules;
-
- /**
- * @var array CcPlayoutHistory[] Collection to store aggregation of CcPlayoutHistory objects.
- */
- protected $collCcPlayoutHistorys;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Applies default values to this object.
- * This method should be called from the object's constructor (or
- * equivalent initialization method).
- * @see __construct()
- */
- public function applyDefaultValues()
- {
- $this->record = 0;
- $this->rebroadcast = 0;
- $this->time_filled = '00:00:00';
- $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 [time_filled] column value.
- *
- * @return string
- */
- public function getDbTimeFilled()
- {
- return $this->time_filled;
- }
-
- /**
- * Get the [optionally formatted] temporal [created] 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 getDbCreated($format = 'Y-m-d H:i:s')
- {
- if ($this->created === null) {
- return null;
- }
-
-
-
- try {
- $dt = new DateTime($this->created);
- } catch (Exception $x) {
- throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created, 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_scheduled] 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 getDbLastScheduled($format = 'Y-m-d H:i:s')
- {
- if ($this->last_scheduled === null) {
- return null;
- }
-
-
-
- try {
- $dt = new DateTime($this->last_scheduled);
- } catch (Exception $x) {
- throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->last_scheduled, 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()
-
- /**
- * Set the value of [time_filled] column.
- *
- * @param string $v new value
- * @return CcShowInstances The current object (for fluent API support)
- */
- public function setDbTimeFilled($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->time_filled !== $v || $this->isNew()) {
- $this->time_filled = $v;
- $this->modifiedColumns[] = CcShowInstancesPeer::TIME_FILLED;
- }
-
- return $this;
- } // setDbTimeFilled()
-
- /**
- * Sets the value of [created] 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 setDbCreated($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->created !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->created !== null && $tmpDt = new DateTime($this->created)) ? $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->created = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
- $this->modifiedColumns[] = CcShowInstancesPeer::CREATED;
- }
- } // if either are not null
-
- return $this;
- } // setDbCreated()
-
- /**
- * Sets the value of [last_scheduled] 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 setDbLastScheduled($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_scheduled !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->last_scheduled !== null && $tmpDt = new DateTime($this->last_scheduled)) ? $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->last_scheduled = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
- $this->modifiedColumns[] = CcShowInstancesPeer::LAST_SCHEDULED;
- }
- } // if either are not null
-
- return $this;
- } // setDbLastScheduled()
-
- /**
- * 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->time_filled !== '00:00:00') {
- 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->created = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
- $this->last_scheduled = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
- $this->modified_instance = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 12; // 12 = 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;
-
- $this->collCcPlayoutHistorys = 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);
- }
- }
- }
-
- if ($this->collCcPlayoutHistorys !== null) {
- foreach ($this->collCcPlayoutHistorys 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());
- }
- }
- }
-
- if ($this->collCcPlayoutHistorys !== null) {
- foreach ($this->collCcPlayoutHistorys 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->getDbCreated();
- break;
- case 10:
- return $this->getDbLastScheduled();
- break;
- case 11:
- 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->getDbCreated(),
- $keys[10] => $this->getDbLastScheduled(),
- $keys[11] => $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->setDbCreated($value);
- break;
- case 10:
- $this->setDbLastScheduled($value);
- break;
- case 11:
- $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->setDbCreated($arr[$keys[9]]);
- if (array_key_exists($keys[10], $arr)) $this->setDbLastScheduled($arr[$keys[10]]);
- if (array_key_exists($keys[11], $arr)) $this->setDbModifiedInstance($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(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::CREATED)) $criteria->add(CcShowInstancesPeer::CREATED, $this->created);
- if ($this->isColumnModified(CcShowInstancesPeer::LAST_SCHEDULED)) $criteria->add(CcShowInstancesPeer::LAST_SCHEDULED, $this->last_scheduled);
- 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->setDbCreated($this->created);
- $copyObj->setDbLastScheduled($this->last_scheduled);
- $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));
- }
- }
-
- foreach ($this->getCcPlayoutHistorys() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addCcPlayoutHistory($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);
- }
-
-
- /**
- * 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 getCcSchedulesJoinCcWebstream($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
- {
- $query = CcScheduleQuery::create(null, $criteria);
- $query->joinWith('CcWebstream', $join_behavior);
-
- return $this->getCcSchedules($query, $con);
- }
-
- /**
- * Clears out the collCcPlayoutHistorys 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 addCcPlayoutHistorys()
- */
- public function clearCcPlayoutHistorys()
- {
- $this->collCcPlayoutHistorys = null; // important to set this to NULL since that means it is uninitialized
- }
-
- /**
- * Initializes the collCcPlayoutHistorys collection.
- *
- * By default this just sets the collCcPlayoutHistorys collection to an empty array (like clearcollCcPlayoutHistorys());
- * 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 initCcPlayoutHistorys()
- {
- $this->collCcPlayoutHistorys = new PropelObjectCollection();
- $this->collCcPlayoutHistorys->setModel('CcPlayoutHistory');
- }
-
- /**
- * Gets an array of CcPlayoutHistory 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 CcPlayoutHistory[] List of CcPlayoutHistory objects
- * @throws PropelException
- */
- public function getCcPlayoutHistorys($criteria = null, PropelPDO $con = null)
- {
- if(null === $this->collCcPlayoutHistorys || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcPlayoutHistorys) {
- // return empty collection
- $this->initCcPlayoutHistorys();
- } else {
- $collCcPlayoutHistorys = CcPlayoutHistoryQuery::create(null, $criteria)
- ->filterByCcShowInstances($this)
- ->find($con);
- if (null !== $criteria) {
- return $collCcPlayoutHistorys;
- }
- $this->collCcPlayoutHistorys = $collCcPlayoutHistorys;
- }
- }
- return $this->collCcPlayoutHistorys;
- }
-
- /**
- * Returns the number of related CcPlayoutHistory objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related CcPlayoutHistory objects.
- * @throws PropelException
- */
- public function countCcPlayoutHistorys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- if(null === $this->collCcPlayoutHistorys || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcPlayoutHistorys) {
- return 0;
- } else {
- $query = CcPlayoutHistoryQuery::create(null, $criteria);
- if($distinct) {
- $query->distinct();
- }
- return $query
- ->filterByCcShowInstances($this)
- ->count($con);
- }
- } else {
- return count($this->collCcPlayoutHistorys);
- }
- }
-
- /**
- * Method called to associate a CcPlayoutHistory object to this object
- * through the CcPlayoutHistory foreign key attribute.
- *
- * @param CcPlayoutHistory $l CcPlayoutHistory
- * @return void
- * @throws PropelException
- */
- public function addCcPlayoutHistory(CcPlayoutHistory $l)
- {
- if ($this->collCcPlayoutHistorys === null) {
- $this->initCcPlayoutHistorys();
- }
- if (!$this->collCcPlayoutHistorys->contains($l)) { // only add it if the **same** object is not already associated
- $this->collCcPlayoutHistorys[]= $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 CcPlayoutHistorys 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 CcPlayoutHistory[] List of CcPlayoutHistory objects
- */
- public function getCcPlayoutHistorysJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
- {
- $query = CcPlayoutHistoryQuery::create(null, $criteria);
- $query->joinWith('CcFiles', $join_behavior);
-
- return $this->getCcPlayoutHistorys($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->created = null;
- $this->last_scheduled = 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 ($this->collCcPlayoutHistorys) {
- foreach ((array) $this->collCcPlayoutHistorys as $o) {
- $o->clearAllReferences($deep);
- }
- }
- } // if ($deep)
-
- $this->collCcShowInstancessRelatedByDbId = null;
- $this->collCcSchedules = null;
- $this->collCcPlayoutHistorys = null;
- $this->aCcShow = null;
- $this->aCcShowInstancesRelatedByDbOriginalShow = null;
- $this->aCcFiles = 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);
- }
-
-} // BaseCcShowInstances
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcShowInstancesPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcShowInstancesPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the starts field.
+ * @var string
+ */
+ protected $starts;
+
+ /**
+ * The value for the ends field.
+ * @var string
+ */
+ protected $ends;
+
+ /**
+ * The value for the show_id field.
+ * @var int
+ */
+ protected $show_id;
+
+ /**
+ * The value for the record field.
+ * Note: this column has a database default value of: 0
+ * @var int
+ */
+ protected $record;
+
+ /**
+ * The value for the rebroadcast field.
+ * Note: this column has a database default value of: 0
+ * @var int
+ */
+ protected $rebroadcast;
+
+ /**
+ * The value for the instance_id field.
+ * @var int
+ */
+ protected $instance_id;
+
+ /**
+ * The value for the file_id field.
+ * @var int
+ */
+ protected $file_id;
+
+ /**
+ * The value for the time_filled field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $time_filled;
+
+ /**
+ * The value for the created field.
+ * @var string
+ */
+ protected $created;
+
+ /**
+ * The value for the last_scheduled field.
+ * @var string
+ */
+ protected $last_scheduled;
+
+ /**
+ * The value for the modified_instance field.
+ * Note: this column has a database default value of: false
+ * @var boolean
+ */
+ protected $modified_instance;
+
+ /**
+ * @var CcShow
+ */
+ protected $aCcShow;
+
+ /**
+ * @var CcShowInstances
+ */
+ protected $aCcShowInstancesRelatedByDbOriginalShow;
+
+ /**
+ * @var CcFiles
+ */
+ protected $aCcFiles;
+
+ /**
+ * @var PropelObjectCollection|CcShowInstances[] Collection to store aggregation of CcShowInstances objects.
+ */
+ protected $collCcShowInstancessRelatedByDbId;
+ protected $collCcShowInstancessRelatedByDbIdPartial;
+
+ /**
+ * @var PropelObjectCollection|CcSchedule[] Collection to store aggregation of CcSchedule objects.
+ */
+ protected $collCcSchedules;
+ protected $collCcSchedulesPartial;
+
+ /**
+ * @var PropelObjectCollection|CcPlayoutHistory[] Collection to store aggregation of CcPlayoutHistory objects.
+ */
+ protected $collCcPlayoutHistorys;
+ protected $collCcPlayoutHistorysPartial;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccShowInstancessRelatedByDbIdScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccSchedulesScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccPlayoutHistorysScheduledForDeletion = null;
+
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->record = 0;
+ $this->rebroadcast = 0;
+ $this->time_filled = '00:00:00';
+ $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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ 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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ 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 [time_filled] column value.
+ *
+ * @return string
+ */
+ public function getDbTimeFilled()
+ {
+
+ return $this->time_filled;
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [created] 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 getDbCreated($format = 'Y-m-d H:i:s')
+ {
+ if ($this->created === null) {
+ return null;
+ }
+
+
+ try {
+ $dt = new DateTime($this->created);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created, true), $x);
+ }
+
+ if ($format === null) {
+ // Because propel.useDateTimeClass is true, we return a DateTime object.
+ return $dt;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [last_scheduled] 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 getDbLastScheduled($format = 'Y-m-d H:i:s')
+ {
+ if ($this->last_scheduled === null) {
+ return null;
+ }
+
+
+ try {
+ $dt = new DateTime($this->last_scheduled);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->last_scheduled, true), $x);
+ }
+
+ if ($format === null) {
+ // Because propel.useDateTimeClass is true, we return a DateTime object.
+ return $dt;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ 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 && is_numeric($v)) {
+ $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 strings are treated as null.
+ * @return CcShowInstances The current object (for fluent API support)
+ */
+ public function setDbStarts($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->starts !== null || $dt !== null) {
+ $currentDateAsString = ($this->starts !== null && $tmpDt = new DateTime($this->starts)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->starts = $newDateAsString;
+ $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 strings are treated as null.
+ * @return CcShowInstances The current object (for fluent API support)
+ */
+ public function setDbEnds($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->ends !== null || $dt !== null) {
+ $currentDateAsString = ($this->ends !== null && $tmpDt = new DateTime($this->ends)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->ends = $newDateAsString;
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->record !== $v) {
+ $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 && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->rebroadcast !== $v) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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()
+
+ /**
+ * Set the value of [time_filled] column.
+ *
+ * @param string $v new value
+ * @return CcShowInstances The current object (for fluent API support)
+ */
+ public function setDbTimeFilled($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->time_filled !== $v) {
+ $this->time_filled = $v;
+ $this->modifiedColumns[] = CcShowInstancesPeer::TIME_FILLED;
+ }
+
+
+ return $this;
+ } // setDbTimeFilled()
+
+ /**
+ * Sets the value of [created] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or DateTime value.
+ * Empty strings are treated as null.
+ * @return CcShowInstances The current object (for fluent API support)
+ */
+ public function setDbCreated($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->created !== null || $dt !== null) {
+ $currentDateAsString = ($this->created !== null && $tmpDt = new DateTime($this->created)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->created = $newDateAsString;
+ $this->modifiedColumns[] = CcShowInstancesPeer::CREATED;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbCreated()
+
+ /**
+ * Sets the value of [last_scheduled] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or DateTime value.
+ * Empty strings are treated as null.
+ * @return CcShowInstances The current object (for fluent API support)
+ */
+ public function setDbLastScheduled($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->last_scheduled !== null || $dt !== null) {
+ $currentDateAsString = ($this->last_scheduled !== null && $tmpDt = new DateTime($this->last_scheduled)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->last_scheduled = $newDateAsString;
+ $this->modifiedColumns[] = CcShowInstancesPeer::LAST_SCHEDULED;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbLastScheduled()
+
+ /**
+ * Sets the value of the [modified_instance] column.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ *
+ * @param boolean|integer|string $v The new value
+ * @return CcShowInstances The current object (for fluent API support)
+ */
+ public function setDbModifiedInstance($v)
+ {
+ if ($v !== null) {
+ if (is_string($v)) {
+ $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ } else {
+ $v = (boolean) $v;
+ }
+ }
+
+ if ($this->modified_instance !== $v) {
+ $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->time_filled !== '00:00:00') {
+ 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 resultset 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->created = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
+ $this->last_scheduled = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
+ $this->modified_instance = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 12; // 12 = CcShowInstancesPeer::NUM_HYDRATE_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;
+
+ $this->collCcPlayoutHistorys = null;
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcShowInstancesQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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 (Exception $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 corresponding 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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ if ($this->ccShowInstancessRelatedByDbIdScheduledForDeletion !== null) {
+ if (!$this->ccShowInstancessRelatedByDbIdScheduledForDeletion->isEmpty()) {
+ CcShowInstancesQuery::create()
+ ->filterByPrimaryKeys($this->ccShowInstancessRelatedByDbIdScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccShowInstancessRelatedByDbIdScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcShowInstancessRelatedByDbId !== null) {
+ foreach ($this->collCcShowInstancessRelatedByDbId as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccSchedulesScheduledForDeletion !== null) {
+ if (!$this->ccSchedulesScheduledForDeletion->isEmpty()) {
+ CcScheduleQuery::create()
+ ->filterByPrimaryKeys($this->ccSchedulesScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccSchedulesScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcSchedules !== null) {
+ foreach ($this->collCcSchedules as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccPlayoutHistorysScheduledForDeletion !== null) {
+ if (!$this->ccPlayoutHistorysScheduledForDeletion->isEmpty()) {
+ foreach ($this->ccPlayoutHistorysScheduledForDeletion as $ccPlayoutHistory) {
+ // need to save related object because we set the relation to null
+ $ccPlayoutHistory->save($con);
+ }
+ $this->ccPlayoutHistorysScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcPlayoutHistorys !== null) {
+ foreach ($this->collCcPlayoutHistorys as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcShowInstancesPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcShowInstancesPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_show_instances_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcShowInstancesPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcShowInstancesPeer::STARTS)) {
+ $modifiedColumns[':p' . $index++] = '"starts"';
+ }
+ if ($this->isColumnModified(CcShowInstancesPeer::ENDS)) {
+ $modifiedColumns[':p' . $index++] = '"ends"';
+ }
+ if ($this->isColumnModified(CcShowInstancesPeer::SHOW_ID)) {
+ $modifiedColumns[':p' . $index++] = '"show_id"';
+ }
+ if ($this->isColumnModified(CcShowInstancesPeer::RECORD)) {
+ $modifiedColumns[':p' . $index++] = '"record"';
+ }
+ if ($this->isColumnModified(CcShowInstancesPeer::REBROADCAST)) {
+ $modifiedColumns[':p' . $index++] = '"rebroadcast"';
+ }
+ if ($this->isColumnModified(CcShowInstancesPeer::INSTANCE_ID)) {
+ $modifiedColumns[':p' . $index++] = '"instance_id"';
+ }
+ if ($this->isColumnModified(CcShowInstancesPeer::FILE_ID)) {
+ $modifiedColumns[':p' . $index++] = '"file_id"';
+ }
+ if ($this->isColumnModified(CcShowInstancesPeer::TIME_FILLED)) {
+ $modifiedColumns[':p' . $index++] = '"time_filled"';
+ }
+ if ($this->isColumnModified(CcShowInstancesPeer::CREATED)) {
+ $modifiedColumns[':p' . $index++] = '"created"';
+ }
+ if ($this->isColumnModified(CcShowInstancesPeer::LAST_SCHEDULED)) {
+ $modifiedColumns[':p' . $index++] = '"last_scheduled"';
+ }
+ if ($this->isColumnModified(CcShowInstancesPeer::MODIFIED_INSTANCE)) {
+ $modifiedColumns[':p' . $index++] = '"modified_instance"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_show_instances" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"starts"':
+ $stmt->bindValue($identifier, $this->starts, PDO::PARAM_STR);
+ break;
+ case '"ends"':
+ $stmt->bindValue($identifier, $this->ends, PDO::PARAM_STR);
+ break;
+ case '"show_id"':
+ $stmt->bindValue($identifier, $this->show_id, PDO::PARAM_INT);
+ break;
+ case '"record"':
+ $stmt->bindValue($identifier, $this->record, PDO::PARAM_INT);
+ break;
+ case '"rebroadcast"':
+ $stmt->bindValue($identifier, $this->rebroadcast, PDO::PARAM_INT);
+ break;
+ case '"instance_id"':
+ $stmt->bindValue($identifier, $this->instance_id, PDO::PARAM_INT);
+ break;
+ case '"file_id"':
+ $stmt->bindValue($identifier, $this->file_id, PDO::PARAM_INT);
+ break;
+ case '"time_filled"':
+ $stmt->bindValue($identifier, $this->time_filled, PDO::PARAM_STR);
+ break;
+ case '"created"':
+ $stmt->bindValue($identifier, $this->created, PDO::PARAM_STR);
+ break;
+ case '"last_scheduled"':
+ $stmt->bindValue($identifier, $this->last_scheduled, PDO::PARAM_STR);
+ break;
+ case '"modified_instance"':
+ $stmt->bindValue($identifier, $this->modified_instance, PDO::PARAM_BOOL);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding 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());
+ }
+ }
+ }
+
+ if ($this->collCcPlayoutHistorys !== null) {
+ foreach ($this->collCcPlayoutHistorys 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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->getDbCreated();
+ break;
+ case 10:
+ return $this->getDbLastScheduled();
+ break;
+ case 11:
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcShowInstances'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcShowInstances'][$this->getPrimaryKey()] = true;
+ $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->getDbCreated(),
+ $keys[10] => $this->getDbLastScheduled(),
+ $keys[11] => $this->getDbModifiedInstance(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcShow) {
+ $result['CcShow'] = $this->aCcShow->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->aCcShowInstancesRelatedByDbOriginalShow) {
+ $result['CcShowInstancesRelatedByDbOriginalShow'] = $this->aCcShowInstancesRelatedByDbOriginalShow->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->aCcFiles) {
+ $result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ if (null !== $this->collCcShowInstancessRelatedByDbId) {
+ $result['CcShowInstancessRelatedByDbId'] = $this->collCcShowInstancessRelatedByDbId->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcSchedules) {
+ $result['CcSchedules'] = $this->collCcSchedules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcPlayoutHistorys) {
+ $result['CcPlayoutHistorys'] = $this->collCcPlayoutHistorys->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ }
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcShowInstancesPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbCreated($value);
+ break;
+ case 10:
+ $this->setDbLastScheduled($value);
+ break;
+ case 11:
+ $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 BasePeer::TYPE_PHPNAME
+ *
+ * @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->setDbCreated($arr[$keys[9]]);
+ if (array_key_exists($keys[10], $arr)) $this->setDbLastScheduled($arr[$keys[10]]);
+ if (array_key_exists($keys[11], $arr)) $this->setDbModifiedInstance($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(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::CREATED)) $criteria->add(CcShowInstancesPeer::CREATED, $this->created);
+ if ($this->isColumnModified(CcShowInstancesPeer::LAST_SCHEDULED)) $criteria->add(CcShowInstancesPeer::LAST_SCHEDULED, $this->last_scheduled);
+ 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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbStarts($this->getDbStarts());
+ $copyObj->setDbEnds($this->getDbEnds());
+ $copyObj->setDbShowId($this->getDbShowId());
+ $copyObj->setDbRecord($this->getDbRecord());
+ $copyObj->setDbRebroadcast($this->getDbRebroadcast());
+ $copyObj->setDbOriginalShow($this->getDbOriginalShow());
+ $copyObj->setDbRecordedFile($this->getDbRecordedFile());
+ $copyObj->setDbTimeFilled($this->getDbTimeFilled());
+ $copyObj->setDbCreated($this->getDbCreated());
+ $copyObj->setDbLastScheduled($this->getDbLastScheduled());
+ $copyObj->setDbModifiedInstance($this->getDbModifiedInstance());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ 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));
+ }
+ }
+
+ foreach ($this->getCcPlayoutHistorys() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcPlayoutHistory($relObj->copy($deepCopy));
+ }
+ }
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcShow The associated CcShow object.
+ * @throws PropelException
+ */
+ public function getCcShow(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcShow === null && ($this->show_id !== null) && $doQuery) {
+ $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 $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcShowInstances The associated CcShowInstances object.
+ * @throws PropelException
+ */
+ public function getCcShowInstancesRelatedByDbOriginalShow(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcShowInstancesRelatedByDbOriginalShow === null && ($this->instance_id !== null) && $doQuery) {
+ $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 $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcFiles The associated CcFiles object.
+ * @throws PropelException
+ */
+ public function getCcFiles(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcFiles === null && ($this->file_id !== null) && $doQuery) {
+ $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;
+ }
+
+
+ /**
+ * Initializes a collection based on the name of a relation.
+ * Avoids crafting an 'init[$relationName]s' method name
+ * that wouldn't work when StandardEnglishPluralizer is used.
+ *
+ * @param string $relationName The name of the relation to initialize
+ * @return void
+ */
+ public function initRelation($relationName)
+ {
+ if ('CcShowInstancesRelatedByDbId' == $relationName) {
+ $this->initCcShowInstancessRelatedByDbId();
+ }
+ if ('CcSchedule' == $relationName) {
+ $this->initCcSchedules();
+ }
+ if ('CcPlayoutHistory' == $relationName) {
+ $this->initCcPlayoutHistorys();
+ }
+ }
+
+ /**
+ * 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 CcShowInstances The current object (for fluent API support)
+ * @see addCcShowInstancessRelatedByDbId()
+ */
+ public function clearCcShowInstancessRelatedByDbId()
+ {
+ $this->collCcShowInstancessRelatedByDbId = null; // important to set this to null since that means it is uninitialized
+ $this->collCcShowInstancessRelatedByDbIdPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcShowInstancessRelatedByDbId collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcShowInstancessRelatedByDbId($v = true)
+ {
+ $this->collCcShowInstancessRelatedByDbIdPartial = $v;
+ }
+
+ /**
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcShowInstancessRelatedByDbId($overrideExisting = true)
+ {
+ if (null !== $this->collCcShowInstancessRelatedByDbId && !$overrideExisting) {
+ return;
+ }
+ $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 PropelObjectCollection|CcShowInstances[] List of CcShowInstances objects
+ * @throws PropelException
+ */
+ public function getCcShowInstancessRelatedByDbId($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcShowInstancessRelatedByDbIdPartial && !$this->isNew();
+ if (null === $this->collCcShowInstancessRelatedByDbId || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcShowInstancessRelatedByDbId) {
+ // return empty collection
+ $this->initCcShowInstancessRelatedByDbId();
+ } else {
+ $collCcShowInstancessRelatedByDbId = CcShowInstancesQuery::create(null, $criteria)
+ ->filterByCcShowInstancesRelatedByDbOriginalShow($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcShowInstancessRelatedByDbIdPartial && count($collCcShowInstancessRelatedByDbId)) {
+ $this->initCcShowInstancessRelatedByDbId(false);
+
+ foreach ($collCcShowInstancessRelatedByDbId as $obj) {
+ if (false == $this->collCcShowInstancessRelatedByDbId->contains($obj)) {
+ $this->collCcShowInstancessRelatedByDbId->append($obj);
+ }
+ }
+
+ $this->collCcShowInstancessRelatedByDbIdPartial = true;
+ }
+
+ $collCcShowInstancessRelatedByDbId->getInternalIterator()->rewind();
+
+ return $collCcShowInstancessRelatedByDbId;
+ }
+
+ if ($partial && $this->collCcShowInstancessRelatedByDbId) {
+ foreach ($this->collCcShowInstancessRelatedByDbId as $obj) {
+ if ($obj->isNew()) {
+ $collCcShowInstancessRelatedByDbId[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcShowInstancessRelatedByDbId = $collCcShowInstancessRelatedByDbId;
+ $this->collCcShowInstancessRelatedByDbIdPartial = false;
+ }
+ }
+
+ return $this->collCcShowInstancessRelatedByDbId;
+ }
+
+ /**
+ * Sets a collection of CcShowInstancesRelatedByDbId objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccShowInstancessRelatedByDbId A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcShowInstances The current object (for fluent API support)
+ */
+ public function setCcShowInstancessRelatedByDbId(PropelCollection $ccShowInstancessRelatedByDbId, PropelPDO $con = null)
+ {
+ $ccShowInstancessRelatedByDbIdToDelete = $this->getCcShowInstancessRelatedByDbId(new Criteria(), $con)->diff($ccShowInstancessRelatedByDbId);
+
+
+ $this->ccShowInstancessRelatedByDbIdScheduledForDeletion = $ccShowInstancessRelatedByDbIdToDelete;
+
+ foreach ($ccShowInstancessRelatedByDbIdToDelete as $ccShowInstancesRelatedByDbIdRemoved) {
+ $ccShowInstancesRelatedByDbIdRemoved->setCcShowInstancesRelatedByDbOriginalShow(null);
+ }
+
+ $this->collCcShowInstancessRelatedByDbId = null;
+ foreach ($ccShowInstancessRelatedByDbId as $ccShowInstancesRelatedByDbId) {
+ $this->addCcShowInstancesRelatedByDbId($ccShowInstancesRelatedByDbId);
+ }
+
+ $this->collCcShowInstancessRelatedByDbId = $ccShowInstancessRelatedByDbId;
+ $this->collCcShowInstancessRelatedByDbIdPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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)
+ {
+ $partial = $this->collCcShowInstancessRelatedByDbIdPartial && !$this->isNew();
+ if (null === $this->collCcShowInstancessRelatedByDbId || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcShowInstancessRelatedByDbId) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcShowInstancessRelatedByDbId());
+ }
+ $query = CcShowInstancesQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcShowInstancesRelatedByDbOriginalShow($this)
+ ->count($con);
+ }
+
+ 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 CcShowInstances The current object (for fluent API support)
+ */
+ public function addCcShowInstancesRelatedByDbId(CcShowInstances $l)
+ {
+ if ($this->collCcShowInstancessRelatedByDbId === null) {
+ $this->initCcShowInstancessRelatedByDbId();
+ $this->collCcShowInstancessRelatedByDbIdPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcShowInstancessRelatedByDbId->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcShowInstancesRelatedByDbId($l);
+
+ if ($this->ccShowInstancessRelatedByDbIdScheduledForDeletion and $this->ccShowInstancessRelatedByDbIdScheduledForDeletion->contains($l)) {
+ $this->ccShowInstancessRelatedByDbIdScheduledForDeletion->remove($this->ccShowInstancessRelatedByDbIdScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcShowInstancesRelatedByDbId $ccShowInstancesRelatedByDbId The ccShowInstancesRelatedByDbId object to add.
+ */
+ protected function doAddCcShowInstancesRelatedByDbId($ccShowInstancesRelatedByDbId)
+ {
+ $this->collCcShowInstancessRelatedByDbId[]= $ccShowInstancesRelatedByDbId;
+ $ccShowInstancesRelatedByDbId->setCcShowInstancesRelatedByDbOriginalShow($this);
+ }
+
+ /**
+ * @param CcShowInstancesRelatedByDbId $ccShowInstancesRelatedByDbId The ccShowInstancesRelatedByDbId object to remove.
+ * @return CcShowInstances The current object (for fluent API support)
+ */
+ public function removeCcShowInstancesRelatedByDbId($ccShowInstancesRelatedByDbId)
+ {
+ if ($this->getCcShowInstancessRelatedByDbId()->contains($ccShowInstancesRelatedByDbId)) {
+ $this->collCcShowInstancessRelatedByDbId->remove($this->collCcShowInstancessRelatedByDbId->search($ccShowInstancesRelatedByDbId));
+ if (null === $this->ccShowInstancessRelatedByDbIdScheduledForDeletion) {
+ $this->ccShowInstancessRelatedByDbIdScheduledForDeletion = clone $this->collCcShowInstancessRelatedByDbId;
+ $this->ccShowInstancessRelatedByDbIdScheduledForDeletion->clear();
+ }
+ $this->ccShowInstancessRelatedByDbIdScheduledForDeletion[]= $ccShowInstancesRelatedByDbId;
+ $ccShowInstancesRelatedByDbId->setCcShowInstancesRelatedByDbOriginalShow(null);
+ }
+
+ return $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 PropelObjectCollection|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 PropelObjectCollection|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 CcShowInstances The current object (for fluent API support)
+ * @see addCcSchedules()
+ */
+ public function clearCcSchedules()
+ {
+ $this->collCcSchedules = null; // important to set this to null since that means it is uninitialized
+ $this->collCcSchedulesPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcSchedules collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcSchedules($v = true)
+ {
+ $this->collCcSchedulesPartial = $v;
+ }
+
+ /**
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcSchedules($overrideExisting = true)
+ {
+ if (null !== $this->collCcSchedules && !$overrideExisting) {
+ return;
+ }
+ $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 PropelObjectCollection|CcSchedule[] List of CcSchedule objects
+ * @throws PropelException
+ */
+ public function getCcSchedules($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcSchedulesPartial && !$this->isNew();
+ if (null === $this->collCcSchedules || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcSchedules) {
+ // return empty collection
+ $this->initCcSchedules();
+ } else {
+ $collCcSchedules = CcScheduleQuery::create(null, $criteria)
+ ->filterByCcShowInstances($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcSchedulesPartial && count($collCcSchedules)) {
+ $this->initCcSchedules(false);
+
+ foreach ($collCcSchedules as $obj) {
+ if (false == $this->collCcSchedules->contains($obj)) {
+ $this->collCcSchedules->append($obj);
+ }
+ }
+
+ $this->collCcSchedulesPartial = true;
+ }
+
+ $collCcSchedules->getInternalIterator()->rewind();
+
+ return $collCcSchedules;
+ }
+
+ if ($partial && $this->collCcSchedules) {
+ foreach ($this->collCcSchedules as $obj) {
+ if ($obj->isNew()) {
+ $collCcSchedules[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcSchedules = $collCcSchedules;
+ $this->collCcSchedulesPartial = false;
+ }
+ }
+
+ return $this->collCcSchedules;
+ }
+
+ /**
+ * Sets a collection of CcSchedule objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccSchedules A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcShowInstances The current object (for fluent API support)
+ */
+ public function setCcSchedules(PropelCollection $ccSchedules, PropelPDO $con = null)
+ {
+ $ccSchedulesToDelete = $this->getCcSchedules(new Criteria(), $con)->diff($ccSchedules);
+
+
+ $this->ccSchedulesScheduledForDeletion = $ccSchedulesToDelete;
+
+ foreach ($ccSchedulesToDelete as $ccScheduleRemoved) {
+ $ccScheduleRemoved->setCcShowInstances(null);
+ }
+
+ $this->collCcSchedules = null;
+ foreach ($ccSchedules as $ccSchedule) {
+ $this->addCcSchedule($ccSchedule);
+ }
+
+ $this->collCcSchedules = $ccSchedules;
+ $this->collCcSchedulesPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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)
+ {
+ $partial = $this->collCcSchedulesPartial && !$this->isNew();
+ if (null === $this->collCcSchedules || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcSchedules) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcSchedules());
+ }
+ $query = CcScheduleQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcShowInstances($this)
+ ->count($con);
+ }
+
+ 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 CcShowInstances The current object (for fluent API support)
+ */
+ public function addCcSchedule(CcSchedule $l)
+ {
+ if ($this->collCcSchedules === null) {
+ $this->initCcSchedules();
+ $this->collCcSchedulesPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcSchedules->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcSchedule($l);
+
+ if ($this->ccSchedulesScheduledForDeletion and $this->ccSchedulesScheduledForDeletion->contains($l)) {
+ $this->ccSchedulesScheduledForDeletion->remove($this->ccSchedulesScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcSchedule $ccSchedule The ccSchedule object to add.
+ */
+ protected function doAddCcSchedule($ccSchedule)
+ {
+ $this->collCcSchedules[]= $ccSchedule;
+ $ccSchedule->setCcShowInstances($this);
+ }
+
+ /**
+ * @param CcSchedule $ccSchedule The ccSchedule object to remove.
+ * @return CcShowInstances The current object (for fluent API support)
+ */
+ public function removeCcSchedule($ccSchedule)
+ {
+ if ($this->getCcSchedules()->contains($ccSchedule)) {
+ $this->collCcSchedules->remove($this->collCcSchedules->search($ccSchedule));
+ if (null === $this->ccSchedulesScheduledForDeletion) {
+ $this->ccSchedulesScheduledForDeletion = clone $this->collCcSchedules;
+ $this->ccSchedulesScheduledForDeletion->clear();
+ }
+ $this->ccSchedulesScheduledForDeletion[]= clone $ccSchedule;
+ $ccSchedule->setCcShowInstances(null);
+ }
+
+ return $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 PropelObjectCollection|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);
+ }
+
+
+ /**
+ * 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 PropelObjectCollection|CcSchedule[] List of CcSchedule objects
+ */
+ public function getCcSchedulesJoinCcWebstream($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcScheduleQuery::create(null, $criteria);
+ $query->joinWith('CcWebstream', $join_behavior);
+
+ return $this->getCcSchedules($query, $con);
+ }
+
+ /**
+ * Clears out the collCcPlayoutHistorys 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 CcShowInstances The current object (for fluent API support)
+ * @see addCcPlayoutHistorys()
+ */
+ public function clearCcPlayoutHistorys()
+ {
+ $this->collCcPlayoutHistorys = null; // important to set this to null since that means it is uninitialized
+ $this->collCcPlayoutHistorysPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcPlayoutHistorys collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcPlayoutHistorys($v = true)
+ {
+ $this->collCcPlayoutHistorysPartial = $v;
+ }
+
+ /**
+ * Initializes the collCcPlayoutHistorys collection.
+ *
+ * By default this just sets the collCcPlayoutHistorys collection to an empty array (like clearcollCcPlayoutHistorys());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcPlayoutHistorys($overrideExisting = true)
+ {
+ if (null !== $this->collCcPlayoutHistorys && !$overrideExisting) {
+ return;
+ }
+ $this->collCcPlayoutHistorys = new PropelObjectCollection();
+ $this->collCcPlayoutHistorys->setModel('CcPlayoutHistory');
+ }
+
+ /**
+ * Gets an array of CcPlayoutHistory 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 PropelObjectCollection|CcPlayoutHistory[] List of CcPlayoutHistory objects
+ * @throws PropelException
+ */
+ public function getCcPlayoutHistorys($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcPlayoutHistorysPartial && !$this->isNew();
+ if (null === $this->collCcPlayoutHistorys || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistorys) {
+ // return empty collection
+ $this->initCcPlayoutHistorys();
+ } else {
+ $collCcPlayoutHistorys = CcPlayoutHistoryQuery::create(null, $criteria)
+ ->filterByCcShowInstances($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcPlayoutHistorysPartial && count($collCcPlayoutHistorys)) {
+ $this->initCcPlayoutHistorys(false);
+
+ foreach ($collCcPlayoutHistorys as $obj) {
+ if (false == $this->collCcPlayoutHistorys->contains($obj)) {
+ $this->collCcPlayoutHistorys->append($obj);
+ }
+ }
+
+ $this->collCcPlayoutHistorysPartial = true;
+ }
+
+ $collCcPlayoutHistorys->getInternalIterator()->rewind();
+
+ return $collCcPlayoutHistorys;
+ }
+
+ if ($partial && $this->collCcPlayoutHistorys) {
+ foreach ($this->collCcPlayoutHistorys as $obj) {
+ if ($obj->isNew()) {
+ $collCcPlayoutHistorys[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcPlayoutHistorys = $collCcPlayoutHistorys;
+ $this->collCcPlayoutHistorysPartial = false;
+ }
+ }
+
+ return $this->collCcPlayoutHistorys;
+ }
+
+ /**
+ * Sets a collection of CcPlayoutHistory objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccPlayoutHistorys A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcShowInstances The current object (for fluent API support)
+ */
+ public function setCcPlayoutHistorys(PropelCollection $ccPlayoutHistorys, PropelPDO $con = null)
+ {
+ $ccPlayoutHistorysToDelete = $this->getCcPlayoutHistorys(new Criteria(), $con)->diff($ccPlayoutHistorys);
+
+
+ $this->ccPlayoutHistorysScheduledForDeletion = $ccPlayoutHistorysToDelete;
+
+ foreach ($ccPlayoutHistorysToDelete as $ccPlayoutHistoryRemoved) {
+ $ccPlayoutHistoryRemoved->setCcShowInstances(null);
+ }
+
+ $this->collCcPlayoutHistorys = null;
+ foreach ($ccPlayoutHistorys as $ccPlayoutHistory) {
+ $this->addCcPlayoutHistory($ccPlayoutHistory);
+ }
+
+ $this->collCcPlayoutHistorys = $ccPlayoutHistorys;
+ $this->collCcPlayoutHistorysPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related CcPlayoutHistory objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcPlayoutHistory objects.
+ * @throws PropelException
+ */
+ public function countCcPlayoutHistorys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collCcPlayoutHistorysPartial && !$this->isNew();
+ if (null === $this->collCcPlayoutHistorys || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPlayoutHistorys) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcPlayoutHistorys());
+ }
+ $query = CcPlayoutHistoryQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcShowInstances($this)
+ ->count($con);
+ }
+
+ return count($this->collCcPlayoutHistorys);
+ }
+
+ /**
+ * Method called to associate a CcPlayoutHistory object to this object
+ * through the CcPlayoutHistory foreign key attribute.
+ *
+ * @param CcPlayoutHistory $l CcPlayoutHistory
+ * @return CcShowInstances The current object (for fluent API support)
+ */
+ public function addCcPlayoutHistory(CcPlayoutHistory $l)
+ {
+ if ($this->collCcPlayoutHistorys === null) {
+ $this->initCcPlayoutHistorys();
+ $this->collCcPlayoutHistorysPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcPlayoutHistorys->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcPlayoutHistory($l);
+
+ if ($this->ccPlayoutHistorysScheduledForDeletion and $this->ccPlayoutHistorysScheduledForDeletion->contains($l)) {
+ $this->ccPlayoutHistorysScheduledForDeletion->remove($this->ccPlayoutHistorysScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcPlayoutHistory $ccPlayoutHistory The ccPlayoutHistory object to add.
+ */
+ protected function doAddCcPlayoutHistory($ccPlayoutHistory)
+ {
+ $this->collCcPlayoutHistorys[]= $ccPlayoutHistory;
+ $ccPlayoutHistory->setCcShowInstances($this);
+ }
+
+ /**
+ * @param CcPlayoutHistory $ccPlayoutHistory The ccPlayoutHistory object to remove.
+ * @return CcShowInstances The current object (for fluent API support)
+ */
+ public function removeCcPlayoutHistory($ccPlayoutHistory)
+ {
+ if ($this->getCcPlayoutHistorys()->contains($ccPlayoutHistory)) {
+ $this->collCcPlayoutHistorys->remove($this->collCcPlayoutHistorys->search($ccPlayoutHistory));
+ if (null === $this->ccPlayoutHistorysScheduledForDeletion) {
+ $this->ccPlayoutHistorysScheduledForDeletion = clone $this->collCcPlayoutHistorys;
+ $this->ccPlayoutHistorysScheduledForDeletion->clear();
+ }
+ $this->ccPlayoutHistorysScheduledForDeletion[]= $ccPlayoutHistory;
+ $ccPlayoutHistory->setCcShowInstances(null);
+ }
+
+ return $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 CcPlayoutHistorys 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 PropelObjectCollection|CcPlayoutHistory[] List of CcPlayoutHistory objects
+ */
+ public function getCcPlayoutHistorysJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcPlayoutHistoryQuery::create(null, $criteria);
+ $query->joinWith('CcFiles', $join_behavior);
+
+ return $this->getCcPlayoutHistorys($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->created = null;
+ $this->last_scheduled = null;
+ $this->modified_instance = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->collCcShowInstancessRelatedByDbId) {
+ foreach ($this->collCcShowInstancessRelatedByDbId as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcSchedules) {
+ foreach ($this->collCcSchedules as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcPlayoutHistorys) {
+ foreach ($this->collCcPlayoutHistorys as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->aCcShow instanceof Persistent) {
+ $this->aCcShow->clearAllReferences($deep);
+ }
+ if ($this->aCcShowInstancesRelatedByDbOriginalShow instanceof Persistent) {
+ $this->aCcShowInstancesRelatedByDbOriginalShow->clearAllReferences($deep);
+ }
+ if ($this->aCcFiles instanceof Persistent) {
+ $this->aCcFiles->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ if ($this->collCcShowInstancessRelatedByDbId instanceof PropelCollection) {
+ $this->collCcShowInstancessRelatedByDbId->clearIterator();
+ }
+ $this->collCcShowInstancessRelatedByDbId = null;
+ if ($this->collCcSchedules instanceof PropelCollection) {
+ $this->collCcSchedules->clearIterator();
+ }
+ $this->collCcSchedules = null;
+ if ($this->collCcPlayoutHistorys instanceof PropelCollection) {
+ $this->collCcPlayoutHistorys->clearIterator();
+ }
+ $this->collCcPlayoutHistorys = null;
+ $this->aCcShow = null;
+ $this->aCcShowInstancesRelatedByDbOriginalShow = null;
+ $this->aCcFiles = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcShowInstancesPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php
index ad91f182c..3558b15dd 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesPeer.php
@@ -4,1561 +4,1595 @@
/**
* Base static class for performing query and update operations on the 'cc_show_instances' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcShowInstancesPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_show_instances';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcShowInstances';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcShowInstances';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcShowInstancesTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 12;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_show_instances.ID';
-
- /** the column name for the STARTS field */
- const STARTS = 'cc_show_instances.STARTS';
-
- /** the column name for the ENDS field */
- const ENDS = 'cc_show_instances.ENDS';
-
- /** the column name for the SHOW_ID field */
- const SHOW_ID = 'cc_show_instances.SHOW_ID';
-
- /** the column name for the RECORD field */
- const RECORD = 'cc_show_instances.RECORD';
-
- /** the column name for the REBROADCAST field */
- const REBROADCAST = 'cc_show_instances.REBROADCAST';
-
- /** the column name for the INSTANCE_ID field */
- const INSTANCE_ID = 'cc_show_instances.INSTANCE_ID';
-
- /** the column name for the FILE_ID field */
- const FILE_ID = 'cc_show_instances.FILE_ID';
-
- /** the column name for the TIME_FILLED field */
- const TIME_FILLED = 'cc_show_instances.TIME_FILLED';
-
- /** the column name for the CREATED field */
- const CREATED = 'cc_show_instances.CREATED';
-
- /** the column name for the LAST_SCHEDULED field */
- const LAST_SCHEDULED = 'cc_show_instances.LAST_SCHEDULED';
-
- /** the column name for the MODIFIED_INSTANCE field */
- const MODIFIED_INSTANCE = 'cc_show_instances.MODIFIED_INSTANCE';
-
- /**
- * An identiy map to hold any loaded instances of CcShowInstances objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcShowInstances[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbShowId', 'DbRecord', 'DbRebroadcast', 'DbOriginalShow', 'DbRecordedFile', 'DbTimeFilled', 'DbCreated', 'DbLastScheduled', 'DbModifiedInstance', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbShowId', 'dbRecord', 'dbRebroadcast', 'dbOriginalShow', 'dbRecordedFile', 'dbTimeFilled', 'dbCreated', 'dbLastScheduled', '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::CREATED, self::LAST_SCHEDULED, self::MODIFIED_INSTANCE, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'SHOW_ID', 'RECORD', 'REBROADCAST', 'INSTANCE_ID', 'FILE_ID', 'TIME_FILLED', 'CREATED', 'LAST_SCHEDULED', 'MODIFIED_INSTANCE', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'show_id', 'record', 'rebroadcast', 'instance_id', 'file_id', 'time_filled', 'created', 'last_scheduled', 'modified_instance', ),
- 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, 'DbStarts' => 1, 'DbEnds' => 2, 'DbShowId' => 3, 'DbRecord' => 4, 'DbRebroadcast' => 5, 'DbOriginalShow' => 6, 'DbRecordedFile' => 7, 'DbTimeFilled' => 8, 'DbCreated' => 9, 'DbLastScheduled' => 10, 'DbModifiedInstance' => 11, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbShowId' => 3, 'dbRecord' => 4, 'dbRebroadcast' => 5, 'dbOriginalShow' => 6, 'dbRecordedFile' => 7, 'dbTimeFilled' => 8, 'dbCreated' => 9, 'dbLastScheduled' => 10, 'dbModifiedInstance' => 11, ),
- 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::CREATED => 9, self::LAST_SCHEDULED => 10, self::MODIFIED_INSTANCE => 11, ),
- 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, 'CREATED' => 9, 'LAST_SCHEDULED' => 10, 'MODIFIED_INSTANCE' => 11, ),
- 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, 'created' => 9, 'last_scheduled' => 10, 'modified_instance' => 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. 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::CREATED);
- $criteria->addSelectColumn(CcShowInstancesPeer::LAST_SCHEDULED);
- $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 . '.CREATED');
- $criteria->addSelectColumn($alias . '.LAST_SCHEDULED');
- $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();
- // Invalidate objects in CcPlayoutHistoryPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CcPlayoutHistoryPeer::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;
- }
+abstract class BaseCcShowInstancesPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_show_instances';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcShowInstances';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcShowInstancesTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 12;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 12;
+
+ /** the column name for the id field */
+ const ID = 'cc_show_instances.id';
+
+ /** the column name for the starts field */
+ const STARTS = 'cc_show_instances.starts';
+
+ /** the column name for the ends field */
+ const ENDS = 'cc_show_instances.ends';
+
+ /** the column name for the show_id field */
+ const SHOW_ID = 'cc_show_instances.show_id';
+
+ /** the column name for the record field */
+ const RECORD = 'cc_show_instances.record';
+
+ /** the column name for the rebroadcast field */
+ const REBROADCAST = 'cc_show_instances.rebroadcast';
+
+ /** the column name for the instance_id field */
+ const INSTANCE_ID = 'cc_show_instances.instance_id';
+
+ /** the column name for the file_id field */
+ const FILE_ID = 'cc_show_instances.file_id';
+
+ /** the column name for the time_filled field */
+ const TIME_FILLED = 'cc_show_instances.time_filled';
+
+ /** the column name for the created field */
+ const CREATED = 'cc_show_instances.created';
+
+ /** the column name for the last_scheduled field */
+ const LAST_SCHEDULED = 'cc_show_instances.last_scheduled';
+
+ /** the column name for the modified_instance field */
+ const MODIFIED_INSTANCE = 'cc_show_instances.modified_instance';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcShowInstances objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcShowInstances[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcShowInstancesPeer::$fieldNames[CcShowInstancesPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbShowId', 'DbRecord', 'DbRebroadcast', 'DbOriginalShow', 'DbRecordedFile', 'DbTimeFilled', 'DbCreated', 'DbLastScheduled', 'DbModifiedInstance', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbShowId', 'dbRecord', 'dbRebroadcast', 'dbOriginalShow', 'dbRecordedFile', 'dbTimeFilled', 'dbCreated', 'dbLastScheduled', 'dbModifiedInstance', ),
+ BasePeer::TYPE_COLNAME => array (CcShowInstancesPeer::ID, CcShowInstancesPeer::STARTS, CcShowInstancesPeer::ENDS, CcShowInstancesPeer::SHOW_ID, CcShowInstancesPeer::RECORD, CcShowInstancesPeer::REBROADCAST, CcShowInstancesPeer::INSTANCE_ID, CcShowInstancesPeer::FILE_ID, CcShowInstancesPeer::TIME_FILLED, CcShowInstancesPeer::CREATED, CcShowInstancesPeer::LAST_SCHEDULED, CcShowInstancesPeer::MODIFIED_INSTANCE, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'SHOW_ID', 'RECORD', 'REBROADCAST', 'INSTANCE_ID', 'FILE_ID', 'TIME_FILLED', 'CREATED', 'LAST_SCHEDULED', 'MODIFIED_INSTANCE', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'show_id', 'record', 'rebroadcast', 'instance_id', 'file_id', 'time_filled', 'created', 'last_scheduled', 'modified_instance', ),
+ 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. CcShowInstancesPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected 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, 'DbCreated' => 9, 'DbLastScheduled' => 10, 'DbModifiedInstance' => 11, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbShowId' => 3, 'dbRecord' => 4, 'dbRebroadcast' => 5, 'dbOriginalShow' => 6, 'dbRecordedFile' => 7, 'dbTimeFilled' => 8, 'dbCreated' => 9, 'dbLastScheduled' => 10, 'dbModifiedInstance' => 11, ),
+ BasePeer::TYPE_COLNAME => array (CcShowInstancesPeer::ID => 0, CcShowInstancesPeer::STARTS => 1, CcShowInstancesPeer::ENDS => 2, CcShowInstancesPeer::SHOW_ID => 3, CcShowInstancesPeer::RECORD => 4, CcShowInstancesPeer::REBROADCAST => 5, CcShowInstancesPeer::INSTANCE_ID => 6, CcShowInstancesPeer::FILE_ID => 7, CcShowInstancesPeer::TIME_FILLED => 8, CcShowInstancesPeer::CREATED => 9, CcShowInstancesPeer::LAST_SCHEDULED => 10, CcShowInstancesPeer::MODIFIED_INSTANCE => 11, ),
+ 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, 'CREATED' => 9, 'LAST_SCHEDULED' => 10, 'MODIFIED_INSTANCE' => 11, ),
+ 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, 'created' => 9, 'last_scheduled' => 10, 'modified_instance' => 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcShowInstancesPeer::getFieldNames($toType);
+ $key = isset(CcShowInstancesPeer::$fieldKeys[$fromType][$name]) ? CcShowInstancesPeer::$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(CcShowInstancesPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcShowInstancesPeer::$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 CcShowInstancesPeer::$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::CREATED);
+ $criteria->addSelectColumn(CcShowInstancesPeer::LAST_SCHEDULED);
+ $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 . '.created');
+ $criteria->addSelectColumn($alias . '.last_scheduled');
+ $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(CcShowInstancesPeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcShowInstancesPeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcShowInstancesPeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcShowInstancesPeer::$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(CcShowInstancesPeer::$instances[$key])) {
+ return CcShowInstancesPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcShowInstancesPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcShowInstancesPeer::$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();
+ // Invalidate objects in CcPlayoutHistoryPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcPlayoutHistoryPeer::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();
+ // 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_HYDRATE_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(CcShowInstancesPeer::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(CcShowInstancesPeer::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(CcShowInstancesPeer::DATABASE_NAME);
+ }
+
+ CcShowInstancesPeer::addSelectColumns($criteria);
+ $startcol = CcShowInstancesPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcShowInstancesPeer::DATABASE_NAME);
+ }
+
+ CcShowInstancesPeer::addSelectColumns($criteria);
+ $startcol = CcShowInstancesPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcShowInstancesPeer::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(CcShowInstancesPeer::DATABASE_NAME);
+ }
+
+ CcShowInstancesPeer::addSelectColumns($criteria);
+ $startcol2 = CcShowInstancesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcShowPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcShowPeer::NUM_HYDRATE_COLUMNS;
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + CcFilesPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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();
+
+ $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(CcShowInstancesPeer::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(CcShowInstancesPeer::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(CcShowInstancesPeer::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(CcShowInstancesPeer::DATABASE_NAME);
+ }
+
+ CcShowInstancesPeer::addSelectColumns($criteria);
+ $startcol2 = CcShowInstancesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcFilesPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcShowInstancesPeer::DATABASE_NAME);
+ }
+
+ CcShowInstancesPeer::addSelectColumns($criteria);
+ $startcol2 = CcShowInstancesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcShowPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcShowPeer::NUM_HYDRATE_COLUMNS;
+
+ CcFilesPeer::addSelectColumns($criteria);
+ $startcol4 = $startcol3 + CcFilesPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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();
+
+ $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(CcShowInstancesPeer::DATABASE_NAME);
+ }
+
+ CcShowInstancesPeer::addSelectColumns($criteria);
+ $startcol2 = CcShowInstancesPeer::NUM_HYDRATE_COLUMNS;
+
+ CcShowPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcShowPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcShowInstancesPeer::DATABASE_NAME)->getTable(CcShowInstancesPeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcShowInstancesPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcShowInstancesPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcShowInstancesPeer::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(CcShowInstancesPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_show_instances table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcShowInstancesPeer::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(CcShowInstancesPeer::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 (Exception $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($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->hasColumn($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
+ * @return CcShowInstances[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php
index 871b907ae..bcf51e462 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowInstancesQuery.php
@@ -4,932 +4,1235 @@
/**
* Base class that represents a query for the 'cc_show_instances' table.
*
- *
*
- * @method CcShowInstancesQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcShowInstancesQuery orderByDbStarts($order = Criteria::ASC) Order by the starts column
- * @method CcShowInstancesQuery orderByDbEnds($order = Criteria::ASC) Order by the ends column
- * @method CcShowInstancesQuery orderByDbShowId($order = Criteria::ASC) Order by the show_id column
- * @method CcShowInstancesQuery orderByDbRecord($order = Criteria::ASC) Order by the record column
- * @method CcShowInstancesQuery orderByDbRebroadcast($order = Criteria::ASC) Order by the rebroadcast column
- * @method CcShowInstancesQuery orderByDbOriginalShow($order = Criteria::ASC) Order by the instance_id column
- * @method CcShowInstancesQuery orderByDbRecordedFile($order = Criteria::ASC) Order by the file_id column
- * @method CcShowInstancesQuery orderByDbTimeFilled($order = Criteria::ASC) Order by the time_filled column
- * @method CcShowInstancesQuery orderByDbCreated($order = Criteria::ASC) Order by the created column
- * @method CcShowInstancesQuery orderByDbLastScheduled($order = Criteria::ASC) Order by the last_scheduled column
- * @method CcShowInstancesQuery orderByDbModifiedInstance($order = Criteria::ASC) Order by the modified_instance column
*
- * @method CcShowInstancesQuery groupByDbId() Group by the id column
- * @method CcShowInstancesQuery groupByDbStarts() Group by the starts column
- * @method CcShowInstancesQuery groupByDbEnds() Group by the ends column
- * @method CcShowInstancesQuery groupByDbShowId() Group by the show_id column
- * @method CcShowInstancesQuery groupByDbRecord() Group by the record column
- * @method CcShowInstancesQuery groupByDbRebroadcast() Group by the rebroadcast column
- * @method CcShowInstancesQuery groupByDbOriginalShow() Group by the instance_id column
- * @method CcShowInstancesQuery groupByDbRecordedFile() Group by the file_id column
- * @method CcShowInstancesQuery groupByDbTimeFilled() Group by the time_filled column
- * @method CcShowInstancesQuery groupByDbCreated() Group by the created column
- * @method CcShowInstancesQuery groupByDbLastScheduled() Group by the last_scheduled column
- * @method CcShowInstancesQuery groupByDbModifiedInstance() Group by the modified_instance column
+ * @method CcShowInstancesQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcShowInstancesQuery orderByDbStarts($order = Criteria::ASC) Order by the starts column
+ * @method CcShowInstancesQuery orderByDbEnds($order = Criteria::ASC) Order by the ends column
+ * @method CcShowInstancesQuery orderByDbShowId($order = Criteria::ASC) Order by the show_id column
+ * @method CcShowInstancesQuery orderByDbRecord($order = Criteria::ASC) Order by the record column
+ * @method CcShowInstancesQuery orderByDbRebroadcast($order = Criteria::ASC) Order by the rebroadcast column
+ * @method CcShowInstancesQuery orderByDbOriginalShow($order = Criteria::ASC) Order by the instance_id column
+ * @method CcShowInstancesQuery orderByDbRecordedFile($order = Criteria::ASC) Order by the file_id column
+ * @method CcShowInstancesQuery orderByDbTimeFilled($order = Criteria::ASC) Order by the time_filled column
+ * @method CcShowInstancesQuery orderByDbCreated($order = Criteria::ASC) Order by the created column
+ * @method CcShowInstancesQuery orderByDbLastScheduled($order = Criteria::ASC) Order by the last_scheduled column
+ * @method CcShowInstancesQuery orderByDbModifiedInstance($order = Criteria::ASC) Order by the modified_instance column
*
- * @method CcShowInstancesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcShowInstancesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcShowInstancesQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcShowInstancesQuery groupByDbId() Group by the id column
+ * @method CcShowInstancesQuery groupByDbStarts() Group by the starts column
+ * @method CcShowInstancesQuery groupByDbEnds() Group by the ends column
+ * @method CcShowInstancesQuery groupByDbShowId() Group by the show_id column
+ * @method CcShowInstancesQuery groupByDbRecord() Group by the record column
+ * @method CcShowInstancesQuery groupByDbRebroadcast() Group by the rebroadcast column
+ * @method CcShowInstancesQuery groupByDbOriginalShow() Group by the instance_id column
+ * @method CcShowInstancesQuery groupByDbRecordedFile() Group by the file_id column
+ * @method CcShowInstancesQuery groupByDbTimeFilled() Group by the time_filled column
+ * @method CcShowInstancesQuery groupByDbCreated() Group by the created column
+ * @method CcShowInstancesQuery groupByDbLastScheduled() Group by the last_scheduled column
+ * @method CcShowInstancesQuery groupByDbModifiedInstance() Group by the modified_instance column
*
- * @method CcShowInstancesQuery leftJoinCcShow($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShow relation
- * @method CcShowInstancesQuery rightJoinCcShow($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShow relation
- * @method CcShowInstancesQuery innerJoinCcShow($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShow relation
+ * @method CcShowInstancesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcShowInstancesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcShowInstancesQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcShowInstancesQuery leftJoinCcShowInstancesRelatedByDbOriginalShow($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowInstancesRelatedByDbOriginalShow relation
- * @method CcShowInstancesQuery rightJoinCcShowInstancesRelatedByDbOriginalShow($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowInstancesRelatedByDbOriginalShow relation
- * @method CcShowInstancesQuery innerJoinCcShowInstancesRelatedByDbOriginalShow($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowInstancesRelatedByDbOriginalShow relation
+ * @method CcShowInstancesQuery leftJoinCcShow($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcShow relation
+ * @method CcShowInstancesQuery rightJoinCcShow($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcShow relation
+ * @method CcShowInstancesQuery innerJoinCcShow($relationAlias = null) Adds a INNER JOIN clause to the query using the CcShow relation
*
- * @method CcShowInstancesQuery leftJoinCcFiles($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFiles relation
- * @method CcShowInstancesQuery rightJoinCcFiles($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFiles relation
- * @method CcShowInstancesQuery innerJoinCcFiles($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFiles relation
+ * @method CcShowInstancesQuery leftJoinCcShowInstancesRelatedByDbOriginalShow($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcShowInstancesRelatedByDbOriginalShow relation
+ * @method CcShowInstancesQuery rightJoinCcShowInstancesRelatedByDbOriginalShow($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcShowInstancesRelatedByDbOriginalShow relation
+ * @method CcShowInstancesQuery innerJoinCcShowInstancesRelatedByDbOriginalShow($relationAlias = null) Adds a INNER JOIN clause to the query using the CcShowInstancesRelatedByDbOriginalShow relation
*
- * @method CcShowInstancesQuery leftJoinCcShowInstancesRelatedByDbId($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowInstancesRelatedByDbId relation
- * @method CcShowInstancesQuery rightJoinCcShowInstancesRelatedByDbId($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowInstancesRelatedByDbId relation
- * @method CcShowInstancesQuery innerJoinCcShowInstancesRelatedByDbId($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowInstancesRelatedByDbId relation
+ * @method CcShowInstancesQuery leftJoinCcFiles($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcFiles relation
+ * @method CcShowInstancesQuery rightJoinCcFiles($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcFiles relation
+ * @method CcShowInstancesQuery innerJoinCcFiles($relationAlias = null) Adds a INNER JOIN clause to the query using the CcFiles relation
*
- * @method CcShowInstancesQuery leftJoinCcSchedule($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSchedule relation
- * @method CcShowInstancesQuery rightJoinCcSchedule($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSchedule relation
- * @method CcShowInstancesQuery innerJoinCcSchedule($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSchedule relation
+ * @method CcShowInstancesQuery leftJoinCcShowInstancesRelatedByDbId($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcShowInstancesRelatedByDbId relation
+ * @method CcShowInstancesQuery rightJoinCcShowInstancesRelatedByDbId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcShowInstancesRelatedByDbId relation
+ * @method CcShowInstancesQuery innerJoinCcShowInstancesRelatedByDbId($relationAlias = null) Adds a INNER JOIN clause to the query using the CcShowInstancesRelatedByDbId relation
*
- * @method CcShowInstancesQuery leftJoinCcPlayoutHistory($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlayoutHistory relation
- * @method CcShowInstancesQuery rightJoinCcPlayoutHistory($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlayoutHistory relation
- * @method CcShowInstancesQuery innerJoinCcPlayoutHistory($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlayoutHistory relation
+ * @method CcShowInstancesQuery leftJoinCcSchedule($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSchedule relation
+ * @method CcShowInstancesQuery rightJoinCcSchedule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSchedule relation
+ * @method CcShowInstancesQuery innerJoinCcSchedule($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSchedule relation
*
- * @method CcShowInstances findOne(PropelPDO $con = null) Return the first CcShowInstances matching the query
- * @method CcShowInstances findOneOrCreate(PropelPDO $con = null) Return the first CcShowInstances matching the query, or a new CcShowInstances object populated from the query conditions when no match is found
+ * @method CcShowInstancesQuery leftJoinCcPlayoutHistory($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPlayoutHistory relation
+ * @method CcShowInstancesQuery rightJoinCcPlayoutHistory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPlayoutHistory relation
+ * @method CcShowInstancesQuery innerJoinCcPlayoutHistory($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPlayoutHistory relation
*
- * @method CcShowInstances findOneByDbId(int $id) Return the first CcShowInstances filtered by the id column
- * @method CcShowInstances findOneByDbStarts(string $starts) Return the first CcShowInstances filtered by the starts column
- * @method CcShowInstances findOneByDbEnds(string $ends) Return the first CcShowInstances filtered by the ends column
- * @method CcShowInstances findOneByDbShowId(int $show_id) Return the first CcShowInstances filtered by the show_id column
- * @method CcShowInstances findOneByDbRecord(int $record) Return the first CcShowInstances filtered by the record column
- * @method CcShowInstances findOneByDbRebroadcast(int $rebroadcast) Return the first CcShowInstances filtered by the rebroadcast column
- * @method CcShowInstances findOneByDbOriginalShow(int $instance_id) Return the first CcShowInstances filtered by the instance_id column
- * @method CcShowInstances findOneByDbRecordedFile(int $file_id) Return the first CcShowInstances filtered by the file_id column
- * @method CcShowInstances findOneByDbTimeFilled(string $time_filled) Return the first CcShowInstances filtered by the time_filled column
- * @method CcShowInstances findOneByDbCreated(string $created) Return the first CcShowInstances filtered by the created column
- * @method CcShowInstances findOneByDbLastScheduled(string $last_scheduled) Return the first CcShowInstances filtered by the last_scheduled column
- * @method CcShowInstances findOneByDbModifiedInstance(boolean $modified_instance) Return the first CcShowInstances filtered by the modified_instance column
+ * @method CcShowInstances findOne(PropelPDO $con = null) Return the first CcShowInstances matching the query
+ * @method CcShowInstances findOneOrCreate(PropelPDO $con = null) Return the first CcShowInstances matching the query, or a new CcShowInstances object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcShowInstances objects filtered by the id column
- * @method array findByDbStarts(string $starts) Return CcShowInstances objects filtered by the starts column
- * @method array findByDbEnds(string $ends) Return CcShowInstances objects filtered by the ends column
- * @method array findByDbShowId(int $show_id) Return CcShowInstances objects filtered by the show_id column
- * @method array findByDbRecord(int $record) Return CcShowInstances objects filtered by the record column
- * @method array findByDbRebroadcast(int $rebroadcast) Return CcShowInstances objects filtered by the rebroadcast column
- * @method array findByDbOriginalShow(int $instance_id) Return CcShowInstances objects filtered by the instance_id column
- * @method array findByDbRecordedFile(int $file_id) Return CcShowInstances objects filtered by the file_id column
- * @method array findByDbTimeFilled(string $time_filled) Return CcShowInstances objects filtered by the time_filled column
- * @method array findByDbCreated(string $created) Return CcShowInstances objects filtered by the created column
- * @method array findByDbLastScheduled(string $last_scheduled) Return CcShowInstances objects filtered by the last_scheduled column
- * @method array findByDbModifiedInstance(boolean $modified_instance) Return CcShowInstances objects filtered by the modified_instance column
+ * @method CcShowInstances findOneByDbStarts(string $starts) Return the first CcShowInstances filtered by the starts column
+ * @method CcShowInstances findOneByDbEnds(string $ends) Return the first CcShowInstances filtered by the ends column
+ * @method CcShowInstances findOneByDbShowId(int $show_id) Return the first CcShowInstances filtered by the show_id column
+ * @method CcShowInstances findOneByDbRecord(int $record) Return the first CcShowInstances filtered by the record column
+ * @method CcShowInstances findOneByDbRebroadcast(int $rebroadcast) Return the first CcShowInstances filtered by the rebroadcast column
+ * @method CcShowInstances findOneByDbOriginalShow(int $instance_id) Return the first CcShowInstances filtered by the instance_id column
+ * @method CcShowInstances findOneByDbRecordedFile(int $file_id) Return the first CcShowInstances filtered by the file_id column
+ * @method CcShowInstances findOneByDbTimeFilled(string $time_filled) Return the first CcShowInstances filtered by the time_filled column
+ * @method CcShowInstances findOneByDbCreated(string $created) Return the first CcShowInstances filtered by the created column
+ * @method CcShowInstances findOneByDbLastScheduled(string $last_scheduled) Return the first CcShowInstances filtered by the last_scheduled column
+ * @method CcShowInstances findOneByDbModifiedInstance(boolean $modified_instance) Return the first CcShowInstances filtered by the modified_instance column
+ *
+ * @method array findByDbId(int $id) Return CcShowInstances objects filtered by the id column
+ * @method array findByDbStarts(string $starts) Return CcShowInstances objects filtered by the starts column
+ * @method array findByDbEnds(string $ends) Return CcShowInstances objects filtered by the ends column
+ * @method array findByDbShowId(int $show_id) Return CcShowInstances objects filtered by the show_id column
+ * @method array findByDbRecord(int $record) Return CcShowInstances objects filtered by the record column
+ * @method array findByDbRebroadcast(int $rebroadcast) Return CcShowInstances objects filtered by the rebroadcast column
+ * @method array findByDbOriginalShow(int $instance_id) Return CcShowInstances objects filtered by the instance_id column
+ * @method array findByDbRecordedFile(int $file_id) Return CcShowInstances objects filtered by the file_id column
+ * @method array findByDbTimeFilled(string $time_filled) Return CcShowInstances objects filtered by the time_filled column
+ * @method array findByDbCreated(string $created) Return CcShowInstances objects filtered by the created column
+ * @method array findByDbLastScheduled(string $last_scheduled) Return CcShowInstances objects filtered by the last_scheduled column
+ * @method array findByDbModifiedInstance(boolean $modified_instance) Return CcShowInstances objects filtered by the modified_instance column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcShowInstancesQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcShowInstancesQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcShowInstances';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcShowInstancesQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcShowInstances', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcShowInstancesQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcShowInstancesQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcShowInstancesQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcShowInstancesQuery) {
+ return $criteria;
+ }
+ $query = new CcShowInstancesQuery(null, null, $modelAlias);
- /**
- * Returns a new CcShowInstancesQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcShowInstancesQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcShowInstancesQuery) {
- return $criteria;
- }
- $query = new CcShowInstancesQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcShowInstances|CcShowInstances[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcShowInstancesPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $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);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcShowInstances A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcShowInstances A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "starts", "ends", "show_id", "record", "rebroadcast", "instance_id", "file_id", "time_filled", "created", "last_scheduled", "modified_instance" FROM "cc_show_instances" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcShowInstances();
+ $obj->hydrate($row);
+ CcShowInstancesPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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);
- }
+ return $obj;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcShowInstances|CcShowInstances[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * 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);
- }
+ /**
+ * 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|CcShowInstances[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * 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 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)
+ {
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcShowInstancesPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * 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 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)
+ {
- /**
- * Filter the query on the time_filled column
- *
- * @param string $dbTimeFilled 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 CcShowInstancesQuery The current query, for fluid interface
- */
- public function filterByDbTimeFilled($dbTimeFilled = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbTimeFilled)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbTimeFilled)) {
- $dbTimeFilled = str_replace('*', '%', $dbTimeFilled);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcShowInstancesPeer::TIME_FILLED, $dbTimeFilled, $comparison);
- }
+ return $this->addUsingAlias(CcShowInstancesPeer::ID, $keys, Criteria::IN);
+ }
- /**
- * Filter the query on the created column
- *
- * @param string|array $dbCreated 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 filterByDbCreated($dbCreated = null, $comparison = null)
- {
- if (is_array($dbCreated)) {
- $useMinMax = false;
- if (isset($dbCreated['min'])) {
- $this->addUsingAlias(CcShowInstancesPeer::CREATED, $dbCreated['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbCreated['max'])) {
- $this->addUsingAlias(CcShowInstancesPeer::CREATED, $dbCreated['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcShowInstancesPeer::CREATED, $dbCreated, $comparison);
- }
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcShowInstancesPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcShowInstancesPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * Filter the query on the last_scheduled column
- *
- * @param string|array $dbLastScheduled 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 filterByDbLastScheduled($dbLastScheduled = null, $comparison = null)
- {
- if (is_array($dbLastScheduled)) {
- $useMinMax = false;
- if (isset($dbLastScheduled['min'])) {
- $this->addUsingAlias(CcShowInstancesPeer::LAST_SCHEDULED, $dbLastScheduled['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbLastScheduled['max'])) {
- $this->addUsingAlias(CcShowInstancesPeer::LAST_SCHEDULED, $dbLastScheduled['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcShowInstancesPeer::LAST_SCHEDULED, $dbLastScheduled, $comparison);
- }
+ return $this->addUsingAlias(CcShowInstancesPeer::ID, $dbId, $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 on the starts column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbStarts('2011-03-14'); // WHERE starts = '2011-03-14'
+ * $query->filterByDbStarts('now'); // WHERE starts = '2011-03-14'
+ * $query->filterByDbStarts(array('max' => 'yesterday')); // WHERE starts < '2011-03-13'
+ *
+ *
+ * @param mixed $dbStarts The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcShowInstancesPeer::STARTS, $dbStarts, $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;
- }
+ /**
+ * Filter the query on the ends column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbEnds('2011-03-14'); // WHERE ends = '2011-03-14'
+ * $query->filterByDbEnds('now'); // WHERE ends = '2011-03-14'
+ * $query->filterByDbEnds(array('max' => 'yesterday')); // WHERE ends < '2011-03-13'
+ *
+ *
+ * @param mixed $dbEnds The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * 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');
- }
+ return $this->addUsingAlias(CcShowInstancesPeer::ENDS, $dbEnds, $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 CcShowInstancesQuery The current query, for fluid interface
- */
- public function filterByCcShowInstancesRelatedByDbOriginalShow($ccShowInstances, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcShowInstancesPeer::INSTANCE_ID, $ccShowInstances->getDbId(), $comparison);
- }
+ /**
+ * Filter the query on the show_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbShowId(1234); // WHERE show_id = 1234
+ * $query->filterByDbShowId(array(12, 34)); // WHERE show_id IN (12, 34)
+ * $query->filterByDbShowId(array('min' => 12)); // WHERE show_id >= 12
+ * $query->filterByDbShowId(array('max' => 12)); // WHERE show_id <= 12
+ *
+ *
+ * @see filterByCcShow()
+ *
+ * @param mixed $dbShowId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcShowInstancesPeer::SHOW_ID, $dbShowId, $comparison);
+ }
- /**
- * 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 on the record column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbRecord(1234); // WHERE record = 1234
+ * $query->filterByDbRecord(array(12, 34)); // WHERE record IN (12, 34)
+ * $query->filterByDbRecord(array('min' => 12)); // WHERE record >= 12
+ * $query->filterByDbRecord(array('max' => 12)); // WHERE record <= 12
+ *
+ *
+ * @param mixed $dbRecord The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcShowInstancesPeer::RECORD, $dbRecord, $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;
- }
+ /**
+ * Filter the query on the rebroadcast column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbRebroadcast(1234); // WHERE rebroadcast = 1234
+ * $query->filterByDbRebroadcast(array(12, 34)); // WHERE rebroadcast IN (12, 34)
+ * $query->filterByDbRebroadcast(array('min' => 12)); // WHERE rebroadcast >= 12
+ * $query->filterByDbRebroadcast(array('max' => 12)); // WHERE rebroadcast <= 12
+ *
+ *
+ * @param mixed $dbRebroadcast The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * 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');
- }
+ return $this->addUsingAlias(CcShowInstancesPeer::REBROADCAST, $dbRebroadcast, $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 CcShowInstancesQuery The current query, for fluid interface
- */
- public function filterByCcShowInstancesRelatedByDbId($ccShowInstances, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcShowInstancesPeer::ID, $ccShowInstances->getDbOriginalShow(), $comparison);
- }
+ /**
+ * Filter the query on the instance_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbOriginalShow(1234); // WHERE instance_id = 1234
+ * $query->filterByDbOriginalShow(array(12, 34)); // WHERE instance_id IN (12, 34)
+ * $query->filterByDbOriginalShow(array('min' => 12)); // WHERE instance_id >= 12
+ * $query->filterByDbOriginalShow(array('max' => 12)); // WHERE instance_id <= 12
+ *
+ *
+ * @see filterByCcShowInstancesRelatedByDbOriginalShow()
+ *
+ * @param mixed $dbOriginalShow The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcShowInstancesPeer::INSTANCE_ID, $dbOriginalShow, $comparison);
+ }
- /**
- * 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 on the file_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbRecordedFile(1234); // WHERE file_id = 1234
+ * $query->filterByDbRecordedFile(array(12, 34)); // WHERE file_id IN (12, 34)
+ * $query->filterByDbRecordedFile(array('min' => 12)); // WHERE file_id >= 12
+ * $query->filterByDbRecordedFile(array('max' => 12)); // WHERE file_id <= 12
+ *
+ *
+ * @see filterByCcFiles()
+ *
+ * @param mixed $dbRecordedFile The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcShowInstancesPeer::FILE_ID, $dbRecordedFile, $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;
- }
+ /**
+ * Filter the query on the time_filled column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbTimeFilled('fooValue'); // WHERE time_filled = 'fooValue'
+ * $query->filterByDbTimeFilled('%fooValue%'); // WHERE time_filled LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbTimeFilled 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 CcShowInstancesQuery The current query, for fluid interface
+ */
+ public function filterByDbTimeFilled($dbTimeFilled = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbTimeFilled)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbTimeFilled)) {
+ $dbTimeFilled = str_replace('*', '%', $dbTimeFilled);
+ $comparison = Criteria::LIKE;
+ }
+ }
- /**
- * 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');
- }
+ return $this->addUsingAlias(CcShowInstancesPeer::TIME_FILLED, $dbTimeFilled, $comparison);
+ }
- /**
- * Filter the query by a related CcPlayoutHistory object
- *
- * @param CcPlayoutHistory $ccPlayoutHistory 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 filterByCcPlayoutHistory($ccPlayoutHistory, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcShowInstancesPeer::ID, $ccPlayoutHistory->getDbInstanceId(), $comparison);
- }
+ /**
+ * Filter the query on the created column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCreated('2011-03-14'); // WHERE created = '2011-03-14'
+ * $query->filterByDbCreated('now'); // WHERE created = '2011-03-14'
+ * $query->filterByDbCreated(array('max' => 'yesterday')); // WHERE created < '2011-03-13'
+ *
+ *
+ * @param mixed $dbCreated The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcShowInstancesQuery The current query, for fluid interface
+ */
+ public function filterByDbCreated($dbCreated = null, $comparison = null)
+ {
+ if (is_array($dbCreated)) {
+ $useMinMax = false;
+ if (isset($dbCreated['min'])) {
+ $this->addUsingAlias(CcShowInstancesPeer::CREATED, $dbCreated['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbCreated['max'])) {
+ $this->addUsingAlias(CcShowInstancesPeer::CREATED, $dbCreated['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * Adds a JOIN clause to the query using the CcPlayoutHistory 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 joinCcPlayoutHistory($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcPlayoutHistory');
-
- // 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, 'CcPlayoutHistory');
- }
-
- return $this;
- }
+ return $this->addUsingAlias(CcShowInstancesPeer::CREATED, $dbCreated, $comparison);
+ }
- /**
- * Use the CcPlayoutHistory relation CcPlayoutHistory 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 CcPlayoutHistoryQuery A secondary query class using the current class as primary query
- */
- public function useCcPlayoutHistoryQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- return $this
- ->joinCcPlayoutHistory($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistory', 'CcPlayoutHistoryQuery');
- }
+ /**
+ * Filter the query on the last_scheduled column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLastScheduled('2011-03-14'); // WHERE last_scheduled = '2011-03-14'
+ * $query->filterByDbLastScheduled('now'); // WHERE last_scheduled = '2011-03-14'
+ * $query->filterByDbLastScheduled(array('max' => 'yesterday')); // WHERE last_scheduled < '2011-03-13'
+ *
+ *
+ * @param mixed $dbLastScheduled The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcShowInstancesQuery The current query, for fluid interface
+ */
+ public function filterByDbLastScheduled($dbLastScheduled = null, $comparison = null)
+ {
+ if (is_array($dbLastScheduled)) {
+ $useMinMax = false;
+ if (isset($dbLastScheduled['min'])) {
+ $this->addUsingAlias(CcShowInstancesPeer::LAST_SCHEDULED, $dbLastScheduled['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbLastScheduled['max'])) {
+ $this->addUsingAlias(CcShowInstancesPeer::LAST_SCHEDULED, $dbLastScheduled['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcShowInstancesPeer::LAST_SCHEDULED, $dbLastScheduled, $comparison);
+ }
-} // BaseCcShowInstancesQuery
+ /**
+ * Filter the query on the modified_instance column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbModifiedInstance(true); // WHERE modified_instance = true
+ * $query->filterByDbModifiedInstance('yes'); // WHERE modified_instance = true
+ *
+ *
+ * @param boolean|string $dbModifiedInstance The value to use as filter.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ * @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)) {
+ $dbModifiedInstance = 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|PropelObjectCollection $ccShow The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcShow($ccShow, $comparison = null)
+ {
+ if ($ccShow instanceof CcShow) {
+ return $this
+ ->addUsingAlias(CcShowInstancesPeer::SHOW_ID, $ccShow->getDbId(), $comparison);
+ } elseif ($ccShow instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcShowInstancesPeer::SHOW_ID, $ccShow->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcShow() only accepts arguments of type CcShow or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcShow($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcShow', 'CcShowQuery');
+ }
+
+ /**
+ * Filter the query by a related CcShowInstances object
+ *
+ * @param CcShowInstances|PropelObjectCollection $ccShowInstances The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcShowInstancesRelatedByDbOriginalShow($ccShowInstances, $comparison = null)
+ {
+ if ($ccShowInstances instanceof CcShowInstances) {
+ return $this
+ ->addUsingAlias(CcShowInstancesPeer::INSTANCE_ID, $ccShowInstances->getDbId(), $comparison);
+ } elseif ($ccShowInstances instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcShowInstancesPeer::INSTANCE_ID, $ccShowInstances->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcShowInstancesRelatedByDbOriginalShow() only accepts arguments of type CcShowInstances or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcShowInstancesRelatedByDbOriginalShow($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcShowInstancesRelatedByDbOriginalShow', 'CcShowInstancesQuery');
+ }
+
+ /**
+ * Filter the query by a related CcFiles object
+ *
+ * @param CcFiles|PropelObjectCollection $ccFiles The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcFiles($ccFiles, $comparison = null)
+ {
+ if ($ccFiles instanceof CcFiles) {
+ return $this
+ ->addUsingAlias(CcShowInstancesPeer::FILE_ID, $ccFiles->getDbId(), $comparison);
+ } elseif ($ccFiles instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcShowInstancesPeer::FILE_ID, $ccFiles->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcFiles() only accepts arguments of type CcFiles or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcFiles($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery');
+ }
+
+ /**
+ * Filter the query by a related CcShowInstances object
+ *
+ * @param CcShowInstances|PropelObjectCollection $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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcShowInstancesRelatedByDbId($ccShowInstances, $comparison = null)
+ {
+ if ($ccShowInstances instanceof CcShowInstances) {
+ return $this
+ ->addUsingAlias(CcShowInstancesPeer::ID, $ccShowInstances->getDbOriginalShow(), $comparison);
+ } elseif ($ccShowInstances instanceof PropelObjectCollection) {
+ return $this
+ ->useCcShowInstancesRelatedByDbIdQuery()
+ ->filterByPrimaryKeys($ccShowInstances->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcShowInstancesRelatedByDbId() only accepts arguments of type CcShowInstances or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcShowInstancesRelatedByDbId($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcShowInstancesRelatedByDbId', 'CcShowInstancesQuery');
+ }
+
+ /**
+ * Filter the query by a related CcSchedule object
+ *
+ * @param CcSchedule|PropelObjectCollection $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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcSchedule($ccSchedule, $comparison = null)
+ {
+ if ($ccSchedule instanceof CcSchedule) {
+ return $this
+ ->addUsingAlias(CcShowInstancesPeer::ID, $ccSchedule->getDbInstanceId(), $comparison);
+ } elseif ($ccSchedule instanceof PropelObjectCollection) {
+ return $this
+ ->useCcScheduleQuery()
+ ->filterByPrimaryKeys($ccSchedule->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcSchedule() only accepts arguments of type CcSchedule or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcSchedule($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery');
+ }
+
+ /**
+ * Filter the query by a related CcPlayoutHistory object
+ *
+ * @param CcPlayoutHistory|PropelObjectCollection $ccPlayoutHistory 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcPlayoutHistory($ccPlayoutHistory, $comparison = null)
+ {
+ if ($ccPlayoutHistory instanceof CcPlayoutHistory) {
+ return $this
+ ->addUsingAlias(CcShowInstancesPeer::ID, $ccPlayoutHistory->getDbInstanceId(), $comparison);
+ } elseif ($ccPlayoutHistory instanceof PropelObjectCollection) {
+ return $this
+ ->useCcPlayoutHistoryQuery()
+ ->filterByPrimaryKeys($ccPlayoutHistory->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcPlayoutHistory() only accepts arguments of type CcPlayoutHistory or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcPlayoutHistory 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 joinCcPlayoutHistory($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcPlayoutHistory');
+
+ // 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, 'CcPlayoutHistory');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcPlayoutHistory relation CcPlayoutHistory 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 CcPlayoutHistoryQuery A secondary query class using the current class as primary query
+ */
+ public function useCcPlayoutHistoryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcPlayoutHistory($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlayoutHistory', 'CcPlayoutHistoryQuery');
+ }
+
+ /**
+ * 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;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcShowPeer.php
index c49ef60fb..45cd5dce5 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowPeer.php
@@ -4,799 +4,821 @@
/**
* Base static class for performing query and update operations on the 'cc_show' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcShowPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_show';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcShow';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcShow';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcShowTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 13;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_show.ID';
-
- /** the column name for the NAME field */
- const NAME = 'cc_show.NAME';
-
- /** the column name for the URL field */
- const URL = 'cc_show.URL';
-
- /** the column name for the GENRE field */
- const GENRE = 'cc_show.GENRE';
-
- /** the column name for the DESCRIPTION field */
- const DESCRIPTION = 'cc_show.DESCRIPTION';
-
- /** the column name for the COLOR field */
- const COLOR = 'cc_show.COLOR';
-
- /** the column name for the BACKGROUND_COLOR field */
- const BACKGROUND_COLOR = 'cc_show.BACKGROUND_COLOR';
-
- /** the column name for the LIVE_STREAM_USING_AIRTIME_AUTH field */
- const LIVE_STREAM_USING_AIRTIME_AUTH = 'cc_show.LIVE_STREAM_USING_AIRTIME_AUTH';
-
- /** the column name for the LIVE_STREAM_USING_CUSTOM_AUTH field */
- const LIVE_STREAM_USING_CUSTOM_AUTH = 'cc_show.LIVE_STREAM_USING_CUSTOM_AUTH';
-
- /** the column name for the LIVE_STREAM_USER field */
- const LIVE_STREAM_USER = 'cc_show.LIVE_STREAM_USER';
-
- /** the column name for the LIVE_STREAM_PASS field */
- const LIVE_STREAM_PASS = 'cc_show.LIVE_STREAM_PASS';
-
- /** the column name for the LINKED field */
- const LINKED = 'cc_show.LINKED';
-
- /** the column name for the IS_LINKABLE field */
- const IS_LINKABLE = 'cc_show.IS_LINKABLE';
-
- /**
- * An identiy map to hold any loaded instances of CcShow objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcShow[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbUrl', 'DbGenre', 'DbDescription', 'DbColor', 'DbBackgroundColor', 'DbLiveStreamUsingAirtimeAuth', 'DbLiveStreamUsingCustomAuth', 'DbLiveStreamUser', 'DbLiveStreamPass', 'DbLinked', 'DbIsLinkable', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbUrl', 'dbGenre', 'dbDescription', 'dbColor', 'dbBackgroundColor', 'dbLiveStreamUsingAirtimeAuth', 'dbLiveStreamUsingCustomAuth', 'dbLiveStreamUser', 'dbLiveStreamPass', 'dbLinked', 'dbIsLinkable', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::URL, self::GENRE, self::DESCRIPTION, self::COLOR, self::BACKGROUND_COLOR, self::LIVE_STREAM_USING_AIRTIME_AUTH, self::LIVE_STREAM_USING_CUSTOM_AUTH, self::LIVE_STREAM_USER, self::LIVE_STREAM_PASS, self::LINKED, self::IS_LINKABLE, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'URL', 'GENRE', 'DESCRIPTION', 'COLOR', 'BACKGROUND_COLOR', 'LIVE_STREAM_USING_AIRTIME_AUTH', 'LIVE_STREAM_USING_CUSTOM_AUTH', 'LIVE_STREAM_USER', 'LIVE_STREAM_PASS', 'LINKED', 'IS_LINKABLE', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'url', 'genre', 'description', 'color', 'background_color', 'live_stream_using_airtime_auth', 'live_stream_using_custom_auth', 'live_stream_user', 'live_stream_pass', 'linked', 'is_linkable', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
- );
-
- /**
- * 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, 'DbLiveStreamUsingAirtimeAuth' => 7, 'DbLiveStreamUsingCustomAuth' => 8, 'DbLiveStreamUser' => 9, 'DbLiveStreamPass' => 10, 'DbLinked' => 11, 'DbIsLinkable' => 12, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbUrl' => 2, 'dbGenre' => 3, 'dbDescription' => 4, 'dbColor' => 5, 'dbBackgroundColor' => 6, 'dbLiveStreamUsingAirtimeAuth' => 7, 'dbLiveStreamUsingCustomAuth' => 8, 'dbLiveStreamUser' => 9, 'dbLiveStreamPass' => 10, 'dbLinked' => 11, 'dbIsLinkable' => 12, ),
- 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, self::LIVE_STREAM_USING_AIRTIME_AUTH => 7, self::LIVE_STREAM_USING_CUSTOM_AUTH => 8, self::LIVE_STREAM_USER => 9, self::LIVE_STREAM_PASS => 10, self::LINKED => 11, self::IS_LINKABLE => 12, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'URL' => 2, 'GENRE' => 3, 'DESCRIPTION' => 4, 'COLOR' => 5, 'BACKGROUND_COLOR' => 6, 'LIVE_STREAM_USING_AIRTIME_AUTH' => 7, 'LIVE_STREAM_USING_CUSTOM_AUTH' => 8, 'LIVE_STREAM_USER' => 9, 'LIVE_STREAM_PASS' => 10, 'LINKED' => 11, 'IS_LINKABLE' => 12, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'url' => 2, 'genre' => 3, 'description' => 4, 'color' => 5, 'background_color' => 6, 'live_stream_using_airtime_auth' => 7, 'live_stream_using_custom_auth' => 8, 'live_stream_user' => 9, 'live_stream_pass' => 10, 'linked' => 11, 'is_linkable' => 12, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
- );
-
- /**
- * 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);
- $criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH);
- $criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH);
- $criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_USER);
- $criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_PASS);
- $criteria->addSelectColumn(CcShowPeer::LINKED);
- $criteria->addSelectColumn(CcShowPeer::IS_LINKABLE);
- } 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');
- $criteria->addSelectColumn($alias . '.LIVE_STREAM_USING_AIRTIME_AUTH');
- $criteria->addSelectColumn($alias . '.LIVE_STREAM_USING_CUSTOM_AUTH');
- $criteria->addSelectColumn($alias . '.LIVE_STREAM_USER');
- $criteria->addSelectColumn($alias . '.LIVE_STREAM_PASS');
- $criteria->addSelectColumn($alias . '.LINKED');
- $criteria->addSelectColumn($alias . '.IS_LINKABLE');
- }
- }
-
- /**
- * 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;
- }
+abstract class BaseCcShowPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_show';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcShow';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcShowTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 13;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 13;
+
+ /** the column name for the id field */
+ const ID = 'cc_show.id';
+
+ /** the column name for the name field */
+ const NAME = 'cc_show.name';
+
+ /** the column name for the url field */
+ const URL = 'cc_show.url';
+
+ /** the column name for the genre field */
+ const GENRE = 'cc_show.genre';
+
+ /** the column name for the description field */
+ const DESCRIPTION = 'cc_show.description';
+
+ /** the column name for the color field */
+ const COLOR = 'cc_show.color';
+
+ /** the column name for the background_color field */
+ const BACKGROUND_COLOR = 'cc_show.background_color';
+
+ /** the column name for the live_stream_using_airtime_auth field */
+ const LIVE_STREAM_USING_AIRTIME_AUTH = 'cc_show.live_stream_using_airtime_auth';
+
+ /** the column name for the live_stream_using_custom_auth field */
+ const LIVE_STREAM_USING_CUSTOM_AUTH = 'cc_show.live_stream_using_custom_auth';
+
+ /** the column name for the live_stream_user field */
+ const LIVE_STREAM_USER = 'cc_show.live_stream_user';
+
+ /** the column name for the live_stream_pass field */
+ const LIVE_STREAM_PASS = 'cc_show.live_stream_pass';
+
+ /** the column name for the linked field */
+ const LINKED = 'cc_show.linked';
+
+ /** the column name for the is_linkable field */
+ const IS_LINKABLE = 'cc_show.is_linkable';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcShow objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcShow[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcShowPeer::$fieldNames[CcShowPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbUrl', 'DbGenre', 'DbDescription', 'DbColor', 'DbBackgroundColor', 'DbLiveStreamUsingAirtimeAuth', 'DbLiveStreamUsingCustomAuth', 'DbLiveStreamUser', 'DbLiveStreamPass', 'DbLinked', 'DbIsLinkable', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbUrl', 'dbGenre', 'dbDescription', 'dbColor', 'dbBackgroundColor', 'dbLiveStreamUsingAirtimeAuth', 'dbLiveStreamUsingCustomAuth', 'dbLiveStreamUser', 'dbLiveStreamPass', 'dbLinked', 'dbIsLinkable', ),
+ BasePeer::TYPE_COLNAME => array (CcShowPeer::ID, CcShowPeer::NAME, CcShowPeer::URL, CcShowPeer::GENRE, CcShowPeer::DESCRIPTION, CcShowPeer::COLOR, CcShowPeer::BACKGROUND_COLOR, CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH, CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH, CcShowPeer::LIVE_STREAM_USER, CcShowPeer::LIVE_STREAM_PASS, CcShowPeer::LINKED, CcShowPeer::IS_LINKABLE, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'URL', 'GENRE', 'DESCRIPTION', 'COLOR', 'BACKGROUND_COLOR', 'LIVE_STREAM_USING_AIRTIME_AUTH', 'LIVE_STREAM_USING_CUSTOM_AUTH', 'LIVE_STREAM_USER', 'LIVE_STREAM_PASS', 'LINKED', 'IS_LINKABLE', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'url', 'genre', 'description', 'color', 'background_color', 'live_stream_using_airtime_auth', 'live_stream_using_custom_auth', 'live_stream_user', 'live_stream_pass', 'linked', 'is_linkable', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. CcShowPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbUrl' => 2, 'DbGenre' => 3, 'DbDescription' => 4, 'DbColor' => 5, 'DbBackgroundColor' => 6, 'DbLiveStreamUsingAirtimeAuth' => 7, 'DbLiveStreamUsingCustomAuth' => 8, 'DbLiveStreamUser' => 9, 'DbLiveStreamPass' => 10, 'DbLinked' => 11, 'DbIsLinkable' => 12, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbUrl' => 2, 'dbGenre' => 3, 'dbDescription' => 4, 'dbColor' => 5, 'dbBackgroundColor' => 6, 'dbLiveStreamUsingAirtimeAuth' => 7, 'dbLiveStreamUsingCustomAuth' => 8, 'dbLiveStreamUser' => 9, 'dbLiveStreamPass' => 10, 'dbLinked' => 11, 'dbIsLinkable' => 12, ),
+ BasePeer::TYPE_COLNAME => array (CcShowPeer::ID => 0, CcShowPeer::NAME => 1, CcShowPeer::URL => 2, CcShowPeer::GENRE => 3, CcShowPeer::DESCRIPTION => 4, CcShowPeer::COLOR => 5, CcShowPeer::BACKGROUND_COLOR => 6, CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH => 7, CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH => 8, CcShowPeer::LIVE_STREAM_USER => 9, CcShowPeer::LIVE_STREAM_PASS => 10, CcShowPeer::LINKED => 11, CcShowPeer::IS_LINKABLE => 12, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'URL' => 2, 'GENRE' => 3, 'DESCRIPTION' => 4, 'COLOR' => 5, 'BACKGROUND_COLOR' => 6, 'LIVE_STREAM_USING_AIRTIME_AUTH' => 7, 'LIVE_STREAM_USING_CUSTOM_AUTH' => 8, 'LIVE_STREAM_USER' => 9, 'LIVE_STREAM_PASS' => 10, 'LINKED' => 11, 'IS_LINKABLE' => 12, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'url' => 2, 'genre' => 3, 'description' => 4, 'color' => 5, 'background_color' => 6, 'live_stream_using_airtime_auth' => 7, 'live_stream_using_custom_auth' => 8, 'live_stream_user' => 9, 'live_stream_pass' => 10, 'linked' => 11, 'is_linkable' => 12, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
+ );
+
+ /**
+ * 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcShowPeer::getFieldNames($toType);
+ $key = isset(CcShowPeer::$fieldKeys[$fromType][$name]) ? CcShowPeer::$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(CcShowPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcShowPeer::$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 CcShowPeer::$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);
+ $criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH);
+ $criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH);
+ $criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_USER);
+ $criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_PASS);
+ $criteria->addSelectColumn(CcShowPeer::LINKED);
+ $criteria->addSelectColumn(CcShowPeer::IS_LINKABLE);
+ } 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');
+ $criteria->addSelectColumn($alias . '.live_stream_using_airtime_auth');
+ $criteria->addSelectColumn($alias . '.live_stream_using_custom_auth');
+ $criteria->addSelectColumn($alias . '.live_stream_user');
+ $criteria->addSelectColumn($alias . '.live_stream_pass');
+ $criteria->addSelectColumn($alias . '.linked');
+ $criteria->addSelectColumn($alias . '.is_linkable');
+ }
+ }
+
+ /**
+ * 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(CcShowPeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcShowPeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcShowPeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcShowPeer::$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(CcShowPeer::$instances[$key])) {
+ return CcShowPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcShowPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcShowPeer::$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();
+ // 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_HYDRATE_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(CcShowPeer::DATABASE_NAME)->getTable(CcShowPeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcShowPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcShowPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcShowPeer::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(CcShowPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_show table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcShowPeer::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(CcShowPeer::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 (Exception $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($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->hasColumn($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
+ * @return CcShow[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcShowQuery.php
index 687335e03..e9e7b1fc1 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowQuery.php
@@ -4,726 +4,973 @@
/**
* Base class that represents a query for the 'cc_show' table.
*
- *
*
- * @method CcShowQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcShowQuery orderByDbName($order = Criteria::ASC) Order by the name column
- * @method CcShowQuery orderByDbUrl($order = Criteria::ASC) Order by the url column
- * @method CcShowQuery orderByDbGenre($order = Criteria::ASC) Order by the genre column
- * @method CcShowQuery orderByDbDescription($order = Criteria::ASC) Order by the description column
- * @method CcShowQuery orderByDbColor($order = Criteria::ASC) Order by the color column
- * @method CcShowQuery orderByDbBackgroundColor($order = Criteria::ASC) Order by the background_color column
- * @method CcShowQuery orderByDbLiveStreamUsingAirtimeAuth($order = Criteria::ASC) Order by the live_stream_using_airtime_auth column
- * @method CcShowQuery orderByDbLiveStreamUsingCustomAuth($order = Criteria::ASC) Order by the live_stream_using_custom_auth column
- * @method CcShowQuery orderByDbLiveStreamUser($order = Criteria::ASC) Order by the live_stream_user column
- * @method CcShowQuery orderByDbLiveStreamPass($order = Criteria::ASC) Order by the live_stream_pass column
- * @method CcShowQuery orderByDbLinked($order = Criteria::ASC) Order by the linked column
- * @method CcShowQuery orderByDbIsLinkable($order = Criteria::ASC) Order by the is_linkable column
*
- * @method CcShowQuery groupByDbId() Group by the id column
- * @method CcShowQuery groupByDbName() Group by the name column
- * @method CcShowQuery groupByDbUrl() Group by the url column
- * @method CcShowQuery groupByDbGenre() Group by the genre column
- * @method CcShowQuery groupByDbDescription() Group by the description column
- * @method CcShowQuery groupByDbColor() Group by the color column
- * @method CcShowQuery groupByDbBackgroundColor() Group by the background_color column
- * @method CcShowQuery groupByDbLiveStreamUsingAirtimeAuth() Group by the live_stream_using_airtime_auth column
- * @method CcShowQuery groupByDbLiveStreamUsingCustomAuth() Group by the live_stream_using_custom_auth column
- * @method CcShowQuery groupByDbLiveStreamUser() Group by the live_stream_user column
- * @method CcShowQuery groupByDbLiveStreamPass() Group by the live_stream_pass column
- * @method CcShowQuery groupByDbLinked() Group by the linked column
- * @method CcShowQuery groupByDbIsLinkable() Group by the is_linkable column
+ * @method CcShowQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcShowQuery orderByDbName($order = Criteria::ASC) Order by the name column
+ * @method CcShowQuery orderByDbUrl($order = Criteria::ASC) Order by the url column
+ * @method CcShowQuery orderByDbGenre($order = Criteria::ASC) Order by the genre column
+ * @method CcShowQuery orderByDbDescription($order = Criteria::ASC) Order by the description column
+ * @method CcShowQuery orderByDbColor($order = Criteria::ASC) Order by the color column
+ * @method CcShowQuery orderByDbBackgroundColor($order = Criteria::ASC) Order by the background_color column
+ * @method CcShowQuery orderByDbLiveStreamUsingAirtimeAuth($order = Criteria::ASC) Order by the live_stream_using_airtime_auth column
+ * @method CcShowQuery orderByDbLiveStreamUsingCustomAuth($order = Criteria::ASC) Order by the live_stream_using_custom_auth column
+ * @method CcShowQuery orderByDbLiveStreamUser($order = Criteria::ASC) Order by the live_stream_user column
+ * @method CcShowQuery orderByDbLiveStreamPass($order = Criteria::ASC) Order by the live_stream_pass column
+ * @method CcShowQuery orderByDbLinked($order = Criteria::ASC) Order by the linked column
+ * @method CcShowQuery orderByDbIsLinkable($order = Criteria::ASC) Order by the is_linkable column
*
- * @method CcShowQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcShowQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcShowQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcShowQuery groupByDbId() Group by the id column
+ * @method CcShowQuery groupByDbName() Group by the name column
+ * @method CcShowQuery groupByDbUrl() Group by the url column
+ * @method CcShowQuery groupByDbGenre() Group by the genre column
+ * @method CcShowQuery groupByDbDescription() Group by the description column
+ * @method CcShowQuery groupByDbColor() Group by the color column
+ * @method CcShowQuery groupByDbBackgroundColor() Group by the background_color column
+ * @method CcShowQuery groupByDbLiveStreamUsingAirtimeAuth() Group by the live_stream_using_airtime_auth column
+ * @method CcShowQuery groupByDbLiveStreamUsingCustomAuth() Group by the live_stream_using_custom_auth column
+ * @method CcShowQuery groupByDbLiveStreamUser() Group by the live_stream_user column
+ * @method CcShowQuery groupByDbLiveStreamPass() Group by the live_stream_pass column
+ * @method CcShowQuery groupByDbLinked() Group by the linked column
+ * @method CcShowQuery groupByDbIsLinkable() Group by the is_linkable column
*
- * @method CcShowQuery leftJoinCcShowInstances($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowInstances relation
- * @method CcShowQuery rightJoinCcShowInstances($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowInstances relation
- * @method CcShowQuery innerJoinCcShowInstances($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowInstances relation
+ * @method CcShowQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcShowQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcShowQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcShowQuery leftJoinCcShowDays($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowDays relation
- * @method CcShowQuery rightJoinCcShowDays($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowDays relation
- * @method CcShowQuery innerJoinCcShowDays($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowDays relation
+ * @method CcShowQuery leftJoinCcShowInstances($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcShowInstances relation
+ * @method CcShowQuery rightJoinCcShowInstances($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcShowInstances relation
+ * @method CcShowQuery innerJoinCcShowInstances($relationAlias = null) Adds a INNER JOIN clause to the query using the CcShowInstances relation
*
- * @method CcShowQuery leftJoinCcShowRebroadcast($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowRebroadcast relation
- * @method CcShowQuery rightJoinCcShowRebroadcast($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowRebroadcast relation
- * @method CcShowQuery innerJoinCcShowRebroadcast($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowRebroadcast relation
+ * @method CcShowQuery leftJoinCcShowDays($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcShowDays relation
+ * @method CcShowQuery rightJoinCcShowDays($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcShowDays relation
+ * @method CcShowQuery innerJoinCcShowDays($relationAlias = null) Adds a INNER JOIN clause to the query using the CcShowDays relation
*
- * @method CcShowQuery leftJoinCcShowHosts($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowHosts relation
- * @method CcShowQuery rightJoinCcShowHosts($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowHosts relation
- * @method CcShowQuery innerJoinCcShowHosts($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowHosts relation
+ * @method CcShowQuery leftJoinCcShowRebroadcast($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcShowRebroadcast relation
+ * @method CcShowQuery rightJoinCcShowRebroadcast($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcShowRebroadcast relation
+ * @method CcShowQuery innerJoinCcShowRebroadcast($relationAlias = null) Adds a INNER JOIN clause to the query using the CcShowRebroadcast relation
*
- * @method CcShow findOne(PropelPDO $con = null) Return the first CcShow matching the query
- * @method CcShow findOneOrCreate(PropelPDO $con = null) Return the first CcShow matching the query, or a new CcShow object populated from the query conditions when no match is found
+ * @method CcShowQuery leftJoinCcShowHosts($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcShowHosts relation
+ * @method CcShowQuery rightJoinCcShowHosts($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcShowHosts relation
+ * @method CcShowQuery innerJoinCcShowHosts($relationAlias = null) Adds a INNER JOIN clause to the query using the CcShowHosts relation
*
- * @method CcShow findOneByDbId(int $id) Return the first CcShow filtered by the id column
- * @method CcShow findOneByDbName(string $name) Return the first CcShow filtered by the name column
- * @method CcShow findOneByDbUrl(string $url) Return the first CcShow filtered by the url column
- * @method CcShow findOneByDbGenre(string $genre) Return the first CcShow filtered by the genre column
- * @method CcShow findOneByDbDescription(string $description) Return the first CcShow filtered by the description column
- * @method CcShow findOneByDbColor(string $color) Return the first CcShow filtered by the color column
- * @method CcShow findOneByDbBackgroundColor(string $background_color) Return the first CcShow filtered by the background_color column
- * @method CcShow findOneByDbLiveStreamUsingAirtimeAuth(boolean $live_stream_using_airtime_auth) Return the first CcShow filtered by the live_stream_using_airtime_auth column
- * @method CcShow findOneByDbLiveStreamUsingCustomAuth(boolean $live_stream_using_custom_auth) Return the first CcShow filtered by the live_stream_using_custom_auth column
- * @method CcShow findOneByDbLiveStreamUser(string $live_stream_user) Return the first CcShow filtered by the live_stream_user column
- * @method CcShow findOneByDbLiveStreamPass(string $live_stream_pass) Return the first CcShow filtered by the live_stream_pass column
- * @method CcShow findOneByDbLinked(boolean $linked) Return the first CcShow filtered by the linked column
- * @method CcShow findOneByDbIsLinkable(boolean $is_linkable) Return the first CcShow filtered by the is_linkable column
+ * @method CcShow findOne(PropelPDO $con = null) Return the first CcShow matching the query
+ * @method CcShow findOneOrCreate(PropelPDO $con = null) Return the first CcShow matching the query, or a new CcShow object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcShow objects filtered by the id column
- * @method array findByDbName(string $name) Return CcShow objects filtered by the name column
- * @method array findByDbUrl(string $url) Return CcShow objects filtered by the url column
- * @method array findByDbGenre(string $genre) Return CcShow objects filtered by the genre column
- * @method array findByDbDescription(string $description) Return CcShow objects filtered by the description column
- * @method array findByDbColor(string $color) Return CcShow objects filtered by the color column
- * @method array findByDbBackgroundColor(string $background_color) Return CcShow objects filtered by the background_color column
- * @method array findByDbLiveStreamUsingAirtimeAuth(boolean $live_stream_using_airtime_auth) Return CcShow objects filtered by the live_stream_using_airtime_auth column
- * @method array findByDbLiveStreamUsingCustomAuth(boolean $live_stream_using_custom_auth) Return CcShow objects filtered by the live_stream_using_custom_auth column
- * @method array findByDbLiveStreamUser(string $live_stream_user) Return CcShow objects filtered by the live_stream_user column
- * @method array findByDbLiveStreamPass(string $live_stream_pass) Return CcShow objects filtered by the live_stream_pass column
- * @method array findByDbLinked(boolean $linked) Return CcShow objects filtered by the linked column
- * @method array findByDbIsLinkable(boolean $is_linkable) Return CcShow objects filtered by the is_linkable column
+ * @method CcShow findOneByDbName(string $name) Return the first CcShow filtered by the name column
+ * @method CcShow findOneByDbUrl(string $url) Return the first CcShow filtered by the url column
+ * @method CcShow findOneByDbGenre(string $genre) Return the first CcShow filtered by the genre column
+ * @method CcShow findOneByDbDescription(string $description) Return the first CcShow filtered by the description column
+ * @method CcShow findOneByDbColor(string $color) Return the first CcShow filtered by the color column
+ * @method CcShow findOneByDbBackgroundColor(string $background_color) Return the first CcShow filtered by the background_color column
+ * @method CcShow findOneByDbLiveStreamUsingAirtimeAuth(boolean $live_stream_using_airtime_auth) Return the first CcShow filtered by the live_stream_using_airtime_auth column
+ * @method CcShow findOneByDbLiveStreamUsingCustomAuth(boolean $live_stream_using_custom_auth) Return the first CcShow filtered by the live_stream_using_custom_auth column
+ * @method CcShow findOneByDbLiveStreamUser(string $live_stream_user) Return the first CcShow filtered by the live_stream_user column
+ * @method CcShow findOneByDbLiveStreamPass(string $live_stream_pass) Return the first CcShow filtered by the live_stream_pass column
+ * @method CcShow findOneByDbLinked(boolean $linked) Return the first CcShow filtered by the linked column
+ * @method CcShow findOneByDbIsLinkable(boolean $is_linkable) Return the first CcShow filtered by the is_linkable column
+ *
+ * @method array findByDbId(int $id) Return CcShow objects filtered by the id column
+ * @method array findByDbName(string $name) Return CcShow objects filtered by the name column
+ * @method array findByDbUrl(string $url) Return CcShow objects filtered by the url column
+ * @method array findByDbGenre(string $genre) Return CcShow objects filtered by the genre column
+ * @method array findByDbDescription(string $description) Return CcShow objects filtered by the description column
+ * @method array findByDbColor(string $color) Return CcShow objects filtered by the color column
+ * @method array findByDbBackgroundColor(string $background_color) Return CcShow objects filtered by the background_color column
+ * @method array findByDbLiveStreamUsingAirtimeAuth(boolean $live_stream_using_airtime_auth) Return CcShow objects filtered by the live_stream_using_airtime_auth column
+ * @method array findByDbLiveStreamUsingCustomAuth(boolean $live_stream_using_custom_auth) Return CcShow objects filtered by the live_stream_using_custom_auth column
+ * @method array findByDbLiveStreamUser(string $live_stream_user) Return CcShow objects filtered by the live_stream_user column
+ * @method array findByDbLiveStreamPass(string $live_stream_pass) Return CcShow objects filtered by the live_stream_pass column
+ * @method array findByDbLinked(boolean $linked) Return CcShow objects filtered by the linked column
+ * @method array findByDbIsLinkable(boolean $is_linkable) Return CcShow objects filtered by the is_linkable column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcShowQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcShowQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcShow';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcShowQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcShow', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcShowQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcShowQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcShowQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcShowQuery) {
+ return $criteria;
+ }
+ $query = new CcShowQuery(null, null, $modelAlias);
- /**
- * Returns a new CcShowQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcShowQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcShowQuery) {
- return $criteria;
- }
- $query = new CcShowQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcShow|CcShow[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcShowPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcShowPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $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);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcShow A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcShow A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "name", "url", "genre", "description", "color", "background_color", "live_stream_using_airtime_auth", "live_stream_using_custom_auth", "live_stream_user", "live_stream_pass", "linked", "is_linkable" FROM "cc_show" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcShow();
+ $obj->hydrate($row);
+ CcShowPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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);
- }
+ return $obj;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcShow|CcShow[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * 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);
- }
+ /**
+ * 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|CcShow[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * 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 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)
+ {
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcShowPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * Filter the query on the live_stream_using_airtime_auth column
- *
- * @param boolean|string $dbLiveStreamUsingAirtimeAuth 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 CcShowQuery The current query, for fluid interface
- */
- public function filterByDbLiveStreamUsingAirtimeAuth($dbLiveStreamUsingAirtimeAuth = null, $comparison = null)
- {
- if (is_string($dbLiveStreamUsingAirtimeAuth)) {
- $live_stream_using_airtime_auth = in_array(strtolower($dbLiveStreamUsingAirtimeAuth), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
- }
- return $this->addUsingAlias(CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH, $dbLiveStreamUsingAirtimeAuth, $comparison);
- }
+ /**
+ * 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)
+ {
- /**
- * Filter the query on the live_stream_using_custom_auth column
- *
- * @param boolean|string $dbLiveStreamUsingCustomAuth 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 CcShowQuery The current query, for fluid interface
- */
- public function filterByDbLiveStreamUsingCustomAuth($dbLiveStreamUsingCustomAuth = null, $comparison = null)
- {
- if (is_string($dbLiveStreamUsingCustomAuth)) {
- $live_stream_using_custom_auth = in_array(strtolower($dbLiveStreamUsingCustomAuth), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
- }
- return $this->addUsingAlias(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH, $dbLiveStreamUsingCustomAuth, $comparison);
- }
+ return $this->addUsingAlias(CcShowPeer::ID, $keys, Criteria::IN);
+ }
- /**
- * Filter the query on the live_stream_user column
- *
- * @param string $dbLiveStreamUser 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 filterByDbLiveStreamUser($dbLiveStreamUser = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbLiveStreamUser)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbLiveStreamUser)) {
- $dbLiveStreamUser = str_replace('*', '%', $dbLiveStreamUser);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcShowPeer::LIVE_STREAM_USER, $dbLiveStreamUser, $comparison);
- }
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcShowPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcShowPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * Filter the query on the live_stream_pass column
- *
- * @param string $dbLiveStreamPass 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 filterByDbLiveStreamPass($dbLiveStreamPass = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbLiveStreamPass)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbLiveStreamPass)) {
- $dbLiveStreamPass = str_replace('*', '%', $dbLiveStreamPass);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcShowPeer::LIVE_STREAM_PASS, $dbLiveStreamPass, $comparison);
- }
+ return $this->addUsingAlias(CcShowPeer::ID, $dbId, $comparison);
+ }
- /**
- * Filter the query on the linked column
- *
- * @param boolean|string $dbLinked 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 CcShowQuery The current query, for fluid interface
- */
- public function filterByDbLinked($dbLinked = null, $comparison = null)
- {
- if (is_string($dbLinked)) {
- $linked = in_array(strtolower($dbLinked), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
- }
- return $this->addUsingAlias(CcShowPeer::LINKED, $dbLinked, $comparison);
- }
+ /**
+ * Filter the query on the name column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbName('fooValue'); // WHERE name = 'fooValue'
+ * $query->filterByDbName('%fooValue%'); // WHERE name LIKE '%fooValue%'
+ *
+ *
+ * @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;
+ }
+ }
- /**
- * Filter the query on the is_linkable column
- *
- * @param boolean|string $dbIsLinkable 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 CcShowQuery The current query, for fluid interface
- */
- public function filterByDbIsLinkable($dbIsLinkable = null, $comparison = null)
- {
- if (is_string($dbIsLinkable)) {
- $is_linkable = in_array(strtolower($dbIsLinkable), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
- }
- return $this->addUsingAlias(CcShowPeer::IS_LINKABLE, $dbIsLinkable, $comparison);
- }
+ return $this->addUsingAlias(CcShowPeer::NAME, $dbName, $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);
- }
+ /**
+ * Filter the query on the url column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbUrl('fooValue'); // WHERE url = 'fooValue'
+ * $query->filterByDbUrl('%fooValue%'); // WHERE url LIKE '%fooValue%'
+ *
+ *
+ * @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;
+ }
+ }
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcShowPeer::URL, $dbUrl, $comparison);
+ }
- /**
- * 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 on the genre column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbGenre('fooValue'); // WHERE genre = 'fooValue'
+ * $query->filterByDbGenre('%fooValue%'); // WHERE genre LIKE '%fooValue%'
+ *
+ *
+ * @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;
+ }
+ }
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcShowPeer::GENRE, $dbGenre, $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;
- }
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDbDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @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;
+ }
+ }
- /**
- * 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');
- }
+ return $this->addUsingAlias(CcShowPeer::DESCRIPTION, $dbDescription, $comparison);
+ }
- /**
- * 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);
- }
+ /**
+ * Filter the query on the color column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbColor('fooValue'); // WHERE color = 'fooValue'
+ * $query->filterByDbColor('%fooValue%'); // WHERE color LIKE '%fooValue%'
+ *
+ *
+ * @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;
+ }
+ }
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcShowPeer::COLOR, $dbColor, $comparison);
+ }
- /**
- * 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 on the background_color column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbBackgroundColor('fooValue'); // WHERE background_color = 'fooValue'
+ * $query->filterByDbBackgroundColor('%fooValue%'); // WHERE background_color LIKE '%fooValue%'
+ *
+ *
+ * @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;
+ }
+ }
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcShowPeer::BACKGROUND_COLOR, $dbBackgroundColor, $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;
- }
+ /**
+ * Filter the query on the live_stream_using_airtime_auth column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLiveStreamUsingAirtimeAuth(true); // WHERE live_stream_using_airtime_auth = true
+ * $query->filterByDbLiveStreamUsingAirtimeAuth('yes'); // WHERE live_stream_using_airtime_auth = true
+ *
+ *
+ * @param boolean|string $dbLiveStreamUsingAirtimeAuth The value to use as filter.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcShowQuery The current query, for fluid interface
+ */
+ public function filterByDbLiveStreamUsingAirtimeAuth($dbLiveStreamUsingAirtimeAuth = null, $comparison = null)
+ {
+ if (is_string($dbLiveStreamUsingAirtimeAuth)) {
+ $dbLiveStreamUsingAirtimeAuth = in_array(strtolower($dbLiveStreamUsingAirtimeAuth), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
- /**
- * 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');
- }
+ return $this->addUsingAlias(CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH, $dbLiveStreamUsingAirtimeAuth, $comparison);
+ }
- /**
- * 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;
- }
+ /**
+ * Filter the query on the live_stream_using_custom_auth column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLiveStreamUsingCustomAuth(true); // WHERE live_stream_using_custom_auth = true
+ * $query->filterByDbLiveStreamUsingCustomAuth('yes'); // WHERE live_stream_using_custom_auth = true
+ *
+ *
+ * @param boolean|string $dbLiveStreamUsingCustomAuth The value to use as filter.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcShowQuery The current query, for fluid interface
+ */
+ public function filterByDbLiveStreamUsingCustomAuth($dbLiveStreamUsingCustomAuth = null, $comparison = null)
+ {
+ if (is_string($dbLiveStreamUsingCustomAuth)) {
+ $dbLiveStreamUsingCustomAuth = in_array(strtolower($dbLiveStreamUsingCustomAuth), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
-} // BaseCcShowQuery
+ return $this->addUsingAlias(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH, $dbLiveStreamUsingCustomAuth, $comparison);
+ }
+
+ /**
+ * Filter the query on the live_stream_user column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLiveStreamUser('fooValue'); // WHERE live_stream_user = 'fooValue'
+ * $query->filterByDbLiveStreamUser('%fooValue%'); // WHERE live_stream_user LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbLiveStreamUser 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 filterByDbLiveStreamUser($dbLiveStreamUser = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbLiveStreamUser)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbLiveStreamUser)) {
+ $dbLiveStreamUser = str_replace('*', '%', $dbLiveStreamUser);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcShowPeer::LIVE_STREAM_USER, $dbLiveStreamUser, $comparison);
+ }
+
+ /**
+ * Filter the query on the live_stream_pass column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLiveStreamPass('fooValue'); // WHERE live_stream_pass = 'fooValue'
+ * $query->filterByDbLiveStreamPass('%fooValue%'); // WHERE live_stream_pass LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbLiveStreamPass 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 filterByDbLiveStreamPass($dbLiveStreamPass = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbLiveStreamPass)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbLiveStreamPass)) {
+ $dbLiveStreamPass = str_replace('*', '%', $dbLiveStreamPass);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcShowPeer::LIVE_STREAM_PASS, $dbLiveStreamPass, $comparison);
+ }
+
+ /**
+ * Filter the query on the linked column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLinked(true); // WHERE linked = true
+ * $query->filterByDbLinked('yes'); // WHERE linked = true
+ *
+ *
+ * @param boolean|string $dbLinked The value to use as filter.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcShowQuery The current query, for fluid interface
+ */
+ public function filterByDbLinked($dbLinked = null, $comparison = null)
+ {
+ if (is_string($dbLinked)) {
+ $dbLinked = in_array(strtolower($dbLinked), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
+
+ return $this->addUsingAlias(CcShowPeer::LINKED, $dbLinked, $comparison);
+ }
+
+ /**
+ * Filter the query on the is_linkable column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbIsLinkable(true); // WHERE is_linkable = true
+ * $query->filterByDbIsLinkable('yes'); // WHERE is_linkable = true
+ *
+ *
+ * @param boolean|string $dbIsLinkable The value to use as filter.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcShowQuery The current query, for fluid interface
+ */
+ public function filterByDbIsLinkable($dbIsLinkable = null, $comparison = null)
+ {
+ if (is_string($dbIsLinkable)) {
+ $dbIsLinkable = in_array(strtolower($dbIsLinkable), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
+
+ return $this->addUsingAlias(CcShowPeer::IS_LINKABLE, $dbIsLinkable, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcShowInstances object
+ *
+ * @param CcShowInstances|PropelObjectCollection $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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcShowInstances($ccShowInstances, $comparison = null)
+ {
+ if ($ccShowInstances instanceof CcShowInstances) {
+ return $this
+ ->addUsingAlias(CcShowPeer::ID, $ccShowInstances->getDbShowId(), $comparison);
+ } elseif ($ccShowInstances instanceof PropelObjectCollection) {
+ return $this
+ ->useCcShowInstancesQuery()
+ ->filterByPrimaryKeys($ccShowInstances->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcShowInstances() only accepts arguments of type CcShowInstances or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcShowInstances($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcShowInstances', 'CcShowInstancesQuery');
+ }
+
+ /**
+ * Filter the query by a related CcShowDays object
+ *
+ * @param CcShowDays|PropelObjectCollection $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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcShowDays($ccShowDays, $comparison = null)
+ {
+ if ($ccShowDays instanceof CcShowDays) {
+ return $this
+ ->addUsingAlias(CcShowPeer::ID, $ccShowDays->getDbShowId(), $comparison);
+ } elseif ($ccShowDays instanceof PropelObjectCollection) {
+ return $this
+ ->useCcShowDaysQuery()
+ ->filterByPrimaryKeys($ccShowDays->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcShowDays() only accepts arguments of type CcShowDays or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcShowDays($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcShowDays', 'CcShowDaysQuery');
+ }
+
+ /**
+ * Filter the query by a related CcShowRebroadcast object
+ *
+ * @param CcShowRebroadcast|PropelObjectCollection $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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcShowRebroadcast($ccShowRebroadcast, $comparison = null)
+ {
+ if ($ccShowRebroadcast instanceof CcShowRebroadcast) {
+ return $this
+ ->addUsingAlias(CcShowPeer::ID, $ccShowRebroadcast->getDbShowId(), $comparison);
+ } elseif ($ccShowRebroadcast instanceof PropelObjectCollection) {
+ return $this
+ ->useCcShowRebroadcastQuery()
+ ->filterByPrimaryKeys($ccShowRebroadcast->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcShowRebroadcast() only accepts arguments of type CcShowRebroadcast or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcShowRebroadcast($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcShowRebroadcast', 'CcShowRebroadcastQuery');
+ }
+
+ /**
+ * Filter the query by a related CcShowHosts object
+ *
+ * @param CcShowHosts|PropelObjectCollection $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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcShowHosts($ccShowHosts, $comparison = null)
+ {
+ if ($ccShowHosts instanceof CcShowHosts) {
+ return $this
+ ->addUsingAlias(CcShowPeer::ID, $ccShowHosts->getDbShow(), $comparison);
+ } elseif ($ccShowHosts instanceof PropelObjectCollection) {
+ return $this
+ ->useCcShowHostsQuery()
+ ->filterByPrimaryKeys($ccShowHosts->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcShowHosts() only accepts arguments of type CcShowHosts or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $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;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowRebroadcast.php b/airtime_mvc/application/models/airtime/om/BaseCcShowRebroadcast.php
index aabd37d79..efbeba873 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowRebroadcast.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowRebroadcast.php
@@ -4,954 +4,1074 @@
/**
* Base class that represents a row from the 'cc_show_rebroadcast' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcShowRebroadcast extends BaseObject implements Persistent
+abstract class BaseCcShowRebroadcast extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcShowRebroadcastPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcShowRebroadcastPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the day_offset field.
- * @var string
- */
- protected $day_offset;
-
- /**
- * The value for the start_time field.
- * @var string
- */
- protected $start_time;
-
- /**
- * The value for the show_id field.
- * @var int
- */
- protected $show_id;
-
- /**
- * @var CcShow
- */
- protected $aCcShow;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Get the [id] column value.
- *
- * @return int
- */
- public function getDbId()
- {
- return $this->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
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcShowRebroadcastPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcShowRebroadcastPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the day_offset field.
+ * @var string
+ */
+ protected $day_offset;
+
+ /**
+ * The value for the start_time field.
+ * @var string
+ */
+ protected $start_time;
+
+ /**
+ * The value for the show_id field.
+ * @var int
+ */
+ protected $show_id;
+
+ /**
+ * @var CcShow
+ */
+ protected $aCcShow;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getDbId()
+ {
+
+ return $this->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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ 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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 strings are treated as null.
+ * @return CcShowRebroadcast The current object (for fluent API support)
+ */
+ public function setDbStartTime($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->start_time !== null || $dt !== null) {
+ $currentDateAsString = ($this->start_time !== null && $tmpDt = new DateTime($this->start_time)) ? $tmpDt->format('H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->start_time = $newDateAsString;
+ $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 && is_numeric($v)) {
+ $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 resultset 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();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 4; // 4 = CcShowRebroadcastPeer::NUM_HYDRATE_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
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcShowRebroadcastQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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 (Exception $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 corresponding 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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcShowRebroadcastPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcShowRebroadcastPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_show_rebroadcast_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcShowRebroadcastPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcShowRebroadcastPeer::DAY_OFFSET)) {
+ $modifiedColumns[':p' . $index++] = '"day_offset"';
+ }
+ if ($this->isColumnModified(CcShowRebroadcastPeer::START_TIME)) {
+ $modifiedColumns[':p' . $index++] = '"start_time"';
+ }
+ if ($this->isColumnModified(CcShowRebroadcastPeer::SHOW_ID)) {
+ $modifiedColumns[':p' . $index++] = '"show_id"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_show_rebroadcast" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"day_offset"':
+ $stmt->bindValue($identifier, $this->day_offset, PDO::PARAM_STR);
+ break;
+ case '"start_time"':
+ $stmt->bindValue($identifier, $this->start_time, PDO::PARAM_STR);
+ break;
+ case '"show_id"':
+ $stmt->bindValue($identifier, $this->show_id, PDO::PARAM_INT);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcShowRebroadcast'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcShowRebroadcast'][$this->getPrimaryKey()] = true;
+ $keys = CcShowRebroadcastPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbDayOffset(),
+ $keys[2] => $this->getDbStartTime(),
+ $keys[3] => $this->getDbShowId(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcShow) {
+ $result['CcShow'] = $this->aCcShow->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcShowRebroadcastPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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 BasePeer::TYPE_PHPNAME
+ *
+ * @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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbDayOffset($this->getDbDayOffset());
+ $copyObj->setDbStartTime($this->getDbStartTime());
+ $copyObj->setDbShowId($this->getDbShowId());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcShow The associated CcShow object.
+ * @throws PropelException
+ */
+ public function getCcShow(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcShow === null && ($this->show_id !== null) && $doQuery) {
+ $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->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->aCcShow instanceof Persistent) {
+ $this->aCcShow->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ $this->aCcShow = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcShowRebroadcastPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowRebroadcastPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcShowRebroadcastPeer.php
index ef0434c70..8f5c1e883 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowRebroadcastPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowRebroadcastPeer.php
@@ -4,976 +4,1002 @@
/**
* Base static class for performing query and update operations on the 'cc_show_rebroadcast' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcShowRebroadcastPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_show_rebroadcast';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcShowRebroadcast';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcShowRebroadcast';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcShowRebroadcastTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 4;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_show_rebroadcast.ID';
-
- /** the column name for the DAY_OFFSET field */
- const DAY_OFFSET = 'cc_show_rebroadcast.DAY_OFFSET';
-
- /** the column name for the START_TIME field */
- const START_TIME = 'cc_show_rebroadcast.START_TIME';
-
- /** the column name for the SHOW_ID field */
- const SHOW_ID = 'cc_show_rebroadcast.SHOW_ID';
-
- /**
- * An identiy map to hold any loaded instances of CcShowRebroadcast objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcShowRebroadcast[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => 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;
- }
+abstract class BaseCcShowRebroadcastPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_show_rebroadcast';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcShowRebroadcast';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcShowRebroadcastTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 4;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 4;
+
+ /** the column name for the id field */
+ const ID = 'cc_show_rebroadcast.id';
+
+ /** the column name for the day_offset field */
+ const DAY_OFFSET = 'cc_show_rebroadcast.day_offset';
+
+ /** the column name for the start_time field */
+ const START_TIME = 'cc_show_rebroadcast.start_time';
+
+ /** the column name for the show_id field */
+ const SHOW_ID = 'cc_show_rebroadcast.show_id';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcShowRebroadcast objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcShowRebroadcast[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcShowRebroadcastPeer::$fieldNames[CcShowRebroadcastPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbDayOffset', 'DbStartTime', 'DbShowId', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbDayOffset', 'dbStartTime', 'dbShowId', ),
+ BasePeer::TYPE_COLNAME => array (CcShowRebroadcastPeer::ID, CcShowRebroadcastPeer::DAY_OFFSET, CcShowRebroadcastPeer::START_TIME, CcShowRebroadcastPeer::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. CcShowRebroadcastPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected 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 (CcShowRebroadcastPeer::ID => 0, CcShowRebroadcastPeer::DAY_OFFSET => 1, CcShowRebroadcastPeer::START_TIME => 2, CcShowRebroadcastPeer::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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcShowRebroadcastPeer::getFieldNames($toType);
+ $key = isset(CcShowRebroadcastPeer::$fieldKeys[$fromType][$name]) ? CcShowRebroadcastPeer::$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(CcShowRebroadcastPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcShowRebroadcastPeer::$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 CcShowRebroadcastPeer::$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(CcShowRebroadcastPeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcShowRebroadcastPeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcShowRebroadcastPeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcShowRebroadcastPeer::$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(CcShowRebroadcastPeer::$instances[$key])) {
+ return CcShowRebroadcastPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcShowRebroadcastPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcShowRebroadcastPeer::$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();
+ // 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_HYDRATE_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(CcShowRebroadcastPeer::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(CcShowRebroadcastPeer::DATABASE_NAME);
+ }
+
+ CcShowRebroadcastPeer::addSelectColumns($criteria);
+ $startcol = CcShowRebroadcastPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcShowRebroadcastPeer::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(CcShowRebroadcastPeer::DATABASE_NAME);
+ }
+
+ CcShowRebroadcastPeer::addSelectColumns($criteria);
+ $startcol2 = CcShowRebroadcastPeer::NUM_HYDRATE_COLUMNS;
+
+ CcShowPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcShowPeer::NUM_HYDRATE_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();
+
+ $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();
+
+ $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(CcShowRebroadcastPeer::DATABASE_NAME)->getTable(CcShowRebroadcastPeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcShowRebroadcastPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcShowRebroadcastPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcShowRebroadcastPeer::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(CcShowRebroadcastPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_show_rebroadcast table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcShowRebroadcastPeer::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(CcShowRebroadcastPeer::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 (Exception $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($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->hasColumn($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
+ * @return CcShowRebroadcast[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowRebroadcastQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcShowRebroadcastQuery.php
index d7fedf8e9..44ff29fed 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcShowRebroadcastQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcShowRebroadcastQuery.php
@@ -4,326 +4,481 @@
/**
* Base class that represents a query for the 'cc_show_rebroadcast' table.
*
- *
*
- * @method CcShowRebroadcastQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcShowRebroadcastQuery orderByDbDayOffset($order = Criteria::ASC) Order by the day_offset column
- * @method CcShowRebroadcastQuery orderByDbStartTime($order = Criteria::ASC) Order by the start_time column
- * @method CcShowRebroadcastQuery orderByDbShowId($order = Criteria::ASC) Order by the show_id column
*
- * @method CcShowRebroadcastQuery groupByDbId() Group by the id column
- * @method CcShowRebroadcastQuery groupByDbDayOffset() Group by the day_offset column
- * @method CcShowRebroadcastQuery groupByDbStartTime() Group by the start_time column
- * @method CcShowRebroadcastQuery groupByDbShowId() Group by the show_id column
+ * @method CcShowRebroadcastQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcShowRebroadcastQuery orderByDbDayOffset($order = Criteria::ASC) Order by the day_offset column
+ * @method CcShowRebroadcastQuery orderByDbStartTime($order = Criteria::ASC) Order by the start_time column
+ * @method CcShowRebroadcastQuery orderByDbShowId($order = Criteria::ASC) Order by the show_id column
*
- * @method CcShowRebroadcastQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcShowRebroadcastQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcShowRebroadcastQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcShowRebroadcastQuery groupByDbId() Group by the id column
+ * @method CcShowRebroadcastQuery groupByDbDayOffset() Group by the day_offset column
+ * @method CcShowRebroadcastQuery groupByDbStartTime() Group by the start_time column
+ * @method CcShowRebroadcastQuery groupByDbShowId() Group by the show_id column
*
- * @method CcShowRebroadcastQuery leftJoinCcShow($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShow relation
- * @method CcShowRebroadcastQuery rightJoinCcShow($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShow relation
- * @method CcShowRebroadcastQuery innerJoinCcShow($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShow relation
+ * @method CcShowRebroadcastQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcShowRebroadcastQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcShowRebroadcastQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcShowRebroadcast findOne(PropelPDO $con = null) Return the first CcShowRebroadcast matching the query
- * @method CcShowRebroadcast findOneOrCreate(PropelPDO $con = null) Return the first CcShowRebroadcast matching the query, or a new CcShowRebroadcast object populated from the query conditions when no match is found
+ * @method CcShowRebroadcastQuery leftJoinCcShow($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcShow relation
+ * @method CcShowRebroadcastQuery rightJoinCcShow($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcShow relation
+ * @method CcShowRebroadcastQuery innerJoinCcShow($relationAlias = null) Adds a INNER JOIN clause to the query using the CcShow relation
*
- * @method CcShowRebroadcast findOneByDbId(int $id) Return the first CcShowRebroadcast filtered by the id column
- * @method CcShowRebroadcast findOneByDbDayOffset(string $day_offset) Return the first CcShowRebroadcast filtered by the day_offset column
- * @method CcShowRebroadcast findOneByDbStartTime(string $start_time) Return the first CcShowRebroadcast filtered by the start_time column
- * @method CcShowRebroadcast findOneByDbShowId(int $show_id) Return the first CcShowRebroadcast filtered by the show_id column
+ * @method CcShowRebroadcast findOne(PropelPDO $con = null) Return the first CcShowRebroadcast matching the query
+ * @method CcShowRebroadcast findOneOrCreate(PropelPDO $con = null) Return the first CcShowRebroadcast matching the query, or a new CcShowRebroadcast object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcShowRebroadcast objects filtered by the id column
- * @method array findByDbDayOffset(string $day_offset) Return CcShowRebroadcast objects filtered by the day_offset column
- * @method array findByDbStartTime(string $start_time) Return CcShowRebroadcast objects filtered by the start_time column
- * @method array findByDbShowId(int $show_id) Return CcShowRebroadcast objects filtered by the show_id column
+ * @method CcShowRebroadcast findOneByDbDayOffset(string $day_offset) Return the first CcShowRebroadcast filtered by the day_offset column
+ * @method CcShowRebroadcast findOneByDbStartTime(string $start_time) Return the first CcShowRebroadcast filtered by the start_time column
+ * @method CcShowRebroadcast findOneByDbShowId(int $show_id) Return the first CcShowRebroadcast filtered by the show_id column
+ *
+ * @method array findByDbId(int $id) Return CcShowRebroadcast objects filtered by the id column
+ * @method array findByDbDayOffset(string $day_offset) Return CcShowRebroadcast objects filtered by the day_offset column
+ * @method array findByDbStartTime(string $start_time) Return CcShowRebroadcast objects filtered by the start_time column
+ * @method array findByDbShowId(int $show_id) Return CcShowRebroadcast objects filtered by the show_id column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcShowRebroadcastQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcShowRebroadcastQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcShowRebroadcast';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcShowRebroadcastQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcShowRebroadcast', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcShowRebroadcastQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcShowRebroadcastQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcShowRebroadcastQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcShowRebroadcastQuery) {
+ return $criteria;
+ }
+ $query = new CcShowRebroadcastQuery(null, null, $modelAlias);
- /**
- * Returns a new CcShowRebroadcastQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcShowRebroadcastQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcShowRebroadcastQuery) {
- return $criteria;
- }
- $query = new CcShowRebroadcastQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcShowRebroadcast|CcShowRebroadcast[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcShowRebroadcastPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcShowRebroadcastPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $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);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcShowRebroadcast A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcShowRebroadcast A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "day_offset", "start_time", "show_id" FROM "cc_show_rebroadcast" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcShowRebroadcast();
+ $obj->hydrate($row);
+ CcShowRebroadcastPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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);
- }
+ return $obj;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcShowRebroadcast|CcShowRebroadcast[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * 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);
- }
+ /**
+ * 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|CcShowRebroadcast[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * 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;
- }
+ /**
+ * 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)
+ {
- /**
- * 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');
- }
+ return $this->addUsingAlias(CcShowRebroadcastPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * 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;
- }
+ /**
+ * 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)
+ {
-} // BaseCcShowRebroadcastQuery
+ return $this->addUsingAlias(CcShowRebroadcastPeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcShowRebroadcastPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcShowRebroadcastPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcShowRebroadcastPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the day_offset column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbDayOffset('fooValue'); // WHERE day_offset = 'fooValue'
+ * $query->filterByDbDayOffset('%fooValue%'); // WHERE day_offset LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbStartTime('2011-03-14'); // WHERE start_time = '2011-03-14'
+ * $query->filterByDbStartTime('now'); // WHERE start_time = '2011-03-14'
+ * $query->filterByDbStartTime(array('max' => 'yesterday')); // WHERE start_time < '2011-03-13'
+ *
+ *
+ * @param mixed $dbStartTime The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbShowId(1234); // WHERE show_id = 1234
+ * $query->filterByDbShowId(array(12, 34)); // WHERE show_id IN (12, 34)
+ * $query->filterByDbShowId(array('min' => 12)); // WHERE show_id >= 12
+ * $query->filterByDbShowId(array('max' => 12)); // WHERE show_id <= 12
+ *
+ *
+ * @see filterByCcShow()
+ *
+ * @param mixed $dbShowId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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|PropelObjectCollection $ccShow The related object(s) 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcShow($ccShow, $comparison = null)
+ {
+ if ($ccShow instanceof CcShow) {
+ return $this
+ ->addUsingAlias(CcShowRebroadcastPeer::SHOW_ID, $ccShow->getDbId(), $comparison);
+ } elseif ($ccShow instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcShowRebroadcastPeer::SHOW_ID, $ccShow->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcShow() only accepts arguments of type CcShow or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $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;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSmemb.php b/airtime_mvc/application/models/airtime/om/BaseCcSmemb.php
index 7fc4dbc9b..9d1270fa8 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSmemb.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSmemb.php
@@ -4,888 +4,1018 @@
/**
* Base class that represents a row from the 'cc_smemb' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcSmemb extends BaseObject implements Persistent
+abstract class BaseCcSmemb extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcSmembPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcSmembPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the uid field.
- * Note: this column has a database default value of: 0
- * @var int
- */
- protected $uid;
-
- /**
- * The value for the gid field.
- * Note: this column has a database default value of: 0
- * @var int
- */
- protected $gid;
-
- /**
- * The value for the level field.
- * Note: this column has a database default value of: 0
- * @var int
- */
- protected $level;
-
- /**
- * The value for the mid field.
- * @var int
- */
- protected $mid;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Applies default values to this object.
- * This method should be called from the object's constructor (or
- * equivalent initialization method).
- * @see __construct()
- */
- public function applyDefaultValues()
- {
- $this->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
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcSmembPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcSmembPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the uid field.
+ * Note: this column has a database default value of: 0
+ * @var int
+ */
+ protected $uid;
+
+ /**
+ * The value for the gid field.
+ * Note: this column has a database default value of: 0
+ * @var int
+ */
+ protected $gid;
+
+ /**
+ * The value for the level field.
+ * Note: this column has a database default value of: 0
+ * @var int
+ */
+ protected $level;
+
+ /**
+ * The value for the mid field.
+ * @var int
+ */
+ protected $mid;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->uid !== $v) {
+ $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 && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->gid !== $v) {
+ $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 && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->level !== $v) {
+ $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 && is_numeric($v)) {
+ $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 resultset 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();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 5; // 5 = CcSmembPeer::NUM_HYDRATE_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
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcSmembQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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 (Exception $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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcSmembPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcSmembPeer::UID)) {
+ $modifiedColumns[':p' . $index++] = '"uid"';
+ }
+ if ($this->isColumnModified(CcSmembPeer::GID)) {
+ $modifiedColumns[':p' . $index++] = '"gid"';
+ }
+ if ($this->isColumnModified(CcSmembPeer::LEVEL)) {
+ $modifiedColumns[':p' . $index++] = '"level"';
+ }
+ if ($this->isColumnModified(CcSmembPeer::MID)) {
+ $modifiedColumns[':p' . $index++] = '"mid"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_smemb" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"uid"':
+ $stmt->bindValue($identifier, $this->uid, PDO::PARAM_INT);
+ break;
+ case '"gid"':
+ $stmt->bindValue($identifier, $this->gid, PDO::PARAM_INT);
+ break;
+ case '"level"':
+ $stmt->bindValue($identifier, $this->level, PDO::PARAM_INT);
+ break;
+ case '"mid"':
+ $stmt->bindValue($identifier, $this->mid, PDO::PARAM_INT);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
+ {
+ if (isset($alreadyDumpedObjects['CcSmemb'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcSmemb'][$this->getPrimaryKey()] = 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(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcSmembPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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 BasePeer::TYPE_PHPNAME
+ *
+ * @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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setUid($this->getUid());
+ $copyObj->setGid($this->getGid());
+ $copyObj->setLevel($this->getLevel());
+ $copyObj->setMid($this->getMid());
+ if ($makeNew) {
+ $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 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->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcSmembPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSmembPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcSmembPeer.php
index 849c13423..4d9bb8f54 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSmembPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSmembPeer.php
@@ -4,743 +4,765 @@
/**
* Base static class for performing query and update operations on the 'cc_smemb' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcSmembPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_smemb';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcSmemb';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcSmemb';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcSmembTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 5;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_smemb.ID';
-
- /** the column name for the UID field */
- const UID = 'cc_smemb.UID';
-
- /** the column name for the GID field */
- const GID = 'cc_smemb.GID';
-
- /** the column name for the LEVEL field */
- const LEVEL = 'cc_smemb.LEVEL';
-
- /** the column name for the MID field */
- const MID = 'cc_smemb.MID';
-
- /**
- * An identiy map to hold any loaded instances of CcSmemb objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcSmemb[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => 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;
- }
+abstract class BaseCcSmembPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_smemb';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcSmemb';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcSmembTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 5;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 5;
+
+ /** the column name for the id field */
+ const ID = 'cc_smemb.id';
+
+ /** the column name for the uid field */
+ const UID = 'cc_smemb.uid';
+
+ /** the column name for the gid field */
+ const GID = 'cc_smemb.gid';
+
+ /** the column name for the level field */
+ const LEVEL = 'cc_smemb.level';
+
+ /** the column name for the mid field */
+ const MID = 'cc_smemb.mid';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcSmemb objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcSmemb[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcSmembPeer::$fieldNames[CcSmembPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Id', 'Uid', 'Gid', 'Level', 'Mid', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'uid', 'gid', 'level', 'mid', ),
+ BasePeer::TYPE_COLNAME => array (CcSmembPeer::ID, CcSmembPeer::UID, CcSmembPeer::GID, CcSmembPeer::LEVEL, CcSmembPeer::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. CcSmembPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected 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 (CcSmembPeer::ID => 0, CcSmembPeer::UID => 1, CcSmembPeer::GID => 2, CcSmembPeer::LEVEL => 3, CcSmembPeer::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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcSmembPeer::getFieldNames($toType);
+ $key = isset(CcSmembPeer::$fieldKeys[$fromType][$name]) ? CcSmembPeer::$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(CcSmembPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcSmembPeer::$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 CcSmembPeer::$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(CcSmembPeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcSmembPeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getId();
+ } // if key === null
+ CcSmembPeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcSmembPeer::$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(CcSmembPeer::$instances[$key])) {
+ return CcSmembPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcSmembPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcSmembPeer::$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();
+ // 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_HYDRATE_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(CcSmembPeer::DATABASE_NAME)->getTable(CcSmembPeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcSmembPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcSmembPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcSmembPeer::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(CcSmembPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_smemb table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcSmembPeer::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(CcSmembPeer::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 (Exception $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($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->hasColumn($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
+ * @return CcSmemb[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSmembQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcSmembQuery.php
index 06b24502c..be7c914d0 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSmembQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSmembQuery.php
@@ -4,302 +4,457 @@
/**
* Base class that represents a query for the 'cc_smemb' table.
*
- *
*
- * @method CcSmembQuery orderById($order = Criteria::ASC) Order by the id column
- * @method CcSmembQuery orderByUid($order = Criteria::ASC) Order by the uid column
- * @method CcSmembQuery orderByGid($order = Criteria::ASC) Order by the gid column
- * @method CcSmembQuery orderByLevel($order = Criteria::ASC) Order by the level column
- * @method CcSmembQuery orderByMid($order = Criteria::ASC) Order by the mid column
*
- * @method CcSmembQuery groupById() Group by the id column
- * @method CcSmembQuery groupByUid() Group by the uid column
- * @method CcSmembQuery groupByGid() Group by the gid column
- * @method CcSmembQuery groupByLevel() Group by the level column
- * @method CcSmembQuery groupByMid() Group by the mid column
+ * @method CcSmembQuery orderById($order = Criteria::ASC) Order by the id column
+ * @method CcSmembQuery orderByUid($order = Criteria::ASC) Order by the uid column
+ * @method CcSmembQuery orderByGid($order = Criteria::ASC) Order by the gid column
+ * @method CcSmembQuery orderByLevel($order = Criteria::ASC) Order by the level column
+ * @method CcSmembQuery orderByMid($order = Criteria::ASC) Order by the mid column
*
- * @method CcSmembQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcSmembQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcSmembQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcSmembQuery groupById() Group by the id column
+ * @method CcSmembQuery groupByUid() Group by the uid column
+ * @method CcSmembQuery groupByGid() Group by the gid column
+ * @method CcSmembQuery groupByLevel() Group by the level column
+ * @method CcSmembQuery groupByMid() Group by the mid column
*
- * @method CcSmemb findOne(PropelPDO $con = null) Return the first CcSmemb matching the query
- * @method CcSmemb findOneOrCreate(PropelPDO $con = null) Return the first CcSmemb matching the query, or a new CcSmemb object populated from the query conditions when no match is found
+ * @method CcSmembQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcSmembQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcSmembQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcSmemb findOneById(int $id) Return the first CcSmemb filtered by the id column
- * @method CcSmemb findOneByUid(int $uid) Return the first CcSmemb filtered by the uid column
- * @method CcSmemb findOneByGid(int $gid) Return the first CcSmemb filtered by the gid column
- * @method CcSmemb findOneByLevel(int $level) Return the first CcSmemb filtered by the level column
- * @method CcSmemb findOneByMid(int $mid) Return the first CcSmemb filtered by the mid column
+ * @method CcSmemb findOne(PropelPDO $con = null) Return the first CcSmemb matching the query
+ * @method CcSmemb findOneOrCreate(PropelPDO $con = null) Return the first CcSmemb matching the query, or a new CcSmemb object populated from the query conditions when no match is found
*
- * @method array findById(int $id) Return CcSmemb objects filtered by the id column
- * @method array findByUid(int $uid) Return CcSmemb objects filtered by the uid column
- * @method array findByGid(int $gid) Return CcSmemb objects filtered by the gid column
- * @method array findByLevel(int $level) Return CcSmemb objects filtered by the level column
- * @method array findByMid(int $mid) Return CcSmemb objects filtered by the mid column
+ * @method CcSmemb findOneByUid(int $uid) Return the first CcSmemb filtered by the uid column
+ * @method CcSmemb findOneByGid(int $gid) Return the first CcSmemb filtered by the gid column
+ * @method CcSmemb findOneByLevel(int $level) Return the first CcSmemb filtered by the level column
+ * @method CcSmemb findOneByMid(int $mid) Return the first CcSmemb filtered by the mid column
+ *
+ * @method array findById(int $id) Return CcSmemb objects filtered by the id column
+ * @method array findByUid(int $uid) Return CcSmemb objects filtered by the uid column
+ * @method array findByGid(int $gid) Return CcSmemb objects filtered by the gid column
+ * @method array findByLevel(int $level) Return CcSmemb objects filtered by the level column
+ * @method array findByMid(int $mid) Return CcSmemb objects filtered by the mid column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcSmembQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcSmembQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcSmemb';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcSmembQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcSmemb', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcSmembQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcSmembQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcSmembQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcSmembQuery) {
+ return $criteria;
+ }
+ $query = new CcSmembQuery(null, null, $modelAlias);
- /**
- * Returns a new CcSmembQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcSmembQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcSmembQuery) {
- return $criteria;
- }
- $query = new CcSmembQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcSmemb|CcSmemb[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcSmembPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $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);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcSmemb A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneById($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcSmemb A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "uid", "gid", "level", "mid" FROM "cc_smemb" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcSmemb();
+ $obj->hydrate($row);
+ CcSmembPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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);
- }
+ return $obj;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcSmemb|CcSmemb[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * 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);
- }
+ /**
+ * 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|CcSmemb[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * 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;
- }
+ /**
+ * 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)
+ {
-} // BaseCcSmembQuery
+ 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
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id >= 12
+ * $query->filterById(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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)) {
+ $useMinMax = false;
+ if (isset($id['min'])) {
+ $this->addUsingAlias(CcSmembPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(CcSmembPeer::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcSmembPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the uid column
+ *
+ * Example usage:
+ *
+ * $query->filterByUid(1234); // WHERE uid = 1234
+ * $query->filterByUid(array(12, 34)); // WHERE uid IN (12, 34)
+ * $query->filterByUid(array('min' => 12)); // WHERE uid >= 12
+ * $query->filterByUid(array('max' => 12)); // WHERE uid <= 12
+ *
+ *
+ * @param mixed $uid The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByGid(1234); // WHERE gid = 1234
+ * $query->filterByGid(array(12, 34)); // WHERE gid IN (12, 34)
+ * $query->filterByGid(array('min' => 12)); // WHERE gid >= 12
+ * $query->filterByGid(array('max' => 12)); // WHERE gid <= 12
+ *
+ *
+ * @param mixed $gid The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByLevel(1234); // WHERE level = 1234
+ * $query->filterByLevel(array(12, 34)); // WHERE level IN (12, 34)
+ * $query->filterByLevel(array('min' => 12)); // WHERE level >= 12
+ * $query->filterByLevel(array('max' => 12)); // WHERE level <= 12
+ *
+ *
+ * @param mixed $level The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByMid(1234); // WHERE mid = 1234
+ * $query->filterByMid(array(12, 34)); // WHERE mid IN (12, 34)
+ * $query->filterByMid(array('min' => 12)); // WHERE mid >= 12
+ * $query->filterByMid(array('max' => 12)); // WHERE mid <= 12
+ *
+ *
+ * @param mixed $mid The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcStreamSetting.php b/airtime_mvc/application/models/airtime/om/BaseCcStreamSetting.php
index 6dadc9b67..f579be6a1 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcStreamSetting.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcStreamSetting.php
@@ -4,753 +4,867 @@
/**
* Base class that represents a row from the 'cc_stream_setting' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcStreamSetting extends BaseObject implements Persistent
+abstract class BaseCcStreamSetting extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcStreamSettingPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcStreamSettingPeer
- */
- protected static $peer;
-
- /**
- * The value for the keyname field.
- * @var string
- */
- protected $keyname;
-
- /**
- * The value for the value field.
- * @var string
- */
- protected $value;
-
- /**
- * The value for the type field.
- * @var string
- */
- protected $type;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Get the [keyname] column value.
- *
- * @return string
- */
- public function getDbKeyName()
- {
- return $this->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
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcStreamSettingPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcStreamSettingPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the keyname field.
+ * @var string
+ */
+ protected $keyname;
+
+ /**
+ * The value for the value field.
+ * @var string
+ */
+ protected $value;
+
+ /**
+ * The value for the type field.
+ * @var string
+ */
+ protected $type;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Get the [keyname] column value.
+ *
+ * @return string
+ */
+ public function getDbKeyName()
+ {
+
+ return $this->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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 resultset 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();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 3; // 3 = CcStreamSettingPeer::NUM_HYDRATE_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
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcStreamSettingQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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 (Exception $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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcStreamSettingPeer::KEYNAME)) {
+ $modifiedColumns[':p' . $index++] = '"keyname"';
+ }
+ if ($this->isColumnModified(CcStreamSettingPeer::VALUE)) {
+ $modifiedColumns[':p' . $index++] = '"value"';
+ }
+ if ($this->isColumnModified(CcStreamSettingPeer::TYPE)) {
+ $modifiedColumns[':p' . $index++] = '"type"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_stream_setting" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"keyname"':
+ $stmt->bindValue($identifier, $this->keyname, PDO::PARAM_STR);
+ break;
+ case '"value"':
+ $stmt->bindValue($identifier, $this->value, PDO::PARAM_STR);
+ break;
+ case '"type"':
+ $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
+ {
+ if (isset($alreadyDumpedObjects['CcStreamSetting'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcStreamSetting'][$this->getPrimaryKey()] = true;
+ $keys = CcStreamSettingPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbKeyName(),
+ $keys[1] => $this->getDbValue(),
+ $keys[2] => $this->getDbType(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcStreamSettingPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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 BasePeer::TYPE_PHPNAME
+ *
+ * @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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbValue($this->getDbValue());
+ $copyObj->setDbType($this->getDbType());
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setDbKeyName(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 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->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcStreamSettingPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcStreamSettingPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcStreamSettingPeer.php
index f5e680b20..5fa81eaf3 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcStreamSettingPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcStreamSettingPeer.php
@@ -4,733 +4,755 @@
/**
* Base static class for performing query and update operations on the 'cc_stream_setting' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcStreamSettingPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_stream_setting';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcStreamSetting';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcStreamSetting';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcStreamSettingTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 3;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the KEYNAME field */
- const KEYNAME = 'cc_stream_setting.KEYNAME';
-
- /** the column name for the VALUE field */
- const VALUE = 'cc_stream_setting.VALUE';
-
- /** the column name for the TYPE field */
- const TYPE = 'cc_stream_setting.TYPE';
-
- /**
- * An identiy map to hold any loaded instances of CcStreamSetting objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcStreamSetting[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => 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;
- }
+abstract class BaseCcStreamSettingPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_stream_setting';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcStreamSetting';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcStreamSettingTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 3;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 3;
+
+ /** the column name for the keyname field */
+ const KEYNAME = 'cc_stream_setting.keyname';
+
+ /** the column name for the value field */
+ const VALUE = 'cc_stream_setting.value';
+
+ /** the column name for the type field */
+ const TYPE = 'cc_stream_setting.type';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcStreamSetting objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcStreamSetting[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcStreamSettingPeer::$fieldNames[CcStreamSettingPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbKeyName', 'DbValue', 'DbType', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbKeyName', 'dbValue', 'dbType', ),
+ BasePeer::TYPE_COLNAME => array (CcStreamSettingPeer::KEYNAME, CcStreamSettingPeer::VALUE, CcStreamSettingPeer::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. CcStreamSettingPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected 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 (CcStreamSettingPeer::KEYNAME => 0, CcStreamSettingPeer::VALUE => 1, CcStreamSettingPeer::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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcStreamSettingPeer::getFieldNames($toType);
+ $key = isset(CcStreamSettingPeer::$fieldKeys[$fromType][$name]) ? CcStreamSettingPeer::$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(CcStreamSettingPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcStreamSettingPeer::$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 CcStreamSettingPeer::$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(CcStreamSettingPeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcStreamSettingPeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbKeyName();
+ } // if key === null
+ CcStreamSettingPeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcStreamSettingPeer::$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(CcStreamSettingPeer::$instances[$key])) {
+ return CcStreamSettingPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcStreamSettingPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcStreamSettingPeer::$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();
+ // 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_HYDRATE_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(CcStreamSettingPeer::DATABASE_NAME)->getTable(CcStreamSettingPeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcStreamSettingPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcStreamSettingPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcStreamSettingPeer::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(CcStreamSettingPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_stream_setting table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcStreamSettingPeer::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(CcStreamSettingPeer::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 (Exception $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($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->hasColumn($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
+ * @return CcStreamSetting[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcStreamSettingQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcStreamSettingQuery.php
index 666106d6f..ee5b92f33 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcStreamSettingQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcStreamSettingQuery.php
@@ -4,219 +4,326 @@
/**
* Base class that represents a query for the 'cc_stream_setting' table.
*
- *
*
- * @method CcStreamSettingQuery orderByDbKeyName($order = Criteria::ASC) Order by the keyname column
- * @method CcStreamSettingQuery orderByDbValue($order = Criteria::ASC) Order by the value column
- * @method CcStreamSettingQuery orderByDbType($order = Criteria::ASC) Order by the type column
*
- * @method CcStreamSettingQuery groupByDbKeyName() Group by the keyname column
- * @method CcStreamSettingQuery groupByDbValue() Group by the value column
- * @method CcStreamSettingQuery groupByDbType() Group by the type column
+ * @method CcStreamSettingQuery orderByDbKeyName($order = Criteria::ASC) Order by the keyname column
+ * @method CcStreamSettingQuery orderByDbValue($order = Criteria::ASC) Order by the value column
+ * @method CcStreamSettingQuery orderByDbType($order = Criteria::ASC) Order by the type column
*
- * @method CcStreamSettingQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcStreamSettingQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcStreamSettingQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcStreamSettingQuery groupByDbKeyName() Group by the keyname column
+ * @method CcStreamSettingQuery groupByDbValue() Group by the value column
+ * @method CcStreamSettingQuery groupByDbType() Group by the type column
*
- * @method CcStreamSetting findOne(PropelPDO $con = null) Return the first CcStreamSetting matching the query
- * @method CcStreamSetting findOneOrCreate(PropelPDO $con = null) Return the first CcStreamSetting matching the query, or a new CcStreamSetting object populated from the query conditions when no match is found
+ * @method CcStreamSettingQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcStreamSettingQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcStreamSettingQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcStreamSetting findOneByDbKeyName(string $keyname) Return the first CcStreamSetting filtered by the keyname column
- * @method CcStreamSetting findOneByDbValue(string $value) Return the first CcStreamSetting filtered by the value column
- * @method CcStreamSetting findOneByDbType(string $type) Return the first CcStreamSetting filtered by the type column
+ * @method CcStreamSetting findOne(PropelPDO $con = null) Return the first CcStreamSetting matching the query
+ * @method CcStreamSetting findOneOrCreate(PropelPDO $con = null) Return the first CcStreamSetting matching the query, or a new CcStreamSetting object populated from the query conditions when no match is found
*
- * @method array findByDbKeyName(string $keyname) Return CcStreamSetting objects filtered by the keyname column
- * @method array findByDbValue(string $value) Return CcStreamSetting objects filtered by the value column
- * @method array findByDbType(string $type) Return CcStreamSetting objects filtered by the type column
+ * @method CcStreamSetting findOneByDbValue(string $value) Return the first CcStreamSetting filtered by the value column
+ * @method CcStreamSetting findOneByDbType(string $type) Return the first CcStreamSetting filtered by the type column
+ *
+ * @method array findByDbKeyName(string $keyname) Return CcStreamSetting objects filtered by the keyname column
+ * @method array findByDbValue(string $value) Return CcStreamSetting objects filtered by the value column
+ * @method array findByDbType(string $type) Return CcStreamSetting objects filtered by the type column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcStreamSettingQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcStreamSettingQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcStreamSetting';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcStreamSettingQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcStreamSetting', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcStreamSettingQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcStreamSettingQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcStreamSettingQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcStreamSettingQuery) {
+ return $criteria;
+ }
+ $query = new CcStreamSettingQuery(null, null, $modelAlias);
- /**
- * Returns a new CcStreamSettingQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcStreamSettingQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcStreamSettingQuery) {
- return $criteria;
- }
- $query = new CcStreamSettingQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcStreamSetting|CcStreamSetting[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcStreamSettingPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcStreamSettingPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $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);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcStreamSetting A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbKeyName($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcStreamSetting A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "keyname", "value", "type" FROM "cc_stream_setting" WHERE "keyname" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcStreamSetting();
+ $obj->hydrate($row);
+ CcStreamSettingPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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);
- }
+ return $obj;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcStreamSetting|CcStreamSetting[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * 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;
- }
+ /**
+ * 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|CcStreamSetting[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
-} // BaseCcStreamSettingQuery
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * 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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbKeyName('fooValue'); // WHERE keyname = 'fooValue'
+ * $query->filterByDbKeyName('%fooValue%'); // WHERE keyname LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbValue('fooValue'); // WHERE value = 'fooValue'
+ * $query->filterByDbValue('%fooValue%'); // WHERE value LIKE '%fooValue%'
+ *
+ *
+ * @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
+ *
+ * Example usage:
+ *
+ * $query->filterByDbType('fooValue'); // WHERE type = 'fooValue'
+ * $query->filterByDbType('%fooValue%'); // WHERE type LIKE '%fooValue%'
+ *
+ *
+ * @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;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php
index c335d7158..6aa0df213 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php
@@ -4,2781 +4,4220 @@
/**
* Base class that represents a row from the 'cc_subjs' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcSubjs extends BaseObject implements Persistent
+abstract class BaseCcSubjs extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcSubjsPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcSubjsPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the login field.
- * Note: this column has a database default value of: ''
- * @var string
- */
- protected $login;
-
- /**
- * The value for the pass field.
- * Note: this column has a database default value of: ''
- * @var string
- */
- protected $pass;
-
- /**
- * The value for the type field.
- * Note: this column has a database default value of: 'U'
- * @var string
- */
- protected $type;
-
- /**
- * The value for the first_name field.
- * Note: this column has a database default value of: ''
- * @var string
- */
- protected $first_name;
-
- /**
- * The value for the last_name field.
- * Note: this column has a database default value of: ''
- * @var string
- */
- protected $last_name;
-
- /**
- * The value for the lastlogin field.
- * @var string
- */
- protected $lastlogin;
-
- /**
- * The value for the lastfail field.
- * @var string
- */
- protected $lastfail;
-
- /**
- * The value for the skype_contact field.
- * @var string
- */
- protected $skype_contact;
-
- /**
- * The value for the jabber_contact field.
- * @var string
- */
- protected $jabber_contact;
-
- /**
- * The value for the email field.
- * @var string
- */
- protected $email;
-
- /**
- * The value for the cell_phone field.
- * @var string
- */
- protected $cell_phone;
-
- /**
- * The value for the login_attempts field.
- * Note: this column has a database default value of: 0
- * @var int
- */
- protected $login_attempts;
-
- /**
- * @var array CcFiles[] Collection to store aggregation of CcFiles objects.
- */
- protected $collCcFilessRelatedByDbOwnerId;
-
- /**
- * @var array CcFiles[] Collection to store aggregation of CcFiles objects.
- */
- protected $collCcFilessRelatedByDbEditedby;
-
- /**
- * @var array CcPerms[] Collection to store aggregation of CcPerms objects.
- */
- protected $collCcPermss;
-
- /**
- * @var array CcShowHosts[] Collection to store aggregation of CcShowHosts objects.
- */
- protected $collCcShowHostss;
-
- /**
- * @var array CcPlaylist[] Collection to store aggregation of CcPlaylist objects.
- */
- protected $collCcPlaylists;
-
- /**
- * @var array CcBlock[] Collection to store aggregation of CcBlock objects.
- */
- protected $collCcBlocks;
-
- /**
- * @var array CcPref[] Collection to store aggregation of CcPref objects.
- */
- protected $collCcPrefs;
-
- /**
- * @var array CcSess[] Collection to store aggregation of CcSess objects.
- */
- protected $collCcSesss;
-
- /**
- * @var array CcSubjsToken[] Collection to store aggregation of CcSubjsToken objects.
- */
- protected $collCcSubjsTokens;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Applies default values to this object.
- * This method should be called from the object's constructor (or
- * equivalent initialization method).
- * @see __construct()
- */
- public function applyDefaultValues()
- {
- $this->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 [cell_phone] column value.
- *
- * @return string
- */
- public function getDbCellPhone()
- {
- return $this->cell_phone;
- }
-
- /**
- * 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 [cell_phone] column.
- *
- * @param string $v new value
- * @return CcSubjs The current object (for fluent API support)
- */
- public function setDbCellPhone($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->cell_phone !== $v) {
- $this->cell_phone = $v;
- $this->modifiedColumns[] = CcSubjsPeer::CELL_PHONE;
- }
-
- return $this;
- } // setDbCellPhone()
-
- /**
- * 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->cell_phone = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
- $this->login_attempts = ($row[$startcol + 12] !== null) ? (int) $row[$startcol + 12] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 13; // 13 = 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->collCcFilessRelatedByDbOwnerId = null;
-
- $this->collCcFilessRelatedByDbEditedby = null;
-
- $this->collCcPermss = null;
-
- $this->collCcShowHostss = null;
-
- $this->collCcPlaylists = null;
-
- $this->collCcBlocks = null;
-
- $this->collCcPrefs = null;
-
- $this->collCcSesss = null;
-
- $this->collCcSubjsTokens = 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->collCcFilessRelatedByDbOwnerId !== null) {
- foreach ($this->collCcFilessRelatedByDbOwnerId as $referrerFK) {
- if (!$referrerFK->isDeleted()) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
- if ($this->collCcFilessRelatedByDbEditedby !== null) {
- foreach ($this->collCcFilessRelatedByDbEditedby 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->collCcBlocks !== null) {
- foreach ($this->collCcBlocks 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);
- }
- }
- }
-
- if ($this->collCcSubjsTokens !== null) {
- foreach ($this->collCcSubjsTokens 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->collCcFilessRelatedByDbOwnerId !== null) {
- foreach ($this->collCcFilessRelatedByDbOwnerId as $referrerFK) {
- if (!$referrerFK->validate($columns)) {
- $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
- }
- }
- }
-
- if ($this->collCcFilessRelatedByDbEditedby !== null) {
- foreach ($this->collCcFilessRelatedByDbEditedby 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->collCcBlocks !== null) {
- foreach ($this->collCcBlocks 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());
- }
- }
- }
-
- if ($this->collCcSubjsTokens !== null) {
- foreach ($this->collCcSubjsTokens 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->getDbCellPhone();
- break;
- case 12:
- 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->getDbCellPhone(),
- $keys[12] => $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->setDbCellPhone($value);
- break;
- case 12:
- $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->setDbCellPhone($arr[$keys[11]]);
- if (array_key_exists($keys[12], $arr)) $this->setDbLoginAttempts($arr[$keys[12]]);
- }
-
- /**
- * 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::CELL_PHONE)) $criteria->add(CcSubjsPeer::CELL_PHONE, $this->cell_phone);
- 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->setDbCellPhone($this->cell_phone);
- $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->getCcFilessRelatedByDbOwnerId() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addCcFilesRelatedByDbOwnerId($relObj->copy($deepCopy));
- }
- }
-
- foreach ($this->getCcFilessRelatedByDbEditedby() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addCcFilesRelatedByDbEditedby($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->getCcBlocks() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addCcBlock($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));
- }
- }
-
- foreach ($this->getCcSubjsTokens() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addCcSubjsToken($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 collCcFilessRelatedByDbOwnerId 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 addCcFilessRelatedByDbOwnerId()
- */
- public function clearCcFilessRelatedByDbOwnerId()
- {
- $this->collCcFilessRelatedByDbOwnerId = null; // important to set this to NULL since that means it is uninitialized
- }
-
- /**
- * Initializes the collCcFilessRelatedByDbOwnerId collection.
- *
- * By default this just sets the collCcFilessRelatedByDbOwnerId collection to an empty array (like clearcollCcFilessRelatedByDbOwnerId());
- * 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 initCcFilessRelatedByDbOwnerId()
- {
- $this->collCcFilessRelatedByDbOwnerId = new PropelObjectCollection();
- $this->collCcFilessRelatedByDbOwnerId->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 getCcFilessRelatedByDbOwnerId($criteria = null, PropelPDO $con = null)
- {
- if(null === $this->collCcFilessRelatedByDbOwnerId || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcFilessRelatedByDbOwnerId) {
- // return empty collection
- $this->initCcFilessRelatedByDbOwnerId();
- } else {
- $collCcFilessRelatedByDbOwnerId = CcFilesQuery::create(null, $criteria)
- ->filterByFkOwner($this)
- ->find($con);
- if (null !== $criteria) {
- return $collCcFilessRelatedByDbOwnerId;
- }
- $this->collCcFilessRelatedByDbOwnerId = $collCcFilessRelatedByDbOwnerId;
- }
- }
- return $this->collCcFilessRelatedByDbOwnerId;
- }
-
- /**
- * 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 countCcFilessRelatedByDbOwnerId(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- if(null === $this->collCcFilessRelatedByDbOwnerId || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcFilessRelatedByDbOwnerId) {
- return 0;
- } else {
- $query = CcFilesQuery::create(null, $criteria);
- if($distinct) {
- $query->distinct();
- }
- return $query
- ->filterByFkOwner($this)
- ->count($con);
- }
- } else {
- return count($this->collCcFilessRelatedByDbOwnerId);
- }
- }
-
- /**
- * 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 addCcFilesRelatedByDbOwnerId(CcFiles $l)
- {
- if ($this->collCcFilessRelatedByDbOwnerId === null) {
- $this->initCcFilessRelatedByDbOwnerId();
- }
- if (!$this->collCcFilessRelatedByDbOwnerId->contains($l)) { // only add it if the **same** object is not already associated
- $this->collCcFilessRelatedByDbOwnerId[]= $l;
- $l->setFkOwner($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 CcFilessRelatedByDbOwnerId 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 getCcFilessRelatedByDbOwnerIdJoinCcMusicDirs($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
- {
- $query = CcFilesQuery::create(null, $criteria);
- $query->joinWith('CcMusicDirs', $join_behavior);
-
- return $this->getCcFilessRelatedByDbOwnerId($query, $con);
- }
-
- /**
- * Clears out the collCcFilessRelatedByDbEditedby 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 addCcFilessRelatedByDbEditedby()
- */
- public function clearCcFilessRelatedByDbEditedby()
- {
- $this->collCcFilessRelatedByDbEditedby = null; // important to set this to NULL since that means it is uninitialized
- }
-
- /**
- * Initializes the collCcFilessRelatedByDbEditedby collection.
- *
- * By default this just sets the collCcFilessRelatedByDbEditedby collection to an empty array (like clearcollCcFilessRelatedByDbEditedby());
- * 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 initCcFilessRelatedByDbEditedby()
- {
- $this->collCcFilessRelatedByDbEditedby = new PropelObjectCollection();
- $this->collCcFilessRelatedByDbEditedby->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 getCcFilessRelatedByDbEditedby($criteria = null, PropelPDO $con = null)
- {
- if(null === $this->collCcFilessRelatedByDbEditedby || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcFilessRelatedByDbEditedby) {
- // return empty collection
- $this->initCcFilessRelatedByDbEditedby();
- } else {
- $collCcFilessRelatedByDbEditedby = CcFilesQuery::create(null, $criteria)
- ->filterByCcSubjsRelatedByDbEditedby($this)
- ->find($con);
- if (null !== $criteria) {
- return $collCcFilessRelatedByDbEditedby;
- }
- $this->collCcFilessRelatedByDbEditedby = $collCcFilessRelatedByDbEditedby;
- }
- }
- return $this->collCcFilessRelatedByDbEditedby;
- }
-
- /**
- * 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 countCcFilessRelatedByDbEditedby(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- if(null === $this->collCcFilessRelatedByDbEditedby || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcFilessRelatedByDbEditedby) {
- return 0;
- } else {
- $query = CcFilesQuery::create(null, $criteria);
- if($distinct) {
- $query->distinct();
- }
- return $query
- ->filterByCcSubjsRelatedByDbEditedby($this)
- ->count($con);
- }
- } else {
- return count($this->collCcFilessRelatedByDbEditedby);
- }
- }
-
- /**
- * 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 addCcFilesRelatedByDbEditedby(CcFiles $l)
- {
- if ($this->collCcFilessRelatedByDbEditedby === null) {
- $this->initCcFilessRelatedByDbEditedby();
- }
- if (!$this->collCcFilessRelatedByDbEditedby->contains($l)) { // only add it if the **same** object is not already associated
- $this->collCcFilessRelatedByDbEditedby[]= $l;
- $l->setCcSubjsRelatedByDbEditedby($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 CcFilessRelatedByDbEditedby 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 getCcFilessRelatedByDbEditedbyJoinCcMusicDirs($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
- {
- $query = CcFilesQuery::create(null, $criteria);
- $query->joinWith('CcMusicDirs', $join_behavior);
-
- return $this->getCcFilessRelatedByDbEditedby($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 collCcBlocks 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 addCcBlocks()
- */
- public function clearCcBlocks()
- {
- $this->collCcBlocks = null; // important to set this to NULL since that means it is uninitialized
- }
-
- /**
- * Initializes the collCcBlocks collection.
- *
- * By default this just sets the collCcBlocks collection to an empty array (like clearcollCcBlocks());
- * 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 initCcBlocks()
- {
- $this->collCcBlocks = new PropelObjectCollection();
- $this->collCcBlocks->setModel('CcBlock');
- }
-
- /**
- * Gets an array of CcBlock 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 CcBlock[] List of CcBlock objects
- * @throws PropelException
- */
- public function getCcBlocks($criteria = null, PropelPDO $con = null)
- {
- if(null === $this->collCcBlocks || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcBlocks) {
- // return empty collection
- $this->initCcBlocks();
- } else {
- $collCcBlocks = CcBlockQuery::create(null, $criteria)
- ->filterByCcSubjs($this)
- ->find($con);
- if (null !== $criteria) {
- return $collCcBlocks;
- }
- $this->collCcBlocks = $collCcBlocks;
- }
- }
- return $this->collCcBlocks;
- }
-
- /**
- * Returns the number of related CcBlock objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related CcBlock objects.
- * @throws PropelException
- */
- public function countCcBlocks(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- if(null === $this->collCcBlocks || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcBlocks) {
- return 0;
- } else {
- $query = CcBlockQuery::create(null, $criteria);
- if($distinct) {
- $query->distinct();
- }
- return $query
- ->filterByCcSubjs($this)
- ->count($con);
- }
- } else {
- return count($this->collCcBlocks);
- }
- }
-
- /**
- * Method called to associate a CcBlock object to this object
- * through the CcBlock foreign key attribute.
- *
- * @param CcBlock $l CcBlock
- * @return void
- * @throws PropelException
- */
- public function addCcBlock(CcBlock $l)
- {
- if ($this->collCcBlocks === null) {
- $this->initCcBlocks();
- }
- if (!$this->collCcBlocks->contains($l)) { // only add it if the **same** object is not already associated
- $this->collCcBlocks[]= $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 out the collCcSubjsTokens 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 addCcSubjsTokens()
- */
- public function clearCcSubjsTokens()
- {
- $this->collCcSubjsTokens = null; // important to set this to NULL since that means it is uninitialized
- }
-
- /**
- * Initializes the collCcSubjsTokens collection.
- *
- * By default this just sets the collCcSubjsTokens collection to an empty array (like clearcollCcSubjsTokens());
- * 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 initCcSubjsTokens()
- {
- $this->collCcSubjsTokens = new PropelObjectCollection();
- $this->collCcSubjsTokens->setModel('CcSubjsToken');
- }
-
- /**
- * Gets an array of CcSubjsToken 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 CcSubjsToken[] List of CcSubjsToken objects
- * @throws PropelException
- */
- public function getCcSubjsTokens($criteria = null, PropelPDO $con = null)
- {
- if(null === $this->collCcSubjsTokens || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcSubjsTokens) {
- // return empty collection
- $this->initCcSubjsTokens();
- } else {
- $collCcSubjsTokens = CcSubjsTokenQuery::create(null, $criteria)
- ->filterByCcSubjs($this)
- ->find($con);
- if (null !== $criteria) {
- return $collCcSubjsTokens;
- }
- $this->collCcSubjsTokens = $collCcSubjsTokens;
- }
- }
- return $this->collCcSubjsTokens;
- }
-
- /**
- * Returns the number of related CcSubjsToken objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related CcSubjsToken objects.
- * @throws PropelException
- */
- public function countCcSubjsTokens(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- if(null === $this->collCcSubjsTokens || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcSubjsTokens) {
- return 0;
- } else {
- $query = CcSubjsTokenQuery::create(null, $criteria);
- if($distinct) {
- $query->distinct();
- }
- return $query
- ->filterByCcSubjs($this)
- ->count($con);
- }
- } else {
- return count($this->collCcSubjsTokens);
- }
- }
-
- /**
- * Method called to associate a CcSubjsToken object to this object
- * through the CcSubjsToken foreign key attribute.
- *
- * @param CcSubjsToken $l CcSubjsToken
- * @return void
- * @throws PropelException
- */
- public function addCcSubjsToken(CcSubjsToken $l)
- {
- if ($this->collCcSubjsTokens === null) {
- $this->initCcSubjsTokens();
- }
- if (!$this->collCcSubjsTokens->contains($l)) { // only add it if the **same** object is not already associated
- $this->collCcSubjsTokens[]= $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->cell_phone = 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->collCcFilessRelatedByDbOwnerId) {
- foreach ((array) $this->collCcFilessRelatedByDbOwnerId as $o) {
- $o->clearAllReferences($deep);
- }
- }
- if ($this->collCcFilessRelatedByDbEditedby) {
- foreach ((array) $this->collCcFilessRelatedByDbEditedby 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->collCcBlocks) {
- foreach ((array) $this->collCcBlocks 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 ($this->collCcSubjsTokens) {
- foreach ((array) $this->collCcSubjsTokens as $o) {
- $o->clearAllReferences($deep);
- }
- }
- } // if ($deep)
-
- $this->collCcFilessRelatedByDbOwnerId = null;
- $this->collCcFilessRelatedByDbEditedby = null;
- $this->collCcPermss = null;
- $this->collCcShowHostss = null;
- $this->collCcPlaylists = null;
- $this->collCcBlocks = null;
- $this->collCcPrefs = null;
- $this->collCcSesss = null;
- $this->collCcSubjsTokens = 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
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcSubjsPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcSubjsPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the login field.
+ * Note: this column has a database default value of: ''
+ * @var string
+ */
+ protected $login;
+
+ /**
+ * The value for the pass field.
+ * Note: this column has a database default value of: ''
+ * @var string
+ */
+ protected $pass;
+
+ /**
+ * The value for the type field.
+ * Note: this column has a database default value of: 'U'
+ * @var string
+ */
+ protected $type;
+
+ /**
+ * The value for the first_name field.
+ * Note: this column has a database default value of: ''
+ * @var string
+ */
+ protected $first_name;
+
+ /**
+ * The value for the last_name field.
+ * Note: this column has a database default value of: ''
+ * @var string
+ */
+ protected $last_name;
+
+ /**
+ * The value for the lastlogin field.
+ * @var string
+ */
+ protected $lastlogin;
+
+ /**
+ * The value for the lastfail field.
+ * @var string
+ */
+ protected $lastfail;
+
+ /**
+ * The value for the skype_contact field.
+ * @var string
+ */
+ protected $skype_contact;
+
+ /**
+ * The value for the jabber_contact field.
+ * @var string
+ */
+ protected $jabber_contact;
+
+ /**
+ * The value for the email field.
+ * @var string
+ */
+ protected $email;
+
+ /**
+ * The value for the cell_phone field.
+ * @var string
+ */
+ protected $cell_phone;
+
+ /**
+ * The value for the login_attempts field.
+ * Note: this column has a database default value of: 0
+ * @var int
+ */
+ protected $login_attempts;
+
+ /**
+ * @var PropelObjectCollection|CcFiles[] Collection to store aggregation of CcFiles objects.
+ */
+ protected $collCcFilessRelatedByDbOwnerId;
+ protected $collCcFilessRelatedByDbOwnerIdPartial;
+
+ /**
+ * @var PropelObjectCollection|CcFiles[] Collection to store aggregation of CcFiles objects.
+ */
+ protected $collCcFilessRelatedByDbEditedby;
+ protected $collCcFilessRelatedByDbEditedbyPartial;
+
+ /**
+ * @var PropelObjectCollection|CcPerms[] Collection to store aggregation of CcPerms objects.
+ */
+ protected $collCcPermss;
+ protected $collCcPermssPartial;
+
+ /**
+ * @var PropelObjectCollection|CcShowHosts[] Collection to store aggregation of CcShowHosts objects.
+ */
+ protected $collCcShowHostss;
+ protected $collCcShowHostssPartial;
+
+ /**
+ * @var PropelObjectCollection|CcPlaylist[] Collection to store aggregation of CcPlaylist objects.
+ */
+ protected $collCcPlaylists;
+ protected $collCcPlaylistsPartial;
+
+ /**
+ * @var PropelObjectCollection|CcBlock[] Collection to store aggregation of CcBlock objects.
+ */
+ protected $collCcBlocks;
+ protected $collCcBlocksPartial;
+
+ /**
+ * @var PropelObjectCollection|CcPref[] Collection to store aggregation of CcPref objects.
+ */
+ protected $collCcPrefs;
+ protected $collCcPrefsPartial;
+
+ /**
+ * @var PropelObjectCollection|CcSess[] Collection to store aggregation of CcSess objects.
+ */
+ protected $collCcSesss;
+ protected $collCcSesssPartial;
+
+ /**
+ * @var PropelObjectCollection|CcSubjsToken[] Collection to store aggregation of CcSubjsToken objects.
+ */
+ protected $collCcSubjsTokens;
+ protected $collCcSubjsTokensPartial;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccFilessRelatedByDbOwnerIdScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccFilessRelatedByDbEditedbyScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccPermssScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccShowHostssScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccPlaylistsScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccBlocksScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccPrefsScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccSesssScheduledForDeletion = null;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccSubjsTokensScheduledForDeletion = null;
+
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ 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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ 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 [cell_phone] column value.
+ *
+ * @return string
+ */
+ public function getDbCellPhone()
+ {
+
+ return $this->cell_phone;
+ }
+
+ /**
+ * 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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->login !== $v) {
+ $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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->pass !== $v) {
+ $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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->type !== $v) {
+ $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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->first_name !== $v) {
+ $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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->last_name !== $v) {
+ $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 strings are treated as null.
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function setDbLastlogin($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->lastlogin !== null || $dt !== null) {
+ $currentDateAsString = ($this->lastlogin !== null && $tmpDt = new DateTime($this->lastlogin)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->lastlogin = $newDateAsString;
+ $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 strings are treated as null.
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function setDbLastfail($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->lastfail !== null || $dt !== null) {
+ $currentDateAsString = ($this->lastfail !== null && $tmpDt = new DateTime($this->lastfail)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->lastfail = $newDateAsString;
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $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 && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->email !== $v) {
+ $this->email = $v;
+ $this->modifiedColumns[] = CcSubjsPeer::EMAIL;
+ }
+
+
+ return $this;
+ } // setDbEmail()
+
+ /**
+ * Set the value of [cell_phone] column.
+ *
+ * @param string $v new value
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function setDbCellPhone($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->cell_phone !== $v) {
+ $this->cell_phone = $v;
+ $this->modifiedColumns[] = CcSubjsPeer::CELL_PHONE;
+ }
+
+
+ return $this;
+ } // setDbCellPhone()
+
+ /**
+ * 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 && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->login_attempts !== $v) {
+ $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 resultset 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->cell_phone = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
+ $this->login_attempts = ($row[$startcol + 12] !== null) ? (int) $row[$startcol + 12] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 13; // 13 = CcSubjsPeer::NUM_HYDRATE_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->collCcFilessRelatedByDbOwnerId = null;
+
+ $this->collCcFilessRelatedByDbEditedby = null;
+
+ $this->collCcPermss = null;
+
+ $this->collCcShowHostss = null;
+
+ $this->collCcPlaylists = null;
+
+ $this->collCcBlocks = null;
+
+ $this->collCcPrefs = null;
+
+ $this->collCcSesss = null;
+
+ $this->collCcSubjsTokens = null;
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @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 {
+ $deleteQuery = CcSubjsQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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 (Exception $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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ if ($this->ccFilessRelatedByDbOwnerIdScheduledForDeletion !== null) {
+ if (!$this->ccFilessRelatedByDbOwnerIdScheduledForDeletion->isEmpty()) {
+ foreach ($this->ccFilessRelatedByDbOwnerIdScheduledForDeletion as $ccFilesRelatedByDbOwnerId) {
+ // need to save related object because we set the relation to null
+ $ccFilesRelatedByDbOwnerId->save($con);
+ }
+ $this->ccFilessRelatedByDbOwnerIdScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcFilessRelatedByDbOwnerId !== null) {
+ foreach ($this->collCcFilessRelatedByDbOwnerId as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccFilessRelatedByDbEditedbyScheduledForDeletion !== null) {
+ if (!$this->ccFilessRelatedByDbEditedbyScheduledForDeletion->isEmpty()) {
+ foreach ($this->ccFilessRelatedByDbEditedbyScheduledForDeletion as $ccFilesRelatedByDbEditedby) {
+ // need to save related object because we set the relation to null
+ $ccFilesRelatedByDbEditedby->save($con);
+ }
+ $this->ccFilessRelatedByDbEditedbyScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcFilessRelatedByDbEditedby !== null) {
+ foreach ($this->collCcFilessRelatedByDbEditedby as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccPermssScheduledForDeletion !== null) {
+ if (!$this->ccPermssScheduledForDeletion->isEmpty()) {
+ CcPermsQuery::create()
+ ->filterByPrimaryKeys($this->ccPermssScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccPermssScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcPermss !== null) {
+ foreach ($this->collCcPermss as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccShowHostssScheduledForDeletion !== null) {
+ if (!$this->ccShowHostssScheduledForDeletion->isEmpty()) {
+ CcShowHostsQuery::create()
+ ->filterByPrimaryKeys($this->ccShowHostssScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccShowHostssScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcShowHostss !== null) {
+ foreach ($this->collCcShowHostss as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccPlaylistsScheduledForDeletion !== null) {
+ if (!$this->ccPlaylistsScheduledForDeletion->isEmpty()) {
+ CcPlaylistQuery::create()
+ ->filterByPrimaryKeys($this->ccPlaylistsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccPlaylistsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcPlaylists !== null) {
+ foreach ($this->collCcPlaylists as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccBlocksScheduledForDeletion !== null) {
+ if (!$this->ccBlocksScheduledForDeletion->isEmpty()) {
+ CcBlockQuery::create()
+ ->filterByPrimaryKeys($this->ccBlocksScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccBlocksScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcBlocks !== null) {
+ foreach ($this->collCcBlocks as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccPrefsScheduledForDeletion !== null) {
+ if (!$this->ccPrefsScheduledForDeletion->isEmpty()) {
+ CcPrefQuery::create()
+ ->filterByPrimaryKeys($this->ccPrefsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccPrefsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcPrefs !== null) {
+ foreach ($this->collCcPrefs as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccSesssScheduledForDeletion !== null) {
+ if (!$this->ccSesssScheduledForDeletion->isEmpty()) {
+ CcSessQuery::create()
+ ->filterByPrimaryKeys($this->ccSesssScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccSesssScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcSesss !== null) {
+ foreach ($this->collCcSesss as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ if ($this->ccSubjsTokensScheduledForDeletion !== null) {
+ if (!$this->ccSubjsTokensScheduledForDeletion->isEmpty()) {
+ CcSubjsTokenQuery::create()
+ ->filterByPrimaryKeys($this->ccSubjsTokensScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccSubjsTokensScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcSubjsTokens !== null) {
+ foreach ($this->collCcSubjsTokens as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcSubjsPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcSubjsPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_subjs_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcSubjsPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcSubjsPeer::LOGIN)) {
+ $modifiedColumns[':p' . $index++] = '"login"';
+ }
+ if ($this->isColumnModified(CcSubjsPeer::PASS)) {
+ $modifiedColumns[':p' . $index++] = '"pass"';
+ }
+ if ($this->isColumnModified(CcSubjsPeer::TYPE)) {
+ $modifiedColumns[':p' . $index++] = '"type"';
+ }
+ if ($this->isColumnModified(CcSubjsPeer::FIRST_NAME)) {
+ $modifiedColumns[':p' . $index++] = '"first_name"';
+ }
+ if ($this->isColumnModified(CcSubjsPeer::LAST_NAME)) {
+ $modifiedColumns[':p' . $index++] = '"last_name"';
+ }
+ if ($this->isColumnModified(CcSubjsPeer::LASTLOGIN)) {
+ $modifiedColumns[':p' . $index++] = '"lastlogin"';
+ }
+ if ($this->isColumnModified(CcSubjsPeer::LASTFAIL)) {
+ $modifiedColumns[':p' . $index++] = '"lastfail"';
+ }
+ if ($this->isColumnModified(CcSubjsPeer::SKYPE_CONTACT)) {
+ $modifiedColumns[':p' . $index++] = '"skype_contact"';
+ }
+ if ($this->isColumnModified(CcSubjsPeer::JABBER_CONTACT)) {
+ $modifiedColumns[':p' . $index++] = '"jabber_contact"';
+ }
+ if ($this->isColumnModified(CcSubjsPeer::EMAIL)) {
+ $modifiedColumns[':p' . $index++] = '"email"';
+ }
+ if ($this->isColumnModified(CcSubjsPeer::CELL_PHONE)) {
+ $modifiedColumns[':p' . $index++] = '"cell_phone"';
+ }
+ if ($this->isColumnModified(CcSubjsPeer::LOGIN_ATTEMPTS)) {
+ $modifiedColumns[':p' . $index++] = '"login_attempts"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_subjs" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"login"':
+ $stmt->bindValue($identifier, $this->login, PDO::PARAM_STR);
+ break;
+ case '"pass"':
+ $stmt->bindValue($identifier, $this->pass, PDO::PARAM_STR);
+ break;
+ case '"type"':
+ $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR);
+ break;
+ case '"first_name"':
+ $stmt->bindValue($identifier, $this->first_name, PDO::PARAM_STR);
+ break;
+ case '"last_name"':
+ $stmt->bindValue($identifier, $this->last_name, PDO::PARAM_STR);
+ break;
+ case '"lastlogin"':
+ $stmt->bindValue($identifier, $this->lastlogin, PDO::PARAM_STR);
+ break;
+ case '"lastfail"':
+ $stmt->bindValue($identifier, $this->lastfail, PDO::PARAM_STR);
+ break;
+ case '"skype_contact"':
+ $stmt->bindValue($identifier, $this->skype_contact, PDO::PARAM_STR);
+ break;
+ case '"jabber_contact"':
+ $stmt->bindValue($identifier, $this->jabber_contact, PDO::PARAM_STR);
+ break;
+ case '"email"':
+ $stmt->bindValue($identifier, $this->email, PDO::PARAM_STR);
+ break;
+ case '"cell_phone"':
+ $stmt->bindValue($identifier, $this->cell_phone, PDO::PARAM_STR);
+ break;
+ case '"login_attempts"':
+ $stmt->bindValue($identifier, $this->login_attempts, PDO::PARAM_INT);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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->collCcFilessRelatedByDbOwnerId !== null) {
+ foreach ($this->collCcFilessRelatedByDbOwnerId as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
+ if ($this->collCcFilessRelatedByDbEditedby !== null) {
+ foreach ($this->collCcFilessRelatedByDbEditedby 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->collCcBlocks !== null) {
+ foreach ($this->collCcBlocks 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());
+ }
+ }
+ }
+
+ if ($this->collCcSubjsTokens !== null) {
+ foreach ($this->collCcSubjsTokens 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @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->getDbCellPhone();
+ break;
+ case 12:
+ 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.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcSubjs'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcSubjs'][$this->getPrimaryKey()] = 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->getDbCellPhone(),
+ $keys[12] => $this->getDbLoginAttempts(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->collCcFilessRelatedByDbOwnerId) {
+ $result['CcFilessRelatedByDbOwnerId'] = $this->collCcFilessRelatedByDbOwnerId->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcFilessRelatedByDbEditedby) {
+ $result['CcFilessRelatedByDbEditedby'] = $this->collCcFilessRelatedByDbEditedby->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcPermss) {
+ $result['CcPermss'] = $this->collCcPermss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcShowHostss) {
+ $result['CcShowHostss'] = $this->collCcShowHostss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcPlaylists) {
+ $result['CcPlaylists'] = $this->collCcPlaylists->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcBlocks) {
+ $result['CcBlocks'] = $this->collCcBlocks->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcPrefs) {
+ $result['CcPrefs'] = $this->collCcPrefs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcSesss) {
+ $result['CcSesss'] = $this->collCcSesss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ if (null !== $this->collCcSubjsTokens) {
+ $result['CcSubjsTokens'] = $this->collCcSubjsTokens->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ }
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcSubjsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbCellPhone($value);
+ break;
+ case 12:
+ $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 BasePeer::TYPE_PHPNAME
+ *
+ * @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->setDbCellPhone($arr[$keys[11]]);
+ if (array_key_exists($keys[12], $arr)) $this->setDbLoginAttempts($arr[$keys[12]]);
+ }
+
+ /**
+ * 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::CELL_PHONE)) $criteria->add(CcSubjsPeer::CELL_PHONE, $this->cell_phone);
+ 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.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbLogin($this->getDbLogin());
+ $copyObj->setDbPass($this->getDbPass());
+ $copyObj->setDbType($this->getDbType());
+ $copyObj->setDbFirstName($this->getDbFirstName());
+ $copyObj->setDbLastName($this->getDbLastName());
+ $copyObj->setDbLastlogin($this->getDbLastlogin());
+ $copyObj->setDbLastfail($this->getDbLastfail());
+ $copyObj->setDbSkypeContact($this->getDbSkypeContact());
+ $copyObj->setDbJabberContact($this->getDbJabberContact());
+ $copyObj->setDbEmail($this->getDbEmail());
+ $copyObj->setDbCellPhone($this->getDbCellPhone());
+ $copyObj->setDbLoginAttempts($this->getDbLoginAttempts());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ foreach ($this->getCcFilessRelatedByDbOwnerId() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcFilesRelatedByDbOwnerId($relObj->copy($deepCopy));
+ }
+ }
+
+ foreach ($this->getCcFilessRelatedByDbEditedby() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcFilesRelatedByDbEditedby($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->getCcBlocks() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcBlock($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));
+ }
+ }
+
+ foreach ($this->getCcSubjsTokens() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcSubjsToken($relObj->copy($deepCopy));
+ }
+ }
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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;
+ }
+
+
+ /**
+ * Initializes a collection based on the name of a relation.
+ * Avoids crafting an 'init[$relationName]s' method name
+ * that wouldn't work when StandardEnglishPluralizer is used.
+ *
+ * @param string $relationName The name of the relation to initialize
+ * @return void
+ */
+ public function initRelation($relationName)
+ {
+ if ('CcFilesRelatedByDbOwnerId' == $relationName) {
+ $this->initCcFilessRelatedByDbOwnerId();
+ }
+ if ('CcFilesRelatedByDbEditedby' == $relationName) {
+ $this->initCcFilessRelatedByDbEditedby();
+ }
+ if ('CcPerms' == $relationName) {
+ $this->initCcPermss();
+ }
+ if ('CcShowHosts' == $relationName) {
+ $this->initCcShowHostss();
+ }
+ if ('CcPlaylist' == $relationName) {
+ $this->initCcPlaylists();
+ }
+ if ('CcBlock' == $relationName) {
+ $this->initCcBlocks();
+ }
+ if ('CcPref' == $relationName) {
+ $this->initCcPrefs();
+ }
+ if ('CcSess' == $relationName) {
+ $this->initCcSesss();
+ }
+ if ('CcSubjsToken' == $relationName) {
+ $this->initCcSubjsTokens();
+ }
+ }
+
+ /**
+ * Clears out the collCcFilessRelatedByDbOwnerId 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 CcSubjs The current object (for fluent API support)
+ * @see addCcFilessRelatedByDbOwnerId()
+ */
+ public function clearCcFilessRelatedByDbOwnerId()
+ {
+ $this->collCcFilessRelatedByDbOwnerId = null; // important to set this to null since that means it is uninitialized
+ $this->collCcFilessRelatedByDbOwnerIdPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcFilessRelatedByDbOwnerId collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcFilessRelatedByDbOwnerId($v = true)
+ {
+ $this->collCcFilessRelatedByDbOwnerIdPartial = $v;
+ }
+
+ /**
+ * Initializes the collCcFilessRelatedByDbOwnerId collection.
+ *
+ * By default this just sets the collCcFilessRelatedByDbOwnerId collection to an empty array (like clearcollCcFilessRelatedByDbOwnerId());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcFilessRelatedByDbOwnerId($overrideExisting = true)
+ {
+ if (null !== $this->collCcFilessRelatedByDbOwnerId && !$overrideExisting) {
+ return;
+ }
+ $this->collCcFilessRelatedByDbOwnerId = new PropelObjectCollection();
+ $this->collCcFilessRelatedByDbOwnerId->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 PropelObjectCollection|CcFiles[] List of CcFiles objects
+ * @throws PropelException
+ */
+ public function getCcFilessRelatedByDbOwnerId($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcFilessRelatedByDbOwnerIdPartial && !$this->isNew();
+ if (null === $this->collCcFilessRelatedByDbOwnerId || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcFilessRelatedByDbOwnerId) {
+ // return empty collection
+ $this->initCcFilessRelatedByDbOwnerId();
+ } else {
+ $collCcFilessRelatedByDbOwnerId = CcFilesQuery::create(null, $criteria)
+ ->filterByFkOwner($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcFilessRelatedByDbOwnerIdPartial && count($collCcFilessRelatedByDbOwnerId)) {
+ $this->initCcFilessRelatedByDbOwnerId(false);
+
+ foreach ($collCcFilessRelatedByDbOwnerId as $obj) {
+ if (false == $this->collCcFilessRelatedByDbOwnerId->contains($obj)) {
+ $this->collCcFilessRelatedByDbOwnerId->append($obj);
+ }
+ }
+
+ $this->collCcFilessRelatedByDbOwnerIdPartial = true;
+ }
+
+ $collCcFilessRelatedByDbOwnerId->getInternalIterator()->rewind();
+
+ return $collCcFilessRelatedByDbOwnerId;
+ }
+
+ if ($partial && $this->collCcFilessRelatedByDbOwnerId) {
+ foreach ($this->collCcFilessRelatedByDbOwnerId as $obj) {
+ if ($obj->isNew()) {
+ $collCcFilessRelatedByDbOwnerId[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcFilessRelatedByDbOwnerId = $collCcFilessRelatedByDbOwnerId;
+ $this->collCcFilessRelatedByDbOwnerIdPartial = false;
+ }
+ }
+
+ return $this->collCcFilessRelatedByDbOwnerId;
+ }
+
+ /**
+ * Sets a collection of CcFilesRelatedByDbOwnerId objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccFilessRelatedByDbOwnerId A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function setCcFilessRelatedByDbOwnerId(PropelCollection $ccFilessRelatedByDbOwnerId, PropelPDO $con = null)
+ {
+ $ccFilessRelatedByDbOwnerIdToDelete = $this->getCcFilessRelatedByDbOwnerId(new Criteria(), $con)->diff($ccFilessRelatedByDbOwnerId);
+
+
+ $this->ccFilessRelatedByDbOwnerIdScheduledForDeletion = $ccFilessRelatedByDbOwnerIdToDelete;
+
+ foreach ($ccFilessRelatedByDbOwnerIdToDelete as $ccFilesRelatedByDbOwnerIdRemoved) {
+ $ccFilesRelatedByDbOwnerIdRemoved->setFkOwner(null);
+ }
+
+ $this->collCcFilessRelatedByDbOwnerId = null;
+ foreach ($ccFilessRelatedByDbOwnerId as $ccFilesRelatedByDbOwnerId) {
+ $this->addCcFilesRelatedByDbOwnerId($ccFilesRelatedByDbOwnerId);
+ }
+
+ $this->collCcFilessRelatedByDbOwnerId = $ccFilessRelatedByDbOwnerId;
+ $this->collCcFilessRelatedByDbOwnerIdPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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 countCcFilessRelatedByDbOwnerId(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collCcFilessRelatedByDbOwnerIdPartial && !$this->isNew();
+ if (null === $this->collCcFilessRelatedByDbOwnerId || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcFilessRelatedByDbOwnerId) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcFilessRelatedByDbOwnerId());
+ }
+ $query = CcFilesQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByFkOwner($this)
+ ->count($con);
+ }
+
+ return count($this->collCcFilessRelatedByDbOwnerId);
+ }
+
+ /**
+ * Method called to associate a CcFiles object to this object
+ * through the CcFiles foreign key attribute.
+ *
+ * @param CcFiles $l CcFiles
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function addCcFilesRelatedByDbOwnerId(CcFiles $l)
+ {
+ if ($this->collCcFilessRelatedByDbOwnerId === null) {
+ $this->initCcFilessRelatedByDbOwnerId();
+ $this->collCcFilessRelatedByDbOwnerIdPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcFilessRelatedByDbOwnerId->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcFilesRelatedByDbOwnerId($l);
+
+ if ($this->ccFilessRelatedByDbOwnerIdScheduledForDeletion and $this->ccFilessRelatedByDbOwnerIdScheduledForDeletion->contains($l)) {
+ $this->ccFilessRelatedByDbOwnerIdScheduledForDeletion->remove($this->ccFilessRelatedByDbOwnerIdScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcFilesRelatedByDbOwnerId $ccFilesRelatedByDbOwnerId The ccFilesRelatedByDbOwnerId object to add.
+ */
+ protected function doAddCcFilesRelatedByDbOwnerId($ccFilesRelatedByDbOwnerId)
+ {
+ $this->collCcFilessRelatedByDbOwnerId[]= $ccFilesRelatedByDbOwnerId;
+ $ccFilesRelatedByDbOwnerId->setFkOwner($this);
+ }
+
+ /**
+ * @param CcFilesRelatedByDbOwnerId $ccFilesRelatedByDbOwnerId The ccFilesRelatedByDbOwnerId object to remove.
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function removeCcFilesRelatedByDbOwnerId($ccFilesRelatedByDbOwnerId)
+ {
+ if ($this->getCcFilessRelatedByDbOwnerId()->contains($ccFilesRelatedByDbOwnerId)) {
+ $this->collCcFilessRelatedByDbOwnerId->remove($this->collCcFilessRelatedByDbOwnerId->search($ccFilesRelatedByDbOwnerId));
+ if (null === $this->ccFilessRelatedByDbOwnerIdScheduledForDeletion) {
+ $this->ccFilessRelatedByDbOwnerIdScheduledForDeletion = clone $this->collCcFilessRelatedByDbOwnerId;
+ $this->ccFilessRelatedByDbOwnerIdScheduledForDeletion->clear();
+ }
+ $this->ccFilessRelatedByDbOwnerIdScheduledForDeletion[]= $ccFilesRelatedByDbOwnerId;
+ $ccFilesRelatedByDbOwnerId->setFkOwner(null);
+ }
+
+ return $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 CcFilessRelatedByDbOwnerId 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 PropelObjectCollection|CcFiles[] List of CcFiles objects
+ */
+ public function getCcFilessRelatedByDbOwnerIdJoinCcMusicDirs($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcFilesQuery::create(null, $criteria);
+ $query->joinWith('CcMusicDirs', $join_behavior);
+
+ return $this->getCcFilessRelatedByDbOwnerId($query, $con);
+ }
+
+ /**
+ * Clears out the collCcFilessRelatedByDbEditedby 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 CcSubjs The current object (for fluent API support)
+ * @see addCcFilessRelatedByDbEditedby()
+ */
+ public function clearCcFilessRelatedByDbEditedby()
+ {
+ $this->collCcFilessRelatedByDbEditedby = null; // important to set this to null since that means it is uninitialized
+ $this->collCcFilessRelatedByDbEditedbyPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcFilessRelatedByDbEditedby collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcFilessRelatedByDbEditedby($v = true)
+ {
+ $this->collCcFilessRelatedByDbEditedbyPartial = $v;
+ }
+
+ /**
+ * Initializes the collCcFilessRelatedByDbEditedby collection.
+ *
+ * By default this just sets the collCcFilessRelatedByDbEditedby collection to an empty array (like clearcollCcFilessRelatedByDbEditedby());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcFilessRelatedByDbEditedby($overrideExisting = true)
+ {
+ if (null !== $this->collCcFilessRelatedByDbEditedby && !$overrideExisting) {
+ return;
+ }
+ $this->collCcFilessRelatedByDbEditedby = new PropelObjectCollection();
+ $this->collCcFilessRelatedByDbEditedby->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 PropelObjectCollection|CcFiles[] List of CcFiles objects
+ * @throws PropelException
+ */
+ public function getCcFilessRelatedByDbEditedby($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcFilessRelatedByDbEditedbyPartial && !$this->isNew();
+ if (null === $this->collCcFilessRelatedByDbEditedby || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcFilessRelatedByDbEditedby) {
+ // return empty collection
+ $this->initCcFilessRelatedByDbEditedby();
+ } else {
+ $collCcFilessRelatedByDbEditedby = CcFilesQuery::create(null, $criteria)
+ ->filterByCcSubjsRelatedByDbEditedby($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcFilessRelatedByDbEditedbyPartial && count($collCcFilessRelatedByDbEditedby)) {
+ $this->initCcFilessRelatedByDbEditedby(false);
+
+ foreach ($collCcFilessRelatedByDbEditedby as $obj) {
+ if (false == $this->collCcFilessRelatedByDbEditedby->contains($obj)) {
+ $this->collCcFilessRelatedByDbEditedby->append($obj);
+ }
+ }
+
+ $this->collCcFilessRelatedByDbEditedbyPartial = true;
+ }
+
+ $collCcFilessRelatedByDbEditedby->getInternalIterator()->rewind();
+
+ return $collCcFilessRelatedByDbEditedby;
+ }
+
+ if ($partial && $this->collCcFilessRelatedByDbEditedby) {
+ foreach ($this->collCcFilessRelatedByDbEditedby as $obj) {
+ if ($obj->isNew()) {
+ $collCcFilessRelatedByDbEditedby[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcFilessRelatedByDbEditedby = $collCcFilessRelatedByDbEditedby;
+ $this->collCcFilessRelatedByDbEditedbyPartial = false;
+ }
+ }
+
+ return $this->collCcFilessRelatedByDbEditedby;
+ }
+
+ /**
+ * Sets a collection of CcFilesRelatedByDbEditedby objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccFilessRelatedByDbEditedby A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function setCcFilessRelatedByDbEditedby(PropelCollection $ccFilessRelatedByDbEditedby, PropelPDO $con = null)
+ {
+ $ccFilessRelatedByDbEditedbyToDelete = $this->getCcFilessRelatedByDbEditedby(new Criteria(), $con)->diff($ccFilessRelatedByDbEditedby);
+
+
+ $this->ccFilessRelatedByDbEditedbyScheduledForDeletion = $ccFilessRelatedByDbEditedbyToDelete;
+
+ foreach ($ccFilessRelatedByDbEditedbyToDelete as $ccFilesRelatedByDbEditedbyRemoved) {
+ $ccFilesRelatedByDbEditedbyRemoved->setCcSubjsRelatedByDbEditedby(null);
+ }
+
+ $this->collCcFilessRelatedByDbEditedby = null;
+ foreach ($ccFilessRelatedByDbEditedby as $ccFilesRelatedByDbEditedby) {
+ $this->addCcFilesRelatedByDbEditedby($ccFilesRelatedByDbEditedby);
+ }
+
+ $this->collCcFilessRelatedByDbEditedby = $ccFilessRelatedByDbEditedby;
+ $this->collCcFilessRelatedByDbEditedbyPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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 countCcFilessRelatedByDbEditedby(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collCcFilessRelatedByDbEditedbyPartial && !$this->isNew();
+ if (null === $this->collCcFilessRelatedByDbEditedby || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcFilessRelatedByDbEditedby) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcFilessRelatedByDbEditedby());
+ }
+ $query = CcFilesQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcSubjsRelatedByDbEditedby($this)
+ ->count($con);
+ }
+
+ return count($this->collCcFilessRelatedByDbEditedby);
+ }
+
+ /**
+ * Method called to associate a CcFiles object to this object
+ * through the CcFiles foreign key attribute.
+ *
+ * @param CcFiles $l CcFiles
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function addCcFilesRelatedByDbEditedby(CcFiles $l)
+ {
+ if ($this->collCcFilessRelatedByDbEditedby === null) {
+ $this->initCcFilessRelatedByDbEditedby();
+ $this->collCcFilessRelatedByDbEditedbyPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcFilessRelatedByDbEditedby->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcFilesRelatedByDbEditedby($l);
+
+ if ($this->ccFilessRelatedByDbEditedbyScheduledForDeletion and $this->ccFilessRelatedByDbEditedbyScheduledForDeletion->contains($l)) {
+ $this->ccFilessRelatedByDbEditedbyScheduledForDeletion->remove($this->ccFilessRelatedByDbEditedbyScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcFilesRelatedByDbEditedby $ccFilesRelatedByDbEditedby The ccFilesRelatedByDbEditedby object to add.
+ */
+ protected function doAddCcFilesRelatedByDbEditedby($ccFilesRelatedByDbEditedby)
+ {
+ $this->collCcFilessRelatedByDbEditedby[]= $ccFilesRelatedByDbEditedby;
+ $ccFilesRelatedByDbEditedby->setCcSubjsRelatedByDbEditedby($this);
+ }
+
+ /**
+ * @param CcFilesRelatedByDbEditedby $ccFilesRelatedByDbEditedby The ccFilesRelatedByDbEditedby object to remove.
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function removeCcFilesRelatedByDbEditedby($ccFilesRelatedByDbEditedby)
+ {
+ if ($this->getCcFilessRelatedByDbEditedby()->contains($ccFilesRelatedByDbEditedby)) {
+ $this->collCcFilessRelatedByDbEditedby->remove($this->collCcFilessRelatedByDbEditedby->search($ccFilesRelatedByDbEditedby));
+ if (null === $this->ccFilessRelatedByDbEditedbyScheduledForDeletion) {
+ $this->ccFilessRelatedByDbEditedbyScheduledForDeletion = clone $this->collCcFilessRelatedByDbEditedby;
+ $this->ccFilessRelatedByDbEditedbyScheduledForDeletion->clear();
+ }
+ $this->ccFilessRelatedByDbEditedbyScheduledForDeletion[]= $ccFilesRelatedByDbEditedby;
+ $ccFilesRelatedByDbEditedby->setCcSubjsRelatedByDbEditedby(null);
+ }
+
+ return $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 CcFilessRelatedByDbEditedby 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 PropelObjectCollection|CcFiles[] List of CcFiles objects
+ */
+ public function getCcFilessRelatedByDbEditedbyJoinCcMusicDirs($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcFilesQuery::create(null, $criteria);
+ $query->joinWith('CcMusicDirs', $join_behavior);
+
+ return $this->getCcFilessRelatedByDbEditedby($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 CcSubjs The current object (for fluent API support)
+ * @see addCcPermss()
+ */
+ public function clearCcPermss()
+ {
+ $this->collCcPermss = null; // important to set this to null since that means it is uninitialized
+ $this->collCcPermssPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcPermss collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcPermss($v = true)
+ {
+ $this->collCcPermssPartial = $v;
+ }
+
+ /**
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcPermss($overrideExisting = true)
+ {
+ if (null !== $this->collCcPermss && !$overrideExisting) {
+ return;
+ }
+ $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 PropelObjectCollection|CcPerms[] List of CcPerms objects
+ * @throws PropelException
+ */
+ public function getCcPermss($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcPermssPartial && !$this->isNew();
+ if (null === $this->collCcPermss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPermss) {
+ // return empty collection
+ $this->initCcPermss();
+ } else {
+ $collCcPermss = CcPermsQuery::create(null, $criteria)
+ ->filterByCcSubjs($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcPermssPartial && count($collCcPermss)) {
+ $this->initCcPermss(false);
+
+ foreach ($collCcPermss as $obj) {
+ if (false == $this->collCcPermss->contains($obj)) {
+ $this->collCcPermss->append($obj);
+ }
+ }
+
+ $this->collCcPermssPartial = true;
+ }
+
+ $collCcPermss->getInternalIterator()->rewind();
+
+ return $collCcPermss;
+ }
+
+ if ($partial && $this->collCcPermss) {
+ foreach ($this->collCcPermss as $obj) {
+ if ($obj->isNew()) {
+ $collCcPermss[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcPermss = $collCcPermss;
+ $this->collCcPermssPartial = false;
+ }
+ }
+
+ return $this->collCcPermss;
+ }
+
+ /**
+ * Sets a collection of CcPerms objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccPermss A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function setCcPermss(PropelCollection $ccPermss, PropelPDO $con = null)
+ {
+ $ccPermssToDelete = $this->getCcPermss(new Criteria(), $con)->diff($ccPermss);
+
+
+ $this->ccPermssScheduledForDeletion = $ccPermssToDelete;
+
+ foreach ($ccPermssToDelete as $ccPermsRemoved) {
+ $ccPermsRemoved->setCcSubjs(null);
+ }
+
+ $this->collCcPermss = null;
+ foreach ($ccPermss as $ccPerms) {
+ $this->addCcPerms($ccPerms);
+ }
+
+ $this->collCcPermss = $ccPermss;
+ $this->collCcPermssPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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)
+ {
+ $partial = $this->collCcPermssPartial && !$this->isNew();
+ if (null === $this->collCcPermss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPermss) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcPermss());
+ }
+ $query = CcPermsQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcSubjs($this)
+ ->count($con);
+ }
+
+ 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 CcSubjs The current object (for fluent API support)
+ */
+ public function addCcPerms(CcPerms $l)
+ {
+ if ($this->collCcPermss === null) {
+ $this->initCcPermss();
+ $this->collCcPermssPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcPermss->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcPerms($l);
+
+ if ($this->ccPermssScheduledForDeletion and $this->ccPermssScheduledForDeletion->contains($l)) {
+ $this->ccPermssScheduledForDeletion->remove($this->ccPermssScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcPerms $ccPerms The ccPerms object to add.
+ */
+ protected function doAddCcPerms($ccPerms)
+ {
+ $this->collCcPermss[]= $ccPerms;
+ $ccPerms->setCcSubjs($this);
+ }
+
+ /**
+ * @param CcPerms $ccPerms The ccPerms object to remove.
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function removeCcPerms($ccPerms)
+ {
+ if ($this->getCcPermss()->contains($ccPerms)) {
+ $this->collCcPermss->remove($this->collCcPermss->search($ccPerms));
+ if (null === $this->ccPermssScheduledForDeletion) {
+ $this->ccPermssScheduledForDeletion = clone $this->collCcPermss;
+ $this->ccPermssScheduledForDeletion->clear();
+ }
+ $this->ccPermssScheduledForDeletion[]= $ccPerms;
+ $ccPerms->setCcSubjs(null);
+ }
+
+ return $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 CcSubjs The current object (for fluent API support)
+ * @see addCcShowHostss()
+ */
+ public function clearCcShowHostss()
+ {
+ $this->collCcShowHostss = null; // important to set this to null since that means it is uninitialized
+ $this->collCcShowHostssPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcShowHostss collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcShowHostss($v = true)
+ {
+ $this->collCcShowHostssPartial = $v;
+ }
+
+ /**
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcShowHostss($overrideExisting = true)
+ {
+ if (null !== $this->collCcShowHostss && !$overrideExisting) {
+ return;
+ }
+ $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 PropelObjectCollection|CcShowHosts[] List of CcShowHosts objects
+ * @throws PropelException
+ */
+ public function getCcShowHostss($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcShowHostssPartial && !$this->isNew();
+ if (null === $this->collCcShowHostss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcShowHostss) {
+ // return empty collection
+ $this->initCcShowHostss();
+ } else {
+ $collCcShowHostss = CcShowHostsQuery::create(null, $criteria)
+ ->filterByCcSubjs($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcShowHostssPartial && count($collCcShowHostss)) {
+ $this->initCcShowHostss(false);
+
+ foreach ($collCcShowHostss as $obj) {
+ if (false == $this->collCcShowHostss->contains($obj)) {
+ $this->collCcShowHostss->append($obj);
+ }
+ }
+
+ $this->collCcShowHostssPartial = true;
+ }
+
+ $collCcShowHostss->getInternalIterator()->rewind();
+
+ return $collCcShowHostss;
+ }
+
+ if ($partial && $this->collCcShowHostss) {
+ foreach ($this->collCcShowHostss as $obj) {
+ if ($obj->isNew()) {
+ $collCcShowHostss[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcShowHostss = $collCcShowHostss;
+ $this->collCcShowHostssPartial = false;
+ }
+ }
+
+ return $this->collCcShowHostss;
+ }
+
+ /**
+ * Sets a collection of CcShowHosts objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccShowHostss A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function setCcShowHostss(PropelCollection $ccShowHostss, PropelPDO $con = null)
+ {
+ $ccShowHostssToDelete = $this->getCcShowHostss(new Criteria(), $con)->diff($ccShowHostss);
+
+
+ $this->ccShowHostssScheduledForDeletion = $ccShowHostssToDelete;
+
+ foreach ($ccShowHostssToDelete as $ccShowHostsRemoved) {
+ $ccShowHostsRemoved->setCcSubjs(null);
+ }
+
+ $this->collCcShowHostss = null;
+ foreach ($ccShowHostss as $ccShowHosts) {
+ $this->addCcShowHosts($ccShowHosts);
+ }
+
+ $this->collCcShowHostss = $ccShowHostss;
+ $this->collCcShowHostssPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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)
+ {
+ $partial = $this->collCcShowHostssPartial && !$this->isNew();
+ if (null === $this->collCcShowHostss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcShowHostss) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcShowHostss());
+ }
+ $query = CcShowHostsQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcSubjs($this)
+ ->count($con);
+ }
+
+ 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 CcSubjs The current object (for fluent API support)
+ */
+ public function addCcShowHosts(CcShowHosts $l)
+ {
+ if ($this->collCcShowHostss === null) {
+ $this->initCcShowHostss();
+ $this->collCcShowHostssPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcShowHostss->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcShowHosts($l);
+
+ if ($this->ccShowHostssScheduledForDeletion and $this->ccShowHostssScheduledForDeletion->contains($l)) {
+ $this->ccShowHostssScheduledForDeletion->remove($this->ccShowHostssScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcShowHosts $ccShowHosts The ccShowHosts object to add.
+ */
+ protected function doAddCcShowHosts($ccShowHosts)
+ {
+ $this->collCcShowHostss[]= $ccShowHosts;
+ $ccShowHosts->setCcSubjs($this);
+ }
+
+ /**
+ * @param CcShowHosts $ccShowHosts The ccShowHosts object to remove.
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function removeCcShowHosts($ccShowHosts)
+ {
+ if ($this->getCcShowHostss()->contains($ccShowHosts)) {
+ $this->collCcShowHostss->remove($this->collCcShowHostss->search($ccShowHosts));
+ if (null === $this->ccShowHostssScheduledForDeletion) {
+ $this->ccShowHostssScheduledForDeletion = clone $this->collCcShowHostss;
+ $this->ccShowHostssScheduledForDeletion->clear();
+ }
+ $this->ccShowHostssScheduledForDeletion[]= clone $ccShowHosts;
+ $ccShowHosts->setCcSubjs(null);
+ }
+
+ return $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 PropelObjectCollection|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 CcSubjs The current object (for fluent API support)
+ * @see addCcPlaylists()
+ */
+ public function clearCcPlaylists()
+ {
+ $this->collCcPlaylists = null; // important to set this to null since that means it is uninitialized
+ $this->collCcPlaylistsPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcPlaylists collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcPlaylists($v = true)
+ {
+ $this->collCcPlaylistsPartial = $v;
+ }
+
+ /**
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcPlaylists($overrideExisting = true)
+ {
+ if (null !== $this->collCcPlaylists && !$overrideExisting) {
+ return;
+ }
+ $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 PropelObjectCollection|CcPlaylist[] List of CcPlaylist objects
+ * @throws PropelException
+ */
+ public function getCcPlaylists($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcPlaylistsPartial && !$this->isNew();
+ if (null === $this->collCcPlaylists || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPlaylists) {
+ // return empty collection
+ $this->initCcPlaylists();
+ } else {
+ $collCcPlaylists = CcPlaylistQuery::create(null, $criteria)
+ ->filterByCcSubjs($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcPlaylistsPartial && count($collCcPlaylists)) {
+ $this->initCcPlaylists(false);
+
+ foreach ($collCcPlaylists as $obj) {
+ if (false == $this->collCcPlaylists->contains($obj)) {
+ $this->collCcPlaylists->append($obj);
+ }
+ }
+
+ $this->collCcPlaylistsPartial = true;
+ }
+
+ $collCcPlaylists->getInternalIterator()->rewind();
+
+ return $collCcPlaylists;
+ }
+
+ if ($partial && $this->collCcPlaylists) {
+ foreach ($this->collCcPlaylists as $obj) {
+ if ($obj->isNew()) {
+ $collCcPlaylists[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcPlaylists = $collCcPlaylists;
+ $this->collCcPlaylistsPartial = false;
+ }
+ }
+
+ return $this->collCcPlaylists;
+ }
+
+ /**
+ * Sets a collection of CcPlaylist objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccPlaylists A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function setCcPlaylists(PropelCollection $ccPlaylists, PropelPDO $con = null)
+ {
+ $ccPlaylistsToDelete = $this->getCcPlaylists(new Criteria(), $con)->diff($ccPlaylists);
+
+
+ $this->ccPlaylistsScheduledForDeletion = $ccPlaylistsToDelete;
+
+ foreach ($ccPlaylistsToDelete as $ccPlaylistRemoved) {
+ $ccPlaylistRemoved->setCcSubjs(null);
+ }
+
+ $this->collCcPlaylists = null;
+ foreach ($ccPlaylists as $ccPlaylist) {
+ $this->addCcPlaylist($ccPlaylist);
+ }
+
+ $this->collCcPlaylists = $ccPlaylists;
+ $this->collCcPlaylistsPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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)
+ {
+ $partial = $this->collCcPlaylistsPartial && !$this->isNew();
+ if (null === $this->collCcPlaylists || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPlaylists) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcPlaylists());
+ }
+ $query = CcPlaylistQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcSubjs($this)
+ ->count($con);
+ }
+
+ 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 CcSubjs The current object (for fluent API support)
+ */
+ public function addCcPlaylist(CcPlaylist $l)
+ {
+ if ($this->collCcPlaylists === null) {
+ $this->initCcPlaylists();
+ $this->collCcPlaylistsPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcPlaylists->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcPlaylist($l);
+
+ if ($this->ccPlaylistsScheduledForDeletion and $this->ccPlaylistsScheduledForDeletion->contains($l)) {
+ $this->ccPlaylistsScheduledForDeletion->remove($this->ccPlaylistsScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcPlaylist $ccPlaylist The ccPlaylist object to add.
+ */
+ protected function doAddCcPlaylist($ccPlaylist)
+ {
+ $this->collCcPlaylists[]= $ccPlaylist;
+ $ccPlaylist->setCcSubjs($this);
+ }
+
+ /**
+ * @param CcPlaylist $ccPlaylist The ccPlaylist object to remove.
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function removeCcPlaylist($ccPlaylist)
+ {
+ if ($this->getCcPlaylists()->contains($ccPlaylist)) {
+ $this->collCcPlaylists->remove($this->collCcPlaylists->search($ccPlaylist));
+ if (null === $this->ccPlaylistsScheduledForDeletion) {
+ $this->ccPlaylistsScheduledForDeletion = clone $this->collCcPlaylists;
+ $this->ccPlaylistsScheduledForDeletion->clear();
+ }
+ $this->ccPlaylistsScheduledForDeletion[]= $ccPlaylist;
+ $ccPlaylist->setCcSubjs(null);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Clears out the collCcBlocks 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 CcSubjs The current object (for fluent API support)
+ * @see addCcBlocks()
+ */
+ public function clearCcBlocks()
+ {
+ $this->collCcBlocks = null; // important to set this to null since that means it is uninitialized
+ $this->collCcBlocksPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcBlocks collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcBlocks($v = true)
+ {
+ $this->collCcBlocksPartial = $v;
+ }
+
+ /**
+ * Initializes the collCcBlocks collection.
+ *
+ * By default this just sets the collCcBlocks collection to an empty array (like clearcollCcBlocks());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcBlocks($overrideExisting = true)
+ {
+ if (null !== $this->collCcBlocks && !$overrideExisting) {
+ return;
+ }
+ $this->collCcBlocks = new PropelObjectCollection();
+ $this->collCcBlocks->setModel('CcBlock');
+ }
+
+ /**
+ * Gets an array of CcBlock 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 PropelObjectCollection|CcBlock[] List of CcBlock objects
+ * @throws PropelException
+ */
+ public function getCcBlocks($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcBlocksPartial && !$this->isNew();
+ if (null === $this->collCcBlocks || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcBlocks) {
+ // return empty collection
+ $this->initCcBlocks();
+ } else {
+ $collCcBlocks = CcBlockQuery::create(null, $criteria)
+ ->filterByCcSubjs($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcBlocksPartial && count($collCcBlocks)) {
+ $this->initCcBlocks(false);
+
+ foreach ($collCcBlocks as $obj) {
+ if (false == $this->collCcBlocks->contains($obj)) {
+ $this->collCcBlocks->append($obj);
+ }
+ }
+
+ $this->collCcBlocksPartial = true;
+ }
+
+ $collCcBlocks->getInternalIterator()->rewind();
+
+ return $collCcBlocks;
+ }
+
+ if ($partial && $this->collCcBlocks) {
+ foreach ($this->collCcBlocks as $obj) {
+ if ($obj->isNew()) {
+ $collCcBlocks[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcBlocks = $collCcBlocks;
+ $this->collCcBlocksPartial = false;
+ }
+ }
+
+ return $this->collCcBlocks;
+ }
+
+ /**
+ * Sets a collection of CcBlock objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccBlocks A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function setCcBlocks(PropelCollection $ccBlocks, PropelPDO $con = null)
+ {
+ $ccBlocksToDelete = $this->getCcBlocks(new Criteria(), $con)->diff($ccBlocks);
+
+
+ $this->ccBlocksScheduledForDeletion = $ccBlocksToDelete;
+
+ foreach ($ccBlocksToDelete as $ccBlockRemoved) {
+ $ccBlockRemoved->setCcSubjs(null);
+ }
+
+ $this->collCcBlocks = null;
+ foreach ($ccBlocks as $ccBlock) {
+ $this->addCcBlock($ccBlock);
+ }
+
+ $this->collCcBlocks = $ccBlocks;
+ $this->collCcBlocksPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related CcBlock objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcBlock objects.
+ * @throws PropelException
+ */
+ public function countCcBlocks(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collCcBlocksPartial && !$this->isNew();
+ if (null === $this->collCcBlocks || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcBlocks) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcBlocks());
+ }
+ $query = CcBlockQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcSubjs($this)
+ ->count($con);
+ }
+
+ return count($this->collCcBlocks);
+ }
+
+ /**
+ * Method called to associate a CcBlock object to this object
+ * through the CcBlock foreign key attribute.
+ *
+ * @param CcBlock $l CcBlock
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function addCcBlock(CcBlock $l)
+ {
+ if ($this->collCcBlocks === null) {
+ $this->initCcBlocks();
+ $this->collCcBlocksPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcBlocks->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcBlock($l);
+
+ if ($this->ccBlocksScheduledForDeletion and $this->ccBlocksScheduledForDeletion->contains($l)) {
+ $this->ccBlocksScheduledForDeletion->remove($this->ccBlocksScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcBlock $ccBlock The ccBlock object to add.
+ */
+ protected function doAddCcBlock($ccBlock)
+ {
+ $this->collCcBlocks[]= $ccBlock;
+ $ccBlock->setCcSubjs($this);
+ }
+
+ /**
+ * @param CcBlock $ccBlock The ccBlock object to remove.
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function removeCcBlock($ccBlock)
+ {
+ if ($this->getCcBlocks()->contains($ccBlock)) {
+ $this->collCcBlocks->remove($this->collCcBlocks->search($ccBlock));
+ if (null === $this->ccBlocksScheduledForDeletion) {
+ $this->ccBlocksScheduledForDeletion = clone $this->collCcBlocks;
+ $this->ccBlocksScheduledForDeletion->clear();
+ }
+ $this->ccBlocksScheduledForDeletion[]= $ccBlock;
+ $ccBlock->setCcSubjs(null);
+ }
+
+ return $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 CcSubjs The current object (for fluent API support)
+ * @see addCcPrefs()
+ */
+ public function clearCcPrefs()
+ {
+ $this->collCcPrefs = null; // important to set this to null since that means it is uninitialized
+ $this->collCcPrefsPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcPrefs collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcPrefs($v = true)
+ {
+ $this->collCcPrefsPartial = $v;
+ }
+
+ /**
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcPrefs($overrideExisting = true)
+ {
+ if (null !== $this->collCcPrefs && !$overrideExisting) {
+ return;
+ }
+ $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 PropelObjectCollection|CcPref[] List of CcPref objects
+ * @throws PropelException
+ */
+ public function getCcPrefs($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcPrefsPartial && !$this->isNew();
+ if (null === $this->collCcPrefs || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPrefs) {
+ // return empty collection
+ $this->initCcPrefs();
+ } else {
+ $collCcPrefs = CcPrefQuery::create(null, $criteria)
+ ->filterByCcSubjs($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcPrefsPartial && count($collCcPrefs)) {
+ $this->initCcPrefs(false);
+
+ foreach ($collCcPrefs as $obj) {
+ if (false == $this->collCcPrefs->contains($obj)) {
+ $this->collCcPrefs->append($obj);
+ }
+ }
+
+ $this->collCcPrefsPartial = true;
+ }
+
+ $collCcPrefs->getInternalIterator()->rewind();
+
+ return $collCcPrefs;
+ }
+
+ if ($partial && $this->collCcPrefs) {
+ foreach ($this->collCcPrefs as $obj) {
+ if ($obj->isNew()) {
+ $collCcPrefs[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcPrefs = $collCcPrefs;
+ $this->collCcPrefsPartial = false;
+ }
+ }
+
+ return $this->collCcPrefs;
+ }
+
+ /**
+ * Sets a collection of CcPref objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccPrefs A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function setCcPrefs(PropelCollection $ccPrefs, PropelPDO $con = null)
+ {
+ $ccPrefsToDelete = $this->getCcPrefs(new Criteria(), $con)->diff($ccPrefs);
+
+
+ $this->ccPrefsScheduledForDeletion = $ccPrefsToDelete;
+
+ foreach ($ccPrefsToDelete as $ccPrefRemoved) {
+ $ccPrefRemoved->setCcSubjs(null);
+ }
+
+ $this->collCcPrefs = null;
+ foreach ($ccPrefs as $ccPref) {
+ $this->addCcPref($ccPref);
+ }
+
+ $this->collCcPrefs = $ccPrefs;
+ $this->collCcPrefsPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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)
+ {
+ $partial = $this->collCcPrefsPartial && !$this->isNew();
+ if (null === $this->collCcPrefs || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcPrefs) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcPrefs());
+ }
+ $query = CcPrefQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcSubjs($this)
+ ->count($con);
+ }
+
+ 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 CcSubjs The current object (for fluent API support)
+ */
+ public function addCcPref(CcPref $l)
+ {
+ if ($this->collCcPrefs === null) {
+ $this->initCcPrefs();
+ $this->collCcPrefsPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcPrefs->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcPref($l);
+
+ if ($this->ccPrefsScheduledForDeletion and $this->ccPrefsScheduledForDeletion->contains($l)) {
+ $this->ccPrefsScheduledForDeletion->remove($this->ccPrefsScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcPref $ccPref The ccPref object to add.
+ */
+ protected function doAddCcPref($ccPref)
+ {
+ $this->collCcPrefs[]= $ccPref;
+ $ccPref->setCcSubjs($this);
+ }
+
+ /**
+ * @param CcPref $ccPref The ccPref object to remove.
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function removeCcPref($ccPref)
+ {
+ if ($this->getCcPrefs()->contains($ccPref)) {
+ $this->collCcPrefs->remove($this->collCcPrefs->search($ccPref));
+ if (null === $this->ccPrefsScheduledForDeletion) {
+ $this->ccPrefsScheduledForDeletion = clone $this->collCcPrefs;
+ $this->ccPrefsScheduledForDeletion->clear();
+ }
+ $this->ccPrefsScheduledForDeletion[]= $ccPref;
+ $ccPref->setCcSubjs(null);
+ }
+
+ return $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 CcSubjs The current object (for fluent API support)
+ * @see addCcSesss()
+ */
+ public function clearCcSesss()
+ {
+ $this->collCcSesss = null; // important to set this to null since that means it is uninitialized
+ $this->collCcSesssPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcSesss collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcSesss($v = true)
+ {
+ $this->collCcSesssPartial = $v;
+ }
+
+ /**
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcSesss($overrideExisting = true)
+ {
+ if (null !== $this->collCcSesss && !$overrideExisting) {
+ return;
+ }
+ $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 PropelObjectCollection|CcSess[] List of CcSess objects
+ * @throws PropelException
+ */
+ public function getCcSesss($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcSesssPartial && !$this->isNew();
+ if (null === $this->collCcSesss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcSesss) {
+ // return empty collection
+ $this->initCcSesss();
+ } else {
+ $collCcSesss = CcSessQuery::create(null, $criteria)
+ ->filterByCcSubjs($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcSesssPartial && count($collCcSesss)) {
+ $this->initCcSesss(false);
+
+ foreach ($collCcSesss as $obj) {
+ if (false == $this->collCcSesss->contains($obj)) {
+ $this->collCcSesss->append($obj);
+ }
+ }
+
+ $this->collCcSesssPartial = true;
+ }
+
+ $collCcSesss->getInternalIterator()->rewind();
+
+ return $collCcSesss;
+ }
+
+ if ($partial && $this->collCcSesss) {
+ foreach ($this->collCcSesss as $obj) {
+ if ($obj->isNew()) {
+ $collCcSesss[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcSesss = $collCcSesss;
+ $this->collCcSesssPartial = false;
+ }
+ }
+
+ return $this->collCcSesss;
+ }
+
+ /**
+ * Sets a collection of CcSess objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccSesss A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function setCcSesss(PropelCollection $ccSesss, PropelPDO $con = null)
+ {
+ $ccSesssToDelete = $this->getCcSesss(new Criteria(), $con)->diff($ccSesss);
+
+
+ $this->ccSesssScheduledForDeletion = $ccSesssToDelete;
+
+ foreach ($ccSesssToDelete as $ccSessRemoved) {
+ $ccSessRemoved->setCcSubjs(null);
+ }
+
+ $this->collCcSesss = null;
+ foreach ($ccSesss as $ccSess) {
+ $this->addCcSess($ccSess);
+ }
+
+ $this->collCcSesss = $ccSesss;
+ $this->collCcSesssPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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)
+ {
+ $partial = $this->collCcSesssPartial && !$this->isNew();
+ if (null === $this->collCcSesss || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcSesss) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcSesss());
+ }
+ $query = CcSessQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcSubjs($this)
+ ->count($con);
+ }
+
+ 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 CcSubjs The current object (for fluent API support)
+ */
+ public function addCcSess(CcSess $l)
+ {
+ if ($this->collCcSesss === null) {
+ $this->initCcSesss();
+ $this->collCcSesssPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcSesss->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcSess($l);
+
+ if ($this->ccSesssScheduledForDeletion and $this->ccSesssScheduledForDeletion->contains($l)) {
+ $this->ccSesssScheduledForDeletion->remove($this->ccSesssScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcSess $ccSess The ccSess object to add.
+ */
+ protected function doAddCcSess($ccSess)
+ {
+ $this->collCcSesss[]= $ccSess;
+ $ccSess->setCcSubjs($this);
+ }
+
+ /**
+ * @param CcSess $ccSess The ccSess object to remove.
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function removeCcSess($ccSess)
+ {
+ if ($this->getCcSesss()->contains($ccSess)) {
+ $this->collCcSesss->remove($this->collCcSesss->search($ccSess));
+ if (null === $this->ccSesssScheduledForDeletion) {
+ $this->ccSesssScheduledForDeletion = clone $this->collCcSesss;
+ $this->ccSesssScheduledForDeletion->clear();
+ }
+ $this->ccSesssScheduledForDeletion[]= $ccSess;
+ $ccSess->setCcSubjs(null);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Clears out the collCcSubjsTokens 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 CcSubjs The current object (for fluent API support)
+ * @see addCcSubjsTokens()
+ */
+ public function clearCcSubjsTokens()
+ {
+ $this->collCcSubjsTokens = null; // important to set this to null since that means it is uninitialized
+ $this->collCcSubjsTokensPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcSubjsTokens collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcSubjsTokens($v = true)
+ {
+ $this->collCcSubjsTokensPartial = $v;
+ }
+
+ /**
+ * Initializes the collCcSubjsTokens collection.
+ *
+ * By default this just sets the collCcSubjsTokens collection to an empty array (like clearcollCcSubjsTokens());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcSubjsTokens($overrideExisting = true)
+ {
+ if (null !== $this->collCcSubjsTokens && !$overrideExisting) {
+ return;
+ }
+ $this->collCcSubjsTokens = new PropelObjectCollection();
+ $this->collCcSubjsTokens->setModel('CcSubjsToken');
+ }
+
+ /**
+ * Gets an array of CcSubjsToken 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 PropelObjectCollection|CcSubjsToken[] List of CcSubjsToken objects
+ * @throws PropelException
+ */
+ public function getCcSubjsTokens($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcSubjsTokensPartial && !$this->isNew();
+ if (null === $this->collCcSubjsTokens || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcSubjsTokens) {
+ // return empty collection
+ $this->initCcSubjsTokens();
+ } else {
+ $collCcSubjsTokens = CcSubjsTokenQuery::create(null, $criteria)
+ ->filterByCcSubjs($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcSubjsTokensPartial && count($collCcSubjsTokens)) {
+ $this->initCcSubjsTokens(false);
+
+ foreach ($collCcSubjsTokens as $obj) {
+ if (false == $this->collCcSubjsTokens->contains($obj)) {
+ $this->collCcSubjsTokens->append($obj);
+ }
+ }
+
+ $this->collCcSubjsTokensPartial = true;
+ }
+
+ $collCcSubjsTokens->getInternalIterator()->rewind();
+
+ return $collCcSubjsTokens;
+ }
+
+ if ($partial && $this->collCcSubjsTokens) {
+ foreach ($this->collCcSubjsTokens as $obj) {
+ if ($obj->isNew()) {
+ $collCcSubjsTokens[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcSubjsTokens = $collCcSubjsTokens;
+ $this->collCcSubjsTokensPartial = false;
+ }
+ }
+
+ return $this->collCcSubjsTokens;
+ }
+
+ /**
+ * Sets a collection of CcSubjsToken objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccSubjsTokens A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function setCcSubjsTokens(PropelCollection $ccSubjsTokens, PropelPDO $con = null)
+ {
+ $ccSubjsTokensToDelete = $this->getCcSubjsTokens(new Criteria(), $con)->diff($ccSubjsTokens);
+
+
+ $this->ccSubjsTokensScheduledForDeletion = $ccSubjsTokensToDelete;
+
+ foreach ($ccSubjsTokensToDelete as $ccSubjsTokenRemoved) {
+ $ccSubjsTokenRemoved->setCcSubjs(null);
+ }
+
+ $this->collCcSubjsTokens = null;
+ foreach ($ccSubjsTokens as $ccSubjsToken) {
+ $this->addCcSubjsToken($ccSubjsToken);
+ }
+
+ $this->collCcSubjsTokens = $ccSubjsTokens;
+ $this->collCcSubjsTokensPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related CcSubjsToken objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcSubjsToken objects.
+ * @throws PropelException
+ */
+ public function countCcSubjsTokens(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collCcSubjsTokensPartial && !$this->isNew();
+ if (null === $this->collCcSubjsTokens || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcSubjsTokens) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcSubjsTokens());
+ }
+ $query = CcSubjsTokenQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcSubjs($this)
+ ->count($con);
+ }
+
+ return count($this->collCcSubjsTokens);
+ }
+
+ /**
+ * Method called to associate a CcSubjsToken object to this object
+ * through the CcSubjsToken foreign key attribute.
+ *
+ * @param CcSubjsToken $l CcSubjsToken
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function addCcSubjsToken(CcSubjsToken $l)
+ {
+ if ($this->collCcSubjsTokens === null) {
+ $this->initCcSubjsTokens();
+ $this->collCcSubjsTokensPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcSubjsTokens->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcSubjsToken($l);
+
+ if ($this->ccSubjsTokensScheduledForDeletion and $this->ccSubjsTokensScheduledForDeletion->contains($l)) {
+ $this->ccSubjsTokensScheduledForDeletion->remove($this->ccSubjsTokensScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcSubjsToken $ccSubjsToken The ccSubjsToken object to add.
+ */
+ protected function doAddCcSubjsToken($ccSubjsToken)
+ {
+ $this->collCcSubjsTokens[]= $ccSubjsToken;
+ $ccSubjsToken->setCcSubjs($this);
+ }
+
+ /**
+ * @param CcSubjsToken $ccSubjsToken The ccSubjsToken object to remove.
+ * @return CcSubjs The current object (for fluent API support)
+ */
+ public function removeCcSubjsToken($ccSubjsToken)
+ {
+ if ($this->getCcSubjsTokens()->contains($ccSubjsToken)) {
+ $this->collCcSubjsTokens->remove($this->collCcSubjsTokens->search($ccSubjsToken));
+ if (null === $this->ccSubjsTokensScheduledForDeletion) {
+ $this->ccSubjsTokensScheduledForDeletion = clone $this->collCcSubjsTokens;
+ $this->ccSubjsTokensScheduledForDeletion->clear();
+ }
+ $this->ccSubjsTokensScheduledForDeletion[]= clone $ccSubjsToken;
+ $ccSubjsToken->setCcSubjs(null);
+ }
+
+ return $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->cell_phone = null;
+ $this->login_attempts = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->collCcFilessRelatedByDbOwnerId) {
+ foreach ($this->collCcFilessRelatedByDbOwnerId as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcFilessRelatedByDbEditedby) {
+ foreach ($this->collCcFilessRelatedByDbEditedby as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcPermss) {
+ foreach ($this->collCcPermss as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcShowHostss) {
+ foreach ($this->collCcShowHostss as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcPlaylists) {
+ foreach ($this->collCcPlaylists as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcBlocks) {
+ foreach ($this->collCcBlocks as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcPrefs) {
+ foreach ($this->collCcPrefs as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcSesss) {
+ foreach ($this->collCcSesss as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+ if ($this->collCcSubjsTokens) {
+ foreach ($this->collCcSubjsTokens as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ if ($this->collCcFilessRelatedByDbOwnerId instanceof PropelCollection) {
+ $this->collCcFilessRelatedByDbOwnerId->clearIterator();
+ }
+ $this->collCcFilessRelatedByDbOwnerId = null;
+ if ($this->collCcFilessRelatedByDbEditedby instanceof PropelCollection) {
+ $this->collCcFilessRelatedByDbEditedby->clearIterator();
+ }
+ $this->collCcFilessRelatedByDbEditedby = null;
+ if ($this->collCcPermss instanceof PropelCollection) {
+ $this->collCcPermss->clearIterator();
+ }
+ $this->collCcPermss = null;
+ if ($this->collCcShowHostss instanceof PropelCollection) {
+ $this->collCcShowHostss->clearIterator();
+ }
+ $this->collCcShowHostss = null;
+ if ($this->collCcPlaylists instanceof PropelCollection) {
+ $this->collCcPlaylists->clearIterator();
+ }
+ $this->collCcPlaylists = null;
+ if ($this->collCcBlocks instanceof PropelCollection) {
+ $this->collCcBlocks->clearIterator();
+ }
+ $this->collCcBlocks = null;
+ if ($this->collCcPrefs instanceof PropelCollection) {
+ $this->collCcPrefs->clearIterator();
+ }
+ $this->collCcPrefs = null;
+ if ($this->collCcSesss instanceof PropelCollection) {
+ $this->collCcSesss->clearIterator();
+ }
+ $this->collCcSesss = null;
+ if ($this->collCcSubjsTokens instanceof PropelCollection) {
+ $this->collCcSubjsTokens->clearIterator();
+ }
+ $this->collCcSubjsTokens = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcSubjsPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjsPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjsPeer.php
index ad60edbb4..f886a27b3 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSubjsPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjsPeer.php
@@ -4,808 +4,830 @@
/**
* Base static class for performing query and update operations on the 'cc_subjs' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcSubjsPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_subjs';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcSubjs';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcSubjs';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcSubjsTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 13;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_subjs.ID';
-
- /** the column name for the LOGIN field */
- const LOGIN = 'cc_subjs.LOGIN';
-
- /** the column name for the PASS field */
- const PASS = 'cc_subjs.PASS';
-
- /** the column name for the TYPE field */
- const TYPE = 'cc_subjs.TYPE';
-
- /** the column name for the FIRST_NAME field */
- const FIRST_NAME = 'cc_subjs.FIRST_NAME';
-
- /** the column name for the LAST_NAME field */
- const LAST_NAME = 'cc_subjs.LAST_NAME';
-
- /** the column name for the LASTLOGIN field */
- const LASTLOGIN = 'cc_subjs.LASTLOGIN';
-
- /** the column name for the LASTFAIL field */
- const LASTFAIL = 'cc_subjs.LASTFAIL';
-
- /** the column name for the SKYPE_CONTACT field */
- const SKYPE_CONTACT = 'cc_subjs.SKYPE_CONTACT';
-
- /** the column name for the JABBER_CONTACT field */
- const JABBER_CONTACT = 'cc_subjs.JABBER_CONTACT';
-
- /** the column name for the EMAIL field */
- const EMAIL = 'cc_subjs.EMAIL';
-
- /** the column name for the CELL_PHONE field */
- const CELL_PHONE = 'cc_subjs.CELL_PHONE';
-
- /** the column name for the LOGIN_ATTEMPTS field */
- const LOGIN_ATTEMPTS = 'cc_subjs.LOGIN_ATTEMPTS';
-
- /**
- * An identiy map to hold any loaded instances of CcSubjs objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcSubjs[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbLogin', 'DbPass', 'DbType', 'DbFirstName', 'DbLastName', 'DbLastlogin', 'DbLastfail', 'DbSkypeContact', 'DbJabberContact', 'DbEmail', 'DbCellPhone', 'DbLoginAttempts', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbLogin', 'dbPass', 'dbType', 'dbFirstName', 'dbLastName', 'dbLastlogin', 'dbLastfail', 'dbSkypeContact', 'dbJabberContact', 'dbEmail', 'dbCellPhone', '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::CELL_PHONE, self::LOGIN_ATTEMPTS, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOGIN', 'PASS', 'TYPE', 'FIRST_NAME', 'LAST_NAME', 'LASTLOGIN', 'LASTFAIL', 'SKYPE_CONTACT', 'JABBER_CONTACT', 'EMAIL', 'CELL_PHONE', 'LOGIN_ATTEMPTS', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'login', 'pass', 'type', 'first_name', 'last_name', 'lastlogin', 'lastfail', 'skype_contact', 'jabber_contact', 'email', 'cell_phone', 'login_attempts', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
- );
-
- /**
- * 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, 'DbCellPhone' => 11, 'DbLoginAttempts' => 12, ),
- 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, 'dbCellPhone' => 11, 'dbLoginAttempts' => 12, ),
- 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::CELL_PHONE => 11, self::LOGIN_ATTEMPTS => 12, ),
- 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, 'CELL_PHONE' => 11, 'LOGIN_ATTEMPTS' => 12, ),
- 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, 'cell_phone' => 11, 'login_attempts' => 12, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
- );
-
- /**
- * 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::CELL_PHONE);
- $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 . '.CELL_PHONE');
- $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 CcPlaylistPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CcPlaylistPeer::clearInstancePool();
- // Invalidate objects in CcBlockPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CcBlockPeer::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();
- // Invalidate objects in CcSubjsTokenPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CcSubjsTokenPeer::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;
- }
+abstract class BaseCcSubjsPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_subjs';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcSubjs';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcSubjsTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 13;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 13;
+
+ /** the column name for the id field */
+ const ID = 'cc_subjs.id';
+
+ /** the column name for the login field */
+ const LOGIN = 'cc_subjs.login';
+
+ /** the column name for the pass field */
+ const PASS = 'cc_subjs.pass';
+
+ /** the column name for the type field */
+ const TYPE = 'cc_subjs.type';
+
+ /** the column name for the first_name field */
+ const FIRST_NAME = 'cc_subjs.first_name';
+
+ /** the column name for the last_name field */
+ const LAST_NAME = 'cc_subjs.last_name';
+
+ /** the column name for the lastlogin field */
+ const LASTLOGIN = 'cc_subjs.lastlogin';
+
+ /** the column name for the lastfail field */
+ const LASTFAIL = 'cc_subjs.lastfail';
+
+ /** the column name for the skype_contact field */
+ const SKYPE_CONTACT = 'cc_subjs.skype_contact';
+
+ /** the column name for the jabber_contact field */
+ const JABBER_CONTACT = 'cc_subjs.jabber_contact';
+
+ /** the column name for the email field */
+ const EMAIL = 'cc_subjs.email';
+
+ /** the column name for the cell_phone field */
+ const CELL_PHONE = 'cc_subjs.cell_phone';
+
+ /** the column name for the login_attempts field */
+ const LOGIN_ATTEMPTS = 'cc_subjs.login_attempts';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcSubjs objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcSubjs[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcSubjsPeer::$fieldNames[CcSubjsPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbLogin', 'DbPass', 'DbType', 'DbFirstName', 'DbLastName', 'DbLastlogin', 'DbLastfail', 'DbSkypeContact', 'DbJabberContact', 'DbEmail', 'DbCellPhone', 'DbLoginAttempts', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbLogin', 'dbPass', 'dbType', 'dbFirstName', 'dbLastName', 'dbLastlogin', 'dbLastfail', 'dbSkypeContact', 'dbJabberContact', 'dbEmail', 'dbCellPhone', 'dbLoginAttempts', ),
+ BasePeer::TYPE_COLNAME => array (CcSubjsPeer::ID, CcSubjsPeer::LOGIN, CcSubjsPeer::PASS, CcSubjsPeer::TYPE, CcSubjsPeer::FIRST_NAME, CcSubjsPeer::LAST_NAME, CcSubjsPeer::LASTLOGIN, CcSubjsPeer::LASTFAIL, CcSubjsPeer::SKYPE_CONTACT, CcSubjsPeer::JABBER_CONTACT, CcSubjsPeer::EMAIL, CcSubjsPeer::CELL_PHONE, CcSubjsPeer::LOGIN_ATTEMPTS, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOGIN', 'PASS', 'TYPE', 'FIRST_NAME', 'LAST_NAME', 'LASTLOGIN', 'LASTFAIL', 'SKYPE_CONTACT', 'JABBER_CONTACT', 'EMAIL', 'CELL_PHONE', 'LOGIN_ATTEMPTS', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'login', 'pass', 'type', 'first_name', 'last_name', 'lastlogin', 'lastfail', 'skype_contact', 'jabber_contact', 'email', 'cell_phone', 'login_attempts', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. CcSubjsPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected 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, 'DbCellPhone' => 11, 'DbLoginAttempts' => 12, ),
+ 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, 'dbCellPhone' => 11, 'dbLoginAttempts' => 12, ),
+ BasePeer::TYPE_COLNAME => array (CcSubjsPeer::ID => 0, CcSubjsPeer::LOGIN => 1, CcSubjsPeer::PASS => 2, CcSubjsPeer::TYPE => 3, CcSubjsPeer::FIRST_NAME => 4, CcSubjsPeer::LAST_NAME => 5, CcSubjsPeer::LASTLOGIN => 6, CcSubjsPeer::LASTFAIL => 7, CcSubjsPeer::SKYPE_CONTACT => 8, CcSubjsPeer::JABBER_CONTACT => 9, CcSubjsPeer::EMAIL => 10, CcSubjsPeer::CELL_PHONE => 11, CcSubjsPeer::LOGIN_ATTEMPTS => 12, ),
+ 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, 'CELL_PHONE' => 11, 'LOGIN_ATTEMPTS' => 12, ),
+ 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, 'cell_phone' => 11, 'login_attempts' => 12, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
+ );
+
+ /**
+ * 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcSubjsPeer::getFieldNames($toType);
+ $key = isset(CcSubjsPeer::$fieldKeys[$fromType][$name]) ? CcSubjsPeer::$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(CcSubjsPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcSubjsPeer::$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 CcSubjsPeer::$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::CELL_PHONE);
+ $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 . '.cell_phone');
+ $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(CcSubjsPeer::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;
+ }
+ /**
+ * Selects 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;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 directly (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(CcSubjsPeer::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 $obj 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($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcSubjsPeer::$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.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ 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(CcSubjsPeer::$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(CcSubjsPeer::$instances[$key])) {
+ return CcSubjsPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcSubjsPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcSubjsPeer::$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 CcPlaylistPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcPlaylistPeer::clearInstancePool();
+ // Invalidate objects in CcBlockPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcBlockPeer::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();
+ // Invalidate objects in CcSubjsTokenPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcSubjsTokenPeer::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();
+ // 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_HYDRATE_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(CcSubjsPeer::DATABASE_NAME)->getTable(CcSubjsPeer::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.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcSubjsPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs 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(CcSubjsPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs 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(CcSubjsPeer::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(CcSubjsPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_subjs table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs 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(CcSubjsPeer::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(CcSubjsPeer::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 (Exception $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($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->hasColumn($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
+ * @return CcSubjs[]
+ * @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
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php
index 38703d208..1416ec184 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php
@@ -4,1113 +4,1412 @@
/**
* Base class that represents a query for the 'cc_subjs' table.
*
- *
*
- * @method CcSubjsQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcSubjsQuery orderByDbLogin($order = Criteria::ASC) Order by the login column
- * @method CcSubjsQuery orderByDbPass($order = Criteria::ASC) Order by the pass column
- * @method CcSubjsQuery orderByDbType($order = Criteria::ASC) Order by the type column
- * @method CcSubjsQuery orderByDbFirstName($order = Criteria::ASC) Order by the first_name column
- * @method CcSubjsQuery orderByDbLastName($order = Criteria::ASC) Order by the last_name column
- * @method CcSubjsQuery orderByDbLastlogin($order = Criteria::ASC) Order by the lastlogin column
- * @method CcSubjsQuery orderByDbLastfail($order = Criteria::ASC) Order by the lastfail column
- * @method CcSubjsQuery orderByDbSkypeContact($order = Criteria::ASC) Order by the skype_contact column
- * @method CcSubjsQuery orderByDbJabberContact($order = Criteria::ASC) Order by the jabber_contact column
- * @method CcSubjsQuery orderByDbEmail($order = Criteria::ASC) Order by the email column
- * @method CcSubjsQuery orderByDbCellPhone($order = Criteria::ASC) Order by the cell_phone column
- * @method CcSubjsQuery orderByDbLoginAttempts($order = Criteria::ASC) Order by the login_attempts column
*
- * @method CcSubjsQuery groupByDbId() Group by the id column
- * @method CcSubjsQuery groupByDbLogin() Group by the login column
- * @method CcSubjsQuery groupByDbPass() Group by the pass column
- * @method CcSubjsQuery groupByDbType() Group by the type column
- * @method CcSubjsQuery groupByDbFirstName() Group by the first_name column
- * @method CcSubjsQuery groupByDbLastName() Group by the last_name column
- * @method CcSubjsQuery groupByDbLastlogin() Group by the lastlogin column
- * @method CcSubjsQuery groupByDbLastfail() Group by the lastfail column
- * @method CcSubjsQuery groupByDbSkypeContact() Group by the skype_contact column
- * @method CcSubjsQuery groupByDbJabberContact() Group by the jabber_contact column
- * @method CcSubjsQuery groupByDbEmail() Group by the email column
- * @method CcSubjsQuery groupByDbCellPhone() Group by the cell_phone column
- * @method CcSubjsQuery groupByDbLoginAttempts() Group by the login_attempts column
+ * @method CcSubjsQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcSubjsQuery orderByDbLogin($order = Criteria::ASC) Order by the login column
+ * @method CcSubjsQuery orderByDbPass($order = Criteria::ASC) Order by the pass column
+ * @method CcSubjsQuery orderByDbType($order = Criteria::ASC) Order by the type column
+ * @method CcSubjsQuery orderByDbFirstName($order = Criteria::ASC) Order by the first_name column
+ * @method CcSubjsQuery orderByDbLastName($order = Criteria::ASC) Order by the last_name column
+ * @method CcSubjsQuery orderByDbLastlogin($order = Criteria::ASC) Order by the lastlogin column
+ * @method CcSubjsQuery orderByDbLastfail($order = Criteria::ASC) Order by the lastfail column
+ * @method CcSubjsQuery orderByDbSkypeContact($order = Criteria::ASC) Order by the skype_contact column
+ * @method CcSubjsQuery orderByDbJabberContact($order = Criteria::ASC) Order by the jabber_contact column
+ * @method CcSubjsQuery orderByDbEmail($order = Criteria::ASC) Order by the email column
+ * @method CcSubjsQuery orderByDbCellPhone($order = Criteria::ASC) Order by the cell_phone column
+ * @method CcSubjsQuery orderByDbLoginAttempts($order = Criteria::ASC) Order by the login_attempts column
*
- * @method CcSubjsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcSubjsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcSubjsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcSubjsQuery groupByDbId() Group by the id column
+ * @method CcSubjsQuery groupByDbLogin() Group by the login column
+ * @method CcSubjsQuery groupByDbPass() Group by the pass column
+ * @method CcSubjsQuery groupByDbType() Group by the type column
+ * @method CcSubjsQuery groupByDbFirstName() Group by the first_name column
+ * @method CcSubjsQuery groupByDbLastName() Group by the last_name column
+ * @method CcSubjsQuery groupByDbLastlogin() Group by the lastlogin column
+ * @method CcSubjsQuery groupByDbLastfail() Group by the lastfail column
+ * @method CcSubjsQuery groupByDbSkypeContact() Group by the skype_contact column
+ * @method CcSubjsQuery groupByDbJabberContact() Group by the jabber_contact column
+ * @method CcSubjsQuery groupByDbEmail() Group by the email column
+ * @method CcSubjsQuery groupByDbCellPhone() Group by the cell_phone column
+ * @method CcSubjsQuery groupByDbLoginAttempts() Group by the login_attempts column
*
- * @method CcSubjsQuery leftJoinCcFilesRelatedByDbOwnerId($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFilesRelatedByDbOwnerId relation
- * @method CcSubjsQuery rightJoinCcFilesRelatedByDbOwnerId($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFilesRelatedByDbOwnerId relation
- * @method CcSubjsQuery innerJoinCcFilesRelatedByDbOwnerId($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFilesRelatedByDbOwnerId relation
+ * @method CcSubjsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcSubjsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcSubjsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcSubjsQuery leftJoinCcFilesRelatedByDbEditedby($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFilesRelatedByDbEditedby relation
- * @method CcSubjsQuery rightJoinCcFilesRelatedByDbEditedby($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFilesRelatedByDbEditedby relation
- * @method CcSubjsQuery innerJoinCcFilesRelatedByDbEditedby($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFilesRelatedByDbEditedby relation
+ * @method CcSubjsQuery leftJoinCcFilesRelatedByDbOwnerId($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcFilesRelatedByDbOwnerId relation
+ * @method CcSubjsQuery rightJoinCcFilesRelatedByDbOwnerId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcFilesRelatedByDbOwnerId relation
+ * @method CcSubjsQuery innerJoinCcFilesRelatedByDbOwnerId($relationAlias = null) Adds a INNER JOIN clause to the query using the CcFilesRelatedByDbOwnerId relation
*
- * @method CcSubjsQuery leftJoinCcPerms($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPerms relation
- * @method CcSubjsQuery rightJoinCcPerms($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPerms relation
- * @method CcSubjsQuery innerJoinCcPerms($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPerms relation
+ * @method CcSubjsQuery leftJoinCcFilesRelatedByDbEditedby($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcFilesRelatedByDbEditedby relation
+ * @method CcSubjsQuery rightJoinCcFilesRelatedByDbEditedby($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcFilesRelatedByDbEditedby relation
+ * @method CcSubjsQuery innerJoinCcFilesRelatedByDbEditedby($relationAlias = null) Adds a INNER JOIN clause to the query using the CcFilesRelatedByDbEditedby relation
*
- * @method CcSubjsQuery leftJoinCcShowHosts($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowHosts relation
- * @method CcSubjsQuery rightJoinCcShowHosts($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowHosts relation
- * @method CcSubjsQuery innerJoinCcShowHosts($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowHosts relation
+ * @method CcSubjsQuery leftJoinCcPerms($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPerms relation
+ * @method CcSubjsQuery rightJoinCcPerms($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPerms relation
+ * @method CcSubjsQuery innerJoinCcPerms($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPerms relation
*
- * @method CcSubjsQuery leftJoinCcPlaylist($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPlaylist relation
- * @method CcSubjsQuery rightJoinCcPlaylist($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlaylist relation
- * @method CcSubjsQuery innerJoinCcPlaylist($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlaylist relation
+ * @method CcSubjsQuery leftJoinCcShowHosts($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcShowHosts relation
+ * @method CcSubjsQuery rightJoinCcShowHosts($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcShowHosts relation
+ * @method CcSubjsQuery innerJoinCcShowHosts($relationAlias = null) Adds a INNER JOIN clause to the query using the CcShowHosts relation
*
- * @method CcSubjsQuery leftJoinCcBlock($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcBlock relation
- * @method CcSubjsQuery rightJoinCcBlock($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcBlock relation
- * @method CcSubjsQuery innerJoinCcBlock($relationAlias = '') Adds a INNER JOIN clause to the query using the CcBlock relation
+ * @method CcSubjsQuery leftJoinCcPlaylist($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPlaylist relation
+ * @method CcSubjsQuery rightJoinCcPlaylist($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPlaylist relation
+ * @method CcSubjsQuery innerJoinCcPlaylist($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPlaylist relation
*
- * @method CcSubjsQuery leftJoinCcPref($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcPref relation
- * @method CcSubjsQuery rightJoinCcPref($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPref relation
- * @method CcSubjsQuery innerJoinCcPref($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPref relation
+ * @method CcSubjsQuery leftJoinCcBlock($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcBlock relation
+ * @method CcSubjsQuery rightJoinCcBlock($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcBlock relation
+ * @method CcSubjsQuery innerJoinCcBlock($relationAlias = null) Adds a INNER JOIN clause to the query using the CcBlock relation
*
- * @method CcSubjsQuery leftJoinCcSess($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSess relation
- * @method CcSubjsQuery rightJoinCcSess($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSess relation
- * @method CcSubjsQuery innerJoinCcSess($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSess relation
+ * @method CcSubjsQuery leftJoinCcPref($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcPref relation
+ * @method CcSubjsQuery rightJoinCcPref($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcPref relation
+ * @method CcSubjsQuery innerJoinCcPref($relationAlias = null) Adds a INNER JOIN clause to the query using the CcPref relation
*
- * @method CcSubjsQuery leftJoinCcSubjsToken($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjsToken relation
- * @method CcSubjsQuery rightJoinCcSubjsToken($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjsToken relation
- * @method CcSubjsQuery innerJoinCcSubjsToken($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjsToken relation
+ * @method CcSubjsQuery leftJoinCcSess($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSess relation
+ * @method CcSubjsQuery rightJoinCcSess($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSess relation
+ * @method CcSubjsQuery innerJoinCcSess($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSess relation
*
- * @method CcSubjs findOne(PropelPDO $con = null) Return the first CcSubjs matching the query
- * @method CcSubjs findOneOrCreate(PropelPDO $con = null) Return the first CcSubjs matching the query, or a new CcSubjs object populated from the query conditions when no match is found
+ * @method CcSubjsQuery leftJoinCcSubjsToken($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSubjsToken relation
+ * @method CcSubjsQuery rightJoinCcSubjsToken($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjsToken relation
+ * @method CcSubjsQuery innerJoinCcSubjsToken($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjsToken relation
*
- * @method CcSubjs findOneByDbId(int $id) Return the first CcSubjs filtered by the id column
- * @method CcSubjs findOneByDbLogin(string $login) Return the first CcSubjs filtered by the login column
- * @method CcSubjs findOneByDbPass(string $pass) Return the first CcSubjs filtered by the pass column
- * @method CcSubjs findOneByDbType(string $type) Return the first CcSubjs filtered by the type column
- * @method CcSubjs findOneByDbFirstName(string $first_name) Return the first CcSubjs filtered by the first_name column
- * @method CcSubjs findOneByDbLastName(string $last_name) Return the first CcSubjs filtered by the last_name column
- * @method CcSubjs findOneByDbLastlogin(string $lastlogin) Return the first CcSubjs filtered by the lastlogin column
- * @method CcSubjs findOneByDbLastfail(string $lastfail) Return the first CcSubjs filtered by the lastfail column
- * @method CcSubjs findOneByDbSkypeContact(string $skype_contact) Return the first CcSubjs filtered by the skype_contact column
- * @method CcSubjs findOneByDbJabberContact(string $jabber_contact) Return the first CcSubjs filtered by the jabber_contact column
- * @method CcSubjs findOneByDbEmail(string $email) Return the first CcSubjs filtered by the email column
- * @method CcSubjs findOneByDbCellPhone(string $cell_phone) Return the first CcSubjs filtered by the cell_phone column
- * @method CcSubjs findOneByDbLoginAttempts(int $login_attempts) Return the first CcSubjs filtered by the login_attempts column
+ * @method CcSubjs findOne(PropelPDO $con = null) Return the first CcSubjs matching the query
+ * @method CcSubjs findOneOrCreate(PropelPDO $con = null) Return the first CcSubjs matching the query, or a new CcSubjs object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcSubjs objects filtered by the id column
- * @method array findByDbLogin(string $login) Return CcSubjs objects filtered by the login column
- * @method array findByDbPass(string $pass) Return CcSubjs objects filtered by the pass column
- * @method array findByDbType(string $type) Return CcSubjs objects filtered by the type column
- * @method array findByDbFirstName(string $first_name) Return CcSubjs objects filtered by the first_name column
- * @method array findByDbLastName(string $last_name) Return CcSubjs objects filtered by the last_name column
- * @method array findByDbLastlogin(string $lastlogin) Return CcSubjs objects filtered by the lastlogin column
- * @method array findByDbLastfail(string $lastfail) Return CcSubjs objects filtered by the lastfail column
- * @method array findByDbSkypeContact(string $skype_contact) Return CcSubjs objects filtered by the skype_contact column
- * @method array findByDbJabberContact(string $jabber_contact) Return CcSubjs objects filtered by the jabber_contact column
- * @method array findByDbEmail(string $email) Return CcSubjs objects filtered by the email column
- * @method array findByDbCellPhone(string $cell_phone) Return CcSubjs objects filtered by the cell_phone column
- * @method array findByDbLoginAttempts(int $login_attempts) Return CcSubjs objects filtered by the login_attempts column
+ * @method CcSubjs findOneByDbLogin(string $login) Return the first CcSubjs filtered by the login column
+ * @method CcSubjs findOneByDbPass(string $pass) Return the first CcSubjs filtered by the pass column
+ * @method CcSubjs findOneByDbType(string $type) Return the first CcSubjs filtered by the type column
+ * @method CcSubjs findOneByDbFirstName(string $first_name) Return the first CcSubjs filtered by the first_name column
+ * @method CcSubjs findOneByDbLastName(string $last_name) Return the first CcSubjs filtered by the last_name column
+ * @method CcSubjs findOneByDbLastlogin(string $lastlogin) Return the first CcSubjs filtered by the lastlogin column
+ * @method CcSubjs findOneByDbLastfail(string $lastfail) Return the first CcSubjs filtered by the lastfail column
+ * @method CcSubjs findOneByDbSkypeContact(string $skype_contact) Return the first CcSubjs filtered by the skype_contact column
+ * @method CcSubjs findOneByDbJabberContact(string $jabber_contact) Return the first CcSubjs filtered by the jabber_contact column
+ * @method CcSubjs findOneByDbEmail(string $email) Return the first CcSubjs filtered by the email column
+ * @method CcSubjs findOneByDbCellPhone(string $cell_phone) Return the first CcSubjs filtered by the cell_phone column
+ * @method CcSubjs findOneByDbLoginAttempts(int $login_attempts) Return the first CcSubjs filtered by the login_attempts column
+ *
+ * @method array findByDbId(int $id) Return CcSubjs objects filtered by the id column
+ * @method array findByDbLogin(string $login) Return CcSubjs objects filtered by the login column
+ * @method array findByDbPass(string $pass) Return CcSubjs objects filtered by the pass column
+ * @method array findByDbType(string $type) Return CcSubjs objects filtered by the type column
+ * @method array findByDbFirstName(string $first_name) Return CcSubjs objects filtered by the first_name column
+ * @method array findByDbLastName(string $last_name) Return CcSubjs objects filtered by the last_name column
+ * @method array findByDbLastlogin(string $lastlogin) Return CcSubjs objects filtered by the lastlogin column
+ * @method array findByDbLastfail(string $lastfail) Return CcSubjs objects filtered by the lastfail column
+ * @method array findByDbSkypeContact(string $skype_contact) Return CcSubjs objects filtered by the skype_contact column
+ * @method array findByDbJabberContact(string $jabber_contact) Return CcSubjs objects filtered by the jabber_contact column
+ * @method array findByDbEmail(string $email) Return CcSubjs objects filtered by the email column
+ * @method array findByDbCellPhone(string $cell_phone) Return CcSubjs objects filtered by the cell_phone column
+ * @method array findByDbLoginAttempts(int $login_attempts) Return CcSubjs objects filtered by the login_attempts column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcSubjsQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcSubjsQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcSubjs';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcSubjsQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcSubjs', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcSubjsQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcSubjsQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcSubjsQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcSubjsQuery) {
+ return $criteria;
+ }
+ $query = new CcSubjsQuery(null, null, $modelAlias);
- /**
- * Returns a new CcSubjsQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcSubjsQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcSubjsQuery) {
- return $criteria;
- }
- $query = new CcSubjsQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcSubjs|CcSubjs[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcSubjsPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcSubjsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $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);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcSubjs A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcSubjs A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "login", "pass", "type", "first_name", "last_name", "lastlogin", "lastfail", "skype_contact", "jabber_contact", "email", "cell_phone", "login_attempts" FROM "cc_subjs" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcSubjs();
+ $obj->hydrate($row);
+ CcSubjsPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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);
- }
+ return $obj;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcSubjs|CcSubjs[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * 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);
- }
+ /**
+ * 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|CcSubjs[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * 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);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * 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 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)
+ {
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcSubjsPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * 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 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)
+ {
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcSubjsPeer::ID, $keys, Criteria::IN);
+ }
- /**
- * 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 id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcSubjsPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcSubjsPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcSubjsPeer::ID, $dbId, $comparison);
+ }
- /**
- * Filter the query on the cell_phone column
- *
- * @param string $dbCellPhone 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 filterByDbCellPhone($dbCellPhone = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbCellPhone)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbCellPhone)) {
- $dbCellPhone = str_replace('*', '%', $dbCellPhone);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcSubjsPeer::CELL_PHONE, $dbCellPhone, $comparison);
- }
+ /**
+ * Filter the query on the login column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLogin('fooValue'); // WHERE login = 'fooValue'
+ * $query->filterByDbLogin('%fooValue%'); // WHERE login LIKE '%fooValue%'
+ *
+ *
+ * @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;
+ }
+ }
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcSubjsPeer::LOGIN, $dbLogin, $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 CcSubjsQuery The current query, for fluid interface
- */
- public function filterByCcFilesRelatedByDbOwnerId($ccFiles, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcSubjsPeer::ID, $ccFiles->getDbOwnerId(), $comparison);
- }
+ /**
+ * Filter the query on the pass column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbPass('fooValue'); // WHERE pass = 'fooValue'
+ * $query->filterByDbPass('%fooValue%'); // WHERE pass LIKE '%fooValue%'
+ *
+ *
+ * @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;
+ }
+ }
- /**
- * Adds a JOIN clause to the query using the CcFilesRelatedByDbOwnerId 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 joinCcFilesRelatedByDbOwnerId($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcFilesRelatedByDbOwnerId');
-
- // 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, 'CcFilesRelatedByDbOwnerId');
- }
-
- return $this;
- }
+ return $this->addUsingAlias(CcSubjsPeer::PASS, $dbPass, $comparison);
+ }
- /**
- * Use the CcFilesRelatedByDbOwnerId 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 useCcFilesRelatedByDbOwnerIdQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- return $this
- ->joinCcFilesRelatedByDbOwnerId($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcFilesRelatedByDbOwnerId', 'CcFilesQuery');
- }
+ /**
+ * Filter the query on the type column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbType('fooValue'); // WHERE type = 'fooValue'
+ * $query->filterByDbType('%fooValue%'); // WHERE type LIKE '%fooValue%'
+ *
+ *
+ * @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;
+ }
+ }
- /**
- * 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 filterByCcFilesRelatedByDbEditedby($ccFiles, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcSubjsPeer::ID, $ccFiles->getDbEditedby(), $comparison);
- }
+ return $this->addUsingAlias(CcSubjsPeer::TYPE, $dbType, $comparison);
+ }
- /**
- * Adds a JOIN clause to the query using the CcFilesRelatedByDbEditedby 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 joinCcFilesRelatedByDbEditedby($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcFilesRelatedByDbEditedby');
-
- // 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, 'CcFilesRelatedByDbEditedby');
- }
-
- return $this;
- }
+ /**
+ * Filter the query on the first_name column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbFirstName('fooValue'); // WHERE first_name = 'fooValue'
+ * $query->filterByDbFirstName('%fooValue%'); // WHERE first_name LIKE '%fooValue%'
+ *
+ *
+ * @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;
+ }
+ }
- /**
- * Use the CcFilesRelatedByDbEditedby 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 useCcFilesRelatedByDbEditedbyQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- return $this
- ->joinCcFilesRelatedByDbEditedby($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcFilesRelatedByDbEditedby', 'CcFilesQuery');
- }
+ return $this->addUsingAlias(CcSubjsPeer::FIRST_NAME, $dbFirstName, $comparison);
+ }
- /**
- * 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);
- }
+ /**
+ * Filter the query on the last_name column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLastName('fooValue'); // WHERE last_name = 'fooValue'
+ * $query->filterByDbLastName('%fooValue%'); // WHERE last_name LIKE '%fooValue%'
+ *
+ *
+ * @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;
+ }
+ }
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcSubjsPeer::LAST_NAME, $dbLastName, $comparison);
+ }
- /**
- * 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 on the lastlogin column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLastlogin('2011-03-14'); // WHERE lastlogin = '2011-03-14'
+ * $query->filterByDbLastlogin('now'); // WHERE lastlogin = '2011-03-14'
+ * $query->filterByDbLastlogin(array('max' => 'yesterday')); // WHERE lastlogin < '2011-03-13'
+ *
+ *
+ * @param mixed $dbLastlogin The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcSubjsPeer::LASTLOGIN, $dbLastlogin, $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;
- }
+ /**
+ * Filter the query on the lastfail column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLastfail('2011-03-14'); // WHERE lastfail = '2011-03-14'
+ * $query->filterByDbLastfail('now'); // WHERE lastfail = '2011-03-14'
+ * $query->filterByDbLastfail(array('max' => 'yesterday')); // WHERE lastfail < '2011-03-13'
+ *
+ *
+ * @param mixed $dbLastfail The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * 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');
- }
+ return $this->addUsingAlias(CcSubjsPeer::LASTFAIL, $dbLastfail, $comparison);
+ }
- /**
- * 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->getDbCreatorId(), $comparison);
- }
+ /**
+ * Filter the query on the skype_contact column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbSkypeContact('fooValue'); // WHERE skype_contact = 'fooValue'
+ * $query->filterByDbSkypeContact('%fooValue%'); // WHERE skype_contact LIKE '%fooValue%'
+ *
+ *
+ * @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;
+ }
+ }
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcSubjsPeer::SKYPE_CONTACT, $dbSkypeContact, $comparison);
+ }
- /**
- * 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 on the jabber_contact column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbJabberContact('fooValue'); // WHERE jabber_contact = 'fooValue'
+ * $query->filterByDbJabberContact('%fooValue%'); // WHERE jabber_contact LIKE '%fooValue%'
+ *
+ *
+ * @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;
+ }
+ }
- /**
- * Filter the query by a related CcBlock object
- *
- * @param CcBlock $ccBlock 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 filterByCcBlock($ccBlock, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcSubjsPeer::ID, $ccBlock->getDbCreatorId(), $comparison);
- }
+ return $this->addUsingAlias(CcSubjsPeer::JABBER_CONTACT, $dbJabberContact, $comparison);
+ }
- /**
- * Adds a JOIN clause to the query using the CcBlock 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 joinCcBlock($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcBlock');
-
- // 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, 'CcBlock');
- }
-
- return $this;
- }
+ /**
+ * Filter the query on the email column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbEmail('fooValue'); // WHERE email = 'fooValue'
+ * $query->filterByDbEmail('%fooValue%'); // WHERE email LIKE '%fooValue%'
+ *
+ *
+ * @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;
+ }
+ }
- /**
- * Use the CcBlock relation CcBlock 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 CcBlockQuery A secondary query class using the current class as primary query
- */
- public function useCcBlockQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
- {
- return $this
- ->joinCcBlock($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcBlock', 'CcBlockQuery');
- }
+ return $this->addUsingAlias(CcSubjsPeer::EMAIL, $dbEmail, $comparison);
+ }
- /**
- * 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);
- }
+ /**
+ * Filter the query on the cell_phone column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCellPhone('fooValue'); // WHERE cell_phone = 'fooValue'
+ * $query->filterByDbCellPhone('%fooValue%'); // WHERE cell_phone LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbCellPhone 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 filterByDbCellPhone($dbCellPhone = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbCellPhone)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCellPhone)) {
+ $dbCellPhone = str_replace('*', '%', $dbCellPhone);
+ $comparison = Criteria::LIKE;
+ }
+ }
- /**
- * 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;
- }
+ return $this->addUsingAlias(CcSubjsPeer::CELL_PHONE, $dbCellPhone, $comparison);
+ }
- /**
- * 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 on the login_attempts column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLoginAttempts(1234); // WHERE login_attempts = 1234
+ * $query->filterByDbLoginAttempts(array(12, 34)); // WHERE login_attempts IN (12, 34)
+ * $query->filterByDbLoginAttempts(array('min' => 12)); // WHERE login_attempts >= 12
+ * $query->filterByDbLoginAttempts(array('max' => 12)); // WHERE login_attempts <= 12
+ *
+ *
+ * @param mixed $dbLoginAttempts The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @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;
+ }
+ }
- /**
- * 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);
- }
+ return $this->addUsingAlias(CcSubjsPeer::LOGIN_ATTEMPTS, $dbLoginAttempts, $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;
- }
+ /**
+ * Filter the query by a related CcFiles object
+ *
+ * @param CcFiles|PropelObjectCollection $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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcFilesRelatedByDbOwnerId($ccFiles, $comparison = null)
+ {
+ if ($ccFiles instanceof CcFiles) {
+ return $this
+ ->addUsingAlias(CcSubjsPeer::ID, $ccFiles->getDbOwnerId(), $comparison);
+ } elseif ($ccFiles instanceof PropelObjectCollection) {
+ return $this
+ ->useCcFilesRelatedByDbOwnerIdQuery()
+ ->filterByPrimaryKeys($ccFiles->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcFilesRelatedByDbOwnerId() only accepts arguments of type CcFiles or PropelCollection');
+ }
+ }
- /**
- * 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');
- }
+ /**
+ * Adds a JOIN clause to the query using the CcFilesRelatedByDbOwnerId 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 joinCcFilesRelatedByDbOwnerId($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcFilesRelatedByDbOwnerId');
- /**
- * Filter the query by a related CcSubjsToken object
- *
- * @param CcSubjsToken $ccSubjsToken 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 filterByCcSubjsToken($ccSubjsToken, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcSubjsPeer::ID, $ccSubjsToken->getDbUserId(), $comparison);
- }
+ // 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);
+ }
- /**
- * Adds a JOIN clause to the query using the CcSubjsToken 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 joinCcSubjsToken($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcSubjsToken');
-
- // 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, 'CcSubjsToken');
- }
-
- return $this;
- }
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CcFilesRelatedByDbOwnerId');
+ }
- /**
- * Use the CcSubjsToken relation CcSubjsToken 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 CcSubjsTokenQuery A secondary query class using the current class as primary query
- */
- public function useCcSubjsTokenQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinCcSubjsToken($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcSubjsToken', 'CcSubjsTokenQuery');
- }
+ return $this;
+ }
- /**
- * 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;
- }
+ /**
+ * Use the CcFilesRelatedByDbOwnerId 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 useCcFilesRelatedByDbOwnerIdQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcFilesRelatedByDbOwnerId($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcFilesRelatedByDbOwnerId', 'CcFilesQuery');
+ }
-} // BaseCcSubjsQuery
+ /**
+ * Filter the query by a related CcFiles object
+ *
+ * @param CcFiles|PropelObjectCollection $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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcFilesRelatedByDbEditedby($ccFiles, $comparison = null)
+ {
+ if ($ccFiles instanceof CcFiles) {
+ return $this
+ ->addUsingAlias(CcSubjsPeer::ID, $ccFiles->getDbEditedby(), $comparison);
+ } elseif ($ccFiles instanceof PropelObjectCollection) {
+ return $this
+ ->useCcFilesRelatedByDbEditedbyQuery()
+ ->filterByPrimaryKeys($ccFiles->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcFilesRelatedByDbEditedby() only accepts arguments of type CcFiles or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcFilesRelatedByDbEditedby 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 joinCcFilesRelatedByDbEditedby($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcFilesRelatedByDbEditedby');
+
+ // 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, 'CcFilesRelatedByDbEditedby');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcFilesRelatedByDbEditedby 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 useCcFilesRelatedByDbEditedbyQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcFilesRelatedByDbEditedby($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcFilesRelatedByDbEditedby', 'CcFilesQuery');
+ }
+
+ /**
+ * Filter the query by a related CcPerms object
+ *
+ * @param CcPerms|PropelObjectCollection $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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcPerms($ccPerms, $comparison = null)
+ {
+ if ($ccPerms instanceof CcPerms) {
+ return $this
+ ->addUsingAlias(CcSubjsPeer::ID, $ccPerms->getSubj(), $comparison);
+ } elseif ($ccPerms instanceof PropelObjectCollection) {
+ return $this
+ ->useCcPermsQuery()
+ ->filterByPrimaryKeys($ccPerms->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcPerms() only accepts arguments of type CcPerms or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcPerms($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPerms', 'CcPermsQuery');
+ }
+
+ /**
+ * Filter the query by a related CcShowHosts object
+ *
+ * @param CcShowHosts|PropelObjectCollection $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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcShowHosts($ccShowHosts, $comparison = null)
+ {
+ if ($ccShowHosts instanceof CcShowHosts) {
+ return $this
+ ->addUsingAlias(CcSubjsPeer::ID, $ccShowHosts->getDbHost(), $comparison);
+ } elseif ($ccShowHosts instanceof PropelObjectCollection) {
+ return $this
+ ->useCcShowHostsQuery()
+ ->filterByPrimaryKeys($ccShowHosts->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcShowHosts() only accepts arguments of type CcShowHosts or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcShowHosts($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcShowHosts', 'CcShowHostsQuery');
+ }
+
+ /**
+ * Filter the query by a related CcPlaylist object
+ *
+ * @param CcPlaylist|PropelObjectCollection $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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcPlaylist($ccPlaylist, $comparison = null)
+ {
+ if ($ccPlaylist instanceof CcPlaylist) {
+ return $this
+ ->addUsingAlias(CcSubjsPeer::ID, $ccPlaylist->getDbCreatorId(), $comparison);
+ } elseif ($ccPlaylist instanceof PropelObjectCollection) {
+ return $this
+ ->useCcPlaylistQuery()
+ ->filterByPrimaryKeys($ccPlaylist->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcPlaylist() only accepts arguments of type CcPlaylist or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcPlaylist($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPlaylist', 'CcPlaylistQuery');
+ }
+
+ /**
+ * Filter the query by a related CcBlock object
+ *
+ * @param CcBlock|PropelObjectCollection $ccBlock 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcBlock($ccBlock, $comparison = null)
+ {
+ if ($ccBlock instanceof CcBlock) {
+ return $this
+ ->addUsingAlias(CcSubjsPeer::ID, $ccBlock->getDbCreatorId(), $comparison);
+ } elseif ($ccBlock instanceof PropelObjectCollection) {
+ return $this
+ ->useCcBlockQuery()
+ ->filterByPrimaryKeys($ccBlock->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcBlock() only accepts arguments of type CcBlock or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcBlock 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 joinCcBlock($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcBlock');
+
+ // 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, 'CcBlock');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcBlock relation CcBlock 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 CcBlockQuery A secondary query class using the current class as primary query
+ */
+ public function useCcBlockQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcBlock($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcBlock', 'CcBlockQuery');
+ }
+
+ /**
+ * Filter the query by a related CcPref object
+ *
+ * @param CcPref|PropelObjectCollection $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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcPref($ccPref, $comparison = null)
+ {
+ if ($ccPref instanceof CcPref) {
+ return $this
+ ->addUsingAlias(CcSubjsPeer::ID, $ccPref->getSubjid(), $comparison);
+ } elseif ($ccPref instanceof PropelObjectCollection) {
+ return $this
+ ->useCcPrefQuery()
+ ->filterByPrimaryKeys($ccPref->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcPref() only accepts arguments of type CcPref or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcPref($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcPref', 'CcPrefQuery');
+ }
+
+ /**
+ * Filter the query by a related CcSess object
+ *
+ * @param CcSess|PropelObjectCollection $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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcSess($ccSess, $comparison = null)
+ {
+ if ($ccSess instanceof CcSess) {
+ return $this
+ ->addUsingAlias(CcSubjsPeer::ID, $ccSess->getUserid(), $comparison);
+ } elseif ($ccSess instanceof PropelObjectCollection) {
+ return $this
+ ->useCcSessQuery()
+ ->filterByPrimaryKeys($ccSess->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcSess() only accepts arguments of type CcSess or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcSess($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcSess', 'CcSessQuery');
+ }
+
+ /**
+ * Filter the query by a related CcSubjsToken object
+ *
+ * @param CcSubjsToken|PropelObjectCollection $ccSubjsToken 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcSubjsToken($ccSubjsToken, $comparison = null)
+ {
+ if ($ccSubjsToken instanceof CcSubjsToken) {
+ return $this
+ ->addUsingAlias(CcSubjsPeer::ID, $ccSubjsToken->getDbUserId(), $comparison);
+ } elseif ($ccSubjsToken instanceof PropelObjectCollection) {
+ return $this
+ ->useCcSubjsTokenQuery()
+ ->filterByPrimaryKeys($ccSubjsToken->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcSubjsToken() only accepts arguments of type CcSubjsToken or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcSubjsToken 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 joinCcSubjsToken($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcSubjsToken');
+
+ // 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, 'CcSubjsToken');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcSubjsToken relation CcSubjsToken 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 CcSubjsTokenQuery A secondary query class using the current class as primary query
+ */
+ public function useCcSubjsTokenQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcSubjsToken($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcSubjsToken', 'CcSubjsTokenQuery');
+ }
+
+ /**
+ * 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;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjsToken.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjsToken.php
index e0a4ba9bb..f1c3b4bef 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSubjsToken.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjsToken.php
@@ -4,1002 +4,1130 @@
/**
* Base class that represents a row from the 'cc_subjs_token' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcSubjsToken extends BaseObject implements Persistent
+abstract class BaseCcSubjsToken extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcSubjsTokenPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcSubjsTokenPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the user_id field.
- * @var int
- */
- protected $user_id;
-
- /**
- * The value for the action field.
- * @var string
- */
- protected $action;
-
- /**
- * The value for the token field.
- * @var string
- */
- protected $token;
-
- /**
- * The value for the created field.
- * @var string
- */
- protected $created;
-
- /**
- * @var CcSubjs
- */
- protected $aCcSubjs;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Get the [id] column value.
- *
- * @return int
- */
- public function getDbId()
- {
- return $this->id;
- }
-
- /**
- * Get the [user_id] column value.
- *
- * @return int
- */
- public function getDbUserId()
- {
- return $this->user_id;
- }
-
- /**
- * Get the [action] column value.
- *
- * @return string
- */
- public function getDbAction()
- {
- return $this->action;
- }
-
- /**
- * Get the [token] column value.
- *
- * @return string
- */
- public function getDbToken()
- {
- return $this->token;
- }
-
- /**
- * Get the [optionally formatted] temporal [created] 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 getDbCreated($format = 'Y-m-d H:i:s')
- {
- if ($this->created === null) {
- return null;
- }
-
-
-
- try {
- $dt = new DateTime($this->created);
- } catch (Exception $x) {
- throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created, 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 CcSubjsToken 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[] = CcSubjsTokenPeer::ID;
- }
-
- return $this;
- } // setDbId()
-
- /**
- * Set the value of [user_id] column.
- *
- * @param int $v new value
- * @return CcSubjsToken The current object (for fluent API support)
- */
- public function setDbUserId($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->user_id !== $v) {
- $this->user_id = $v;
- $this->modifiedColumns[] = CcSubjsTokenPeer::USER_ID;
- }
-
- if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) {
- $this->aCcSubjs = null;
- }
-
- return $this;
- } // setDbUserId()
-
- /**
- * Set the value of [action] column.
- *
- * @param string $v new value
- * @return CcSubjsToken The current object (for fluent API support)
- */
- public function setDbAction($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->action !== $v) {
- $this->action = $v;
- $this->modifiedColumns[] = CcSubjsTokenPeer::ACTION;
- }
-
- return $this;
- } // setDbAction()
-
- /**
- * Set the value of [token] column.
- *
- * @param string $v new value
- * @return CcSubjsToken The current object (for fluent API support)
- */
- public function setDbToken($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->token !== $v) {
- $this->token = $v;
- $this->modifiedColumns[] = CcSubjsTokenPeer::TOKEN;
- }
-
- return $this;
- } // setDbToken()
-
- /**
- * Sets the value of [created] 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 CcSubjsToken The current object (for fluent API support)
- */
- public function setDbCreated($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->created !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->created !== null && $tmpDt = new DateTime($this->created)) ? $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->created = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
- $this->modifiedColumns[] = CcSubjsTokenPeer::CREATED;
- }
- } // if either are not null
-
- return $this;
- } // setDbCreated()
-
- /**
- * 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->user_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
- $this->action = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
- $this->token = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
- $this->created = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 5; // 5 = CcSubjsTokenPeer::NUM_COLUMNS - CcSubjsTokenPeer::NUM_LAZY_LOAD_COLUMNS).
-
- } catch (Exception $e) {
- throw new PropelException("Error populating CcSubjsToken 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->user_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(CcSubjsTokenPeer::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 = CcSubjsTokenPeer::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(CcSubjsTokenPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $con->beginTransaction();
- try {
- $ret = $this->preDelete($con);
- if ($ret) {
- CcSubjsTokenQuery::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(CcSubjsTokenPeer::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);
- CcSubjsTokenPeer::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[] = CcSubjsTokenPeer::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(CcSubjsTokenPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcSubjsTokenPeer::ID.')');
- }
-
- $pk = BasePeer::doInsert($criteria, $con);
- $affectedRows += 1;
- $this->setDbId($pk); //[IMV] update autoincrement primary key
- $this->setNew(false);
- } else {
- $affectedRows += CcSubjsTokenPeer::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 = CcSubjsTokenPeer::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 = CcSubjsTokenPeer::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->getDbUserId();
- break;
- case 2:
- return $this->getDbAction();
- break;
- case 3:
- return $this->getDbToken();
- break;
- case 4:
- return $this->getDbCreated();
- 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 = CcSubjsTokenPeer::getFieldNames($keyType);
- $result = array(
- $keys[0] => $this->getDbId(),
- $keys[1] => $this->getDbUserId(),
- $keys[2] => $this->getDbAction(),
- $keys[3] => $this->getDbToken(),
- $keys[4] => $this->getDbCreated(),
- );
- 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 = CcSubjsTokenPeer::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->setDbUserId($value);
- break;
- case 2:
- $this->setDbAction($value);
- break;
- case 3:
- $this->setDbToken($value);
- break;
- case 4:
- $this->setDbCreated($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 = CcSubjsTokenPeer::getFieldNames($keyType);
-
- if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
- if (array_key_exists($keys[1], $arr)) $this->setDbUserId($arr[$keys[1]]);
- if (array_key_exists($keys[2], $arr)) $this->setDbAction($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setDbToken($arr[$keys[3]]);
- if (array_key_exists($keys[4], $arr)) $this->setDbCreated($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(CcSubjsTokenPeer::DATABASE_NAME);
-
- if ($this->isColumnModified(CcSubjsTokenPeer::ID)) $criteria->add(CcSubjsTokenPeer::ID, $this->id);
- if ($this->isColumnModified(CcSubjsTokenPeer::USER_ID)) $criteria->add(CcSubjsTokenPeer::USER_ID, $this->user_id);
- if ($this->isColumnModified(CcSubjsTokenPeer::ACTION)) $criteria->add(CcSubjsTokenPeer::ACTION, $this->action);
- if ($this->isColumnModified(CcSubjsTokenPeer::TOKEN)) $criteria->add(CcSubjsTokenPeer::TOKEN, $this->token);
- if ($this->isColumnModified(CcSubjsTokenPeer::CREATED)) $criteria->add(CcSubjsTokenPeer::CREATED, $this->created);
-
- 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(CcSubjsTokenPeer::DATABASE_NAME);
- $criteria->add(CcSubjsTokenPeer::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 CcSubjsToken (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->setDbUserId($this->user_id);
- $copyObj->setDbAction($this->action);
- $copyObj->setDbToken($this->token);
- $copyObj->setDbCreated($this->created);
-
- $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 CcSubjsToken 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 CcSubjsTokenPeer
- */
- public function getPeer()
- {
- if (self::$peer === null) {
- self::$peer = new CcSubjsTokenPeer();
- }
- return self::$peer;
- }
-
- /**
- * Declares an association between this object and a CcSubjs object.
- *
- * @param CcSubjs $v
- * @return CcSubjsToken The current object (for fluent API support)
- * @throws PropelException
- */
- public function setCcSubjs(CcSubjs $v = null)
- {
- if ($v === null) {
- $this->setDbUserId(NULL);
- } else {
- $this->setDbUserId($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->addCcSubjsToken($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->user_id !== null)) {
- $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->user_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->addCcSubjsTokens($this);
- */
- }
- return $this->aCcSubjs;
- }
-
- /**
- * Clears the current object and sets all attributes to their default values
- */
- public function clear()
- {
- $this->id = null;
- $this->user_id = null;
- $this->action = null;
- $this->token = null;
- $this->created = 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);
- }
-
-} // BaseCcSubjsToken
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcSubjsTokenPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcSubjsTokenPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the user_id field.
+ * @var int
+ */
+ protected $user_id;
+
+ /**
+ * The value for the action field.
+ * @var string
+ */
+ protected $action;
+
+ /**
+ * The value for the token field.
+ * @var string
+ */
+ protected $token;
+
+ /**
+ * The value for the created field.
+ * @var string
+ */
+ protected $created;
+
+ /**
+ * @var CcSubjs
+ */
+ protected $aCcSubjs;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getDbId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [user_id] column value.
+ *
+ * @return int
+ */
+ public function getDbUserId()
+ {
+
+ return $this->user_id;
+ }
+
+ /**
+ * Get the [action] column value.
+ *
+ * @return string
+ */
+ public function getDbAction()
+ {
+
+ return $this->action;
+ }
+
+ /**
+ * Get the [token] column value.
+ *
+ * @return string
+ */
+ public function getDbToken()
+ {
+
+ return $this->token;
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [created] 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 getDbCreated($format = 'Y-m-d H:i:s')
+ {
+ if ($this->created === null) {
+ return null;
+ }
+
+
+ try {
+ $dt = new DateTime($this->created);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created, true), $x);
+ }
+
+ if ($format === null) {
+ // Because propel.useDateTimeClass is true, we return a DateTime object.
+ return $dt;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcSubjsToken The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcSubjsTokenPeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [user_id] column.
+ *
+ * @param int $v new value
+ * @return CcSubjsToken The current object (for fluent API support)
+ */
+ public function setDbUserId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->user_id !== $v) {
+ $this->user_id = $v;
+ $this->modifiedColumns[] = CcSubjsTokenPeer::USER_ID;
+ }
+
+ if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) {
+ $this->aCcSubjs = null;
+ }
+
+
+ return $this;
+ } // setDbUserId()
+
+ /**
+ * Set the value of [action] column.
+ *
+ * @param string $v new value
+ * @return CcSubjsToken The current object (for fluent API support)
+ */
+ public function setDbAction($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->action !== $v) {
+ $this->action = $v;
+ $this->modifiedColumns[] = CcSubjsTokenPeer::ACTION;
+ }
+
+
+ return $this;
+ } // setDbAction()
+
+ /**
+ * Set the value of [token] column.
+ *
+ * @param string $v new value
+ * @return CcSubjsToken The current object (for fluent API support)
+ */
+ public function setDbToken($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->token !== $v) {
+ $this->token = $v;
+ $this->modifiedColumns[] = CcSubjsTokenPeer::TOKEN;
+ }
+
+
+ return $this;
+ } // setDbToken()
+
+ /**
+ * Sets the value of [created] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or DateTime value.
+ * Empty strings are treated as null.
+ * @return CcSubjsToken The current object (for fluent API support)
+ */
+ public function setDbCreated($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->created !== null || $dt !== null) {
+ $currentDateAsString = ($this->created !== null && $tmpDt = new DateTime($this->created)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->created = $newDateAsString;
+ $this->modifiedColumns[] = CcSubjsTokenPeer::CREATED;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbCreated()
+
+ /**
+ * 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 resultset 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->user_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
+ $this->action = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->token = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->created = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 5; // 5 = CcSubjsTokenPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcSubjsToken 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->user_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(CcSubjsTokenPeer::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 = CcSubjsTokenPeer::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
+ * @throws Exception
+ * @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(CcSubjsTokenPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = CcSubjsTokenQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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(CcSubjsTokenPeer::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);
+ CcSubjsTokenPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $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 corresponding 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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcSubjsTokenPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcSubjsTokenPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_subjs_token_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcSubjsTokenPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcSubjsTokenPeer::USER_ID)) {
+ $modifiedColumns[':p' . $index++] = '"user_id"';
+ }
+ if ($this->isColumnModified(CcSubjsTokenPeer::ACTION)) {
+ $modifiedColumns[':p' . $index++] = '"action"';
+ }
+ if ($this->isColumnModified(CcSubjsTokenPeer::TOKEN)) {
+ $modifiedColumns[':p' . $index++] = '"token"';
+ }
+ if ($this->isColumnModified(CcSubjsTokenPeer::CREATED)) {
+ $modifiedColumns[':p' . $index++] = '"created"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_subjs_token" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"user_id"':
+ $stmt->bindValue($identifier, $this->user_id, PDO::PARAM_INT);
+ break;
+ case '"action"':
+ $stmt->bindValue($identifier, $this->action, PDO::PARAM_STR);
+ break;
+ case '"token"':
+ $stmt->bindValue($identifier, $this->token, PDO::PARAM_STR);
+ break;
+ case '"created"':
+ $stmt->bindValue($identifier, $this->created, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding 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 = CcSubjsTokenPeer::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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcSubjsTokenPeer::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->getDbUserId();
+ break;
+ case 2:
+ return $this->getDbAction();
+ break;
+ case 3:
+ return $this->getDbToken();
+ break;
+ case 4:
+ return $this->getDbCreated();
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcSubjsToken'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcSubjsToken'][$this->getPrimaryKey()] = true;
+ $keys = CcSubjsTokenPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbUserId(),
+ $keys[2] => $this->getDbAction(),
+ $keys[3] => $this->getDbToken(),
+ $keys[4] => $this->getDbCreated(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcSubjs) {
+ $result['CcSubjs'] = $this->aCcSubjs->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcSubjsTokenPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbUserId($value);
+ break;
+ case 2:
+ $this->setDbAction($value);
+ break;
+ case 3:
+ $this->setDbToken($value);
+ break;
+ case 4:
+ $this->setDbCreated($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 BasePeer::TYPE_PHPNAME
+ *
+ * @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 = CcSubjsTokenPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbUserId($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setDbAction($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbToken($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbCreated($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(CcSubjsTokenPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcSubjsTokenPeer::ID)) $criteria->add(CcSubjsTokenPeer::ID, $this->id);
+ if ($this->isColumnModified(CcSubjsTokenPeer::USER_ID)) $criteria->add(CcSubjsTokenPeer::USER_ID, $this->user_id);
+ if ($this->isColumnModified(CcSubjsTokenPeer::ACTION)) $criteria->add(CcSubjsTokenPeer::ACTION, $this->action);
+ if ($this->isColumnModified(CcSubjsTokenPeer::TOKEN)) $criteria->add(CcSubjsTokenPeer::TOKEN, $this->token);
+ if ($this->isColumnModified(CcSubjsTokenPeer::CREATED)) $criteria->add(CcSubjsTokenPeer::CREATED, $this->created);
+
+ 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(CcSubjsTokenPeer::DATABASE_NAME);
+ $criteria->add(CcSubjsTokenPeer::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 CcSubjsToken (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbUserId($this->getDbUserId());
+ $copyObj->setDbAction($this->getDbAction());
+ $copyObj->setDbToken($this->getDbToken());
+ $copyObj->setDbCreated($this->getDbCreated());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 CcSubjsToken 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 CcSubjsTokenPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcSubjsTokenPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcSubjs object.
+ *
+ * @param CcSubjs $v
+ * @return CcSubjsToken The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcSubjs(CcSubjs $v = null)
+ {
+ if ($v === null) {
+ $this->setDbUserId(NULL);
+ } else {
+ $this->setDbUserId($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->addCcSubjsToken($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcSubjs object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcSubjs The associated CcSubjs object.
+ * @throws PropelException
+ */
+ public function getCcSubjs(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcSubjs === null && ($this->user_id !== null) && $doQuery) {
+ $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->user_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->addCcSubjsTokens($this);
+ */
+ }
+
+ return $this->aCcSubjs;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->user_id = null;
+ $this->action = null;
+ $this->token = null;
+ $this->created = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->aCcSubjs instanceof Persistent) {
+ $this->aCcSubjs->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ $this->aCcSubjs = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcSubjsTokenPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjsTokenPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjsTokenPeer.php
index 7f08ba6a7..f8c54b2c0 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSubjsTokenPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjsTokenPeer.php
@@ -4,981 +4,1007 @@
/**
* Base static class for performing query and update operations on the 'cc_subjs_token' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcSubjsTokenPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_subjs_token';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcSubjsToken';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcSubjsToken';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcSubjsTokenTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 5;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_subjs_token.ID';
-
- /** the column name for the USER_ID field */
- const USER_ID = 'cc_subjs_token.USER_ID';
-
- /** the column name for the ACTION field */
- const ACTION = 'cc_subjs_token.ACTION';
-
- /** the column name for the TOKEN field */
- const TOKEN = 'cc_subjs_token.TOKEN';
-
- /** the column name for the CREATED field */
- const CREATED = 'cc_subjs_token.CREATED';
-
- /**
- * An identiy map to hold any loaded instances of CcSubjsToken objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcSubjsToken[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbUserId', 'DbAction', 'DbToken', 'DbCreated', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbUserId', 'dbAction', 'dbToken', 'dbCreated', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::USER_ID, self::ACTION, self::TOKEN, self::CREATED, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'USER_ID', 'ACTION', 'TOKEN', 'CREATED', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'user_id', 'action', 'token', 'created', ),
- 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 ('DbId' => 0, 'DbUserId' => 1, 'DbAction' => 2, 'DbToken' => 3, 'DbCreated' => 4, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbUserId' => 1, 'dbAction' => 2, 'dbToken' => 3, 'dbCreated' => 4, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::USER_ID => 1, self::ACTION => 2, self::TOKEN => 3, self::CREATED => 4, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'USER_ID' => 1, 'ACTION' => 2, 'TOKEN' => 3, 'CREATED' => 4, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'user_id' => 1, 'action' => 2, 'token' => 3, 'created' => 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. CcSubjsTokenPeer::COLUMN_NAME).
- * @return string
- */
- public static function alias($alias, $column)
- {
- return str_replace(CcSubjsTokenPeer::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(CcSubjsTokenPeer::ID);
- $criteria->addSelectColumn(CcSubjsTokenPeer::USER_ID);
- $criteria->addSelectColumn(CcSubjsTokenPeer::ACTION);
- $criteria->addSelectColumn(CcSubjsTokenPeer::TOKEN);
- $criteria->addSelectColumn(CcSubjsTokenPeer::CREATED);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.USER_ID');
- $criteria->addSelectColumn($alias . '.ACTION');
- $criteria->addSelectColumn($alias . '.TOKEN');
- $criteria->addSelectColumn($alias . '.CREATED');
- }
- }
-
- /**
- * 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(CcSubjsTokenPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcSubjsTokenPeer::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(CcSubjsTokenPeer::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 CcSubjsToken
- * @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 = CcSubjsTokenPeer::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 CcSubjsTokenPeer::populateObjects(CcSubjsTokenPeer::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(CcSubjsTokenPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- if (!$criteria->hasSelectClause()) {
- $criteria = clone $criteria;
- CcSubjsTokenPeer::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 CcSubjsToken $value A CcSubjsToken object.
- * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
- */
- public static function addInstanceToPool(CcSubjsToken $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 CcSubjsToken object or a primary key value.
- */
- public static function removeInstanceFromPool($value)
- {
- if (Propel::isInstancePoolingEnabled() && $value !== null) {
- if (is_object($value) && $value instanceof CcSubjsToken) {
- $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 CcSubjsToken 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 CcSubjsToken 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_token
- * 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 = CcSubjsTokenPeer::getOMClass(false);
- // populate the object(s)
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key = CcSubjsTokenPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj = CcSubjsTokenPeer::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;
- CcSubjsTokenPeer::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 (CcSubjsToken object, last column rank)
- */
- public static function populateObject($row, $startcol = 0)
- {
- $key = CcSubjsTokenPeer::getPrimaryKeyHashFromRow($row, $startcol);
- if (null !== ($obj = CcSubjsTokenPeer::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 + CcSubjsTokenPeer::NUM_COLUMNS;
- } else {
- $cls = CcSubjsTokenPeer::OM_CLASS;
- $obj = new $cls();
- $col = $obj->hydrate($row, $startcol);
- CcSubjsTokenPeer::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(CcSubjsTokenPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcSubjsTokenPeer::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(CcSubjsTokenPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcSubjsTokenPeer::USER_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 CcSubjsToken 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 CcSubjsToken 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);
- }
-
- CcSubjsTokenPeer::addSelectColumns($criteria);
- $startcol = (CcSubjsTokenPeer::NUM_COLUMNS - CcSubjsTokenPeer::NUM_LAZY_LOAD_COLUMNS);
- CcSubjsPeer::addSelectColumns($criteria);
-
- $criteria->addJoin(CcSubjsTokenPeer::USER_ID, CcSubjsPeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcSubjsTokenPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcSubjsTokenPeer::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 = CcSubjsTokenPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcSubjsTokenPeer::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 (CcSubjsToken) to $obj2 (CcSubjs)
- $obj2->addCcSubjsToken($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(CcSubjsTokenPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcSubjsTokenPeer::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(CcSubjsTokenPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcSubjsTokenPeer::USER_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 CcSubjsToken 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 CcSubjsToken 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);
- }
-
- CcSubjsTokenPeer::addSelectColumns($criteria);
- $startcol2 = (CcSubjsTokenPeer::NUM_COLUMNS - CcSubjsTokenPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcSubjsPeer::addSelectColumns($criteria);
- $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcSubjsTokenPeer::USER_ID, CcSubjsPeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcSubjsTokenPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcSubjsTokenPeer::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 = CcSubjsTokenPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcSubjsTokenPeer::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 (CcSubjsToken) to the collection in $obj2 (CcSubjs)
- $obj2->addCcSubjsToken($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(BaseCcSubjsTokenPeer::DATABASE_NAME);
- if (!$dbMap->hasTable(BaseCcSubjsTokenPeer::TABLE_NAME))
- {
- $dbMap->addTableObject(new CcSubjsTokenTableMap());
- }
- }
-
- /**
- * 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 ? CcSubjsTokenPeer::CLASS_DEFAULT : CcSubjsTokenPeer::OM_CLASS;
- }
-
- /**
- * Method perform an INSERT on the database, given a CcSubjsToken or Criteria object.
- *
- * @param mixed $values Criteria or CcSubjsToken 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(CcSubjsTokenPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
- } else {
- $criteria = $values->buildCriteria(); // build Criteria from CcSubjsToken object
- }
-
- if ($criteria->containsKey(CcSubjsTokenPeer::ID) && $criteria->keyContainsValue(CcSubjsTokenPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcSubjsTokenPeer::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 CcSubjsToken or Criteria object.
- *
- * @param mixed $values Criteria or CcSubjsToken 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(CcSubjsTokenPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $selectCriteria = new Criteria(self::DATABASE_NAME);
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
-
- $comparison = $criteria->getComparison(CcSubjsTokenPeer::ID);
- $value = $criteria->remove(CcSubjsTokenPeer::ID);
- if ($value) {
- $selectCriteria->add(CcSubjsTokenPeer::ID, $value, $comparison);
- } else {
- $selectCriteria->setPrimaryTableName(CcSubjsTokenPeer::TABLE_NAME);
- }
-
- } else { // $values is CcSubjsToken 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_token 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(CcSubjsTokenPeer::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(CcSubjsTokenPeer::TABLE_NAME, $con, CcSubjsTokenPeer::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).
- CcSubjsTokenPeer::clearInstancePool();
- CcSubjsTokenPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Method perform a DELETE on the database, given a CcSubjsToken or Criteria object OR a primary key value.
- *
- * @param mixed $values Criteria or CcSubjsToken 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(CcSubjsTokenPeer::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.
- CcSubjsTokenPeer::clearInstancePool();
- // rename for clarity
- $criteria = clone $values;
- } elseif ($values instanceof CcSubjsToken) { // it's a model object
- // invalidate the cache for this single object
- CcSubjsTokenPeer::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(CcSubjsTokenPeer::ID, (array) $values, Criteria::IN);
- // invalidate the cache for this object(s)
- foreach ((array) $values as $singleval) {
- CcSubjsTokenPeer::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);
- CcSubjsTokenPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Validates all modified columns of given CcSubjsToken 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 CcSubjsToken $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(CcSubjsToken $obj, $cols = null)
- {
- $columns = array();
-
- if ($cols) {
- $dbMap = Propel::getDatabaseMap(CcSubjsTokenPeer::DATABASE_NAME);
- $tableMap = $dbMap->getTable(CcSubjsTokenPeer::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(CcSubjsTokenPeer::DATABASE_NAME, CcSubjsTokenPeer::TABLE_NAME, $columns);
- }
-
- /**
- * Retrieve a single object by pkey.
- *
- * @param int $pk the primary key.
- * @param PropelPDO $con the connection to use
- * @return CcSubjsToken
- */
- public static function retrieveByPK($pk, PropelPDO $con = null)
- {
-
- if (null !== ($obj = CcSubjsTokenPeer::getInstanceFromPool((string) $pk))) {
- return $obj;
- }
-
- if ($con === null) {
- $con = Propel::getConnection(CcSubjsTokenPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria = new Criteria(CcSubjsTokenPeer::DATABASE_NAME);
- $criteria->add(CcSubjsTokenPeer::ID, $pk);
-
- $v = CcSubjsTokenPeer::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(CcSubjsTokenPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $objs = null;
- if (empty($pks)) {
- $objs = array();
- } else {
- $criteria = new Criteria(CcSubjsTokenPeer::DATABASE_NAME);
- $criteria->add(CcSubjsTokenPeer::ID, $pks, Criteria::IN);
- $objs = CcSubjsTokenPeer::doSelect($criteria, $con);
- }
- return $objs;
- }
+abstract class BaseCcSubjsTokenPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_subjs_token';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcSubjsToken';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcSubjsTokenTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 5;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 5;
+
+ /** the column name for the id field */
+ const ID = 'cc_subjs_token.id';
+
+ /** the column name for the user_id field */
+ const USER_ID = 'cc_subjs_token.user_id';
+
+ /** the column name for the action field */
+ const ACTION = 'cc_subjs_token.action';
+
+ /** the column name for the token field */
+ const TOKEN = 'cc_subjs_token.token';
+
+ /** the column name for the created field */
+ const CREATED = 'cc_subjs_token.created';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcSubjsToken objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcSubjsToken[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcSubjsTokenPeer::$fieldNames[CcSubjsTokenPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbUserId', 'DbAction', 'DbToken', 'DbCreated', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbUserId', 'dbAction', 'dbToken', 'dbCreated', ),
+ BasePeer::TYPE_COLNAME => array (CcSubjsTokenPeer::ID, CcSubjsTokenPeer::USER_ID, CcSubjsTokenPeer::ACTION, CcSubjsTokenPeer::TOKEN, CcSubjsTokenPeer::CREATED, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'USER_ID', 'ACTION', 'TOKEN', 'CREATED', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'user_id', 'action', 'token', 'created', ),
+ 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. CcSubjsTokenPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbUserId' => 1, 'DbAction' => 2, 'DbToken' => 3, 'DbCreated' => 4, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbUserId' => 1, 'dbAction' => 2, 'dbToken' => 3, 'dbCreated' => 4, ),
+ BasePeer::TYPE_COLNAME => array (CcSubjsTokenPeer::ID => 0, CcSubjsTokenPeer::USER_ID => 1, CcSubjsTokenPeer::ACTION => 2, CcSubjsTokenPeer::TOKEN => 3, CcSubjsTokenPeer::CREATED => 4, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'USER_ID' => 1, 'ACTION' => 2, 'TOKEN' => 3, 'CREATED' => 4, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'user_id' => 1, 'action' => 2, 'token' => 3, 'created' => 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcSubjsTokenPeer::getFieldNames($toType);
+ $key = isset(CcSubjsTokenPeer::$fieldKeys[$fromType][$name]) ? CcSubjsTokenPeer::$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(CcSubjsTokenPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcSubjsTokenPeer::$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 CcSubjsTokenPeer::$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. CcSubjsTokenPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcSubjsTokenPeer::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(CcSubjsTokenPeer::ID);
+ $criteria->addSelectColumn(CcSubjsTokenPeer::USER_ID);
+ $criteria->addSelectColumn(CcSubjsTokenPeer::ACTION);
+ $criteria->addSelectColumn(CcSubjsTokenPeer::TOKEN);
+ $criteria->addSelectColumn(CcSubjsTokenPeer::CREATED);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.user_id');
+ $criteria->addSelectColumn($alias . '.action');
+ $criteria->addSelectColumn($alias . '.token');
+ $criteria->addSelectColumn($alias . '.created');
+ }
+ }
+
+ /**
+ * 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(CcSubjsTokenPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcSubjsTokenPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(CcSubjsTokenPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcSubjsTokenPeer::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;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcSubjsToken
+ * @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 = CcSubjsTokenPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 CcSubjsTokenPeer::populateObjects(CcSubjsTokenPeer::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 directly (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(CcSubjsTokenPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcSubjsTokenPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcSubjsTokenPeer::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 CcSubjsToken $obj A CcSubjsToken object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcSubjsTokenPeer::$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 CcSubjsToken object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcSubjsToken) {
+ $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 CcSubjsToken object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(CcSubjsTokenPeer::$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 CcSubjsToken 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(CcSubjsTokenPeer::$instances[$key])) {
+ return CcSubjsTokenPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcSubjsTokenPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcSubjsTokenPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_subjs_token
+ * 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 = CcSubjsTokenPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcSubjsTokenPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcSubjsTokenPeer::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;
+ CcSubjsTokenPeer::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 (CcSubjsToken object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcSubjsTokenPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcSubjsTokenPeer::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 + CcSubjsTokenPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = CcSubjsTokenPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcSubjsTokenPeer::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(CcSubjsTokenPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcSubjsTokenPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcSubjsTokenPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcSubjsTokenPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcSubjsTokenPeer::USER_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 CcSubjsToken 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 CcSubjsToken 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(CcSubjsTokenPeer::DATABASE_NAME);
+ }
+
+ CcSubjsTokenPeer::addSelectColumns($criteria);
+ $startcol = CcSubjsTokenPeer::NUM_HYDRATE_COLUMNS;
+ CcSubjsPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcSubjsTokenPeer::USER_ID, CcSubjsPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcSubjsTokenPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcSubjsTokenPeer::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 = CcSubjsTokenPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcSubjsTokenPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcSubjsPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcSubjsPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcSubjsPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcSubjsToken) to $obj2 (CcSubjs)
+ $obj2->addCcSubjsToken($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(CcSubjsTokenPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcSubjsTokenPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcSubjsTokenPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcSubjsTokenPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcSubjsTokenPeer::USER_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 CcSubjsToken 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 CcSubjsToken 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(CcSubjsTokenPeer::DATABASE_NAME);
+ }
+
+ CcSubjsTokenPeer::addSelectColumns($criteria);
+ $startcol2 = CcSubjsTokenPeer::NUM_HYDRATE_COLUMNS;
+
+ CcSubjsPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcSubjsPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcSubjsTokenPeer::USER_ID, CcSubjsPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcSubjsTokenPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcSubjsTokenPeer::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 = CcSubjsTokenPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcSubjsTokenPeer::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();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcSubjsPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CcSubjsToken) to the collection in $obj2 (CcSubjs)
+ $obj2->addCcSubjsToken($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(CcSubjsTokenPeer::DATABASE_NAME)->getTable(CcSubjsTokenPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcSubjsTokenPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcSubjsTokenPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \CcSubjsTokenTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcSubjsTokenPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a CcSubjsToken or Criteria object.
+ *
+ * @param mixed $values Criteria or CcSubjsToken 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(CcSubjsTokenPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcSubjsToken object
+ }
+
+ if ($criteria->containsKey(CcSubjsTokenPeer::ID) && $criteria->keyContainsValue(CcSubjsTokenPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcSubjsTokenPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(CcSubjsTokenPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a CcSubjsToken or Criteria object.
+ *
+ * @param mixed $values Criteria or CcSubjsToken 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(CcSubjsTokenPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(CcSubjsTokenPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcSubjsTokenPeer::ID);
+ $value = $criteria->remove(CcSubjsTokenPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcSubjsTokenPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcSubjsTokenPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcSubjsToken object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(CcSubjsTokenPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_subjs_token table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcSubjsTokenPeer::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(CcSubjsTokenPeer::TABLE_NAME, $con, CcSubjsTokenPeer::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).
+ CcSubjsTokenPeer::clearInstancePool();
+ CcSubjsTokenPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a CcSubjsToken or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcSubjsToken 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(CcSubjsTokenPeer::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.
+ CcSubjsTokenPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcSubjsToken) { // it's a model object
+ // invalidate the cache for this single object
+ CcSubjsTokenPeer::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(CcSubjsTokenPeer::DATABASE_NAME);
+ $criteria->add(CcSubjsTokenPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcSubjsTokenPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcSubjsTokenPeer::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);
+ CcSubjsTokenPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcSubjsToken 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 CcSubjsToken $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($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcSubjsTokenPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcSubjsTokenPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcSubjsTokenPeer::DATABASE_NAME, CcSubjsTokenPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcSubjsToken
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcSubjsTokenPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcSubjsTokenPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcSubjsTokenPeer::DATABASE_NAME);
+ $criteria->add(CcSubjsTokenPeer::ID, $pk);
+
+ $v = CcSubjsTokenPeer::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
+ * @return CcSubjsToken[]
+ * @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(CcSubjsTokenPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcSubjsTokenPeer::DATABASE_NAME);
+ $criteria->add(CcSubjsTokenPeer::ID, $pks, Criteria::IN);
+ $objs = CcSubjsTokenPeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
} // BaseCcSubjsTokenPeer
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjsTokenQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjsTokenQuery.php
index c2ee6f7bf..7906cec5a 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSubjsTokenQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjsTokenQuery.php
@@ -4,352 +4,514 @@
/**
* Base class that represents a query for the 'cc_subjs_token' table.
*
- *
*
- * @method CcSubjsTokenQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcSubjsTokenQuery orderByDbUserId($order = Criteria::ASC) Order by the user_id column
- * @method CcSubjsTokenQuery orderByDbAction($order = Criteria::ASC) Order by the action column
- * @method CcSubjsTokenQuery orderByDbToken($order = Criteria::ASC) Order by the token column
- * @method CcSubjsTokenQuery orderByDbCreated($order = Criteria::ASC) Order by the created column
*
- * @method CcSubjsTokenQuery groupByDbId() Group by the id column
- * @method CcSubjsTokenQuery groupByDbUserId() Group by the user_id column
- * @method CcSubjsTokenQuery groupByDbAction() Group by the action column
- * @method CcSubjsTokenQuery groupByDbToken() Group by the token column
- * @method CcSubjsTokenQuery groupByDbCreated() Group by the created column
+ * @method CcSubjsTokenQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcSubjsTokenQuery orderByDbUserId($order = Criteria::ASC) Order by the user_id column
+ * @method CcSubjsTokenQuery orderByDbAction($order = Criteria::ASC) Order by the action column
+ * @method CcSubjsTokenQuery orderByDbToken($order = Criteria::ASC) Order by the token column
+ * @method CcSubjsTokenQuery orderByDbCreated($order = Criteria::ASC) Order by the created column
*
- * @method CcSubjsTokenQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcSubjsTokenQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcSubjsTokenQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcSubjsTokenQuery groupByDbId() Group by the id column
+ * @method CcSubjsTokenQuery groupByDbUserId() Group by the user_id column
+ * @method CcSubjsTokenQuery groupByDbAction() Group by the action column
+ * @method CcSubjsTokenQuery groupByDbToken() Group by the token column
+ * @method CcSubjsTokenQuery groupByDbCreated() Group by the created column
*
- * @method CcSubjsTokenQuery leftJoinCcSubjs($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSubjs relation
- * @method CcSubjsTokenQuery rightJoinCcSubjs($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjs relation
- * @method CcSubjsTokenQuery innerJoinCcSubjs($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjs relation
+ * @method CcSubjsTokenQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcSubjsTokenQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcSubjsTokenQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcSubjsToken findOne(PropelPDO $con = null) Return the first CcSubjsToken matching the query
- * @method CcSubjsToken findOneOrCreate(PropelPDO $con = null) Return the first CcSubjsToken matching the query, or a new CcSubjsToken object populated from the query conditions when no match is found
+ * @method CcSubjsTokenQuery leftJoinCcSubjs($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSubjs relation
+ * @method CcSubjsTokenQuery rightJoinCcSubjs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSubjs relation
+ * @method CcSubjsTokenQuery innerJoinCcSubjs($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSubjs relation
*
- * @method CcSubjsToken findOneByDbId(int $id) Return the first CcSubjsToken filtered by the id column
- * @method CcSubjsToken findOneByDbUserId(int $user_id) Return the first CcSubjsToken filtered by the user_id column
- * @method CcSubjsToken findOneByDbAction(string $action) Return the first CcSubjsToken filtered by the action column
- * @method CcSubjsToken findOneByDbToken(string $token) Return the first CcSubjsToken filtered by the token column
- * @method CcSubjsToken findOneByDbCreated(string $created) Return the first CcSubjsToken filtered by the created column
+ * @method CcSubjsToken findOne(PropelPDO $con = null) Return the first CcSubjsToken matching the query
+ * @method CcSubjsToken findOneOrCreate(PropelPDO $con = null) Return the first CcSubjsToken matching the query, or a new CcSubjsToken object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcSubjsToken objects filtered by the id column
- * @method array findByDbUserId(int $user_id) Return CcSubjsToken objects filtered by the user_id column
- * @method array findByDbAction(string $action) Return CcSubjsToken objects filtered by the action column
- * @method array findByDbToken(string $token) Return CcSubjsToken objects filtered by the token column
- * @method array findByDbCreated(string $created) Return CcSubjsToken objects filtered by the created column
+ * @method CcSubjsToken findOneByDbUserId(int $user_id) Return the first CcSubjsToken filtered by the user_id column
+ * @method CcSubjsToken findOneByDbAction(string $action) Return the first CcSubjsToken filtered by the action column
+ * @method CcSubjsToken findOneByDbToken(string $token) Return the first CcSubjsToken filtered by the token column
+ * @method CcSubjsToken findOneByDbCreated(string $created) Return the first CcSubjsToken filtered by the created column
+ *
+ * @method array findByDbId(int $id) Return CcSubjsToken objects filtered by the id column
+ * @method array findByDbUserId(int $user_id) Return CcSubjsToken objects filtered by the user_id column
+ * @method array findByDbAction(string $action) Return CcSubjsToken objects filtered by the action column
+ * @method array findByDbToken(string $token) Return CcSubjsToken objects filtered by the token column
+ * @method array findByDbCreated(string $created) Return CcSubjsToken objects filtered by the created column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcSubjsTokenQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcSubjsTokenQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcSubjsToken';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcSubjsTokenQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcSubjsToken', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcSubjsTokenQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcSubjsTokenQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcSubjsTokenQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcSubjsTokenQuery) {
+ return $criteria;
+ }
+ $query = new CcSubjsTokenQuery(null, null, $modelAlias);
- /**
- * Returns a new CcSubjsTokenQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcSubjsTokenQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcSubjsTokenQuery) {
- return $criteria;
- }
- $query = new CcSubjsTokenQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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 CcSubjsToken|array|mixed the result, formatted by the current formatter
- */
- public function findPk($key, $con = null)
- {
- if ((null !== ($obj = CcSubjsTokenPeer::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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcSubjsToken|CcSubjsToken[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcSubjsTokenPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcSubjsTokenPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
- /**
- * Filter the query by primary key
- *
- * @param mixed $key Primary key to use for the query
- *
- * @return CcSubjsTokenQuery The current query, for fluid interface
- */
- public function filterByPrimaryKey($key)
- {
- return $this->addUsingAlias(CcSubjsTokenPeer::ID, $key, Criteria::EQUAL);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcSubjsToken A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * Filter the query by a list of primary keys
- *
- * @param array $keys The list of primary key to use for the query
- *
- * @return CcSubjsTokenQuery The current query, for fluid interface
- */
- public function filterByPrimaryKeys($keys)
- {
- return $this->addUsingAlias(CcSubjsTokenPeer::ID, $keys, Criteria::IN);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcSubjsToken A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "user_id", "action", "token", "created" FROM "cc_subjs_token" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcSubjsToken();
+ $obj->hydrate($row);
+ CcSubjsTokenPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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 CcSubjsTokenQuery 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(CcSubjsTokenPeer::ID, $dbId, $comparison);
- }
+ return $obj;
+ }
- /**
- * Filter the query on the user_id column
- *
- * @param int|array $dbUserId 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 CcSubjsTokenQuery The current query, for fluid interface
- */
- public function filterByDbUserId($dbUserId = null, $comparison = null)
- {
- if (is_array($dbUserId)) {
- $useMinMax = false;
- if (isset($dbUserId['min'])) {
- $this->addUsingAlias(CcSubjsTokenPeer::USER_ID, $dbUserId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbUserId['max'])) {
- $this->addUsingAlias(CcSubjsTokenPeer::USER_ID, $dbUserId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcSubjsTokenPeer::USER_ID, $dbUserId, $comparison);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcSubjsToken|CcSubjsToken[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * Filter the query on the action column
- *
- * @param string $dbAction 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 CcSubjsTokenQuery The current query, for fluid interface
- */
- public function filterByDbAction($dbAction = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbAction)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbAction)) {
- $dbAction = str_replace('*', '%', $dbAction);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcSubjsTokenPeer::ACTION, $dbAction, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * Filter the query on the token column
- *
- * @param string $dbToken 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 CcSubjsTokenQuery The current query, for fluid interface
- */
- public function filterByDbToken($dbToken = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbToken)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbToken)) {
- $dbToken = str_replace('*', '%', $dbToken);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcSubjsTokenPeer::TOKEN, $dbToken, $comparison);
- }
+ /**
+ * 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|CcSubjsToken[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * Filter the query on the created column
- *
- * @param string|array $dbCreated 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 CcSubjsTokenQuery The current query, for fluid interface
- */
- public function filterByDbCreated($dbCreated = null, $comparison = null)
- {
- if (is_array($dbCreated)) {
- $useMinMax = false;
- if (isset($dbCreated['min'])) {
- $this->addUsingAlias(CcSubjsTokenPeer::CREATED, $dbCreated['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbCreated['max'])) {
- $this->addUsingAlias(CcSubjsTokenPeer::CREATED, $dbCreated['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcSubjsTokenPeer::CREATED, $dbCreated, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * 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 CcSubjsTokenQuery The current query, for fluid interface
- */
- public function filterByCcSubjs($ccSubjs, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcSubjsTokenPeer::USER_ID, $ccSubjs->getDbId(), $comparison);
- }
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcSubjsTokenQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
- /**
- * 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 CcSubjsTokenQuery 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;
- }
+ return $this->addUsingAlias(CcSubjsTokenPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * 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');
- }
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcSubjsTokenQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
- /**
- * Exclude object from result
- *
- * @param CcSubjsToken $ccSubjsToken Object to remove from the list of results
- *
- * @return CcSubjsTokenQuery The current query, for fluid interface
- */
- public function prune($ccSubjsToken = null)
- {
- if ($ccSubjsToken) {
- $this->addUsingAlias(CcSubjsTokenPeer::ID, $ccSubjsToken->getDbId(), Criteria::NOT_EQUAL);
- }
-
- return $this;
- }
+ return $this->addUsingAlias(CcSubjsTokenPeer::ID, $keys, Criteria::IN);
+ }
-} // BaseCcSubjsTokenQuery
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcSubjsTokenQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcSubjsTokenPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcSubjsTokenPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcSubjsTokenPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the user_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbUserId(1234); // WHERE user_id = 1234
+ * $query->filterByDbUserId(array(12, 34)); // WHERE user_id IN (12, 34)
+ * $query->filterByDbUserId(array('min' => 12)); // WHERE user_id >= 12
+ * $query->filterByDbUserId(array('max' => 12)); // WHERE user_id <= 12
+ *
+ *
+ * @see filterByCcSubjs()
+ *
+ * @param mixed $dbUserId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcSubjsTokenQuery The current query, for fluid interface
+ */
+ public function filterByDbUserId($dbUserId = null, $comparison = null)
+ {
+ if (is_array($dbUserId)) {
+ $useMinMax = false;
+ if (isset($dbUserId['min'])) {
+ $this->addUsingAlias(CcSubjsTokenPeer::USER_ID, $dbUserId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbUserId['max'])) {
+ $this->addUsingAlias(CcSubjsTokenPeer::USER_ID, $dbUserId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcSubjsTokenPeer::USER_ID, $dbUserId, $comparison);
+ }
+
+ /**
+ * Filter the query on the action column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbAction('fooValue'); // WHERE action = 'fooValue'
+ * $query->filterByDbAction('%fooValue%'); // WHERE action LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbAction 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 CcSubjsTokenQuery The current query, for fluid interface
+ */
+ public function filterByDbAction($dbAction = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbAction)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbAction)) {
+ $dbAction = str_replace('*', '%', $dbAction);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcSubjsTokenPeer::ACTION, $dbAction, $comparison);
+ }
+
+ /**
+ * Filter the query on the token column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbToken('fooValue'); // WHERE token = 'fooValue'
+ * $query->filterByDbToken('%fooValue%'); // WHERE token LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbToken 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 CcSubjsTokenQuery The current query, for fluid interface
+ */
+ public function filterByDbToken($dbToken = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbToken)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbToken)) {
+ $dbToken = str_replace('*', '%', $dbToken);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcSubjsTokenPeer::TOKEN, $dbToken, $comparison);
+ }
+
+ /**
+ * Filter the query on the created column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCreated('2011-03-14'); // WHERE created = '2011-03-14'
+ * $query->filterByDbCreated('now'); // WHERE created = '2011-03-14'
+ * $query->filterByDbCreated(array('max' => 'yesterday')); // WHERE created < '2011-03-13'
+ *
+ *
+ * @param mixed $dbCreated The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcSubjsTokenQuery The current query, for fluid interface
+ */
+ public function filterByDbCreated($dbCreated = null, $comparison = null)
+ {
+ if (is_array($dbCreated)) {
+ $useMinMax = false;
+ if (isset($dbCreated['min'])) {
+ $this->addUsingAlias(CcSubjsTokenPeer::CREATED, $dbCreated['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbCreated['max'])) {
+ $this->addUsingAlias(CcSubjsTokenPeer::CREATED, $dbCreated['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcSubjsTokenPeer::CREATED, $dbCreated, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcSubjs object
+ *
+ * @param CcSubjs|PropelObjectCollection $ccSubjs The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcSubjsTokenQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcSubjs($ccSubjs, $comparison = null)
+ {
+ if ($ccSubjs instanceof CcSubjs) {
+ return $this
+ ->addUsingAlias(CcSubjsTokenPeer::USER_ID, $ccSubjs->getDbId(), $comparison);
+ } elseif ($ccSubjs instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcSubjsTokenPeer::USER_ID, $ccSubjs->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcSubjs() only accepts arguments of type CcSubjs or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 CcSubjsTokenQuery The current query, for fluid interface
+ */
+ public function joinCcSubjs($relationAlias = null, $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 = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcSubjs($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcSubjsToken $ccSubjsToken Object to remove from the list of results
+ *
+ * @return CcSubjsTokenQuery The current query, for fluid interface
+ */
+ public function prune($ccSubjsToken = null)
+ {
+ if ($ccSubjsToken) {
+ $this->addUsingAlias(CcSubjsTokenPeer::ID, $ccSubjsToken->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcTimestamp.php b/airtime_mvc/application/models/airtime/om/BaseCcTimestamp.php
index d61b8e513..dd0afc588 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcTimestamp.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcTimestamp.php
@@ -4,942 +4,1189 @@
/**
* Base class that represents a row from the 'cc_timestamp' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcTimestamp extends BaseObject implements Persistent
+abstract class BaseCcTimestamp extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcTimestampPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcTimestampPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the timestamp field.
- * @var string
- */
- protected $timestamp;
-
- /**
- * @var array CcListenerCount[] Collection to store aggregation of CcListenerCount objects.
- */
- protected $collCcListenerCounts;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Get the [id] column value.
- *
- * @return int
- */
- public function getDbId()
- {
- return $this->id;
- }
-
- /**
- * Get the [optionally formatted] temporal [timestamp] 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 getDbTimestamp($format = 'Y-m-d H:i:s')
- {
- if ($this->timestamp === null) {
- return null;
- }
-
-
-
- try {
- $dt = new DateTime($this->timestamp);
- } catch (Exception $x) {
- throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->timestamp, 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 CcTimestamp 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[] = CcTimestampPeer::ID;
- }
-
- return $this;
- } // setDbId()
-
- /**
- * Sets the value of [timestamp] 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 CcTimestamp The current object (for fluent API support)
- */
- public function setDbTimestamp($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->timestamp !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->timestamp !== null && $tmpDt = new DateTime($this->timestamp)) ? $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->timestamp = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
- $this->modifiedColumns[] = CcTimestampPeer::TIMESTAMP;
- }
- } // if either are not null
-
- return $this;
- } // setDbTimestamp()
-
- /**
- * 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->timestamp = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 2; // 2 = CcTimestampPeer::NUM_COLUMNS - CcTimestampPeer::NUM_LAZY_LOAD_COLUMNS).
-
- } catch (Exception $e) {
- throw new PropelException("Error populating CcTimestamp 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(CcTimestampPeer::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 = CcTimestampPeer::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->collCcListenerCounts = 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(CcTimestampPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $con->beginTransaction();
- try {
- $ret = $this->preDelete($con);
- if ($ret) {
- CcTimestampQuery::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(CcTimestampPeer::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);
- CcTimestampPeer::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[] = CcTimestampPeer::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(CcTimestampPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcTimestampPeer::ID.')');
- }
-
- $pk = BasePeer::doInsert($criteria, $con);
- $affectedRows = 1;
- $this->setDbId($pk); //[IMV] update autoincrement primary key
- $this->setNew(false);
- } else {
- $affectedRows = CcTimestampPeer::doUpdate($this, $con);
- }
-
- $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
- }
-
- if ($this->collCcListenerCounts !== null) {
- foreach ($this->collCcListenerCounts 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 = CcTimestampPeer::doValidate($this, $columns)) !== true) {
- $failureMap = array_merge($failureMap, $retval);
- }
-
-
- if ($this->collCcListenerCounts !== null) {
- foreach ($this->collCcListenerCounts 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 = CcTimestampPeer::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->getDbTimestamp();
- 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 = CcTimestampPeer::getFieldNames($keyType);
- $result = array(
- $keys[0] => $this->getDbId(),
- $keys[1] => $this->getDbTimestamp(),
- );
- 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 = CcTimestampPeer::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->setDbTimestamp($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 = CcTimestampPeer::getFieldNames($keyType);
-
- if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
- if (array_key_exists($keys[1], $arr)) $this->setDbTimestamp($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(CcTimestampPeer::DATABASE_NAME);
-
- if ($this->isColumnModified(CcTimestampPeer::ID)) $criteria->add(CcTimestampPeer::ID, $this->id);
- if ($this->isColumnModified(CcTimestampPeer::TIMESTAMP)) $criteria->add(CcTimestampPeer::TIMESTAMP, $this->timestamp);
-
- 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(CcTimestampPeer::DATABASE_NAME);
- $criteria->add(CcTimestampPeer::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 CcTimestamp (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->setDbTimestamp($this->timestamp);
-
- 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->getCcListenerCounts() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addCcListenerCount($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 CcTimestamp 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 CcTimestampPeer
- */
- public function getPeer()
- {
- if (self::$peer === null) {
- self::$peer = new CcTimestampPeer();
- }
- return self::$peer;
- }
-
- /**
- * Clears out the collCcListenerCounts 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 addCcListenerCounts()
- */
- public function clearCcListenerCounts()
- {
- $this->collCcListenerCounts = null; // important to set this to NULL since that means it is uninitialized
- }
-
- /**
- * Initializes the collCcListenerCounts collection.
- *
- * By default this just sets the collCcListenerCounts collection to an empty array (like clearcollCcListenerCounts());
- * 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 initCcListenerCounts()
- {
- $this->collCcListenerCounts = new PropelObjectCollection();
- $this->collCcListenerCounts->setModel('CcListenerCount');
- }
-
- /**
- * Gets an array of CcListenerCount 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 CcTimestamp 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 CcListenerCount[] List of CcListenerCount objects
- * @throws PropelException
- */
- public function getCcListenerCounts($criteria = null, PropelPDO $con = null)
- {
- if(null === $this->collCcListenerCounts || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcListenerCounts) {
- // return empty collection
- $this->initCcListenerCounts();
- } else {
- $collCcListenerCounts = CcListenerCountQuery::create(null, $criteria)
- ->filterByCcTimestamp($this)
- ->find($con);
- if (null !== $criteria) {
- return $collCcListenerCounts;
- }
- $this->collCcListenerCounts = $collCcListenerCounts;
- }
- }
- return $this->collCcListenerCounts;
- }
-
- /**
- * Returns the number of related CcListenerCount objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related CcListenerCount objects.
- * @throws PropelException
- */
- public function countCcListenerCounts(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- if(null === $this->collCcListenerCounts || null !== $criteria) {
- if ($this->isNew() && null === $this->collCcListenerCounts) {
- return 0;
- } else {
- $query = CcListenerCountQuery::create(null, $criteria);
- if($distinct) {
- $query->distinct();
- }
- return $query
- ->filterByCcTimestamp($this)
- ->count($con);
- }
- } else {
- return count($this->collCcListenerCounts);
- }
- }
-
- /**
- * Method called to associate a CcListenerCount object to this object
- * through the CcListenerCount foreign key attribute.
- *
- * @param CcListenerCount $l CcListenerCount
- * @return void
- * @throws PropelException
- */
- public function addCcListenerCount(CcListenerCount $l)
- {
- if ($this->collCcListenerCounts === null) {
- $this->initCcListenerCounts();
- }
- if (!$this->collCcListenerCounts->contains($l)) { // only add it if the **same** object is not already associated
- $this->collCcListenerCounts[]= $l;
- $l->setCcTimestamp($this);
- }
- }
-
-
- /**
- * If this collection has already been initialized with
- * an identical criteria, it returns the collection.
- * Otherwise if this CcTimestamp is new, it will return
- * an empty collection; or if this CcTimestamp has previously
- * been saved, it will retrieve related CcListenerCounts 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 CcTimestamp.
- *
- * @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 CcListenerCount[] List of CcListenerCount objects
- */
- public function getCcListenerCountsJoinCcMountName($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
- {
- $query = CcListenerCountQuery::create(null, $criteria);
- $query->joinWith('CcMountName', $join_behavior);
-
- return $this->getCcListenerCounts($query, $con);
- }
-
- /**
- * Clears the current object and sets all attributes to their default values
- */
- public function clear()
- {
- $this->id = null;
- $this->timestamp = 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->collCcListenerCounts) {
- foreach ((array) $this->collCcListenerCounts as $o) {
- $o->clearAllReferences($deep);
- }
- }
- } // if ($deep)
-
- $this->collCcListenerCounts = 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);
- }
-
-} // BaseCcTimestamp
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcTimestampPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcTimestampPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the timestamp field.
+ * @var string
+ */
+ protected $timestamp;
+
+ /**
+ * @var PropelObjectCollection|CcListenerCount[] Collection to store aggregation of CcListenerCount objects.
+ */
+ protected $collCcListenerCounts;
+ protected $collCcListenerCountsPartial;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccListenerCountsScheduledForDeletion = null;
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getDbId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [timestamp] 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 getDbTimestamp($format = 'Y-m-d H:i:s')
+ {
+ if ($this->timestamp === null) {
+ return null;
+ }
+
+
+ try {
+ $dt = new DateTime($this->timestamp);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->timestamp, true), $x);
+ }
+
+ if ($format === null) {
+ // Because propel.useDateTimeClass is true, we return a DateTime object.
+ return $dt;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcTimestamp The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcTimestampPeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Sets the value of [timestamp] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or DateTime value.
+ * Empty strings are treated as null.
+ * @return CcTimestamp The current object (for fluent API support)
+ */
+ public function setDbTimestamp($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->timestamp !== null || $dt !== null) {
+ $currentDateAsString = ($this->timestamp !== null && $tmpDt = new DateTime($this->timestamp)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->timestamp = $newDateAsString;
+ $this->modifiedColumns[] = CcTimestampPeer::TIMESTAMP;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbTimestamp()
+
+ /**
+ * 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 resultset 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->timestamp = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 2; // 2 = CcTimestampPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcTimestamp 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(CcTimestampPeer::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 = CcTimestampPeer::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->collCcListenerCounts = null;
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @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(CcTimestampPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = CcTimestampQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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(CcTimestampPeer::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);
+ CcTimestampPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ if ($this->ccListenerCountsScheduledForDeletion !== null) {
+ if (!$this->ccListenerCountsScheduledForDeletion->isEmpty()) {
+ CcListenerCountQuery::create()
+ ->filterByPrimaryKeys($this->ccListenerCountsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccListenerCountsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcListenerCounts !== null) {
+ foreach ($this->collCcListenerCounts as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcTimestampPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcTimestampPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_timestamp_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcTimestampPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcTimestampPeer::TIMESTAMP)) {
+ $modifiedColumns[':p' . $index++] = '"timestamp"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_timestamp" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"timestamp"':
+ $stmt->bindValue($identifier, $this->timestamp, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ if (($retval = CcTimestampPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+ if ($this->collCcListenerCounts !== null) {
+ foreach ($this->collCcListenerCounts 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcTimestampPeer::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->getDbTimestamp();
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcTimestamp'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcTimestamp'][$this->getPrimaryKey()] = true;
+ $keys = CcTimestampPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbTimestamp(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->collCcListenerCounts) {
+ $result['CcListenerCounts'] = $this->collCcListenerCounts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ }
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcTimestampPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbTimestamp($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 BasePeer::TYPE_PHPNAME
+ *
+ * @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 = CcTimestampPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setDbTimestamp($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(CcTimestampPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcTimestampPeer::ID)) $criteria->add(CcTimestampPeer::ID, $this->id);
+ if ($this->isColumnModified(CcTimestampPeer::TIMESTAMP)) $criteria->add(CcTimestampPeer::TIMESTAMP, $this->timestamp);
+
+ 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(CcTimestampPeer::DATABASE_NAME);
+ $criteria->add(CcTimestampPeer::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 CcTimestamp (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbTimestamp($this->getDbTimestamp());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ foreach ($this->getCcListenerCounts() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCcListenerCount($relObj->copy($deepCopy));
+ }
+ }
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 CcTimestamp 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 CcTimestampPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcTimestampPeer();
+ }
+
+ return self::$peer;
+ }
+
+
+ /**
+ * Initializes a collection based on the name of a relation.
+ * Avoids crafting an 'init[$relationName]s' method name
+ * that wouldn't work when StandardEnglishPluralizer is used.
+ *
+ * @param string $relationName The name of the relation to initialize
+ * @return void
+ */
+ public function initRelation($relationName)
+ {
+ if ('CcListenerCount' == $relationName) {
+ $this->initCcListenerCounts();
+ }
+ }
+
+ /**
+ * Clears out the collCcListenerCounts 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 CcTimestamp The current object (for fluent API support)
+ * @see addCcListenerCounts()
+ */
+ public function clearCcListenerCounts()
+ {
+ $this->collCcListenerCounts = null; // important to set this to null since that means it is uninitialized
+ $this->collCcListenerCountsPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcListenerCounts collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcListenerCounts($v = true)
+ {
+ $this->collCcListenerCountsPartial = $v;
+ }
+
+ /**
+ * Initializes the collCcListenerCounts collection.
+ *
+ * By default this just sets the collCcListenerCounts collection to an empty array (like clearcollCcListenerCounts());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcListenerCounts($overrideExisting = true)
+ {
+ if (null !== $this->collCcListenerCounts && !$overrideExisting) {
+ return;
+ }
+ $this->collCcListenerCounts = new PropelObjectCollection();
+ $this->collCcListenerCounts->setModel('CcListenerCount');
+ }
+
+ /**
+ * Gets an array of CcListenerCount 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 CcTimestamp 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 PropelObjectCollection|CcListenerCount[] List of CcListenerCount objects
+ * @throws PropelException
+ */
+ public function getCcListenerCounts($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcListenerCountsPartial && !$this->isNew();
+ if (null === $this->collCcListenerCounts || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcListenerCounts) {
+ // return empty collection
+ $this->initCcListenerCounts();
+ } else {
+ $collCcListenerCounts = CcListenerCountQuery::create(null, $criteria)
+ ->filterByCcTimestamp($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcListenerCountsPartial && count($collCcListenerCounts)) {
+ $this->initCcListenerCounts(false);
+
+ foreach ($collCcListenerCounts as $obj) {
+ if (false == $this->collCcListenerCounts->contains($obj)) {
+ $this->collCcListenerCounts->append($obj);
+ }
+ }
+
+ $this->collCcListenerCountsPartial = true;
+ }
+
+ $collCcListenerCounts->getInternalIterator()->rewind();
+
+ return $collCcListenerCounts;
+ }
+
+ if ($partial && $this->collCcListenerCounts) {
+ foreach ($this->collCcListenerCounts as $obj) {
+ if ($obj->isNew()) {
+ $collCcListenerCounts[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcListenerCounts = $collCcListenerCounts;
+ $this->collCcListenerCountsPartial = false;
+ }
+ }
+
+ return $this->collCcListenerCounts;
+ }
+
+ /**
+ * Sets a collection of CcListenerCount objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccListenerCounts A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcTimestamp The current object (for fluent API support)
+ */
+ public function setCcListenerCounts(PropelCollection $ccListenerCounts, PropelPDO $con = null)
+ {
+ $ccListenerCountsToDelete = $this->getCcListenerCounts(new Criteria(), $con)->diff($ccListenerCounts);
+
+
+ $this->ccListenerCountsScheduledForDeletion = $ccListenerCountsToDelete;
+
+ foreach ($ccListenerCountsToDelete as $ccListenerCountRemoved) {
+ $ccListenerCountRemoved->setCcTimestamp(null);
+ }
+
+ $this->collCcListenerCounts = null;
+ foreach ($ccListenerCounts as $ccListenerCount) {
+ $this->addCcListenerCount($ccListenerCount);
+ }
+
+ $this->collCcListenerCounts = $ccListenerCounts;
+ $this->collCcListenerCountsPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * Returns the number of related CcListenerCount objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CcListenerCount objects.
+ * @throws PropelException
+ */
+ public function countCcListenerCounts(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collCcListenerCountsPartial && !$this->isNew();
+ if (null === $this->collCcListenerCounts || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcListenerCounts) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcListenerCounts());
+ }
+ $query = CcListenerCountQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcTimestamp($this)
+ ->count($con);
+ }
+
+ return count($this->collCcListenerCounts);
+ }
+
+ /**
+ * Method called to associate a CcListenerCount object to this object
+ * through the CcListenerCount foreign key attribute.
+ *
+ * @param CcListenerCount $l CcListenerCount
+ * @return CcTimestamp The current object (for fluent API support)
+ */
+ public function addCcListenerCount(CcListenerCount $l)
+ {
+ if ($this->collCcListenerCounts === null) {
+ $this->initCcListenerCounts();
+ $this->collCcListenerCountsPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcListenerCounts->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcListenerCount($l);
+
+ if ($this->ccListenerCountsScheduledForDeletion and $this->ccListenerCountsScheduledForDeletion->contains($l)) {
+ $this->ccListenerCountsScheduledForDeletion->remove($this->ccListenerCountsScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcListenerCount $ccListenerCount The ccListenerCount object to add.
+ */
+ protected function doAddCcListenerCount($ccListenerCount)
+ {
+ $this->collCcListenerCounts[]= $ccListenerCount;
+ $ccListenerCount->setCcTimestamp($this);
+ }
+
+ /**
+ * @param CcListenerCount $ccListenerCount The ccListenerCount object to remove.
+ * @return CcTimestamp The current object (for fluent API support)
+ */
+ public function removeCcListenerCount($ccListenerCount)
+ {
+ if ($this->getCcListenerCounts()->contains($ccListenerCount)) {
+ $this->collCcListenerCounts->remove($this->collCcListenerCounts->search($ccListenerCount));
+ if (null === $this->ccListenerCountsScheduledForDeletion) {
+ $this->ccListenerCountsScheduledForDeletion = clone $this->collCcListenerCounts;
+ $this->ccListenerCountsScheduledForDeletion->clear();
+ }
+ $this->ccListenerCountsScheduledForDeletion[]= clone $ccListenerCount;
+ $ccListenerCount->setCcTimestamp(null);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this CcTimestamp is new, it will return
+ * an empty collection; or if this CcTimestamp has previously
+ * been saved, it will retrieve related CcListenerCounts 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 CcTimestamp.
+ *
+ * @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 PropelObjectCollection|CcListenerCount[] List of CcListenerCount objects
+ */
+ public function getCcListenerCountsJoinCcMountName($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $query = CcListenerCountQuery::create(null, $criteria);
+ $query->joinWith('CcMountName', $join_behavior);
+
+ return $this->getCcListenerCounts($query, $con);
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->timestamp = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->collCcListenerCounts) {
+ foreach ($this->collCcListenerCounts as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ if ($this->collCcListenerCounts instanceof PropelCollection) {
+ $this->collCcListenerCounts->clearIterator();
+ }
+ $this->collCcListenerCounts = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcTimestampPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcTimestampPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcTimestampPeer.php
index 3d3b7d6ae..961ad255c 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcTimestampPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcTimestampPeer.php
@@ -4,735 +4,757 @@
/**
* Base static class for performing query and update operations on the 'cc_timestamp' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcTimestampPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_timestamp';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcTimestamp';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcTimestamp';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcTimestampTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 2;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_timestamp.ID';
-
- /** the column name for the TIMESTAMP field */
- const TIMESTAMP = 'cc_timestamp.TIMESTAMP';
-
- /**
- * An identiy map to hold any loaded instances of CcTimestamp objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcTimestamp[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbTimestamp', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTimestamp', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::TIMESTAMP, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TIMESTAMP', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'timestamp', ),
- 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 ('DbId' => 0, 'DbTimestamp' => 1, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTimestamp' => 1, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::TIMESTAMP => 1, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TIMESTAMP' => 1, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'timestamp' => 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. CcTimestampPeer::COLUMN_NAME).
- * @return string
- */
- public static function alias($alias, $column)
- {
- return str_replace(CcTimestampPeer::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(CcTimestampPeer::ID);
- $criteria->addSelectColumn(CcTimestampPeer::TIMESTAMP);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.TIMESTAMP');
- }
- }
-
- /**
- * 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(CcTimestampPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcTimestampPeer::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(CcTimestampPeer::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 CcTimestamp
- * @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 = CcTimestampPeer::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 CcTimestampPeer::populateObjects(CcTimestampPeer::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(CcTimestampPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- if (!$criteria->hasSelectClause()) {
- $criteria = clone $criteria;
- CcTimestampPeer::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 CcTimestamp $value A CcTimestamp object.
- * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
- */
- public static function addInstanceToPool(CcTimestamp $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 CcTimestamp object or a primary key value.
- */
- public static function removeInstanceFromPool($value)
- {
- if (Propel::isInstancePoolingEnabled() && $value !== null) {
- if (is_object($value) && $value instanceof CcTimestamp) {
- $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 CcTimestamp 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 CcTimestamp 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_timestamp
- * by a foreign key with ON DELETE CASCADE
- */
- public static function clearRelatedInstancePool()
- {
- // Invalidate objects in CcListenerCountPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CcListenerCountPeer::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 = CcTimestampPeer::getOMClass(false);
- // populate the object(s)
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key = CcTimestampPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj = CcTimestampPeer::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;
- CcTimestampPeer::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 (CcTimestamp object, last column rank)
- */
- public static function populateObject($row, $startcol = 0)
- {
- $key = CcTimestampPeer::getPrimaryKeyHashFromRow($row, $startcol);
- if (null !== ($obj = CcTimestampPeer::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 + CcTimestampPeer::NUM_COLUMNS;
- } else {
- $cls = CcTimestampPeer::OM_CLASS;
- $obj = new $cls();
- $col = $obj->hydrate($row, $startcol);
- CcTimestampPeer::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(BaseCcTimestampPeer::DATABASE_NAME);
- if (!$dbMap->hasTable(BaseCcTimestampPeer::TABLE_NAME))
- {
- $dbMap->addTableObject(new CcTimestampTableMap());
- }
- }
-
- /**
- * 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 ? CcTimestampPeer::CLASS_DEFAULT : CcTimestampPeer::OM_CLASS;
- }
-
- /**
- * Method perform an INSERT on the database, given a CcTimestamp or Criteria object.
- *
- * @param mixed $values Criteria or CcTimestamp 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(CcTimestampPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
- } else {
- $criteria = $values->buildCriteria(); // build Criteria from CcTimestamp object
- }
-
- if ($criteria->containsKey(CcTimestampPeer::ID) && $criteria->keyContainsValue(CcTimestampPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcTimestampPeer::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 CcTimestamp or Criteria object.
- *
- * @param mixed $values Criteria or CcTimestamp 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(CcTimestampPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $selectCriteria = new Criteria(self::DATABASE_NAME);
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
-
- $comparison = $criteria->getComparison(CcTimestampPeer::ID);
- $value = $criteria->remove(CcTimestampPeer::ID);
- if ($value) {
- $selectCriteria->add(CcTimestampPeer::ID, $value, $comparison);
- } else {
- $selectCriteria->setPrimaryTableName(CcTimestampPeer::TABLE_NAME);
- }
-
- } else { // $values is CcTimestamp 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_timestamp 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(CcTimestampPeer::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(CcTimestampPeer::TABLE_NAME, $con, CcTimestampPeer::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).
- CcTimestampPeer::clearInstancePool();
- CcTimestampPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Method perform a DELETE on the database, given a CcTimestamp or Criteria object OR a primary key value.
- *
- * @param mixed $values Criteria or CcTimestamp 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(CcTimestampPeer::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.
- CcTimestampPeer::clearInstancePool();
- // rename for clarity
- $criteria = clone $values;
- } elseif ($values instanceof CcTimestamp) { // it's a model object
- // invalidate the cache for this single object
- CcTimestampPeer::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(CcTimestampPeer::ID, (array) $values, Criteria::IN);
- // invalidate the cache for this object(s)
- foreach ((array) $values as $singleval) {
- CcTimestampPeer::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);
- CcTimestampPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Validates all modified columns of given CcTimestamp 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 CcTimestamp $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(CcTimestamp $obj, $cols = null)
- {
- $columns = array();
-
- if ($cols) {
- $dbMap = Propel::getDatabaseMap(CcTimestampPeer::DATABASE_NAME);
- $tableMap = $dbMap->getTable(CcTimestampPeer::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(CcTimestampPeer::DATABASE_NAME, CcTimestampPeer::TABLE_NAME, $columns);
- }
-
- /**
- * Retrieve a single object by pkey.
- *
- * @param int $pk the primary key.
- * @param PropelPDO $con the connection to use
- * @return CcTimestamp
- */
- public static function retrieveByPK($pk, PropelPDO $con = null)
- {
-
- if (null !== ($obj = CcTimestampPeer::getInstanceFromPool((string) $pk))) {
- return $obj;
- }
-
- if ($con === null) {
- $con = Propel::getConnection(CcTimestampPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria = new Criteria(CcTimestampPeer::DATABASE_NAME);
- $criteria->add(CcTimestampPeer::ID, $pk);
-
- $v = CcTimestampPeer::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(CcTimestampPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $objs = null;
- if (empty($pks)) {
- $objs = array();
- } else {
- $criteria = new Criteria(CcTimestampPeer::DATABASE_NAME);
- $criteria->add(CcTimestampPeer::ID, $pks, Criteria::IN);
- $objs = CcTimestampPeer::doSelect($criteria, $con);
- }
- return $objs;
- }
+abstract class BaseCcTimestampPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_timestamp';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcTimestamp';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcTimestampTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 2;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 2;
+
+ /** the column name for the id field */
+ const ID = 'cc_timestamp.id';
+
+ /** the column name for the timestamp field */
+ const TIMESTAMP = 'cc_timestamp.timestamp';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcTimestamp objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcTimestamp[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcTimestampPeer::$fieldNames[CcTimestampPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbTimestamp', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbTimestamp', ),
+ BasePeer::TYPE_COLNAME => array (CcTimestampPeer::ID, CcTimestampPeer::TIMESTAMP, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TIMESTAMP', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'timestamp', ),
+ 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. CcTimestampPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbTimestamp' => 1, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbTimestamp' => 1, ),
+ BasePeer::TYPE_COLNAME => array (CcTimestampPeer::ID => 0, CcTimestampPeer::TIMESTAMP => 1, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TIMESTAMP' => 1, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'timestamp' => 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcTimestampPeer::getFieldNames($toType);
+ $key = isset(CcTimestampPeer::$fieldKeys[$fromType][$name]) ? CcTimestampPeer::$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(CcTimestampPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcTimestampPeer::$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 CcTimestampPeer::$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. CcTimestampPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcTimestampPeer::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(CcTimestampPeer::ID);
+ $criteria->addSelectColumn(CcTimestampPeer::TIMESTAMP);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.timestamp');
+ }
+ }
+
+ /**
+ * 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(CcTimestampPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcTimestampPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(CcTimestampPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcTimestampPeer::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;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcTimestamp
+ * @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 = CcTimestampPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 CcTimestampPeer::populateObjects(CcTimestampPeer::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 directly (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(CcTimestampPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcTimestampPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcTimestampPeer::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 CcTimestamp $obj A CcTimestamp object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcTimestampPeer::$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 CcTimestamp object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcTimestamp) {
+ $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 CcTimestamp object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(CcTimestampPeer::$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 CcTimestamp 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(CcTimestampPeer::$instances[$key])) {
+ return CcTimestampPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcTimestampPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcTimestampPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_timestamp
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ // Invalidate objects in CcListenerCountPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CcListenerCountPeer::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 = CcTimestampPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcTimestampPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcTimestampPeer::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;
+ CcTimestampPeer::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 (CcTimestamp object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcTimestampPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcTimestampPeer::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 + CcTimestampPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = CcTimestampPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcTimestampPeer::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(CcTimestampPeer::DATABASE_NAME)->getTable(CcTimestampPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcTimestampPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcTimestampPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \CcTimestampTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcTimestampPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a CcTimestamp or Criteria object.
+ *
+ * @param mixed $values Criteria or CcTimestamp 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(CcTimestampPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcTimestamp object
+ }
+
+ if ($criteria->containsKey(CcTimestampPeer::ID) && $criteria->keyContainsValue(CcTimestampPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcTimestampPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(CcTimestampPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a CcTimestamp or Criteria object.
+ *
+ * @param mixed $values Criteria or CcTimestamp 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(CcTimestampPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(CcTimestampPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcTimestampPeer::ID);
+ $value = $criteria->remove(CcTimestampPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcTimestampPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcTimestampPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcTimestamp object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(CcTimestampPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_timestamp table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcTimestampPeer::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(CcTimestampPeer::TABLE_NAME, $con, CcTimestampPeer::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).
+ CcTimestampPeer::clearInstancePool();
+ CcTimestampPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a CcTimestamp or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcTimestamp 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(CcTimestampPeer::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.
+ CcTimestampPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcTimestamp) { // it's a model object
+ // invalidate the cache for this single object
+ CcTimestampPeer::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(CcTimestampPeer::DATABASE_NAME);
+ $criteria->add(CcTimestampPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcTimestampPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcTimestampPeer::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);
+ CcTimestampPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcTimestamp 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 CcTimestamp $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($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcTimestampPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcTimestampPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcTimestampPeer::DATABASE_NAME, CcTimestampPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcTimestamp
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcTimestampPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcTimestampPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcTimestampPeer::DATABASE_NAME);
+ $criteria->add(CcTimestampPeer::ID, $pk);
+
+ $v = CcTimestampPeer::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
+ * @return CcTimestamp[]
+ * @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(CcTimestampPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcTimestampPeer::DATABASE_NAME);
+ $criteria->add(CcTimestampPeer::ID, $pks, Criteria::IN);
+ $objs = CcTimestampPeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
} // BaseCcTimestampPeer
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcTimestampQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcTimestampQuery.php
index a3f383112..6c4f80e58 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcTimestampQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcTimestampQuery.php
@@ -4,265 +4,398 @@
/**
* Base class that represents a query for the 'cc_timestamp' table.
*
- *
*
- * @method CcTimestampQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcTimestampQuery orderByDbTimestamp($order = Criteria::ASC) Order by the timestamp column
*
- * @method CcTimestampQuery groupByDbId() Group by the id column
- * @method CcTimestampQuery groupByDbTimestamp() Group by the timestamp column
+ * @method CcTimestampQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcTimestampQuery orderByDbTimestamp($order = Criteria::ASC) Order by the timestamp column
*
- * @method CcTimestampQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcTimestampQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcTimestampQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcTimestampQuery groupByDbId() Group by the id column
+ * @method CcTimestampQuery groupByDbTimestamp() Group by the timestamp column
*
- * @method CcTimestampQuery leftJoinCcListenerCount($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcListenerCount relation
- * @method CcTimestampQuery rightJoinCcListenerCount($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcListenerCount relation
- * @method CcTimestampQuery innerJoinCcListenerCount($relationAlias = '') Adds a INNER JOIN clause to the query using the CcListenerCount relation
+ * @method CcTimestampQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcTimestampQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcTimestampQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcTimestamp findOne(PropelPDO $con = null) Return the first CcTimestamp matching the query
- * @method CcTimestamp findOneOrCreate(PropelPDO $con = null) Return the first CcTimestamp matching the query, or a new CcTimestamp object populated from the query conditions when no match is found
+ * @method CcTimestampQuery leftJoinCcListenerCount($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcListenerCount relation
+ * @method CcTimestampQuery rightJoinCcListenerCount($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcListenerCount relation
+ * @method CcTimestampQuery innerJoinCcListenerCount($relationAlias = null) Adds a INNER JOIN clause to the query using the CcListenerCount relation
*
- * @method CcTimestamp findOneByDbId(int $id) Return the first CcTimestamp filtered by the id column
- * @method CcTimestamp findOneByDbTimestamp(string $timestamp) Return the first CcTimestamp filtered by the timestamp column
+ * @method CcTimestamp findOne(PropelPDO $con = null) Return the first CcTimestamp matching the query
+ * @method CcTimestamp findOneOrCreate(PropelPDO $con = null) Return the first CcTimestamp matching the query, or a new CcTimestamp object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcTimestamp objects filtered by the id column
- * @method array findByDbTimestamp(string $timestamp) Return CcTimestamp objects filtered by the timestamp column
+ * @method CcTimestamp findOneByDbTimestamp(string $timestamp) Return the first CcTimestamp filtered by the timestamp column
+ *
+ * @method array findByDbId(int $id) Return CcTimestamp objects filtered by the id column
+ * @method array findByDbTimestamp(string $timestamp) Return CcTimestamp objects filtered by the timestamp column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcTimestampQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcTimestampQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcTimestamp';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcTimestampQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcTimestamp', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcTimestampQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcTimestampQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcTimestampQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcTimestampQuery) {
+ return $criteria;
+ }
+ $query = new CcTimestampQuery(null, null, $modelAlias);
- /**
- * Returns a new CcTimestampQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcTimestampQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcTimestampQuery) {
- return $criteria;
- }
- $query = new CcTimestampQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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 CcTimestamp|array|mixed the result, formatted by the current formatter
- */
- public function findPk($key, $con = null)
- {
- if ((null !== ($obj = CcTimestampPeer::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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcTimestamp|CcTimestamp[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcTimestampPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcTimestampPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
- /**
- * Filter the query by primary key
- *
- * @param mixed $key Primary key to use for the query
- *
- * @return CcTimestampQuery The current query, for fluid interface
- */
- public function filterByPrimaryKey($key)
- {
- return $this->addUsingAlias(CcTimestampPeer::ID, $key, Criteria::EQUAL);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcTimestamp A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * Filter the query by a list of primary keys
- *
- * @param array $keys The list of primary key to use for the query
- *
- * @return CcTimestampQuery The current query, for fluid interface
- */
- public function filterByPrimaryKeys($keys)
- {
- return $this->addUsingAlias(CcTimestampPeer::ID, $keys, Criteria::IN);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcTimestamp A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "timestamp" FROM "cc_timestamp" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcTimestamp();
+ $obj->hydrate($row);
+ CcTimestampPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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 CcTimestampQuery 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(CcTimestampPeer::ID, $dbId, $comparison);
- }
+ return $obj;
+ }
- /**
- * Filter the query on the timestamp column
- *
- * @param string|array $dbTimestamp 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 CcTimestampQuery The current query, for fluid interface
- */
- public function filterByDbTimestamp($dbTimestamp = null, $comparison = null)
- {
- if (is_array($dbTimestamp)) {
- $useMinMax = false;
- if (isset($dbTimestamp['min'])) {
- $this->addUsingAlias(CcTimestampPeer::TIMESTAMP, $dbTimestamp['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbTimestamp['max'])) {
- $this->addUsingAlias(CcTimestampPeer::TIMESTAMP, $dbTimestamp['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcTimestampPeer::TIMESTAMP, $dbTimestamp, $comparison);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcTimestamp|CcTimestamp[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * Filter the query by a related CcListenerCount object
- *
- * @param CcListenerCount $ccListenerCount the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return CcTimestampQuery The current query, for fluid interface
- */
- public function filterByCcListenerCount($ccListenerCount, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcTimestampPeer::ID, $ccListenerCount->getDbTimestampId(), $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * Adds a JOIN clause to the query using the CcListenerCount relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return CcTimestampQuery The current query, for fluid interface
- */
- public function joinCcListenerCount($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CcListenerCount');
-
- // 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, 'CcListenerCount');
- }
-
- return $this;
- }
+ /**
+ * 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|CcTimestamp[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * Use the CcListenerCount relation CcListenerCount 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 CcListenerCountQuery A secondary query class using the current class as primary query
- */
- public function useCcListenerCountQuery($relationAlias = '', $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinCcListenerCount($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CcListenerCount', 'CcListenerCountQuery');
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * Exclude object from result
- *
- * @param CcTimestamp $ccTimestamp Object to remove from the list of results
- *
- * @return CcTimestampQuery The current query, for fluid interface
- */
- public function prune($ccTimestamp = null)
- {
- if ($ccTimestamp) {
- $this->addUsingAlias(CcTimestampPeer::ID, $ccTimestamp->getDbId(), Criteria::NOT_EQUAL);
- }
-
- return $this;
- }
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcTimestampQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
-} // BaseCcTimestampQuery
+ return $this->addUsingAlias(CcTimestampPeer::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 CcTimestampQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(CcTimestampPeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcTimestampQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcTimestampPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcTimestampPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcTimestampPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the timestamp column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbTimestamp('2011-03-14'); // WHERE timestamp = '2011-03-14'
+ * $query->filterByDbTimestamp('now'); // WHERE timestamp = '2011-03-14'
+ * $query->filterByDbTimestamp(array('max' => 'yesterday')); // WHERE timestamp < '2011-03-13'
+ *
+ *
+ * @param mixed $dbTimestamp The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcTimestampQuery The current query, for fluid interface
+ */
+ public function filterByDbTimestamp($dbTimestamp = null, $comparison = null)
+ {
+ if (is_array($dbTimestamp)) {
+ $useMinMax = false;
+ if (isset($dbTimestamp['min'])) {
+ $this->addUsingAlias(CcTimestampPeer::TIMESTAMP, $dbTimestamp['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbTimestamp['max'])) {
+ $this->addUsingAlias(CcTimestampPeer::TIMESTAMP, $dbTimestamp['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcTimestampPeer::TIMESTAMP, $dbTimestamp, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcListenerCount object
+ *
+ * @param CcListenerCount|PropelObjectCollection $ccListenerCount the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcTimestampQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcListenerCount($ccListenerCount, $comparison = null)
+ {
+ if ($ccListenerCount instanceof CcListenerCount) {
+ return $this
+ ->addUsingAlias(CcTimestampPeer::ID, $ccListenerCount->getDbTimestampId(), $comparison);
+ } elseif ($ccListenerCount instanceof PropelObjectCollection) {
+ return $this
+ ->useCcListenerCountQuery()
+ ->filterByPrimaryKeys($ccListenerCount->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcListenerCount() only accepts arguments of type CcListenerCount or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CcListenerCount relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CcTimestampQuery The current query, for fluid interface
+ */
+ public function joinCcListenerCount($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CcListenerCount');
+
+ // 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, 'CcListenerCount');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CcListenerCount relation CcListenerCount 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 CcListenerCountQuery A secondary query class using the current class as primary query
+ */
+ public function useCcListenerCountQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcListenerCount($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcListenerCount', 'CcListenerCountQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcTimestamp $ccTimestamp Object to remove from the list of results
+ *
+ * @return CcTimestampQuery The current query, for fluid interface
+ */
+ public function prune($ccTimestamp = null)
+ {
+ if ($ccTimestamp) {
+ $this->addUsingAlias(CcTimestampPeer::ID, $ccTimestamp->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcWebstream.php b/airtime_mvc/application/models/airtime/om/BaseCcWebstream.php
index 6f6e16e2b..fedddbcbd 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcWebstream.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcWebstream.php
@@ -4,1482 +4,1741 @@
/**
* Base class that represents a row from the 'cc_webstream' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcWebstream extends BaseObject implements Persistent
+abstract class BaseCcWebstream extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcWebstreamPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcWebstreamPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the name field.
- * @var string
- */
- protected $name;
-
- /**
- * The value for the description field.
- * @var string
- */
- protected $description;
-
- /**
- * The value for the url field.
- * @var string
- */
- protected $url;
-
- /**
- * The value for the length field.
- * Note: this column has a database default value of: '00:00:00'
- * @var string
- */
- protected $length;
-
- /**
- * The value for the creator_id field.
- * @var int
- */
- protected $creator_id;
-
- /**
- * The value for the mtime field.
- * @var string
- */
- protected $mtime;
-
- /**
- * The value for the utime field.
- * @var string
- */
- protected $utime;
-
- /**
- * The value for the lptime field.
- * @var string
- */
- protected $lptime;
-
- /**
- * The value for the mime field.
- * @var string
- */
- protected $mime;
-
- /**
- * @var array CcSchedule[] Collection to store aggregation of CcSchedule objects.
- */
- protected $collCcSchedules;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Applies default values to this object.
- * This method should be called from the object's constructor (or
- * equivalent initialization method).
- * @see __construct()
- */
- public function applyDefaultValues()
- {
- $this->length = '00:00:00';
- }
-
- /**
- * Initializes internal state of BaseCcWebstream 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 [description] column value.
- *
- * @return string
- */
- public function getDbDescription()
- {
- return $this->description;
- }
-
- /**
- * Get the [url] column value.
- *
- * @return string
- */
- public function getDbUrl()
- {
- return $this->url;
- }
-
- /**
- * Get the [length] column value.
- *
- * @return string
- */
- public function getDbLength()
- {
- return $this->length;
- }
-
- /**
- * Get the [creator_id] column value.
- *
- * @return int
- */
- public function getDbCreatorId()
- {
- return $this->creator_id;
- }
-
- /**
- * 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 [optionally formatted] temporal [utime] 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 getDbUtime($format = 'Y-m-d H:i:s')
- {
- if ($this->utime === null) {
- return null;
- }
-
-
-
- try {
- $dt = new DateTime($this->utime);
- } catch (Exception $x) {
- throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->utime, 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 [lptime] 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 getDbLPtime($format = 'Y-m-d H:i:s')
- {
- if ($this->lptime === null) {
- return null;
- }
-
-
-
- try {
- $dt = new DateTime($this->lptime);
- } catch (Exception $x) {
- throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->lptime, 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 [mime] column value.
- *
- * @return string
- */
- public function getDbMime()
- {
- return $this->mime;
- }
-
- /**
- * Set the value of [id] column.
- *
- * @param int $v new value
- * @return CcWebstream 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[] = CcWebstreamPeer::ID;
- }
-
- return $this;
- } // setDbId()
-
- /**
- * Set the value of [name] column.
- *
- * @param string $v new value
- * @return CcWebstream 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[] = CcWebstreamPeer::NAME;
- }
-
- return $this;
- } // setDbName()
-
- /**
- * Set the value of [description] column.
- *
- * @param string $v new value
- * @return CcWebstream 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[] = CcWebstreamPeer::DESCRIPTION;
- }
-
- return $this;
- } // setDbDescription()
-
- /**
- * Set the value of [url] column.
- *
- * @param string $v new value
- * @return CcWebstream 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[] = CcWebstreamPeer::URL;
- }
-
- return $this;
- } // setDbUrl()
-
- /**
- * Set the value of [length] column.
- *
- * @param string $v new value
- * @return CcWebstream The current object (for fluent API support)
- */
- public function setDbLength($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->length !== $v || $this->isNew()) {
- $this->length = $v;
- $this->modifiedColumns[] = CcWebstreamPeer::LENGTH;
- }
-
- return $this;
- } // setDbLength()
-
- /**
- * Set the value of [creator_id] column.
- *
- * @param int $v new value
- * @return CcWebstream The current object (for fluent API support)
- */
- public function setDbCreatorId($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
-
- if ($this->creator_id !== $v) {
- $this->creator_id = $v;
- $this->modifiedColumns[] = CcWebstreamPeer::CREATOR_ID;
- }
-
- return $this;
- } // setDbCreatorId()
-
- /**
- * 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 CcWebstream 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[] = CcWebstreamPeer::MTIME;
- }
- } // if either are not null
-
- return $this;
- } // setDbMtime()
-
- /**
- * Sets the value of [utime] 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 CcWebstream The current object (for fluent API support)
- */
- public function setDbUtime($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->utime !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->utime !== null && $tmpDt = new DateTime($this->utime)) ? $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->utime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
- $this->modifiedColumns[] = CcWebstreamPeer::UTIME;
- }
- } // if either are not null
-
- return $this;
- } // setDbUtime()
-
- /**
- * Sets the value of [lptime] 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 CcWebstream The current object (for fluent API support)
- */
- public function setDbLPtime($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->lptime !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->lptime !== null && $tmpDt = new DateTime($this->lptime)) ? $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->lptime = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
- $this->modifiedColumns[] = CcWebstreamPeer::LPTIME;
- }
- } // if either are not null
-
- return $this;
- } // setDbLPtime()
-
- /**
- * Set the value of [mime] column.
- *
- * @param string $v new value
- * @return CcWebstream The current object (for fluent API support)
- */
- public function setDbMime($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->mime !== $v) {
- $this->mime = $v;
- $this->modifiedColumns[] = CcWebstreamPeer::MIME;
- }
-
- return $this;
- } // setDbMime()
-
- /**
- * 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->length !== '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->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
- $this->description = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
- $this->url = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
- $this->length = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
- $this->creator_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
- $this->mtime = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
- $this->utime = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
- $this->lptime = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
- $this->mime = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 10; // 10 = CcWebstreamPeer::NUM_COLUMNS - CcWebstreamPeer::NUM_LAZY_LOAD_COLUMNS).
-
- } catch (Exception $e) {
- throw new PropelException("Error populating CcWebstream 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(CcWebstreamPeer::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 = CcWebstreamPeer::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->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(CcWebstreamPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $con->beginTransaction();
- try {
- $ret = $this->preDelete($con);
- if ($ret) {
- CcWebstreamQuery::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(CcWebstreamPeer::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);
- CcWebstreamPeer::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[] = CcWebstreamPeer::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(CcWebstreamPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcWebstreamPeer::ID.')');
- }
-
- $pk = BasePeer::doInsert($criteria, $con);
- $affectedRows = 1;
- $this->setDbId($pk); //[IMV] update autoincrement primary key
- $this->setNew(false);
- } else {
- $affectedRows = CcWebstreamPeer::doUpdate($this, $con);
- }
-
- $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
- }
-
- 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();
-
-
- if (($retval = CcWebstreamPeer::doValidate($this, $columns)) !== true) {
- $failureMap = array_merge($failureMap, $retval);
- }
-
-
- 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 = CcWebstreamPeer::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->getDbDescription();
- break;
- case 3:
- return $this->getDbUrl();
- break;
- case 4:
- return $this->getDbLength();
- break;
- case 5:
- return $this->getDbCreatorId();
- break;
- case 6:
- return $this->getDbMtime();
- break;
- case 7:
- return $this->getDbUtime();
- break;
- case 8:
- return $this->getDbLPtime();
- break;
- case 9:
- return $this->getDbMime();
- 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 = CcWebstreamPeer::getFieldNames($keyType);
- $result = array(
- $keys[0] => $this->getDbId(),
- $keys[1] => $this->getDbName(),
- $keys[2] => $this->getDbDescription(),
- $keys[3] => $this->getDbUrl(),
- $keys[4] => $this->getDbLength(),
- $keys[5] => $this->getDbCreatorId(),
- $keys[6] => $this->getDbMtime(),
- $keys[7] => $this->getDbUtime(),
- $keys[8] => $this->getDbLPtime(),
- $keys[9] => $this->getDbMime(),
- );
- 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 = CcWebstreamPeer::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->setDbDescription($value);
- break;
- case 3:
- $this->setDbUrl($value);
- break;
- case 4:
- $this->setDbLength($value);
- break;
- case 5:
- $this->setDbCreatorId($value);
- break;
- case 6:
- $this->setDbMtime($value);
- break;
- case 7:
- $this->setDbUtime($value);
- break;
- case 8:
- $this->setDbLPtime($value);
- break;
- case 9:
- $this->setDbMime($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 = CcWebstreamPeer::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->setDbDescription($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setDbUrl($arr[$keys[3]]);
- if (array_key_exists($keys[4], $arr)) $this->setDbLength($arr[$keys[4]]);
- if (array_key_exists($keys[5], $arr)) $this->setDbCreatorId($arr[$keys[5]]);
- if (array_key_exists($keys[6], $arr)) $this->setDbMtime($arr[$keys[6]]);
- if (array_key_exists($keys[7], $arr)) $this->setDbUtime($arr[$keys[7]]);
- if (array_key_exists($keys[8], $arr)) $this->setDbLPtime($arr[$keys[8]]);
- if (array_key_exists($keys[9], $arr)) $this->setDbMime($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(CcWebstreamPeer::DATABASE_NAME);
-
- if ($this->isColumnModified(CcWebstreamPeer::ID)) $criteria->add(CcWebstreamPeer::ID, $this->id);
- if ($this->isColumnModified(CcWebstreamPeer::NAME)) $criteria->add(CcWebstreamPeer::NAME, $this->name);
- if ($this->isColumnModified(CcWebstreamPeer::DESCRIPTION)) $criteria->add(CcWebstreamPeer::DESCRIPTION, $this->description);
- if ($this->isColumnModified(CcWebstreamPeer::URL)) $criteria->add(CcWebstreamPeer::URL, $this->url);
- if ($this->isColumnModified(CcWebstreamPeer::LENGTH)) $criteria->add(CcWebstreamPeer::LENGTH, $this->length);
- if ($this->isColumnModified(CcWebstreamPeer::CREATOR_ID)) $criteria->add(CcWebstreamPeer::CREATOR_ID, $this->creator_id);
- if ($this->isColumnModified(CcWebstreamPeer::MTIME)) $criteria->add(CcWebstreamPeer::MTIME, $this->mtime);
- if ($this->isColumnModified(CcWebstreamPeer::UTIME)) $criteria->add(CcWebstreamPeer::UTIME, $this->utime);
- if ($this->isColumnModified(CcWebstreamPeer::LPTIME)) $criteria->add(CcWebstreamPeer::LPTIME, $this->lptime);
- if ($this->isColumnModified(CcWebstreamPeer::MIME)) $criteria->add(CcWebstreamPeer::MIME, $this->mime);
-
- 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(CcWebstreamPeer::DATABASE_NAME);
- $criteria->add(CcWebstreamPeer::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 CcWebstream (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->setDbDescription($this->description);
- $copyObj->setDbUrl($this->url);
- $copyObj->setDbLength($this->length);
- $copyObj->setDbCreatorId($this->creator_id);
- $copyObj->setDbMtime($this->mtime);
- $copyObj->setDbUtime($this->utime);
- $copyObj->setDbLPtime($this->lptime);
- $copyObj->setDbMime($this->mime);
-
- 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->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 CcWebstream 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 CcWebstreamPeer
- */
- public function getPeer()
- {
- if (self::$peer === null) {
- self::$peer = new CcWebstreamPeer();
- }
- return self::$peer;
- }
-
- /**
- * 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 CcWebstream 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)
- ->filterByCcWebstream($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
- ->filterByCcWebstream($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->setCcWebstream($this);
- }
- }
-
-
- /**
- * If this collection has already been initialized with
- * an identical criteria, it returns the collection.
- * Otherwise if this CcWebstream is new, it will return
- * an empty collection; or if this CcWebstream 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 CcWebstream.
- *
- * @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);
- }
-
-
- /**
- * If this collection has already been initialized with
- * an identical criteria, it returns the collection.
- * Otherwise if this CcWebstream is new, it will return
- * an empty collection; or if this CcWebstream 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 CcWebstream.
- *
- * @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->name = null;
- $this->description = null;
- $this->url = null;
- $this->length = null;
- $this->creator_id = null;
- $this->mtime = null;
- $this->utime = null;
- $this->lptime = null;
- $this->mime = 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->collCcSchedules) {
- foreach ((array) $this->collCcSchedules as $o) {
- $o->clearAllReferences($deep);
- }
- }
- } // if ($deep)
-
- $this->collCcSchedules = 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);
- }
-
-} // BaseCcWebstream
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcWebstreamPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcWebstreamPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the name field.
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * The value for the description field.
+ * @var string
+ */
+ protected $description;
+
+ /**
+ * The value for the url field.
+ * @var string
+ */
+ protected $url;
+
+ /**
+ * The value for the length field.
+ * Note: this column has a database default value of: '00:00:00'
+ * @var string
+ */
+ protected $length;
+
+ /**
+ * The value for the creator_id field.
+ * @var int
+ */
+ protected $creator_id;
+
+ /**
+ * The value for the mtime field.
+ * @var string
+ */
+ protected $mtime;
+
+ /**
+ * The value for the utime field.
+ * @var string
+ */
+ protected $utime;
+
+ /**
+ * The value for the lptime field.
+ * @var string
+ */
+ protected $lptime;
+
+ /**
+ * The value for the mime field.
+ * @var string
+ */
+ protected $mime;
+
+ /**
+ * @var PropelObjectCollection|CcSchedule[] Collection to store aggregation of CcSchedule objects.
+ */
+ protected $collCcSchedules;
+ protected $collCcSchedulesPartial;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $ccSchedulesScheduledForDeletion = null;
+
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->length = '00:00:00';
+ }
+
+ /**
+ * Initializes internal state of BaseCcWebstream 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 [description] column value.
+ *
+ * @return string
+ */
+ public function getDbDescription()
+ {
+
+ return $this->description;
+ }
+
+ /**
+ * Get the [url] column value.
+ *
+ * @return string
+ */
+ public function getDbUrl()
+ {
+
+ return $this->url;
+ }
+
+ /**
+ * Get the [length] column value.
+ *
+ * @return string
+ */
+ public function getDbLength()
+ {
+
+ return $this->length;
+ }
+
+ /**
+ * Get the [creator_id] column value.
+ *
+ * @return int
+ */
+ public function getDbCreatorId()
+ {
+
+ return $this->creator_id;
+ }
+
+ /**
+ * 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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [utime] 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 getDbUtime($format = 'Y-m-d H:i:s')
+ {
+ if ($this->utime === null) {
+ return null;
+ }
+
+
+ try {
+ $dt = new DateTime($this->utime);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->utime, true), $x);
+ }
+
+ if ($format === null) {
+ // Because propel.useDateTimeClass is true, we return a DateTime object.
+ return $dt;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Get the [optionally formatted] temporal [lptime] 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 getDbLPtime($format = 'Y-m-d H:i:s')
+ {
+ if ($this->lptime === null) {
+ return null;
+ }
+
+
+ try {
+ $dt = new DateTime($this->lptime);
+ } catch (Exception $x) {
+ throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->lptime, true), $x);
+ }
+
+ if ($format === null) {
+ // Because propel.useDateTimeClass is true, we return a DateTime object.
+ return $dt;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Get the [mime] column value.
+ *
+ * @return string
+ */
+ public function getDbMime()
+ {
+
+ return $this->mime;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcWebstream The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcWebstreamPeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [name] column.
+ *
+ * @param string $v new value
+ * @return CcWebstream The current object (for fluent API support)
+ */
+ public function setDbName($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->name !== $v) {
+ $this->name = $v;
+ $this->modifiedColumns[] = CcWebstreamPeer::NAME;
+ }
+
+
+ return $this;
+ } // setDbName()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return CcWebstream The current object (for fluent API support)
+ */
+ public function setDbDescription($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = CcWebstreamPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDbDescription()
+
+ /**
+ * Set the value of [url] column.
+ *
+ * @param string $v new value
+ * @return CcWebstream The current object (for fluent API support)
+ */
+ public function setDbUrl($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->url !== $v) {
+ $this->url = $v;
+ $this->modifiedColumns[] = CcWebstreamPeer::URL;
+ }
+
+
+ return $this;
+ } // setDbUrl()
+
+ /**
+ * Set the value of [length] column.
+ *
+ * @param string $v new value
+ * @return CcWebstream The current object (for fluent API support)
+ */
+ public function setDbLength($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->length !== $v) {
+ $this->length = $v;
+ $this->modifiedColumns[] = CcWebstreamPeer::LENGTH;
+ }
+
+
+ return $this;
+ } // setDbLength()
+
+ /**
+ * Set the value of [creator_id] column.
+ *
+ * @param int $v new value
+ * @return CcWebstream The current object (for fluent API support)
+ */
+ public function setDbCreatorId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->creator_id !== $v) {
+ $this->creator_id = $v;
+ $this->modifiedColumns[] = CcWebstreamPeer::CREATOR_ID;
+ }
+
+
+ return $this;
+ } // setDbCreatorId()
+
+ /**
+ * 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 strings are treated as null.
+ * @return CcWebstream The current object (for fluent API support)
+ */
+ public function setDbMtime($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->mtime !== null || $dt !== null) {
+ $currentDateAsString = ($this->mtime !== null && $tmpDt = new DateTime($this->mtime)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->mtime = $newDateAsString;
+ $this->modifiedColumns[] = CcWebstreamPeer::MTIME;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbMtime()
+
+ /**
+ * Sets the value of [utime] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or DateTime value.
+ * Empty strings are treated as null.
+ * @return CcWebstream The current object (for fluent API support)
+ */
+ public function setDbUtime($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->utime !== null || $dt !== null) {
+ $currentDateAsString = ($this->utime !== null && $tmpDt = new DateTime($this->utime)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->utime = $newDateAsString;
+ $this->modifiedColumns[] = CcWebstreamPeer::UTIME;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbUtime()
+
+ /**
+ * Sets the value of [lptime] column to a normalized version of the date/time value specified.
+ *
+ * @param mixed $v string, integer (timestamp), or DateTime value.
+ * Empty strings are treated as null.
+ * @return CcWebstream The current object (for fluent API support)
+ */
+ public function setDbLPtime($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->lptime !== null || $dt !== null) {
+ $currentDateAsString = ($this->lptime !== null && $tmpDt = new DateTime($this->lptime)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->lptime = $newDateAsString;
+ $this->modifiedColumns[] = CcWebstreamPeer::LPTIME;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbLPtime()
+
+ /**
+ * Set the value of [mime] column.
+ *
+ * @param string $v new value
+ * @return CcWebstream The current object (for fluent API support)
+ */
+ public function setDbMime($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->mime !== $v) {
+ $this->mime = $v;
+ $this->modifiedColumns[] = CcWebstreamPeer::MIME;
+ }
+
+
+ return $this;
+ } // setDbMime()
+
+ /**
+ * 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->length !== '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 resultset 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->description = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->url = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->length = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->creator_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
+ $this->mtime = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
+ $this->utime = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
+ $this->lptime = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
+ $this->mime = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 10; // 10 = CcWebstreamPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcWebstream 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(CcWebstreamPeer::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 = CcWebstreamPeer::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->collCcSchedules = null;
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @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(CcWebstreamPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = CcWebstreamQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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(CcWebstreamPeer::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);
+ CcWebstreamPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $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->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ if ($this->ccSchedulesScheduledForDeletion !== null) {
+ if (!$this->ccSchedulesScheduledForDeletion->isEmpty()) {
+ CcScheduleQuery::create()
+ ->filterByPrimaryKeys($this->ccSchedulesScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->ccSchedulesScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCcSchedules !== null) {
+ foreach ($this->collCcSchedules as $referrerFK) {
+ if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcWebstreamPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcWebstreamPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_webstream_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcWebstreamPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcWebstreamPeer::NAME)) {
+ $modifiedColumns[':p' . $index++] = '"name"';
+ }
+ if ($this->isColumnModified(CcWebstreamPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '"description"';
+ }
+ if ($this->isColumnModified(CcWebstreamPeer::URL)) {
+ $modifiedColumns[':p' . $index++] = '"url"';
+ }
+ if ($this->isColumnModified(CcWebstreamPeer::LENGTH)) {
+ $modifiedColumns[':p' . $index++] = '"length"';
+ }
+ if ($this->isColumnModified(CcWebstreamPeer::CREATOR_ID)) {
+ $modifiedColumns[':p' . $index++] = '"creator_id"';
+ }
+ if ($this->isColumnModified(CcWebstreamPeer::MTIME)) {
+ $modifiedColumns[':p' . $index++] = '"mtime"';
+ }
+ if ($this->isColumnModified(CcWebstreamPeer::UTIME)) {
+ $modifiedColumns[':p' . $index++] = '"utime"';
+ }
+ if ($this->isColumnModified(CcWebstreamPeer::LPTIME)) {
+ $modifiedColumns[':p' . $index++] = '"lptime"';
+ }
+ if ($this->isColumnModified(CcWebstreamPeer::MIME)) {
+ $modifiedColumns[':p' . $index++] = '"mime"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_webstream" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"name"':
+ $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
+ break;
+ case '"description"':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '"url"':
+ $stmt->bindValue($identifier, $this->url, PDO::PARAM_STR);
+ break;
+ case '"length"':
+ $stmt->bindValue($identifier, $this->length, PDO::PARAM_STR);
+ break;
+ case '"creator_id"':
+ $stmt->bindValue($identifier, $this->creator_id, PDO::PARAM_INT);
+ break;
+ case '"mtime"':
+ $stmt->bindValue($identifier, $this->mtime, PDO::PARAM_STR);
+ break;
+ case '"utime"':
+ $stmt->bindValue($identifier, $this->utime, PDO::PARAM_STR);
+ break;
+ case '"lptime"':
+ $stmt->bindValue($identifier, $this->lptime, PDO::PARAM_STR);
+ break;
+ case '"mime"':
+ $stmt->bindValue($identifier, $this->mime, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ if (($retval = CcWebstreamPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcWebstreamPeer::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->getDbDescription();
+ break;
+ case 3:
+ return $this->getDbUrl();
+ break;
+ case 4:
+ return $this->getDbLength();
+ break;
+ case 5:
+ return $this->getDbCreatorId();
+ break;
+ case 6:
+ return $this->getDbMtime();
+ break;
+ case 7:
+ return $this->getDbUtime();
+ break;
+ case 8:
+ return $this->getDbLPtime();
+ break;
+ case 9:
+ return $this->getDbMime();
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcWebstream'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcWebstream'][$this->getPrimaryKey()] = true;
+ $keys = CcWebstreamPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbName(),
+ $keys[2] => $this->getDbDescription(),
+ $keys[3] => $this->getDbUrl(),
+ $keys[4] => $this->getDbLength(),
+ $keys[5] => $this->getDbCreatorId(),
+ $keys[6] => $this->getDbMtime(),
+ $keys[7] => $this->getDbUtime(),
+ $keys[8] => $this->getDbLPtime(),
+ $keys[9] => $this->getDbMime(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->collCcSchedules) {
+ $result['CcSchedules'] = $this->collCcSchedules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
+ }
+
+ 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcWebstreamPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbDescription($value);
+ break;
+ case 3:
+ $this->setDbUrl($value);
+ break;
+ case 4:
+ $this->setDbLength($value);
+ break;
+ case 5:
+ $this->setDbCreatorId($value);
+ break;
+ case 6:
+ $this->setDbMtime($value);
+ break;
+ case 7:
+ $this->setDbUtime($value);
+ break;
+ case 8:
+ $this->setDbLPtime($value);
+ break;
+ case 9:
+ $this->setDbMime($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 BasePeer::TYPE_PHPNAME
+ *
+ * @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 = CcWebstreamPeer::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->setDbDescription($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbUrl($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDbLength($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setDbCreatorId($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setDbMtime($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setDbUtime($arr[$keys[7]]);
+ if (array_key_exists($keys[8], $arr)) $this->setDbLPtime($arr[$keys[8]]);
+ if (array_key_exists($keys[9], $arr)) $this->setDbMime($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(CcWebstreamPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcWebstreamPeer::ID)) $criteria->add(CcWebstreamPeer::ID, $this->id);
+ if ($this->isColumnModified(CcWebstreamPeer::NAME)) $criteria->add(CcWebstreamPeer::NAME, $this->name);
+ if ($this->isColumnModified(CcWebstreamPeer::DESCRIPTION)) $criteria->add(CcWebstreamPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(CcWebstreamPeer::URL)) $criteria->add(CcWebstreamPeer::URL, $this->url);
+ if ($this->isColumnModified(CcWebstreamPeer::LENGTH)) $criteria->add(CcWebstreamPeer::LENGTH, $this->length);
+ if ($this->isColumnModified(CcWebstreamPeer::CREATOR_ID)) $criteria->add(CcWebstreamPeer::CREATOR_ID, $this->creator_id);
+ if ($this->isColumnModified(CcWebstreamPeer::MTIME)) $criteria->add(CcWebstreamPeer::MTIME, $this->mtime);
+ if ($this->isColumnModified(CcWebstreamPeer::UTIME)) $criteria->add(CcWebstreamPeer::UTIME, $this->utime);
+ if ($this->isColumnModified(CcWebstreamPeer::LPTIME)) $criteria->add(CcWebstreamPeer::LPTIME, $this->lptime);
+ if ($this->isColumnModified(CcWebstreamPeer::MIME)) $criteria->add(CcWebstreamPeer::MIME, $this->mime);
+
+ 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(CcWebstreamPeer::DATABASE_NAME);
+ $criteria->add(CcWebstreamPeer::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 CcWebstream (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbName($this->getDbName());
+ $copyObj->setDbDescription($this->getDbDescription());
+ $copyObj->setDbUrl($this->getDbUrl());
+ $copyObj->setDbLength($this->getDbLength());
+ $copyObj->setDbCreatorId($this->getDbCreatorId());
+ $copyObj->setDbMtime($this->getDbMtime());
+ $copyObj->setDbUtime($this->getDbUtime());
+ $copyObj->setDbLPtime($this->getDbLPtime());
+ $copyObj->setDbMime($this->getDbMime());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ 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));
+ }
+ }
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 CcWebstream 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 CcWebstreamPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcWebstreamPeer();
+ }
+
+ return self::$peer;
+ }
+
+
+ /**
+ * Initializes a collection based on the name of a relation.
+ * Avoids crafting an 'init[$relationName]s' method name
+ * that wouldn't work when StandardEnglishPluralizer is used.
+ *
+ * @param string $relationName The name of the relation to initialize
+ * @return void
+ */
+ public function initRelation($relationName)
+ {
+ if ('CcSchedule' == $relationName) {
+ $this->initCcSchedules();
+ }
+ }
+
+ /**
+ * 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 CcWebstream The current object (for fluent API support)
+ * @see addCcSchedules()
+ */
+ public function clearCcSchedules()
+ {
+ $this->collCcSchedules = null; // important to set this to null since that means it is uninitialized
+ $this->collCcSchedulesPartial = null;
+
+ return $this;
+ }
+
+ /**
+ * reset is the collCcSchedules collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCcSchedules($v = true)
+ {
+ $this->collCcSchedulesPartial = $v;
+ }
+
+ /**
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCcSchedules($overrideExisting = true)
+ {
+ if (null !== $this->collCcSchedules && !$overrideExisting) {
+ return;
+ }
+ $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 CcWebstream 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 PropelObjectCollection|CcSchedule[] List of CcSchedule objects
+ * @throws PropelException
+ */
+ public function getCcSchedules($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCcSchedulesPartial && !$this->isNew();
+ if (null === $this->collCcSchedules || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcSchedules) {
+ // return empty collection
+ $this->initCcSchedules();
+ } else {
+ $collCcSchedules = CcScheduleQuery::create(null, $criteria)
+ ->filterByCcWebstream($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCcSchedulesPartial && count($collCcSchedules)) {
+ $this->initCcSchedules(false);
+
+ foreach ($collCcSchedules as $obj) {
+ if (false == $this->collCcSchedules->contains($obj)) {
+ $this->collCcSchedules->append($obj);
+ }
+ }
+
+ $this->collCcSchedulesPartial = true;
+ }
+
+ $collCcSchedules->getInternalIterator()->rewind();
+
+ return $collCcSchedules;
+ }
+
+ if ($partial && $this->collCcSchedules) {
+ foreach ($this->collCcSchedules as $obj) {
+ if ($obj->isNew()) {
+ $collCcSchedules[] = $obj;
+ }
+ }
+ }
+
+ $this->collCcSchedules = $collCcSchedules;
+ $this->collCcSchedulesPartial = false;
+ }
+ }
+
+ return $this->collCcSchedules;
+ }
+
+ /**
+ * Sets a collection of CcSchedule objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $ccSchedules A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ * @return CcWebstream The current object (for fluent API support)
+ */
+ public function setCcSchedules(PropelCollection $ccSchedules, PropelPDO $con = null)
+ {
+ $ccSchedulesToDelete = $this->getCcSchedules(new Criteria(), $con)->diff($ccSchedules);
+
+
+ $this->ccSchedulesScheduledForDeletion = $ccSchedulesToDelete;
+
+ foreach ($ccSchedulesToDelete as $ccScheduleRemoved) {
+ $ccScheduleRemoved->setCcWebstream(null);
+ }
+
+ $this->collCcSchedules = null;
+ foreach ($ccSchedules as $ccSchedule) {
+ $this->addCcSchedule($ccSchedule);
+ }
+
+ $this->collCcSchedules = $ccSchedules;
+ $this->collCcSchedulesPartial = false;
+
+ return $this;
+ }
+
+ /**
+ * 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)
+ {
+ $partial = $this->collCcSchedulesPartial && !$this->isNew();
+ if (null === $this->collCcSchedules || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCcSchedules) {
+ return 0;
+ }
+
+ if ($partial && !$criteria) {
+ return count($this->getCcSchedules());
+ }
+ $query = CcScheduleQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCcWebstream($this)
+ ->count($con);
+ }
+
+ 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 CcWebstream The current object (for fluent API support)
+ */
+ public function addCcSchedule(CcSchedule $l)
+ {
+ if ($this->collCcSchedules === null) {
+ $this->initCcSchedules();
+ $this->collCcSchedulesPartial = true;
+ }
+
+ if (!in_array($l, $this->collCcSchedules->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
+ $this->doAddCcSchedule($l);
+
+ if ($this->ccSchedulesScheduledForDeletion and $this->ccSchedulesScheduledForDeletion->contains($l)) {
+ $this->ccSchedulesScheduledForDeletion->remove($this->ccSchedulesScheduledForDeletion->search($l));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CcSchedule $ccSchedule The ccSchedule object to add.
+ */
+ protected function doAddCcSchedule($ccSchedule)
+ {
+ $this->collCcSchedules[]= $ccSchedule;
+ $ccSchedule->setCcWebstream($this);
+ }
+
+ /**
+ * @param CcSchedule $ccSchedule The ccSchedule object to remove.
+ * @return CcWebstream The current object (for fluent API support)
+ */
+ public function removeCcSchedule($ccSchedule)
+ {
+ if ($this->getCcSchedules()->contains($ccSchedule)) {
+ $this->collCcSchedules->remove($this->collCcSchedules->search($ccSchedule));
+ if (null === $this->ccSchedulesScheduledForDeletion) {
+ $this->ccSchedulesScheduledForDeletion = clone $this->collCcSchedules;
+ $this->ccSchedulesScheduledForDeletion->clear();
+ }
+ $this->ccSchedulesScheduledForDeletion[]= $ccSchedule;
+ $ccSchedule->setCcWebstream(null);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this CcWebstream is new, it will return
+ * an empty collection; or if this CcWebstream 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 CcWebstream.
+ *
+ * @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 PropelObjectCollection|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);
+ }
+
+
+ /**
+ * If this collection has already been initialized with
+ * an identical criteria, it returns the collection.
+ * Otherwise if this CcWebstream is new, it will return
+ * an empty collection; or if this CcWebstream 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 CcWebstream.
+ *
+ * @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 PropelObjectCollection|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->name = null;
+ $this->description = null;
+ $this->url = null;
+ $this->length = null;
+ $this->creator_id = null;
+ $this->mtime = null;
+ $this->utime = null;
+ $this->lptime = null;
+ $this->mime = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->collCcSchedules) {
+ foreach ($this->collCcSchedules as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ if ($this->collCcSchedules instanceof PropelCollection) {
+ $this->collCcSchedules->clearIterator();
+ }
+ $this->collCcSchedules = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcWebstreamPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcWebstreamMetadata.php b/airtime_mvc/application/models/airtime/om/BaseCcWebstreamMetadata.php
index f5730573c..2976c85c4 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcWebstreamMetadata.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcWebstreamMetadata.php
@@ -4,954 +4,1074 @@
/**
* Base class that represents a row from the 'cc_webstream_metadata' table.
*
- *
+ *
*
* @package propel.generator.airtime.om
*/
-abstract class BaseCcWebstreamMetadata extends BaseObject implements Persistent
+abstract class BaseCcWebstreamMetadata extends BaseObject implements Persistent
{
-
- /**
- * Peer class name
- */
- const PEER = 'CcWebstreamMetadataPeer';
-
- /**
- * The Peer class.
- * Instance provides a convenient way of calling static methods on a class
- * that calling code may not be able to identify.
- * @var CcWebstreamMetadataPeer
- */
- protected static $peer;
-
- /**
- * The value for the id field.
- * @var int
- */
- protected $id;
-
- /**
- * The value for the instance_id field.
- * @var int
- */
- protected $instance_id;
-
- /**
- * The value for the start_time field.
- * @var string
- */
- protected $start_time;
-
- /**
- * The value for the liquidsoap_data field.
- * @var string
- */
- protected $liquidsoap_data;
-
- /**
- * @var CcSchedule
- */
- protected $aCcSchedule;
-
- /**
- * Flag to prevent endless save loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInSave = false;
-
- /**
- * Flag to prevent endless validation loop, if this object is referenced
- * by another object which falls in this transaction.
- * @var boolean
- */
- protected $alreadyInValidation = false;
-
- /**
- * Get the [id] column value.
- *
- * @return int
- */
- public function getDbId()
- {
- return $this->id;
- }
-
- /**
- * Get the [instance_id] column value.
- *
- * @return int
- */
- public function getDbInstanceId()
- {
- return $this->instance_id;
- }
-
- /**
- * 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 = 'Y-m-d H:i:s')
- {
- 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 [liquidsoap_data] column value.
- *
- * @return string
- */
- public function getDbLiquidsoapData()
- {
- return $this->liquidsoap_data;
- }
-
- /**
- * Set the value of [id] column.
- *
- * @param int $v new value
- * @return CcWebstreamMetadata 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[] = CcWebstreamMetadataPeer::ID;
- }
-
- return $this;
- } // setDbId()
-
- /**
- * Set the value of [instance_id] column.
- *
- * @param int $v new value
- * @return CcWebstreamMetadata 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[] = CcWebstreamMetadataPeer::INSTANCE_ID;
- }
-
- if ($this->aCcSchedule !== null && $this->aCcSchedule->getDbId() !== $v) {
- $this->aCcSchedule = null;
- }
-
- return $this;
- } // setDbInstanceId()
-
- /**
- * 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 CcWebstreamMetadata 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('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_time = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
- $this->modifiedColumns[] = CcWebstreamMetadataPeer::START_TIME;
- }
- } // if either are not null
-
- return $this;
- } // setDbStartTime()
-
- /**
- * Set the value of [liquidsoap_data] column.
- *
- * @param string $v new value
- * @return CcWebstreamMetadata The current object (for fluent API support)
- */
- public function setDbLiquidsoapData($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
-
- if ($this->liquidsoap_data !== $v) {
- $this->liquidsoap_data = $v;
- $this->modifiedColumns[] = CcWebstreamMetadataPeer::LIQUIDSOAP_DATA;
- }
-
- return $this;
- } // setDbLiquidsoapData()
-
- /**
- * 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->start_time = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
- $this->liquidsoap_data = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
- $this->resetModified();
-
- $this->setNew(false);
-
- if ($rehydrate) {
- $this->ensureConsistency();
- }
-
- return $startcol + 4; // 4 = CcWebstreamMetadataPeer::NUM_COLUMNS - CcWebstreamMetadataPeer::NUM_LAZY_LOAD_COLUMNS).
-
- } catch (Exception $e) {
- throw new PropelException("Error populating CcWebstreamMetadata 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->aCcSchedule !== null && $this->instance_id !== $this->aCcSchedule->getDbId()) {
- $this->aCcSchedule = 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(CcWebstreamMetadataPeer::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 = CcWebstreamMetadataPeer::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->aCcSchedule = 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(CcWebstreamMetadataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $con->beginTransaction();
- try {
- $ret = $this->preDelete($con);
- if ($ret) {
- CcWebstreamMetadataQuery::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(CcWebstreamMetadataPeer::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);
- CcWebstreamMetadataPeer::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->aCcSchedule !== null) {
- if ($this->aCcSchedule->isModified() || $this->aCcSchedule->isNew()) {
- $affectedRows += $this->aCcSchedule->save($con);
- }
- $this->setCcSchedule($this->aCcSchedule);
- }
-
- if ($this->isNew() ) {
- $this->modifiedColumns[] = CcWebstreamMetadataPeer::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(CcWebstreamMetadataPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcWebstreamMetadataPeer::ID.')');
- }
-
- $pk = BasePeer::doInsert($criteria, $con);
- $affectedRows += 1;
- $this->setDbId($pk); //[IMV] update autoincrement primary key
- $this->setNew(false);
- } else {
- $affectedRows += CcWebstreamMetadataPeer::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->aCcSchedule !== null) {
- if (!$this->aCcSchedule->validate($columns)) {
- $failureMap = array_merge($failureMap, $this->aCcSchedule->getValidationFailures());
- }
- }
-
-
- if (($retval = CcWebstreamMetadataPeer::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 = CcWebstreamMetadataPeer::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->getDbStartTime();
- break;
- case 3:
- return $this->getDbLiquidsoapData();
- 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 = CcWebstreamMetadataPeer::getFieldNames($keyType);
- $result = array(
- $keys[0] => $this->getDbId(),
- $keys[1] => $this->getDbInstanceId(),
- $keys[2] => $this->getDbStartTime(),
- $keys[3] => $this->getDbLiquidsoapData(),
- );
- if ($includeForeignObjects) {
- if (null !== $this->aCcSchedule) {
- $result['CcSchedule'] = $this->aCcSchedule->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 = CcWebstreamMetadataPeer::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->setDbStartTime($value);
- break;
- case 3:
- $this->setDbLiquidsoapData($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 = CcWebstreamMetadataPeer::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->setDbStartTime($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setDbLiquidsoapData($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(CcWebstreamMetadataPeer::DATABASE_NAME);
-
- if ($this->isColumnModified(CcWebstreamMetadataPeer::ID)) $criteria->add(CcWebstreamMetadataPeer::ID, $this->id);
- if ($this->isColumnModified(CcWebstreamMetadataPeer::INSTANCE_ID)) $criteria->add(CcWebstreamMetadataPeer::INSTANCE_ID, $this->instance_id);
- if ($this->isColumnModified(CcWebstreamMetadataPeer::START_TIME)) $criteria->add(CcWebstreamMetadataPeer::START_TIME, $this->start_time);
- if ($this->isColumnModified(CcWebstreamMetadataPeer::LIQUIDSOAP_DATA)) $criteria->add(CcWebstreamMetadataPeer::LIQUIDSOAP_DATA, $this->liquidsoap_data);
-
- 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(CcWebstreamMetadataPeer::DATABASE_NAME);
- $criteria->add(CcWebstreamMetadataPeer::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 CcWebstreamMetadata (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->setDbStartTime($this->start_time);
- $copyObj->setDbLiquidsoapData($this->liquidsoap_data);
-
- $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 CcWebstreamMetadata 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 CcWebstreamMetadataPeer
- */
- public function getPeer()
- {
- if (self::$peer === null) {
- self::$peer = new CcWebstreamMetadataPeer();
- }
- return self::$peer;
- }
-
- /**
- * Declares an association between this object and a CcSchedule object.
- *
- * @param CcSchedule $v
- * @return CcWebstreamMetadata The current object (for fluent API support)
- * @throws PropelException
- */
- public function setCcSchedule(CcSchedule $v = null)
- {
- if ($v === null) {
- $this->setDbInstanceId(NULL);
- } else {
- $this->setDbInstanceId($v->getDbId());
- }
-
- $this->aCcSchedule = $v;
-
- // Add binding for other direction of this n:n relationship.
- // If this object has already been added to the CcSchedule object, it will not be re-added.
- if ($v !== null) {
- $v->addCcWebstreamMetadata($this);
- }
-
- return $this;
- }
-
-
- /**
- * Get the associated CcSchedule object
- *
- * @param PropelPDO Optional Connection object.
- * @return CcSchedule The associated CcSchedule object.
- * @throws PropelException
- */
- public function getCcSchedule(PropelPDO $con = null)
- {
- if ($this->aCcSchedule === null && ($this->instance_id !== null)) {
- $this->aCcSchedule = CcScheduleQuery::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->aCcSchedule->addCcWebstreamMetadatas($this);
- */
- }
- return $this->aCcSchedule;
- }
-
- /**
- * Clears the current object and sets all attributes to their default values
- */
- public function clear()
- {
- $this->id = null;
- $this->instance_id = null;
- $this->start_time = null;
- $this->liquidsoap_data = 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->aCcSchedule = 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);
- }
-
-} // BaseCcWebstreamMetadata
+ /**
+ * Peer class name
+ */
+ const PEER = 'CcWebstreamMetadataPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var CcWebstreamMetadataPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the instance_id field.
+ * @var int
+ */
+ protected $instance_id;
+
+ /**
+ * The value for the start_time field.
+ * @var string
+ */
+ protected $start_time;
+
+ /**
+ * The value for the liquidsoap_data field.
+ * @var string
+ */
+ protected $liquidsoap_data;
+
+ /**
+ * @var CcSchedule
+ */
+ protected $aCcSchedule;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getDbId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [instance_id] column value.
+ *
+ * @return int
+ */
+ public function getDbInstanceId()
+ {
+
+ return $this->instance_id;
+ }
+
+ /**
+ * 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 = 'Y-m-d H:i:s')
+ {
+ 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;
+ }
+
+ if (strpos($format, '%') !== false) {
+ return strftime($format, $dt->format('U'));
+ }
+
+ return $dt->format($format);
+
+ }
+
+ /**
+ * Get the [liquidsoap_data] column value.
+ *
+ * @return string
+ */
+ public function getDbLiquidsoapData()
+ {
+
+ return $this->liquidsoap_data;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CcWebstreamMetadata The current object (for fluent API support)
+ */
+ public function setDbId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CcWebstreamMetadataPeer::ID;
+ }
+
+
+ return $this;
+ } // setDbId()
+
+ /**
+ * Set the value of [instance_id] column.
+ *
+ * @param int $v new value
+ * @return CcWebstreamMetadata The current object (for fluent API support)
+ */
+ public function setDbInstanceId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->instance_id !== $v) {
+ $this->instance_id = $v;
+ $this->modifiedColumns[] = CcWebstreamMetadataPeer::INSTANCE_ID;
+ }
+
+ if ($this->aCcSchedule !== null && $this->aCcSchedule->getDbId() !== $v) {
+ $this->aCcSchedule = null;
+ }
+
+
+ return $this;
+ } // setDbInstanceId()
+
+ /**
+ * 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 strings are treated as null.
+ * @return CcWebstreamMetadata The current object (for fluent API support)
+ */
+ public function setDbStartTime($v)
+ {
+ $dt = PropelDateTime::newInstance($v, null, 'DateTime');
+ if ($this->start_time !== null || $dt !== null) {
+ $currentDateAsString = ($this->start_time !== null && $tmpDt = new DateTime($this->start_time)) ? $tmpDt->format('Y-m-d H:i:s') : null;
+ $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
+ if ($currentDateAsString !== $newDateAsString) {
+ $this->start_time = $newDateAsString;
+ $this->modifiedColumns[] = CcWebstreamMetadataPeer::START_TIME;
+ }
+ } // if either are not null
+
+
+ return $this;
+ } // setDbStartTime()
+
+ /**
+ * Set the value of [liquidsoap_data] column.
+ *
+ * @param string $v new value
+ * @return CcWebstreamMetadata The current object (for fluent API support)
+ */
+ public function setDbLiquidsoapData($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->liquidsoap_data !== $v) {
+ $this->liquidsoap_data = $v;
+ $this->modifiedColumns[] = CcWebstreamMetadataPeer::LIQUIDSOAP_DATA;
+ }
+
+
+ return $this;
+ } // setDbLiquidsoapData()
+
+ /**
+ * 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 resultset 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->start_time = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->liquidsoap_data = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 4; // 4 = CcWebstreamMetadataPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CcWebstreamMetadata 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->aCcSchedule !== null && $this->instance_id !== $this->aCcSchedule->getDbId()) {
+ $this->aCcSchedule = 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(CcWebstreamMetadataPeer::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 = CcWebstreamMetadataPeer::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->aCcSchedule = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @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(CcWebstreamMetadataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = CcWebstreamMetadataQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $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
+ * @throws Exception
+ * @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(CcWebstreamMetadataPeer::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);
+ CcWebstreamMetadataPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $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 corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcSchedule !== null) {
+ if ($this->aCcSchedule->isModified() || $this->aCcSchedule->isNew()) {
+ $affectedRows += $this->aCcSchedule->save($con);
+ }
+ $this->setCcSchedule($this->aCcSchedule);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = CcWebstreamMetadataPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . CcWebstreamMetadataPeer::ID . ')');
+ }
+ if (null === $this->id) {
+ try {
+ $stmt = $con->query("SELECT nextval('cc_webstream_metadata_id_seq')");
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $this->id = $row[0];
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get sequence id.', $e);
+ }
+ }
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CcWebstreamMetadataPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '"id"';
+ }
+ if ($this->isColumnModified(CcWebstreamMetadataPeer::INSTANCE_ID)) {
+ $modifiedColumns[':p' . $index++] = '"instance_id"';
+ }
+ if ($this->isColumnModified(CcWebstreamMetadataPeer::START_TIME)) {
+ $modifiedColumns[':p' . $index++] = '"start_time"';
+ }
+ if ($this->isColumnModified(CcWebstreamMetadataPeer::LIQUIDSOAP_DATA)) {
+ $modifiedColumns[':p' . $index++] = '"liquidsoap_data"';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO "cc_webstream_metadata" (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '"id"':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '"instance_id"':
+ $stmt->bindValue($identifier, $this->instance_id, PDO::PARAM_INT);
+ break;
+ case '"start_time"':
+ $stmt->bindValue($identifier, $this->start_time, PDO::PARAM_STR);
+ break;
+ case '"liquidsoap_data"':
+ $stmt->bindValue($identifier, $this->liquidsoap_data, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * 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;
+ }
+
+ $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 aggregated 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
objects 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 corresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCcSchedule !== null) {
+ if (!$this->aCcSchedule->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCcSchedule->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CcWebstreamMetadataPeer::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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcWebstreamMetadataPeer::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->getDbStartTime();
+ break;
+ case 3:
+ return $this->getDbLiquidsoapData();
+ 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 array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @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, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CcWebstreamMetadata'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CcWebstreamMetadata'][$this->getPrimaryKey()] = true;
+ $keys = CcWebstreamMetadataPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getDbId(),
+ $keys[1] => $this->getDbInstanceId(),
+ $keys[2] => $this->getDbStartTime(),
+ $keys[3] => $this->getDbLiquidsoapData(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+ if ($includeForeignObjects) {
+ if (null !== $this->aCcSchedule) {
+ $result['CcSchedule'] = $this->aCcSchedule->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, 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.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CcWebstreamMetadataPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $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->setDbStartTime($value);
+ break;
+ case 3:
+ $this->setDbLiquidsoapData($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 BasePeer::TYPE_PHPNAME
+ *
+ * @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 = CcWebstreamMetadataPeer::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->setDbStartTime($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDbLiquidsoapData($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(CcWebstreamMetadataPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CcWebstreamMetadataPeer::ID)) $criteria->add(CcWebstreamMetadataPeer::ID, $this->id);
+ if ($this->isColumnModified(CcWebstreamMetadataPeer::INSTANCE_ID)) $criteria->add(CcWebstreamMetadataPeer::INSTANCE_ID, $this->instance_id);
+ if ($this->isColumnModified(CcWebstreamMetadataPeer::START_TIME)) $criteria->add(CcWebstreamMetadataPeer::START_TIME, $this->start_time);
+ if ($this->isColumnModified(CcWebstreamMetadataPeer::LIQUIDSOAP_DATA)) $criteria->add(CcWebstreamMetadataPeer::LIQUIDSOAP_DATA, $this->liquidsoap_data);
+
+ 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(CcWebstreamMetadataPeer::DATABASE_NAME);
+ $criteria->add(CcWebstreamMetadataPeer::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 CcWebstreamMetadata (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setDbInstanceId($this->getDbInstanceId());
+ $copyObj->setDbStartTime($this->getDbStartTime());
+ $copyObj->setDbLiquidsoapData($this->getDbLiquidsoapData());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $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 CcWebstreamMetadata 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 CcWebstreamMetadataPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CcWebstreamMetadataPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CcSchedule object.
+ *
+ * @param CcSchedule $v
+ * @return CcWebstreamMetadata The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCcSchedule(CcSchedule $v = null)
+ {
+ if ($v === null) {
+ $this->setDbInstanceId(NULL);
+ } else {
+ $this->setDbInstanceId($v->getDbId());
+ }
+
+ $this->aCcSchedule = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CcSchedule object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCcWebstreamMetadata($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CcSchedule object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @param $doQuery Executes a query to get the object if required
+ * @return CcSchedule The associated CcSchedule object.
+ * @throws PropelException
+ */
+ public function getCcSchedule(PropelPDO $con = null, $doQuery = true)
+ {
+ if ($this->aCcSchedule === null && ($this->instance_id !== null) && $doQuery) {
+ $this->aCcSchedule = CcScheduleQuery::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->aCcSchedule->addCcWebstreamMetadatas($this);
+ */
+ }
+
+ return $this->aCcSchedule;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->instance_id = null;
+ $this->start_time = null;
+ $this->liquidsoap_data = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+ if ($this->aCcSchedule instanceof Persistent) {
+ $this->aCcSchedule->clearAllReferences($deep);
+ }
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ $this->aCcSchedule = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CcWebstreamMetadataPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcWebstreamMetadataPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcWebstreamMetadataPeer.php
index 445e9793c..b34c28fc6 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcWebstreamMetadataPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcWebstreamMetadataPeer.php
@@ -4,976 +4,1002 @@
/**
* Base static class for performing query and update operations on the 'cc_webstream_metadata' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcWebstreamMetadataPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_webstream_metadata';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcWebstreamMetadata';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcWebstreamMetadata';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcWebstreamMetadataTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 4;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_webstream_metadata.ID';
-
- /** the column name for the INSTANCE_ID field */
- const INSTANCE_ID = 'cc_webstream_metadata.INSTANCE_ID';
-
- /** the column name for the START_TIME field */
- const START_TIME = 'cc_webstream_metadata.START_TIME';
-
- /** the column name for the LIQUIDSOAP_DATA field */
- const LIQUIDSOAP_DATA = 'cc_webstream_metadata.LIQUIDSOAP_DATA';
-
- /**
- * An identiy map to hold any loaded instances of CcWebstreamMetadata objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcWebstreamMetadata[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbInstanceId', 'DbStartTime', 'DbLiquidsoapData', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbInstanceId', 'dbStartTime', 'dbLiquidsoapData', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::INSTANCE_ID, self::START_TIME, self::LIQUIDSOAP_DATA, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'INSTANCE_ID', 'START_TIME', 'LIQUIDSOAP_DATA', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'instance_id', 'start_time', 'liquidsoap_data', ),
- 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, 'DbStartTime' => 2, 'DbLiquidsoapData' => 3, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbInstanceId' => 1, 'dbStartTime' => 2, 'dbLiquidsoapData' => 3, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::INSTANCE_ID => 1, self::START_TIME => 2, self::LIQUIDSOAP_DATA => 3, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'INSTANCE_ID' => 1, 'START_TIME' => 2, 'LIQUIDSOAP_DATA' => 3, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'instance_id' => 1, 'start_time' => 2, 'liquidsoap_data' => 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. CcWebstreamMetadataPeer::COLUMN_NAME).
- * @return string
- */
- public static function alias($alias, $column)
- {
- return str_replace(CcWebstreamMetadataPeer::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(CcWebstreamMetadataPeer::ID);
- $criteria->addSelectColumn(CcWebstreamMetadataPeer::INSTANCE_ID);
- $criteria->addSelectColumn(CcWebstreamMetadataPeer::START_TIME);
- $criteria->addSelectColumn(CcWebstreamMetadataPeer::LIQUIDSOAP_DATA);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.INSTANCE_ID');
- $criteria->addSelectColumn($alias . '.START_TIME');
- $criteria->addSelectColumn($alias . '.LIQUIDSOAP_DATA');
- }
- }
-
- /**
- * 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(CcWebstreamMetadataPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcWebstreamMetadataPeer::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(CcWebstreamMetadataPeer::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 CcWebstreamMetadata
- * @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 = CcWebstreamMetadataPeer::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 CcWebstreamMetadataPeer::populateObjects(CcWebstreamMetadataPeer::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(CcWebstreamMetadataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- if (!$criteria->hasSelectClause()) {
- $criteria = clone $criteria;
- CcWebstreamMetadataPeer::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 CcWebstreamMetadata $value A CcWebstreamMetadata object.
- * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
- */
- public static function addInstanceToPool(CcWebstreamMetadata $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 CcWebstreamMetadata object or a primary key value.
- */
- public static function removeInstanceFromPool($value)
- {
- if (Propel::isInstancePoolingEnabled() && $value !== null) {
- if (is_object($value) && $value instanceof CcWebstreamMetadata) {
- $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 CcWebstreamMetadata 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 CcWebstreamMetadata 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_webstream_metadata
- * 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 = CcWebstreamMetadataPeer::getOMClass(false);
- // populate the object(s)
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key = CcWebstreamMetadataPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj = CcWebstreamMetadataPeer::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;
- CcWebstreamMetadataPeer::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 (CcWebstreamMetadata object, last column rank)
- */
- public static function populateObject($row, $startcol = 0)
- {
- $key = CcWebstreamMetadataPeer::getPrimaryKeyHashFromRow($row, $startcol);
- if (null !== ($obj = CcWebstreamMetadataPeer::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 + CcWebstreamMetadataPeer::NUM_COLUMNS;
- } else {
- $cls = CcWebstreamMetadataPeer::OM_CLASS;
- $obj = new $cls();
- $col = $obj->hydrate($row, $startcol);
- CcWebstreamMetadataPeer::addInstanceToPool($obj, $key);
- }
- return array($obj, $col);
- }
-
- /**
- * Returns the number of rows matching criteria, joining the related CcSchedule 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 doCountJoinCcSchedule(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(CcWebstreamMetadataPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcWebstreamMetadataPeer::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(CcWebstreamMetadataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcWebstreamMetadataPeer::INSTANCE_ID, CcSchedulePeer::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 CcWebstreamMetadata objects pre-filled with their CcSchedule 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 CcWebstreamMetadata objects.
- * @throws PropelException Any exceptions caught during processing will be
- * rethrown wrapped into a PropelException.
- */
- public static function doSelectJoinCcSchedule(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);
- }
-
- CcWebstreamMetadataPeer::addSelectColumns($criteria);
- $startcol = (CcWebstreamMetadataPeer::NUM_COLUMNS - CcWebstreamMetadataPeer::NUM_LAZY_LOAD_COLUMNS);
- CcSchedulePeer::addSelectColumns($criteria);
-
- $criteria->addJoin(CcWebstreamMetadataPeer::INSTANCE_ID, CcSchedulePeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcWebstreamMetadataPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcWebstreamMetadataPeer::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 = CcWebstreamMetadataPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcWebstreamMetadataPeer::addInstanceToPool($obj1, $key1);
- } // if $obj1 already loaded
-
- $key2 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, $startcol);
- if ($key2 !== null) {
- $obj2 = CcSchedulePeer::getInstanceFromPool($key2);
- if (!$obj2) {
-
- $cls = CcSchedulePeer::getOMClass(false);
-
- $obj2 = new $cls();
- $obj2->hydrate($row, $startcol);
- CcSchedulePeer::addInstanceToPool($obj2, $key2);
- } // if obj2 already loaded
-
- // Add the $obj1 (CcWebstreamMetadata) to $obj2 (CcSchedule)
- $obj2->addCcWebstreamMetadata($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(CcWebstreamMetadataPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcWebstreamMetadataPeer::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(CcWebstreamMetadataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria->addJoin(CcWebstreamMetadataPeer::INSTANCE_ID, CcSchedulePeer::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 CcWebstreamMetadata 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 CcWebstreamMetadata 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);
- }
-
- CcWebstreamMetadataPeer::addSelectColumns($criteria);
- $startcol2 = (CcWebstreamMetadataPeer::NUM_COLUMNS - CcWebstreamMetadataPeer::NUM_LAZY_LOAD_COLUMNS);
-
- CcSchedulePeer::addSelectColumns($criteria);
- $startcol3 = $startcol2 + (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS);
-
- $criteria->addJoin(CcWebstreamMetadataPeer::INSTANCE_ID, CcSchedulePeer::ID, $join_behavior);
-
- $stmt = BasePeer::doSelect($criteria, $con);
- $results = array();
-
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key1 = CcWebstreamMetadataPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj1 = CcWebstreamMetadataPeer::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 = CcWebstreamMetadataPeer::getOMClass(false);
-
- $obj1 = new $cls();
- $obj1->hydrate($row);
- CcWebstreamMetadataPeer::addInstanceToPool($obj1, $key1);
- } // if obj1 already loaded
-
- // Add objects for joined CcSchedule rows
-
- $key2 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, $startcol2);
- if ($key2 !== null) {
- $obj2 = CcSchedulePeer::getInstanceFromPool($key2);
- if (!$obj2) {
-
- $cls = CcSchedulePeer::getOMClass(false);
-
- $obj2 = new $cls();
- $obj2->hydrate($row, $startcol2);
- CcSchedulePeer::addInstanceToPool($obj2, $key2);
- } // if obj2 loaded
-
- // Add the $obj1 (CcWebstreamMetadata) to the collection in $obj2 (CcSchedule)
- $obj2->addCcWebstreamMetadata($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(BaseCcWebstreamMetadataPeer::DATABASE_NAME);
- if (!$dbMap->hasTable(BaseCcWebstreamMetadataPeer::TABLE_NAME))
- {
- $dbMap->addTableObject(new CcWebstreamMetadataTableMap());
- }
- }
-
- /**
- * 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 ? CcWebstreamMetadataPeer::CLASS_DEFAULT : CcWebstreamMetadataPeer::OM_CLASS;
- }
-
- /**
- * Method perform an INSERT on the database, given a CcWebstreamMetadata or Criteria object.
- *
- * @param mixed $values Criteria or CcWebstreamMetadata 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(CcWebstreamMetadataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
- } else {
- $criteria = $values->buildCriteria(); // build Criteria from CcWebstreamMetadata object
- }
-
- if ($criteria->containsKey(CcWebstreamMetadataPeer::ID) && $criteria->keyContainsValue(CcWebstreamMetadataPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcWebstreamMetadataPeer::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 CcWebstreamMetadata or Criteria object.
- *
- * @param mixed $values Criteria or CcWebstreamMetadata 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(CcWebstreamMetadataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $selectCriteria = new Criteria(self::DATABASE_NAME);
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
-
- $comparison = $criteria->getComparison(CcWebstreamMetadataPeer::ID);
- $value = $criteria->remove(CcWebstreamMetadataPeer::ID);
- if ($value) {
- $selectCriteria->add(CcWebstreamMetadataPeer::ID, $value, $comparison);
- } else {
- $selectCriteria->setPrimaryTableName(CcWebstreamMetadataPeer::TABLE_NAME);
- }
-
- } else { // $values is CcWebstreamMetadata 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_webstream_metadata 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(CcWebstreamMetadataPeer::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(CcWebstreamMetadataPeer::TABLE_NAME, $con, CcWebstreamMetadataPeer::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).
- CcWebstreamMetadataPeer::clearInstancePool();
- CcWebstreamMetadataPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Method perform a DELETE on the database, given a CcWebstreamMetadata or Criteria object OR a primary key value.
- *
- * @param mixed $values Criteria or CcWebstreamMetadata 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(CcWebstreamMetadataPeer::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.
- CcWebstreamMetadataPeer::clearInstancePool();
- // rename for clarity
- $criteria = clone $values;
- } elseif ($values instanceof CcWebstreamMetadata) { // it's a model object
- // invalidate the cache for this single object
- CcWebstreamMetadataPeer::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(CcWebstreamMetadataPeer::ID, (array) $values, Criteria::IN);
- // invalidate the cache for this object(s)
- foreach ((array) $values as $singleval) {
- CcWebstreamMetadataPeer::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);
- CcWebstreamMetadataPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Validates all modified columns of given CcWebstreamMetadata 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 CcWebstreamMetadata $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(CcWebstreamMetadata $obj, $cols = null)
- {
- $columns = array();
-
- if ($cols) {
- $dbMap = Propel::getDatabaseMap(CcWebstreamMetadataPeer::DATABASE_NAME);
- $tableMap = $dbMap->getTable(CcWebstreamMetadataPeer::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(CcWebstreamMetadataPeer::DATABASE_NAME, CcWebstreamMetadataPeer::TABLE_NAME, $columns);
- }
-
- /**
- * Retrieve a single object by pkey.
- *
- * @param int $pk the primary key.
- * @param PropelPDO $con the connection to use
- * @return CcWebstreamMetadata
- */
- public static function retrieveByPK($pk, PropelPDO $con = null)
- {
-
- if (null !== ($obj = CcWebstreamMetadataPeer::getInstanceFromPool((string) $pk))) {
- return $obj;
- }
-
- if ($con === null) {
- $con = Propel::getConnection(CcWebstreamMetadataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria = new Criteria(CcWebstreamMetadataPeer::DATABASE_NAME);
- $criteria->add(CcWebstreamMetadataPeer::ID, $pk);
-
- $v = CcWebstreamMetadataPeer::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(CcWebstreamMetadataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $objs = null;
- if (empty($pks)) {
- $objs = array();
- } else {
- $criteria = new Criteria(CcWebstreamMetadataPeer::DATABASE_NAME);
- $criteria->add(CcWebstreamMetadataPeer::ID, $pks, Criteria::IN);
- $objs = CcWebstreamMetadataPeer::doSelect($criteria, $con);
- }
- return $objs;
- }
+abstract class BaseCcWebstreamMetadataPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_webstream_metadata';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcWebstreamMetadata';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcWebstreamMetadataTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 4;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 4;
+
+ /** the column name for the id field */
+ const ID = 'cc_webstream_metadata.id';
+
+ /** the column name for the instance_id field */
+ const INSTANCE_ID = 'cc_webstream_metadata.instance_id';
+
+ /** the column name for the start_time field */
+ const START_TIME = 'cc_webstream_metadata.start_time';
+
+ /** the column name for the liquidsoap_data field */
+ const LIQUIDSOAP_DATA = 'cc_webstream_metadata.liquidsoap_data';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcWebstreamMetadata objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcWebstreamMetadata[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcWebstreamMetadataPeer::$fieldNames[CcWebstreamMetadataPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbInstanceId', 'DbStartTime', 'DbLiquidsoapData', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbInstanceId', 'dbStartTime', 'dbLiquidsoapData', ),
+ BasePeer::TYPE_COLNAME => array (CcWebstreamMetadataPeer::ID, CcWebstreamMetadataPeer::INSTANCE_ID, CcWebstreamMetadataPeer::START_TIME, CcWebstreamMetadataPeer::LIQUIDSOAP_DATA, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'INSTANCE_ID', 'START_TIME', 'LIQUIDSOAP_DATA', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'instance_id', 'start_time', 'liquidsoap_data', ),
+ 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. CcWebstreamMetadataPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbInstanceId' => 1, 'DbStartTime' => 2, 'DbLiquidsoapData' => 3, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbInstanceId' => 1, 'dbStartTime' => 2, 'dbLiquidsoapData' => 3, ),
+ BasePeer::TYPE_COLNAME => array (CcWebstreamMetadataPeer::ID => 0, CcWebstreamMetadataPeer::INSTANCE_ID => 1, CcWebstreamMetadataPeer::START_TIME => 2, CcWebstreamMetadataPeer::LIQUIDSOAP_DATA => 3, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'INSTANCE_ID' => 1, 'START_TIME' => 2, 'LIQUIDSOAP_DATA' => 3, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'instance_id' => 1, 'start_time' => 2, 'liquidsoap_data' => 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcWebstreamMetadataPeer::getFieldNames($toType);
+ $key = isset(CcWebstreamMetadataPeer::$fieldKeys[$fromType][$name]) ? CcWebstreamMetadataPeer::$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(CcWebstreamMetadataPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcWebstreamMetadataPeer::$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 CcWebstreamMetadataPeer::$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. CcWebstreamMetadataPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcWebstreamMetadataPeer::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(CcWebstreamMetadataPeer::ID);
+ $criteria->addSelectColumn(CcWebstreamMetadataPeer::INSTANCE_ID);
+ $criteria->addSelectColumn(CcWebstreamMetadataPeer::START_TIME);
+ $criteria->addSelectColumn(CcWebstreamMetadataPeer::LIQUIDSOAP_DATA);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.instance_id');
+ $criteria->addSelectColumn($alias . '.start_time');
+ $criteria->addSelectColumn($alias . '.liquidsoap_data');
+ }
+ }
+
+ /**
+ * 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(CcWebstreamMetadataPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcWebstreamMetadataPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(CcWebstreamMetadataPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcWebstreamMetadataPeer::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;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcWebstreamMetadata
+ * @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 = CcWebstreamMetadataPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 CcWebstreamMetadataPeer::populateObjects(CcWebstreamMetadataPeer::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 directly (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(CcWebstreamMetadataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcWebstreamMetadataPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcWebstreamMetadataPeer::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 CcWebstreamMetadata $obj A CcWebstreamMetadata object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcWebstreamMetadataPeer::$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 CcWebstreamMetadata object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcWebstreamMetadata) {
+ $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 CcWebstreamMetadata object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(CcWebstreamMetadataPeer::$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 CcWebstreamMetadata 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(CcWebstreamMetadataPeer::$instances[$key])) {
+ return CcWebstreamMetadataPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcWebstreamMetadataPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcWebstreamMetadataPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_webstream_metadata
+ * 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 = CcWebstreamMetadataPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcWebstreamMetadataPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcWebstreamMetadataPeer::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;
+ CcWebstreamMetadataPeer::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 (CcWebstreamMetadata object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcWebstreamMetadataPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcWebstreamMetadataPeer::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 + CcWebstreamMetadataPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = CcWebstreamMetadataPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcWebstreamMetadataPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CcSchedule 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 doCountJoinCcSchedule(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(CcWebstreamMetadataPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcWebstreamMetadataPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcWebstreamMetadataPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcWebstreamMetadataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcWebstreamMetadataPeer::INSTANCE_ID, CcSchedulePeer::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 CcWebstreamMetadata objects pre-filled with their CcSchedule 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 CcWebstreamMetadata objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCcSchedule(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(CcWebstreamMetadataPeer::DATABASE_NAME);
+ }
+
+ CcWebstreamMetadataPeer::addSelectColumns($criteria);
+ $startcol = CcWebstreamMetadataPeer::NUM_HYDRATE_COLUMNS;
+ CcSchedulePeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CcWebstreamMetadataPeer::INSTANCE_ID, CcSchedulePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcWebstreamMetadataPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcWebstreamMetadataPeer::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 = CcWebstreamMetadataPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcWebstreamMetadataPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CcSchedulePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcSchedulePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CcSchedulePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CcWebstreamMetadata) to $obj2 (CcSchedule)
+ $obj2->addCcWebstreamMetadata($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(CcWebstreamMetadataPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcWebstreamMetadataPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CcWebstreamMetadataPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcWebstreamMetadataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CcWebstreamMetadataPeer::INSTANCE_ID, CcSchedulePeer::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 CcWebstreamMetadata 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 CcWebstreamMetadata 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(CcWebstreamMetadataPeer::DATABASE_NAME);
+ }
+
+ CcWebstreamMetadataPeer::addSelectColumns($criteria);
+ $startcol2 = CcWebstreamMetadataPeer::NUM_HYDRATE_COLUMNS;
+
+ CcSchedulePeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CcSchedulePeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CcWebstreamMetadataPeer::INSTANCE_ID, CcSchedulePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CcWebstreamMetadataPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CcWebstreamMetadataPeer::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 = CcWebstreamMetadataPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CcWebstreamMetadataPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CcSchedule rows
+
+ $key2 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CcSchedulePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CcSchedulePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CcSchedulePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CcWebstreamMetadata) to the collection in $obj2 (CcSchedule)
+ $obj2->addCcWebstreamMetadata($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(CcWebstreamMetadataPeer::DATABASE_NAME)->getTable(CcWebstreamMetadataPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcWebstreamMetadataPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcWebstreamMetadataPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \CcWebstreamMetadataTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcWebstreamMetadataPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a CcWebstreamMetadata or Criteria object.
+ *
+ * @param mixed $values Criteria or CcWebstreamMetadata 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(CcWebstreamMetadataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcWebstreamMetadata object
+ }
+
+ if ($criteria->containsKey(CcWebstreamMetadataPeer::ID) && $criteria->keyContainsValue(CcWebstreamMetadataPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcWebstreamMetadataPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(CcWebstreamMetadataPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a CcWebstreamMetadata or Criteria object.
+ *
+ * @param mixed $values Criteria or CcWebstreamMetadata 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(CcWebstreamMetadataPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(CcWebstreamMetadataPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcWebstreamMetadataPeer::ID);
+ $value = $criteria->remove(CcWebstreamMetadataPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcWebstreamMetadataPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcWebstreamMetadataPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcWebstreamMetadata object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(CcWebstreamMetadataPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_webstream_metadata table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcWebstreamMetadataPeer::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(CcWebstreamMetadataPeer::TABLE_NAME, $con, CcWebstreamMetadataPeer::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).
+ CcWebstreamMetadataPeer::clearInstancePool();
+ CcWebstreamMetadataPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a CcWebstreamMetadata or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcWebstreamMetadata 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(CcWebstreamMetadataPeer::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.
+ CcWebstreamMetadataPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcWebstreamMetadata) { // it's a model object
+ // invalidate the cache for this single object
+ CcWebstreamMetadataPeer::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(CcWebstreamMetadataPeer::DATABASE_NAME);
+ $criteria->add(CcWebstreamMetadataPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcWebstreamMetadataPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcWebstreamMetadataPeer::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);
+ CcWebstreamMetadataPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcWebstreamMetadata 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 CcWebstreamMetadata $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($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcWebstreamMetadataPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcWebstreamMetadataPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcWebstreamMetadataPeer::DATABASE_NAME, CcWebstreamMetadataPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcWebstreamMetadata
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcWebstreamMetadataPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcWebstreamMetadataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcWebstreamMetadataPeer::DATABASE_NAME);
+ $criteria->add(CcWebstreamMetadataPeer::ID, $pk);
+
+ $v = CcWebstreamMetadataPeer::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
+ * @return CcWebstreamMetadata[]
+ * @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(CcWebstreamMetadataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcWebstreamMetadataPeer::DATABASE_NAME);
+ $criteria->add(CcWebstreamMetadataPeer::ID, $pks, Criteria::IN);
+ $objs = CcWebstreamMetadataPeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
} // BaseCcWebstreamMetadataPeer
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcWebstreamMetadataQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcWebstreamMetadataQuery.php
index ba5bfcb12..ee9ef2b0d 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcWebstreamMetadataQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcWebstreamMetadataQuery.php
@@ -4,326 +4,481 @@
/**
* Base class that represents a query for the 'cc_webstream_metadata' table.
*
- *
*
- * @method CcWebstreamMetadataQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcWebstreamMetadataQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column
- * @method CcWebstreamMetadataQuery orderByDbStartTime($order = Criteria::ASC) Order by the start_time column
- * @method CcWebstreamMetadataQuery orderByDbLiquidsoapData($order = Criteria::ASC) Order by the liquidsoap_data column
*
- * @method CcWebstreamMetadataQuery groupByDbId() Group by the id column
- * @method CcWebstreamMetadataQuery groupByDbInstanceId() Group by the instance_id column
- * @method CcWebstreamMetadataQuery groupByDbStartTime() Group by the start_time column
- * @method CcWebstreamMetadataQuery groupByDbLiquidsoapData() Group by the liquidsoap_data column
+ * @method CcWebstreamMetadataQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcWebstreamMetadataQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column
+ * @method CcWebstreamMetadataQuery orderByDbStartTime($order = Criteria::ASC) Order by the start_time column
+ * @method CcWebstreamMetadataQuery orderByDbLiquidsoapData($order = Criteria::ASC) Order by the liquidsoap_data column
*
- * @method CcWebstreamMetadataQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcWebstreamMetadataQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcWebstreamMetadataQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcWebstreamMetadataQuery groupByDbId() Group by the id column
+ * @method CcWebstreamMetadataQuery groupByDbInstanceId() Group by the instance_id column
+ * @method CcWebstreamMetadataQuery groupByDbStartTime() Group by the start_time column
+ * @method CcWebstreamMetadataQuery groupByDbLiquidsoapData() Group by the liquidsoap_data column
*
- * @method CcWebstreamMetadataQuery leftJoinCcSchedule($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSchedule relation
- * @method CcWebstreamMetadataQuery rightJoinCcSchedule($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSchedule relation
- * @method CcWebstreamMetadataQuery innerJoinCcSchedule($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSchedule relation
+ * @method CcWebstreamMetadataQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcWebstreamMetadataQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcWebstreamMetadataQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcWebstreamMetadata findOne(PropelPDO $con = null) Return the first CcWebstreamMetadata matching the query
- * @method CcWebstreamMetadata findOneOrCreate(PropelPDO $con = null) Return the first CcWebstreamMetadata matching the query, or a new CcWebstreamMetadata object populated from the query conditions when no match is found
+ * @method CcWebstreamMetadataQuery leftJoinCcSchedule($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSchedule relation
+ * @method CcWebstreamMetadataQuery rightJoinCcSchedule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSchedule relation
+ * @method CcWebstreamMetadataQuery innerJoinCcSchedule($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSchedule relation
*
- * @method CcWebstreamMetadata findOneByDbId(int $id) Return the first CcWebstreamMetadata filtered by the id column
- * @method CcWebstreamMetadata findOneByDbInstanceId(int $instance_id) Return the first CcWebstreamMetadata filtered by the instance_id column
- * @method CcWebstreamMetadata findOneByDbStartTime(string $start_time) Return the first CcWebstreamMetadata filtered by the start_time column
- * @method CcWebstreamMetadata findOneByDbLiquidsoapData(string $liquidsoap_data) Return the first CcWebstreamMetadata filtered by the liquidsoap_data column
+ * @method CcWebstreamMetadata findOne(PropelPDO $con = null) Return the first CcWebstreamMetadata matching the query
+ * @method CcWebstreamMetadata findOneOrCreate(PropelPDO $con = null) Return the first CcWebstreamMetadata matching the query, or a new CcWebstreamMetadata object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcWebstreamMetadata objects filtered by the id column
- * @method array findByDbInstanceId(int $instance_id) Return CcWebstreamMetadata objects filtered by the instance_id column
- * @method array findByDbStartTime(string $start_time) Return CcWebstreamMetadata objects filtered by the start_time column
- * @method array findByDbLiquidsoapData(string $liquidsoap_data) Return CcWebstreamMetadata objects filtered by the liquidsoap_data column
+ * @method CcWebstreamMetadata findOneByDbInstanceId(int $instance_id) Return the first CcWebstreamMetadata filtered by the instance_id column
+ * @method CcWebstreamMetadata findOneByDbStartTime(string $start_time) Return the first CcWebstreamMetadata filtered by the start_time column
+ * @method CcWebstreamMetadata findOneByDbLiquidsoapData(string $liquidsoap_data) Return the first CcWebstreamMetadata filtered by the liquidsoap_data column
+ *
+ * @method array findByDbId(int $id) Return CcWebstreamMetadata objects filtered by the id column
+ * @method array findByDbInstanceId(int $instance_id) Return CcWebstreamMetadata objects filtered by the instance_id column
+ * @method array findByDbStartTime(string $start_time) Return CcWebstreamMetadata objects filtered by the start_time column
+ * @method array findByDbLiquidsoapData(string $liquidsoap_data) Return CcWebstreamMetadata objects filtered by the liquidsoap_data column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcWebstreamMetadataQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcWebstreamMetadataQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcWebstreamMetadata';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcWebstreamMetadataQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcWebstreamMetadata', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcWebstreamMetadataQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcWebstreamMetadataQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcWebstreamMetadataQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcWebstreamMetadataQuery) {
+ return $criteria;
+ }
+ $query = new CcWebstreamMetadataQuery(null, null, $modelAlias);
- /**
- * Returns a new CcWebstreamMetadataQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcWebstreamMetadataQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcWebstreamMetadataQuery) {
- return $criteria;
- }
- $query = new CcWebstreamMetadataQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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 CcWebstreamMetadata|array|mixed the result, formatted by the current formatter
- */
- public function findPk($key, $con = null)
- {
- if ((null !== ($obj = CcWebstreamMetadataPeer::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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcWebstreamMetadata|CcWebstreamMetadata[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcWebstreamMetadataPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcWebstreamMetadataPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
- /**
- * Filter the query by primary key
- *
- * @param mixed $key Primary key to use for the query
- *
- * @return CcWebstreamMetadataQuery The current query, for fluid interface
- */
- public function filterByPrimaryKey($key)
- {
- return $this->addUsingAlias(CcWebstreamMetadataPeer::ID, $key, Criteria::EQUAL);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcWebstreamMetadata A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * Filter the query by a list of primary keys
- *
- * @param array $keys The list of primary key to use for the query
- *
- * @return CcWebstreamMetadataQuery The current query, for fluid interface
- */
- public function filterByPrimaryKeys($keys)
- {
- return $this->addUsingAlias(CcWebstreamMetadataPeer::ID, $keys, Criteria::IN);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcWebstreamMetadata A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "instance_id", "start_time", "liquidsoap_data" FROM "cc_webstream_metadata" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcWebstreamMetadata();
+ $obj->hydrate($row);
+ CcWebstreamMetadataPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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 CcWebstreamMetadataQuery 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(CcWebstreamMetadataPeer::ID, $dbId, $comparison);
- }
+ return $obj;
+ }
- /**
- * 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 CcWebstreamMetadataQuery 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(CcWebstreamMetadataPeer::INSTANCE_ID, $dbInstanceId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbInstanceId['max'])) {
- $this->addUsingAlias(CcWebstreamMetadataPeer::INSTANCE_ID, $dbInstanceId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcWebstreamMetadataPeer::INSTANCE_ID, $dbInstanceId, $comparison);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcWebstreamMetadata|CcWebstreamMetadata[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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 CcWebstreamMetadataQuery 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(CcWebstreamMetadataPeer::START_TIME, $dbStartTime['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbStartTime['max'])) {
- $this->addUsingAlias(CcWebstreamMetadataPeer::START_TIME, $dbStartTime['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcWebstreamMetadataPeer::START_TIME, $dbStartTime, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * Filter the query on the liquidsoap_data column
- *
- * @param string $dbLiquidsoapData 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 CcWebstreamMetadataQuery The current query, for fluid interface
- */
- public function filterByDbLiquidsoapData($dbLiquidsoapData = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbLiquidsoapData)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbLiquidsoapData)) {
- $dbLiquidsoapData = str_replace('*', '%', $dbLiquidsoapData);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcWebstreamMetadataPeer::LIQUIDSOAP_DATA, $dbLiquidsoapData, $comparison);
- }
+ /**
+ * 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|CcWebstreamMetadata[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * 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 CcWebstreamMetadataQuery The current query, for fluid interface
- */
- public function filterByCcSchedule($ccSchedule, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcWebstreamMetadataPeer::INSTANCE_ID, $ccSchedule->getDbId(), $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * 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 CcWebstreamMetadataQuery 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;
- }
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcWebstreamMetadataQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
- /**
- * 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');
- }
+ return $this->addUsingAlias(CcWebstreamMetadataPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * Exclude object from result
- *
- * @param CcWebstreamMetadata $ccWebstreamMetadata Object to remove from the list of results
- *
- * @return CcWebstreamMetadataQuery The current query, for fluid interface
- */
- public function prune($ccWebstreamMetadata = null)
- {
- if ($ccWebstreamMetadata) {
- $this->addUsingAlias(CcWebstreamMetadataPeer::ID, $ccWebstreamMetadata->getDbId(), Criteria::NOT_EQUAL);
- }
-
- return $this;
- }
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcWebstreamMetadataQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
-} // BaseCcWebstreamMetadataQuery
+ return $this->addUsingAlias(CcWebstreamMetadataPeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcWebstreamMetadataQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcWebstreamMetadataPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcWebstreamMetadataPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcWebstreamMetadataPeer::ID, $dbId, $comparison);
+ }
+
+ /**
+ * Filter the query on the instance_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbInstanceId(1234); // WHERE instance_id = 1234
+ * $query->filterByDbInstanceId(array(12, 34)); // WHERE instance_id IN (12, 34)
+ * $query->filterByDbInstanceId(array('min' => 12)); // WHERE instance_id >= 12
+ * $query->filterByDbInstanceId(array('max' => 12)); // WHERE instance_id <= 12
+ *
+ *
+ * @see filterByCcSchedule()
+ *
+ * @param mixed $dbInstanceId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcWebstreamMetadataQuery 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(CcWebstreamMetadataPeer::INSTANCE_ID, $dbInstanceId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbInstanceId['max'])) {
+ $this->addUsingAlias(CcWebstreamMetadataPeer::INSTANCE_ID, $dbInstanceId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcWebstreamMetadataPeer::INSTANCE_ID, $dbInstanceId, $comparison);
+ }
+
+ /**
+ * Filter the query on the start_time column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbStartTime('2011-03-14'); // WHERE start_time = '2011-03-14'
+ * $query->filterByDbStartTime('now'); // WHERE start_time = '2011-03-14'
+ * $query->filterByDbStartTime(array('max' => 'yesterday')); // WHERE start_time < '2011-03-13'
+ *
+ *
+ * @param mixed $dbStartTime The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcWebstreamMetadataQuery 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(CcWebstreamMetadataPeer::START_TIME, $dbStartTime['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbStartTime['max'])) {
+ $this->addUsingAlias(CcWebstreamMetadataPeer::START_TIME, $dbStartTime['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcWebstreamMetadataPeer::START_TIME, $dbStartTime, $comparison);
+ }
+
+ /**
+ * Filter the query on the liquidsoap_data column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLiquidsoapData('fooValue'); // WHERE liquidsoap_data = 'fooValue'
+ * $query->filterByDbLiquidsoapData('%fooValue%'); // WHERE liquidsoap_data LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbLiquidsoapData 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 CcWebstreamMetadataQuery The current query, for fluid interface
+ */
+ public function filterByDbLiquidsoapData($dbLiquidsoapData = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbLiquidsoapData)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbLiquidsoapData)) {
+ $dbLiquidsoapData = str_replace('*', '%', $dbLiquidsoapData);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcWebstreamMetadataPeer::LIQUIDSOAP_DATA, $dbLiquidsoapData, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcSchedule object
+ *
+ * @param CcSchedule|PropelObjectCollection $ccSchedule The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcWebstreamMetadataQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcSchedule($ccSchedule, $comparison = null)
+ {
+ if ($ccSchedule instanceof CcSchedule) {
+ return $this
+ ->addUsingAlias(CcWebstreamMetadataPeer::INSTANCE_ID, $ccSchedule->getDbId(), $comparison);
+ } elseif ($ccSchedule instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CcWebstreamMetadataPeer::INSTANCE_ID, $ccSchedule->toKeyValue('PrimaryKey', 'DbId'), $comparison);
+ } else {
+ throw new PropelException('filterByCcSchedule() only accepts arguments of type CcSchedule or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 CcWebstreamMetadataQuery The current query, for fluid interface
+ */
+ public function joinCcSchedule($relationAlias = null, $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 = null, $joinType = Criteria::INNER_JOIN)
+ {
+ return $this
+ ->joinCcSchedule($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcWebstreamMetadata $ccWebstreamMetadata Object to remove from the list of results
+ *
+ * @return CcWebstreamMetadataQuery The current query, for fluid interface
+ */
+ public function prune($ccWebstreamMetadata = null)
+ {
+ if ($ccWebstreamMetadata) {
+ $this->addUsingAlias(CcWebstreamMetadataPeer::ID, $ccWebstreamMetadata->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcWebstreamPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcWebstreamPeer.php
index c1b2f7221..6c4dedf93 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcWebstreamPeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcWebstreamPeer.php
@@ -4,775 +4,797 @@
/**
* Base static class for performing query and update operations on the 'cc_webstream' table.
*
- *
*
- * @package propel.generator.airtime.om
+ *
+ * @package propel.generator.airtime.om
*/
-abstract class BaseCcWebstreamPeer {
-
- /** the default database name for this class */
- const DATABASE_NAME = 'airtime';
-
- /** the table name for this class */
- const TABLE_NAME = 'cc_webstream';
-
- /** the related Propel class for this table */
- const OM_CLASS = 'CcWebstream';
-
- /** A class that can be returned by this peer. */
- const CLASS_DEFAULT = 'airtime.CcWebstream';
-
- /** the related TableMap class for this table */
- const TM_CLASS = 'CcWebstreamTableMap';
-
- /** The total number of columns. */
- const NUM_COLUMNS = 10;
-
- /** The number of lazy-loaded columns. */
- const NUM_LAZY_LOAD_COLUMNS = 0;
-
- /** the column name for the ID field */
- const ID = 'cc_webstream.ID';
-
- /** the column name for the NAME field */
- const NAME = 'cc_webstream.NAME';
-
- /** the column name for the DESCRIPTION field */
- const DESCRIPTION = 'cc_webstream.DESCRIPTION';
-
- /** the column name for the URL field */
- const URL = 'cc_webstream.URL';
-
- /** the column name for the LENGTH field */
- const LENGTH = 'cc_webstream.LENGTH';
-
- /** the column name for the CREATOR_ID field */
- const CREATOR_ID = 'cc_webstream.CREATOR_ID';
-
- /** the column name for the MTIME field */
- const MTIME = 'cc_webstream.MTIME';
-
- /** the column name for the UTIME field */
- const UTIME = 'cc_webstream.UTIME';
-
- /** the column name for the LPTIME field */
- const LPTIME = 'cc_webstream.LPTIME';
-
- /** the column name for the MIME field */
- const MIME = 'cc_webstream.MIME';
-
- /**
- * An identiy map to hold any loaded instances of CcWebstream objects.
- * This must be public so that other peer classes can access this when hydrating from JOIN
- * queries.
- * @var array CcWebstream[]
- */
- public static $instances = array();
-
-
- /**
- * holds an array of fieldnames
- *
- * first dimension keys are the type constants
- * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
- */
- private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbDescription', 'DbUrl', 'DbLength', 'DbCreatorId', 'DbMtime', 'DbUtime', 'DbLPtime', 'DbMime', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbDescription', 'dbUrl', 'dbLength', 'dbCreatorId', 'dbMtime', 'dbUtime', 'dbLPtime', 'dbMime', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::DESCRIPTION, self::URL, self::LENGTH, self::CREATOR_ID, self::MTIME, self::UTIME, self::LPTIME, self::MIME, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'DESCRIPTION', 'URL', 'LENGTH', 'CREATOR_ID', 'MTIME', 'UTIME', 'LPTIME', 'MIME', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'description', 'url', 'length', 'creator_id', 'mtime', 'utime', 'lptime', 'mime', ),
- 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, 'DbName' => 1, 'DbDescription' => 2, 'DbUrl' => 3, 'DbLength' => 4, 'DbCreatorId' => 5, 'DbMtime' => 6, 'DbUtime' => 7, 'DbLPtime' => 8, 'DbMime' => 9, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbDescription' => 2, 'dbUrl' => 3, 'dbLength' => 4, 'dbCreatorId' => 5, 'dbMtime' => 6, 'dbUtime' => 7, 'dbLPtime' => 8, 'dbMime' => 9, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::DESCRIPTION => 2, self::URL => 3, self::LENGTH => 4, self::CREATOR_ID => 5, self::MTIME => 6, self::UTIME => 7, self::LPTIME => 8, self::MIME => 9, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'DESCRIPTION' => 2, 'URL' => 3, 'LENGTH' => 4, 'CREATOR_ID' => 5, 'MTIME' => 6, 'UTIME' => 7, 'LPTIME' => 8, 'MIME' => 9, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'description' => 2, 'url' => 3, 'length' => 4, 'creator_id' => 5, 'mtime' => 6, 'utime' => 7, 'lptime' => 8, 'mime' => 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. CcWebstreamPeer::COLUMN_NAME).
- * @return string
- */
- public static function alias($alias, $column)
- {
- return str_replace(CcWebstreamPeer::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(CcWebstreamPeer::ID);
- $criteria->addSelectColumn(CcWebstreamPeer::NAME);
- $criteria->addSelectColumn(CcWebstreamPeer::DESCRIPTION);
- $criteria->addSelectColumn(CcWebstreamPeer::URL);
- $criteria->addSelectColumn(CcWebstreamPeer::LENGTH);
- $criteria->addSelectColumn(CcWebstreamPeer::CREATOR_ID);
- $criteria->addSelectColumn(CcWebstreamPeer::MTIME);
- $criteria->addSelectColumn(CcWebstreamPeer::UTIME);
- $criteria->addSelectColumn(CcWebstreamPeer::LPTIME);
- $criteria->addSelectColumn(CcWebstreamPeer::MIME);
- } else {
- $criteria->addSelectColumn($alias . '.ID');
- $criteria->addSelectColumn($alias . '.NAME');
- $criteria->addSelectColumn($alias . '.DESCRIPTION');
- $criteria->addSelectColumn($alias . '.URL');
- $criteria->addSelectColumn($alias . '.LENGTH');
- $criteria->addSelectColumn($alias . '.CREATOR_ID');
- $criteria->addSelectColumn($alias . '.MTIME');
- $criteria->addSelectColumn($alias . '.UTIME');
- $criteria->addSelectColumn($alias . '.LPTIME');
- $criteria->addSelectColumn($alias . '.MIME');
- }
- }
-
- /**
- * 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(CcWebstreamPeer::TABLE_NAME);
-
- if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
- $criteria->setDistinct();
- }
-
- if (!$criteria->hasSelectClause()) {
- CcWebstreamPeer::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(CcWebstreamPeer::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 CcWebstream
- * @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 = CcWebstreamPeer::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 CcWebstreamPeer::populateObjects(CcWebstreamPeer::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(CcWebstreamPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- if (!$criteria->hasSelectClause()) {
- $criteria = clone $criteria;
- CcWebstreamPeer::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 CcWebstream $value A CcWebstream object.
- * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
- */
- public static function addInstanceToPool(CcWebstream $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 CcWebstream object or a primary key value.
- */
- public static function removeInstanceFromPool($value)
- {
- if (Propel::isInstancePoolingEnabled() && $value !== null) {
- if (is_object($value) && $value instanceof CcWebstream) {
- $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 CcWebstream 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 CcWebstream 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_webstream
- * by a foreign key with ON DELETE CASCADE
- */
- public static function clearRelatedInstancePool()
- {
- // 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 = CcWebstreamPeer::getOMClass(false);
- // populate the object(s)
- while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
- $key = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, 0);
- if (null !== ($obj = CcWebstreamPeer::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;
- CcWebstreamPeer::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 (CcWebstream object, last column rank)
- */
- public static function populateObject($row, $startcol = 0)
- {
- $key = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, $startcol);
- if (null !== ($obj = CcWebstreamPeer::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 + CcWebstreamPeer::NUM_COLUMNS;
- } else {
- $cls = CcWebstreamPeer::OM_CLASS;
- $obj = new $cls();
- $col = $obj->hydrate($row, $startcol);
- CcWebstreamPeer::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(BaseCcWebstreamPeer::DATABASE_NAME);
- if (!$dbMap->hasTable(BaseCcWebstreamPeer::TABLE_NAME))
- {
- $dbMap->addTableObject(new CcWebstreamTableMap());
- }
- }
-
- /**
- * 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 ? CcWebstreamPeer::CLASS_DEFAULT : CcWebstreamPeer::OM_CLASS;
- }
-
- /**
- * Method perform an INSERT on the database, given a CcWebstream or Criteria object.
- *
- * @param mixed $values Criteria or CcWebstream 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(CcWebstreamPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
- } else {
- $criteria = $values->buildCriteria(); // build Criteria from CcWebstream object
- }
-
- if ($criteria->containsKey(CcWebstreamPeer::ID) && $criteria->keyContainsValue(CcWebstreamPeer::ID) ) {
- throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcWebstreamPeer::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 CcWebstream or Criteria object.
- *
- * @param mixed $values Criteria or CcWebstream 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(CcWebstreamPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $selectCriteria = new Criteria(self::DATABASE_NAME);
-
- if ($values instanceof Criteria) {
- $criteria = clone $values; // rename for clarity
-
- $comparison = $criteria->getComparison(CcWebstreamPeer::ID);
- $value = $criteria->remove(CcWebstreamPeer::ID);
- if ($value) {
- $selectCriteria->add(CcWebstreamPeer::ID, $value, $comparison);
- } else {
- $selectCriteria->setPrimaryTableName(CcWebstreamPeer::TABLE_NAME);
- }
-
- } else { // $values is CcWebstream 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_webstream 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(CcWebstreamPeer::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(CcWebstreamPeer::TABLE_NAME, $con, CcWebstreamPeer::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).
- CcWebstreamPeer::clearInstancePool();
- CcWebstreamPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Method perform a DELETE on the database, given a CcWebstream or Criteria object OR a primary key value.
- *
- * @param mixed $values Criteria or CcWebstream 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(CcWebstreamPeer::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.
- CcWebstreamPeer::clearInstancePool();
- // rename for clarity
- $criteria = clone $values;
- } elseif ($values instanceof CcWebstream) { // it's a model object
- // invalidate the cache for this single object
- CcWebstreamPeer::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(CcWebstreamPeer::ID, (array) $values, Criteria::IN);
- // invalidate the cache for this object(s)
- foreach ((array) $values as $singleval) {
- CcWebstreamPeer::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);
- CcWebstreamPeer::clearRelatedInstancePool();
- $con->commit();
- return $affectedRows;
- } catch (PropelException $e) {
- $con->rollBack();
- throw $e;
- }
- }
-
- /**
- * Validates all modified columns of given CcWebstream 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 CcWebstream $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(CcWebstream $obj, $cols = null)
- {
- $columns = array();
-
- if ($cols) {
- $dbMap = Propel::getDatabaseMap(CcWebstreamPeer::DATABASE_NAME);
- $tableMap = $dbMap->getTable(CcWebstreamPeer::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(CcWebstreamPeer::DATABASE_NAME, CcWebstreamPeer::TABLE_NAME, $columns);
- }
-
- /**
- * Retrieve a single object by pkey.
- *
- * @param int $pk the primary key.
- * @param PropelPDO $con the connection to use
- * @return CcWebstream
- */
- public static function retrieveByPK($pk, PropelPDO $con = null)
- {
-
- if (null !== ($obj = CcWebstreamPeer::getInstanceFromPool((string) $pk))) {
- return $obj;
- }
-
- if ($con === null) {
- $con = Propel::getConnection(CcWebstreamPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $criteria = new Criteria(CcWebstreamPeer::DATABASE_NAME);
- $criteria->add(CcWebstreamPeer::ID, $pk);
-
- $v = CcWebstreamPeer::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(CcWebstreamPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $objs = null;
- if (empty($pks)) {
- $objs = array();
- } else {
- $criteria = new Criteria(CcWebstreamPeer::DATABASE_NAME);
- $criteria->add(CcWebstreamPeer::ID, $pks, Criteria::IN);
- $objs = CcWebstreamPeer::doSelect($criteria, $con);
- }
- return $objs;
- }
+abstract class BaseCcWebstreamPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'airtime';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'cc_webstream';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'CcWebstream';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'CcWebstreamTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 10;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 10;
+
+ /** the column name for the id field */
+ const ID = 'cc_webstream.id';
+
+ /** the column name for the name field */
+ const NAME = 'cc_webstream.name';
+
+ /** the column name for the description field */
+ const DESCRIPTION = 'cc_webstream.description';
+
+ /** the column name for the url field */
+ const URL = 'cc_webstream.url';
+
+ /** the column name for the length field */
+ const LENGTH = 'cc_webstream.length';
+
+ /** the column name for the creator_id field */
+ const CREATOR_ID = 'cc_webstream.creator_id';
+
+ /** the column name for the mtime field */
+ const MTIME = 'cc_webstream.mtime';
+
+ /** the column name for the utime field */
+ const UTIME = 'cc_webstream.utime';
+
+ /** the column name for the lptime field */
+ const LPTIME = 'cc_webstream.lptime';
+
+ /** the column name for the mime field */
+ const MIME = 'cc_webstream.mime';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of CcWebstream objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array CcWebstream[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. CcWebstreamPeer::$fieldNames[CcWebstreamPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbDescription', 'DbUrl', 'DbLength', 'DbCreatorId', 'DbMtime', 'DbUtime', 'DbLPtime', 'DbMime', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbDescription', 'dbUrl', 'dbLength', 'dbCreatorId', 'dbMtime', 'dbUtime', 'dbLPtime', 'dbMime', ),
+ BasePeer::TYPE_COLNAME => array (CcWebstreamPeer::ID, CcWebstreamPeer::NAME, CcWebstreamPeer::DESCRIPTION, CcWebstreamPeer::URL, CcWebstreamPeer::LENGTH, CcWebstreamPeer::CREATOR_ID, CcWebstreamPeer::MTIME, CcWebstreamPeer::UTIME, CcWebstreamPeer::LPTIME, CcWebstreamPeer::MIME, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'DESCRIPTION', 'URL', 'LENGTH', 'CREATOR_ID', 'MTIME', 'UTIME', 'LPTIME', 'MIME', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'description', 'url', 'length', 'creator_id', 'mtime', 'utime', 'lptime', 'mime', ),
+ 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. CcWebstreamPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbDescription' => 2, 'DbUrl' => 3, 'DbLength' => 4, 'DbCreatorId' => 5, 'DbMtime' => 6, 'DbUtime' => 7, 'DbLPtime' => 8, 'DbMime' => 9, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbDescription' => 2, 'dbUrl' => 3, 'dbLength' => 4, 'dbCreatorId' => 5, 'dbMtime' => 6, 'dbUtime' => 7, 'dbLPtime' => 8, 'dbMime' => 9, ),
+ BasePeer::TYPE_COLNAME => array (CcWebstreamPeer::ID => 0, CcWebstreamPeer::NAME => 1, CcWebstreamPeer::DESCRIPTION => 2, CcWebstreamPeer::URL => 3, CcWebstreamPeer::LENGTH => 4, CcWebstreamPeer::CREATOR_ID => 5, CcWebstreamPeer::MTIME => 6, CcWebstreamPeer::UTIME => 7, CcWebstreamPeer::LPTIME => 8, CcWebstreamPeer::MIME => 9, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'DESCRIPTION' => 2, 'URL' => 3, 'LENGTH' => 4, 'CREATOR_ID' => 5, 'MTIME' => 6, 'UTIME' => 7, 'LPTIME' => 8, 'MIME' => 9, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'description' => 2, 'url' => 3, 'length' => 4, 'creator_id' => 5, 'mtime' => 6, 'utime' => 7, 'lptime' => 8, 'mime' => 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.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CcWebstreamPeer::getFieldNames($toType);
+ $key = isset(CcWebstreamPeer::$fieldKeys[$fromType][$name]) ? CcWebstreamPeer::$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(CcWebstreamPeer::$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
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CcWebstreamPeer::$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 CcWebstreamPeer::$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. CcWebstreamPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CcWebstreamPeer::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(CcWebstreamPeer::ID);
+ $criteria->addSelectColumn(CcWebstreamPeer::NAME);
+ $criteria->addSelectColumn(CcWebstreamPeer::DESCRIPTION);
+ $criteria->addSelectColumn(CcWebstreamPeer::URL);
+ $criteria->addSelectColumn(CcWebstreamPeer::LENGTH);
+ $criteria->addSelectColumn(CcWebstreamPeer::CREATOR_ID);
+ $criteria->addSelectColumn(CcWebstreamPeer::MTIME);
+ $criteria->addSelectColumn(CcWebstreamPeer::UTIME);
+ $criteria->addSelectColumn(CcWebstreamPeer::LPTIME);
+ $criteria->addSelectColumn(CcWebstreamPeer::MIME);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.name');
+ $criteria->addSelectColumn($alias . '.description');
+ $criteria->addSelectColumn($alias . '.url');
+ $criteria->addSelectColumn($alias . '.length');
+ $criteria->addSelectColumn($alias . '.creator_id');
+ $criteria->addSelectColumn($alias . '.mtime');
+ $criteria->addSelectColumn($alias . '.utime');
+ $criteria->addSelectColumn($alias . '.lptime');
+ $criteria->addSelectColumn($alias . '.mime');
+ }
+ }
+
+ /**
+ * 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(CcWebstreamPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CcWebstreamPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(CcWebstreamPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcWebstreamPeer::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;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CcWebstream
+ * @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 = CcWebstreamPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @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 CcWebstreamPeer::populateObjects(CcWebstreamPeer::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 directly (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(CcWebstreamPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CcWebstreamPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcWebstreamPeer::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 CcWebstream $obj A CcWebstream object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getDbId();
+ } // if key === null
+ CcWebstreamPeer::$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 CcWebstream object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CcWebstream) {
+ $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 CcWebstream object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(CcWebstreamPeer::$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 CcWebstream 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(CcWebstreamPeer::$instances[$key])) {
+ return CcWebstreamPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (CcWebstreamPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ CcWebstreamPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to cc_webstream
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ // 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 = CcWebstreamPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CcWebstreamPeer::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;
+ CcWebstreamPeer::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 (CcWebstream object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CcWebstreamPeer::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 + CcWebstreamPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = CcWebstreamPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CcWebstreamPeer::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(CcWebstreamPeer::DATABASE_NAME)->getTable(CcWebstreamPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCcWebstreamPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCcWebstreamPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \CcWebstreamTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return CcWebstreamPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a CcWebstream or Criteria object.
+ *
+ * @param mixed $values Criteria or CcWebstream 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(CcWebstreamPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CcWebstream object
+ }
+
+ if ($criteria->containsKey(CcWebstreamPeer::ID) && $criteria->keyContainsValue(CcWebstreamPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcWebstreamPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(CcWebstreamPeer::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 (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a CcWebstream or Criteria object.
+ *
+ * @param mixed $values Criteria or CcWebstream 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(CcWebstreamPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(CcWebstreamPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CcWebstreamPeer::ID);
+ $value = $criteria->remove(CcWebstreamPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CcWebstreamPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CcWebstreamPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CcWebstream object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(CcWebstreamPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the cc_webstream table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CcWebstreamPeer::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(CcWebstreamPeer::TABLE_NAME, $con, CcWebstreamPeer::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).
+ CcWebstreamPeer::clearInstancePool();
+ CcWebstreamPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a CcWebstream or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CcWebstream 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(CcWebstreamPeer::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.
+ CcWebstreamPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CcWebstream) { // it's a model object
+ // invalidate the cache for this single object
+ CcWebstreamPeer::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(CcWebstreamPeer::DATABASE_NAME);
+ $criteria->add(CcWebstreamPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ CcWebstreamPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CcWebstreamPeer::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);
+ CcWebstreamPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CcWebstream 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 CcWebstream $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($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CcWebstreamPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CcWebstreamPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CcWebstreamPeer::DATABASE_NAME, CcWebstreamPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return CcWebstream
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = CcWebstreamPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CcWebstreamPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(CcWebstreamPeer::DATABASE_NAME);
+ $criteria->add(CcWebstreamPeer::ID, $pk);
+
+ $v = CcWebstreamPeer::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
+ * @return CcWebstream[]
+ * @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(CcWebstreamPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(CcWebstreamPeer::DATABASE_NAME);
+ $criteria->add(CcWebstreamPeer::ID, $pks, Criteria::IN);
+ $objs = CcWebstreamPeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
} // BaseCcWebstreamPeer
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcWebstreamQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcWebstreamQuery.php
index 6f5becfb6..e9d2f2d02 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcWebstreamQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcWebstreamQuery.php
@@ -4,500 +4,703 @@
/**
* Base class that represents a query for the 'cc_webstream' table.
*
- *
*
- * @method CcWebstreamQuery orderByDbId($order = Criteria::ASC) Order by the id column
- * @method CcWebstreamQuery orderByDbName($order = Criteria::ASC) Order by the name column
- * @method CcWebstreamQuery orderByDbDescription($order = Criteria::ASC) Order by the description column
- * @method CcWebstreamQuery orderByDbUrl($order = Criteria::ASC) Order by the url column
- * @method CcWebstreamQuery orderByDbLength($order = Criteria::ASC) Order by the length column
- * @method CcWebstreamQuery orderByDbCreatorId($order = Criteria::ASC) Order by the creator_id column
- * @method CcWebstreamQuery orderByDbMtime($order = Criteria::ASC) Order by the mtime column
- * @method CcWebstreamQuery orderByDbUtime($order = Criteria::ASC) Order by the utime column
- * @method CcWebstreamQuery orderByDbLPtime($order = Criteria::ASC) Order by the lptime column
- * @method CcWebstreamQuery orderByDbMime($order = Criteria::ASC) Order by the mime column
*
- * @method CcWebstreamQuery groupByDbId() Group by the id column
- * @method CcWebstreamQuery groupByDbName() Group by the name column
- * @method CcWebstreamQuery groupByDbDescription() Group by the description column
- * @method CcWebstreamQuery groupByDbUrl() Group by the url column
- * @method CcWebstreamQuery groupByDbLength() Group by the length column
- * @method CcWebstreamQuery groupByDbCreatorId() Group by the creator_id column
- * @method CcWebstreamQuery groupByDbMtime() Group by the mtime column
- * @method CcWebstreamQuery groupByDbUtime() Group by the utime column
- * @method CcWebstreamQuery groupByDbLPtime() Group by the lptime column
- * @method CcWebstreamQuery groupByDbMime() Group by the mime column
+ * @method CcWebstreamQuery orderByDbId($order = Criteria::ASC) Order by the id column
+ * @method CcWebstreamQuery orderByDbName($order = Criteria::ASC) Order by the name column
+ * @method CcWebstreamQuery orderByDbDescription($order = Criteria::ASC) Order by the description column
+ * @method CcWebstreamQuery orderByDbUrl($order = Criteria::ASC) Order by the url column
+ * @method CcWebstreamQuery orderByDbLength($order = Criteria::ASC) Order by the length column
+ * @method CcWebstreamQuery orderByDbCreatorId($order = Criteria::ASC) Order by the creator_id column
+ * @method CcWebstreamQuery orderByDbMtime($order = Criteria::ASC) Order by the mtime column
+ * @method CcWebstreamQuery orderByDbUtime($order = Criteria::ASC) Order by the utime column
+ * @method CcWebstreamQuery orderByDbLPtime($order = Criteria::ASC) Order by the lptime column
+ * @method CcWebstreamQuery orderByDbMime($order = Criteria::ASC) Order by the mime column
*
- * @method CcWebstreamQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
- * @method CcWebstreamQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
- * @method CcWebstreamQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ * @method CcWebstreamQuery groupByDbId() Group by the id column
+ * @method CcWebstreamQuery groupByDbName() Group by the name column
+ * @method CcWebstreamQuery groupByDbDescription() Group by the description column
+ * @method CcWebstreamQuery groupByDbUrl() Group by the url column
+ * @method CcWebstreamQuery groupByDbLength() Group by the length column
+ * @method CcWebstreamQuery groupByDbCreatorId() Group by the creator_id column
+ * @method CcWebstreamQuery groupByDbMtime() Group by the mtime column
+ * @method CcWebstreamQuery groupByDbUtime() Group by the utime column
+ * @method CcWebstreamQuery groupByDbLPtime() Group by the lptime column
+ * @method CcWebstreamQuery groupByDbMime() Group by the mime column
*
- * @method CcWebstreamQuery leftJoinCcSchedule($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSchedule relation
- * @method CcWebstreamQuery rightJoinCcSchedule($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSchedule relation
- * @method CcWebstreamQuery innerJoinCcSchedule($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSchedule relation
+ * @method CcWebstreamQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method CcWebstreamQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method CcWebstreamQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CcWebstream findOne(PropelPDO $con = null) Return the first CcWebstream matching the query
- * @method CcWebstream findOneOrCreate(PropelPDO $con = null) Return the first CcWebstream matching the query, or a new CcWebstream object populated from the query conditions when no match is found
+ * @method CcWebstreamQuery leftJoinCcSchedule($relationAlias = null) Adds a LEFT JOIN clause to the query using the CcSchedule relation
+ * @method CcWebstreamQuery rightJoinCcSchedule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CcSchedule relation
+ * @method CcWebstreamQuery innerJoinCcSchedule($relationAlias = null) Adds a INNER JOIN clause to the query using the CcSchedule relation
*
- * @method CcWebstream findOneByDbId(int $id) Return the first CcWebstream filtered by the id column
- * @method CcWebstream findOneByDbName(string $name) Return the first CcWebstream filtered by the name column
- * @method CcWebstream findOneByDbDescription(string $description) Return the first CcWebstream filtered by the description column
- * @method CcWebstream findOneByDbUrl(string $url) Return the first CcWebstream filtered by the url column
- * @method CcWebstream findOneByDbLength(string $length) Return the first CcWebstream filtered by the length column
- * @method CcWebstream findOneByDbCreatorId(int $creator_id) Return the first CcWebstream filtered by the creator_id column
- * @method CcWebstream findOneByDbMtime(string $mtime) Return the first CcWebstream filtered by the mtime column
- * @method CcWebstream findOneByDbUtime(string $utime) Return the first CcWebstream filtered by the utime column
- * @method CcWebstream findOneByDbLPtime(string $lptime) Return the first CcWebstream filtered by the lptime column
- * @method CcWebstream findOneByDbMime(string $mime) Return the first CcWebstream filtered by the mime column
+ * @method CcWebstream findOne(PropelPDO $con = null) Return the first CcWebstream matching the query
+ * @method CcWebstream findOneOrCreate(PropelPDO $con = null) Return the first CcWebstream matching the query, or a new CcWebstream object populated from the query conditions when no match is found
*
- * @method array findByDbId(int $id) Return CcWebstream objects filtered by the id column
- * @method array findByDbName(string $name) Return CcWebstream objects filtered by the name column
- * @method array findByDbDescription(string $description) Return CcWebstream objects filtered by the description column
- * @method array findByDbUrl(string $url) Return CcWebstream objects filtered by the url column
- * @method array findByDbLength(string $length) Return CcWebstream objects filtered by the length column
- * @method array findByDbCreatorId(int $creator_id) Return CcWebstream objects filtered by the creator_id column
- * @method array findByDbMtime(string $mtime) Return CcWebstream objects filtered by the mtime column
- * @method array findByDbUtime(string $utime) Return CcWebstream objects filtered by the utime column
- * @method array findByDbLPtime(string $lptime) Return CcWebstream objects filtered by the lptime column
- * @method array findByDbMime(string $mime) Return CcWebstream objects filtered by the mime column
+ * @method CcWebstream findOneByDbName(string $name) Return the first CcWebstream filtered by the name column
+ * @method CcWebstream findOneByDbDescription(string $description) Return the first CcWebstream filtered by the description column
+ * @method CcWebstream findOneByDbUrl(string $url) Return the first CcWebstream filtered by the url column
+ * @method CcWebstream findOneByDbLength(string $length) Return the first CcWebstream filtered by the length column
+ * @method CcWebstream findOneByDbCreatorId(int $creator_id) Return the first CcWebstream filtered by the creator_id column
+ * @method CcWebstream findOneByDbMtime(string $mtime) Return the first CcWebstream filtered by the mtime column
+ * @method CcWebstream findOneByDbUtime(string $utime) Return the first CcWebstream filtered by the utime column
+ * @method CcWebstream findOneByDbLPtime(string $lptime) Return the first CcWebstream filtered by the lptime column
+ * @method CcWebstream findOneByDbMime(string $mime) Return the first CcWebstream filtered by the mime column
+ *
+ * @method array findByDbId(int $id) Return CcWebstream objects filtered by the id column
+ * @method array findByDbName(string $name) Return CcWebstream objects filtered by the name column
+ * @method array findByDbDescription(string $description) Return CcWebstream objects filtered by the description column
+ * @method array findByDbUrl(string $url) Return CcWebstream objects filtered by the url column
+ * @method array findByDbLength(string $length) Return CcWebstream objects filtered by the length column
+ * @method array findByDbCreatorId(int $creator_id) Return CcWebstream objects filtered by the creator_id column
+ * @method array findByDbMtime(string $mtime) Return CcWebstream objects filtered by the mtime column
+ * @method array findByDbUtime(string $utime) Return CcWebstream objects filtered by the utime column
+ * @method array findByDbLPtime(string $lptime) Return CcWebstream objects filtered by the lptime column
+ * @method array findByDbMime(string $mime) Return CcWebstream objects filtered by the mime column
*
* @package propel.generator.airtime.om
*/
abstract class BaseCcWebstreamQuery extends ModelCriteria
{
+ /**
+ * Initializes internal state of BaseCcWebstreamQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'airtime';
+ }
+ if (null === $modelName) {
+ $modelName = 'CcWebstream';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
- /**
- * Initializes internal state of BaseCcWebstreamQuery object.
- *
- * @param string $dbName The dabase name
- * @param string $modelName The phpName of a model, e.g. 'Book'
- * @param string $modelAlias The alias for the model in this query, e.g. 'b'
- */
- public function __construct($dbName = 'airtime', $modelName = 'CcWebstream', $modelAlias = null)
- {
- parent::__construct($dbName, $modelName, $modelAlias);
- }
+ /**
+ * Returns a new CcWebstreamQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param CcWebstreamQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return CcWebstreamQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof CcWebstreamQuery) {
+ return $criteria;
+ }
+ $query = new CcWebstreamQuery(null, null, $modelAlias);
- /**
- * Returns a new CcWebstreamQuery object.
- *
- * @param string $modelAlias The alias of a model in the query
- * @param Criteria $criteria Optional Criteria to build the query from
- *
- * @return CcWebstreamQuery
- */
- public static function create($modelAlias = null, $criteria = null)
- {
- if ($criteria instanceof CcWebstreamQuery) {
- return $criteria;
- }
- $query = new CcWebstreamQuery();
- if (null !== $modelAlias) {
- $query->setModelAlias($modelAlias);
- }
- if ($criteria instanceof Criteria) {
- $query->mergeWith($criteria);
- }
- return $query;
- }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
- /**
- * 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 CcWebstream|array|mixed the result, formatted by the current formatter
- */
- public function findPk($key, $con = null)
- {
- if ((null !== ($obj = CcWebstreamPeer::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);
- }
- }
+ return $query;
+ }
- /**
- * 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);
- }
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(12, $con);
+ *
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CcWebstream|CcWebstream[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CcWebstreamPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CcWebstreamPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
- /**
- * Filter the query by primary key
- *
- * @param mixed $key Primary key to use for the query
- *
- * @return CcWebstreamQuery The current query, for fluid interface
- */
- public function filterByPrimaryKey($key)
- {
- return $this->addUsingAlias(CcWebstreamPeer::ID, $key, Criteria::EQUAL);
- }
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcWebstream A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneByDbId($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
- /**
- * Filter the query by a list of primary keys
- *
- * @param array $keys The list of primary key to use for the query
- *
- * @return CcWebstreamQuery The current query, for fluid interface
- */
- public function filterByPrimaryKeys($keys)
- {
- return $this->addUsingAlias(CcWebstreamPeer::ID, $keys, Criteria::IN);
- }
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcWebstream A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT "id", "name", "description", "url", "length", "creator_id", "mtime", "utime", "lptime", "mime" FROM "cc_webstream" WHERE "id" = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CcWebstream();
+ $obj->hydrate($row);
+ CcWebstreamPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
- /**
- * 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 CcWebstreamQuery 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(CcWebstreamPeer::ID, $dbId, $comparison);
- }
+ return $obj;
+ }
- /**
- * 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 CcWebstreamQuery 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(CcWebstreamPeer::NAME, $dbName, $comparison);
- }
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CcWebstream|CcWebstream[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
- /**
- * 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 CcWebstreamQuery 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(CcWebstreamPeer::DESCRIPTION, $dbDescription, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
- /**
- * 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 CcWebstreamQuery 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(CcWebstreamPeer::URL, $dbUrl, $comparison);
- }
+ /**
+ * 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|CcWebstream[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
- /**
- * Filter the query on the length column
- *
- * @param string $dbLength 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 CcWebstreamQuery The current query, for fluid interface
- */
- public function filterByDbLength($dbLength = null, $comparison = null)
- {
- if (null === $comparison) {
- if (is_array($dbLength)) {
- $comparison = Criteria::IN;
- } elseif (preg_match('/[\%\*]/', $dbLength)) {
- $dbLength = str_replace('*', '%', $dbLength);
- $comparison = Criteria::LIKE;
- }
- }
- return $this->addUsingAlias(CcWebstreamPeer::LENGTH, $dbLength, $comparison);
- }
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
- /**
- * Filter the query on the creator_id column
- *
- * @param int|array $dbCreatorId 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 CcWebstreamQuery The current query, for fluid interface
- */
- public function filterByDbCreatorId($dbCreatorId = null, $comparison = null)
- {
- if (is_array($dbCreatorId)) {
- $useMinMax = false;
- if (isset($dbCreatorId['min'])) {
- $this->addUsingAlias(CcWebstreamPeer::CREATOR_ID, $dbCreatorId['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbCreatorId['max'])) {
- $this->addUsingAlias(CcWebstreamPeer::CREATOR_ID, $dbCreatorId['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcWebstreamPeer::CREATOR_ID, $dbCreatorId, $comparison);
- }
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CcWebstreamQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
- /**
- * 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 CcWebstreamQuery 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(CcWebstreamPeer::MTIME, $dbMtime['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbMtime['max'])) {
- $this->addUsingAlias(CcWebstreamPeer::MTIME, $dbMtime['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcWebstreamPeer::MTIME, $dbMtime, $comparison);
- }
+ return $this->addUsingAlias(CcWebstreamPeer::ID, $key, Criteria::EQUAL);
+ }
- /**
- * Filter the query on the utime column
- *
- * @param string|array $dbUtime 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 CcWebstreamQuery The current query, for fluid interface
- */
- public function filterByDbUtime($dbUtime = null, $comparison = null)
- {
- if (is_array($dbUtime)) {
- $useMinMax = false;
- if (isset($dbUtime['min'])) {
- $this->addUsingAlias(CcWebstreamPeer::UTIME, $dbUtime['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbUtime['max'])) {
- $this->addUsingAlias(CcWebstreamPeer::UTIME, $dbUtime['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcWebstreamPeer::UTIME, $dbUtime, $comparison);
- }
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CcWebstreamQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
- /**
- * Filter the query on the lptime column
- *
- * @param string|array $dbLPtime 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 CcWebstreamQuery The current query, for fluid interface
- */
- public function filterByDbLPtime($dbLPtime = null, $comparison = null)
- {
- if (is_array($dbLPtime)) {
- $useMinMax = false;
- if (isset($dbLPtime['min'])) {
- $this->addUsingAlias(CcWebstreamPeer::LPTIME, $dbLPtime['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbLPtime['max'])) {
- $this->addUsingAlias(CcWebstreamPeer::LPTIME, $dbLPtime['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
- $comparison = Criteria::IN;
- }
- }
- return $this->addUsingAlias(CcWebstreamPeer::LPTIME, $dbLPtime, $comparison);
- }
+ return $this->addUsingAlias(CcWebstreamPeer::ID, $keys, Criteria::IN);
+ }
- /**
- * 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 CcWebstreamQuery 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(CcWebstreamPeer::MIME, $dbMime, $comparison);
- }
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbId(1234); // WHERE id = 1234
+ * $query->filterByDbId(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterByDbId(array('min' => 12)); // WHERE id >= 12
+ * $query->filterByDbId(array('max' => 12)); // WHERE id <= 12
+ *
+ *
+ * @param mixed $dbId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcWebstreamQuery The current query, for fluid interface
+ */
+ public function filterByDbId($dbId = null, $comparison = null)
+ {
+ if (is_array($dbId)) {
+ $useMinMax = false;
+ if (isset($dbId['min'])) {
+ $this->addUsingAlias(CcWebstreamPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbId['max'])) {
+ $this->addUsingAlias(CcWebstreamPeer::ID, $dbId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
- /**
- * 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 CcWebstreamQuery The current query, for fluid interface
- */
- public function filterByCcSchedule($ccSchedule, $comparison = null)
- {
- return $this
- ->addUsingAlias(CcWebstreamPeer::ID, $ccSchedule->getDbStreamId(), $comparison);
- }
+ return $this->addUsingAlias(CcWebstreamPeer::ID, $dbId, $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 CcWebstreamQuery 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;
- }
+ /**
+ * Filter the query on the name column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbName('fooValue'); // WHERE name = 'fooValue'
+ * $query->filterByDbName('%fooValue%'); // WHERE name LIKE '%fooValue%'
+ *
+ *
+ * @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 CcWebstreamQuery 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;
+ }
+ }
- /**
- * 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');
- }
+ return $this->addUsingAlias(CcWebstreamPeer::NAME, $dbName, $comparison);
+ }
- /**
- * Exclude object from result
- *
- * @param CcWebstream $ccWebstream Object to remove from the list of results
- *
- * @return CcWebstreamQuery The current query, for fluid interface
- */
- public function prune($ccWebstream = null)
- {
- if ($ccWebstream) {
- $this->addUsingAlias(CcWebstreamPeer::ID, $ccWebstream->getDbId(), Criteria::NOT_EQUAL);
- }
-
- return $this;
- }
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDbDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @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 CcWebstreamQuery 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;
+ }
+ }
-} // BaseCcWebstreamQuery
+ return $this->addUsingAlias(CcWebstreamPeer::DESCRIPTION, $dbDescription, $comparison);
+ }
+
+ /**
+ * Filter the query on the url column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbUrl('fooValue'); // WHERE url = 'fooValue'
+ * $query->filterByDbUrl('%fooValue%'); // WHERE url LIKE '%fooValue%'
+ *
+ *
+ * @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 CcWebstreamQuery 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(CcWebstreamPeer::URL, $dbUrl, $comparison);
+ }
+
+ /**
+ * Filter the query on the length column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLength('fooValue'); // WHERE length = 'fooValue'
+ * $query->filterByDbLength('%fooValue%'); // WHERE length LIKE '%fooValue%'
+ *
+ *
+ * @param string $dbLength 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 CcWebstreamQuery The current query, for fluid interface
+ */
+ public function filterByDbLength($dbLength = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($dbLength)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbLength)) {
+ $dbLength = str_replace('*', '%', $dbLength);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CcWebstreamPeer::LENGTH, $dbLength, $comparison);
+ }
+
+ /**
+ * Filter the query on the creator_id column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbCreatorId(1234); // WHERE creator_id = 1234
+ * $query->filterByDbCreatorId(array(12, 34)); // WHERE creator_id IN (12, 34)
+ * $query->filterByDbCreatorId(array('min' => 12)); // WHERE creator_id >= 12
+ * $query->filterByDbCreatorId(array('max' => 12)); // WHERE creator_id <= 12
+ *
+ *
+ * @param mixed $dbCreatorId The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcWebstreamQuery The current query, for fluid interface
+ */
+ public function filterByDbCreatorId($dbCreatorId = null, $comparison = null)
+ {
+ if (is_array($dbCreatorId)) {
+ $useMinMax = false;
+ if (isset($dbCreatorId['min'])) {
+ $this->addUsingAlias(CcWebstreamPeer::CREATOR_ID, $dbCreatorId['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbCreatorId['max'])) {
+ $this->addUsingAlias(CcWebstreamPeer::CREATOR_ID, $dbCreatorId['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcWebstreamPeer::CREATOR_ID, $dbCreatorId, $comparison);
+ }
+
+ /**
+ * Filter the query on the mtime column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbMtime('2011-03-14'); // WHERE mtime = '2011-03-14'
+ * $query->filterByDbMtime('now'); // WHERE mtime = '2011-03-14'
+ * $query->filterByDbMtime(array('max' => 'yesterday')); // WHERE mtime < '2011-03-13'
+ *
+ *
+ * @param mixed $dbMtime The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcWebstreamQuery 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(CcWebstreamPeer::MTIME, $dbMtime['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbMtime['max'])) {
+ $this->addUsingAlias(CcWebstreamPeer::MTIME, $dbMtime['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcWebstreamPeer::MTIME, $dbMtime, $comparison);
+ }
+
+ /**
+ * Filter the query on the utime column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbUtime('2011-03-14'); // WHERE utime = '2011-03-14'
+ * $query->filterByDbUtime('now'); // WHERE utime = '2011-03-14'
+ * $query->filterByDbUtime(array('max' => 'yesterday')); // WHERE utime < '2011-03-13'
+ *
+ *
+ * @param mixed $dbUtime The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcWebstreamQuery The current query, for fluid interface
+ */
+ public function filterByDbUtime($dbUtime = null, $comparison = null)
+ {
+ if (is_array($dbUtime)) {
+ $useMinMax = false;
+ if (isset($dbUtime['min'])) {
+ $this->addUsingAlias(CcWebstreamPeer::UTIME, $dbUtime['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbUtime['max'])) {
+ $this->addUsingAlias(CcWebstreamPeer::UTIME, $dbUtime['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcWebstreamPeer::UTIME, $dbUtime, $comparison);
+ }
+
+ /**
+ * Filter the query on the lptime column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbLPtime('2011-03-14'); // WHERE lptime = '2011-03-14'
+ * $query->filterByDbLPtime('now'); // WHERE lptime = '2011-03-14'
+ * $query->filterByDbLPtime(array('max' => 'yesterday')); // WHERE lptime < '2011-03-13'
+ *
+ *
+ * @param mixed $dbLPtime The value to use as filter.
+ * Values can be integers (unix timestamps), DateTime objects, or strings.
+ * Empty strings are treated as NULL.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcWebstreamQuery The current query, for fluid interface
+ */
+ public function filterByDbLPtime($dbLPtime = null, $comparison = null)
+ {
+ if (is_array($dbLPtime)) {
+ $useMinMax = false;
+ if (isset($dbLPtime['min'])) {
+ $this->addUsingAlias(CcWebstreamPeer::LPTIME, $dbLPtime['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbLPtime['max'])) {
+ $this->addUsingAlias(CcWebstreamPeer::LPTIME, $dbLPtime['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(CcWebstreamPeer::LPTIME, $dbLPtime, $comparison);
+ }
+
+ /**
+ * Filter the query on the mime column
+ *
+ * Example usage:
+ *
+ * $query->filterByDbMime('fooValue'); // WHERE mime = 'fooValue'
+ * $query->filterByDbMime('%fooValue%'); // WHERE mime LIKE '%fooValue%'
+ *
+ *
+ * @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 CcWebstreamQuery 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(CcWebstreamPeer::MIME, $dbMime, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CcSchedule object
+ *
+ * @param CcSchedule|PropelObjectCollection $ccSchedule the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CcWebstreamQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCcSchedule($ccSchedule, $comparison = null)
+ {
+ if ($ccSchedule instanceof CcSchedule) {
+ return $this
+ ->addUsingAlias(CcWebstreamPeer::ID, $ccSchedule->getDbStreamId(), $comparison);
+ } elseif ($ccSchedule instanceof PropelObjectCollection) {
+ return $this
+ ->useCcScheduleQuery()
+ ->filterByPrimaryKeys($ccSchedule->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCcSchedule() only accepts arguments of type CcSchedule or PropelCollection');
+ }
+ }
+
+ /**
+ * 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 CcWebstreamQuery The current query, for fluid interface
+ */
+ public function joinCcSchedule($relationAlias = null, $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 = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinCcSchedule($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CcWebstream $ccWebstream Object to remove from the list of results
+ *
+ * @return CcWebstreamQuery The current query, for fluid interface
+ */
+ public function prune($ccWebstream = null)
+ {
+ if ($ccWebstream) {
+ $this->addUsingAlias(CcWebstreamPeer::ID, $ccWebstream->getDbId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/airtime_mvc/build/sql/schema.sql b/airtime_mvc/build/sql/schema.sql
index 3ae4497a1..0ef5003d1 100644
--- a/airtime_mvc/build/sql/schema.sql
+++ b/airtime_mvc/build/sql/schema.sql
@@ -1,902 +1,825 @@
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_music_dirs
------------------------------------------------------------------------------
-
-DROP TABLE "cc_music_dirs" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_music_dirs" CASCADE;
CREATE TABLE "cc_music_dirs"
(
- "id" serial NOT NULL,
- "directory" TEXT,
- "type" VARCHAR(255),
- "exists" BOOLEAN default 't',
- "watched" BOOLEAN default 't',
- PRIMARY KEY ("id"),
- CONSTRAINT "cc_music_dir_unique" UNIQUE ("directory")
+ "id" serial NOT NULL,
+ "directory" TEXT,
+ "type" VARCHAR(255),
+ "exists" BOOLEAN DEFAULT 't',
+ "watched" BOOLEAN DEFAULT 't',
+ PRIMARY KEY ("id"),
+ CONSTRAINT "cc_music_dir_unique" UNIQUE ("directory")
);
-COMMENT ON TABLE "cc_music_dirs" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_files
------------------------------------------------------------------------------
-
-DROP TABLE "cc_files" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_files" CASCADE;
CREATE TABLE "cc_files"
(
- "id" serial NOT NULL,
- "name" VARCHAR(255) default '' NOT NULL,
- "mime" VARCHAR(255) default '' NOT NULL,
- "ftype" VARCHAR(128) default '' NOT NULL,
- "directory" INTEGER,
- "filepath" TEXT default '',
- "import_status" INTEGER default 1 NOT NULL,
- "currentlyaccessing" INTEGER default 0 NOT NULL,
- "editedby" INTEGER,
- "mtime" TIMESTAMP(6),
- "utime" TIMESTAMP(6),
- "lptime" TIMESTAMP(6),
- "md5" CHAR(32),
- "track_title" VARCHAR(512),
- "artist_name" VARCHAR(512),
- "bit_rate" INTEGER,
- "sample_rate" INTEGER,
- "format" VARCHAR(128),
- "length" interval default '00:00:00',
- "album_title" VARCHAR(512),
- "genre" VARCHAR(64),
- "comments" TEXT,
- "year" VARCHAR(16),
- "track_number" INTEGER,
- "channels" INTEGER,
- "url" VARCHAR(1024),
- "bpm" INTEGER,
- "rating" VARCHAR(8),
- "encoded_by" VARCHAR(255),
- "disc_number" VARCHAR(8),
- "mood" VARCHAR(64),
- "label" VARCHAR(512),
- "composer" VARCHAR(512),
- "encoder" VARCHAR(64),
- "checksum" VARCHAR(256),
- "lyrics" TEXT,
- "orchestra" VARCHAR(512),
- "conductor" VARCHAR(512),
- "lyricist" VARCHAR(512),
- "original_lyricist" VARCHAR(512),
- "radio_station_name" VARCHAR(512),
- "info_url" VARCHAR(512),
- "artist_url" VARCHAR(512),
- "audio_source_url" VARCHAR(512),
- "radio_station_url" VARCHAR(512),
- "buy_this_url" VARCHAR(512),
- "isrc_number" VARCHAR(512),
- "catalog_number" VARCHAR(512),
- "original_artist" VARCHAR(512),
- "copyright" VARCHAR(512),
- "report_datetime" VARCHAR(32),
- "report_location" VARCHAR(512),
- "report_organization" VARCHAR(512),
- "subject" VARCHAR(512),
- "contributor" VARCHAR(512),
- "language" VARCHAR(512),
- "file_exists" BOOLEAN default 't',
- "soundcloud_id" INTEGER,
- "soundcloud_error_code" INTEGER,
- "soundcloud_error_msg" VARCHAR(512),
- "soundcloud_link_to_file" VARCHAR(4096),
- "soundcloud_upload_time" TIMESTAMP(6),
- "replay_gain" NUMERIC,
- "owner_id" INTEGER,
- "cuein" interval default '00:00:00',
- "cueout" interval default '00:00:00',
- "silan_check" BOOLEAN default 'f',
- "hidden" BOOLEAN default 'f',
- "is_scheduled" BOOLEAN default 'f',
- "is_playlist" BOOLEAN default 'f',
- "resource_id" TEXT,
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "name" VARCHAR(255) DEFAULT '' NOT NULL,
+ "mime" VARCHAR(255) DEFAULT '' NOT NULL,
+ "ftype" VARCHAR(128) DEFAULT '' NOT NULL,
+ "directory" INTEGER,
+ "filepath" TEXT DEFAULT '',
+ "import_status" INTEGER DEFAULT 1 NOT NULL,
+ "currentlyaccessing" INTEGER DEFAULT 0 NOT NULL,
+ "editedby" INTEGER,
+ "mtime" TIMESTAMP(6),
+ "utime" TIMESTAMP(6),
+ "lptime" TIMESTAMP(6),
+ "md5" CHAR(32),
+ "track_title" VARCHAR(512),
+ "artist_name" VARCHAR(512),
+ "bit_rate" INTEGER,
+ "sample_rate" INTEGER,
+ "format" VARCHAR(128),
+ "length" interval DEFAULT '00:00:00',
+ "album_title" VARCHAR(512),
+ "genre" VARCHAR(64),
+ "comments" TEXT,
+ "year" VARCHAR(16),
+ "track_number" INTEGER,
+ "channels" INTEGER,
+ "url" VARCHAR(1024),
+ "bpm" INTEGER,
+ "rating" VARCHAR(8),
+ "encoded_by" VARCHAR(255),
+ "disc_number" VARCHAR(8),
+ "mood" VARCHAR(64),
+ "label" VARCHAR(512),
+ "composer" VARCHAR(512),
+ "encoder" VARCHAR(64),
+ "checksum" VARCHAR(256),
+ "lyrics" TEXT,
+ "orchestra" VARCHAR(512),
+ "conductor" VARCHAR(512),
+ "lyricist" VARCHAR(512),
+ "original_lyricist" VARCHAR(512),
+ "radio_station_name" VARCHAR(512),
+ "info_url" VARCHAR(512),
+ "artist_url" VARCHAR(512),
+ "audio_source_url" VARCHAR(512),
+ "radio_station_url" VARCHAR(512),
+ "buy_this_url" VARCHAR(512),
+ "isrc_number" VARCHAR(512),
+ "catalog_number" VARCHAR(512),
+ "original_artist" VARCHAR(512),
+ "copyright" VARCHAR(512),
+ "report_datetime" VARCHAR(32),
+ "report_location" VARCHAR(512),
+ "report_organization" VARCHAR(512),
+ "subject" VARCHAR(512),
+ "contributor" VARCHAR(512),
+ "language" VARCHAR(512),
+ "file_exists" BOOLEAN DEFAULT 't',
+ "soundcloud_id" INTEGER,
+ "soundcloud_error_code" INTEGER,
+ "soundcloud_error_msg" VARCHAR(512),
+ "soundcloud_link_to_file" VARCHAR(4096),
+ "soundcloud_upload_time" TIMESTAMP(6),
+ "replay_gain" NUMERIC,
+ "owner_id" INTEGER,
+ "cuein" interval DEFAULT '00:00:00',
+ "cueout" interval DEFAULT '00:00:00',
+ "silan_check" BOOLEAN DEFAULT 'f',
+ "hidden" BOOLEAN DEFAULT 'f',
+ "is_scheduled" BOOLEAN DEFAULT 'f',
+ "is_playlist" BOOLEAN DEFAULT 'f',
+ "resource_id" TEXT,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_files" IS '';
-
-
-SET search_path TO public;
CREATE INDEX "cc_files_md5_idx" ON "cc_files" ("md5");
CREATE INDEX "cc_files_name_idx" ON "cc_files" ("name");
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_perms
------------------------------------------------------------------------------
-
-DROP TABLE "cc_perms" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_perms" CASCADE;
CREATE TABLE "cc_perms"
(
- "permid" INTEGER NOT NULL,
- "subj" INTEGER,
- "action" VARCHAR(20),
- "obj" INTEGER,
- "type" CHAR(1),
- PRIMARY KEY ("permid"),
- CONSTRAINT "cc_perms_all_idx" UNIQUE ("subj","action","obj"),
- CONSTRAINT "cc_perms_permid_idx" UNIQUE ("permid")
+ "permid" INTEGER NOT NULL,
+ "subj" INTEGER,
+ "action" VARCHAR(20),
+ "obj" INTEGER,
+ "type" CHAR(1),
+ PRIMARY KEY ("permid"),
+ CONSTRAINT "cc_perms_all_idx" UNIQUE ("subj","action","obj"),
+ CONSTRAINT "cc_perms_permid_idx" UNIQUE ("permid")
);
-COMMENT ON TABLE "cc_perms" IS '';
-
-
-SET search_path TO public;
CREATE INDEX "cc_perms_subj_obj_idx" ON "cc_perms" ("subj","obj");
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_show
------------------------------------------------------------------------------
-
-DROP TABLE "cc_show" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_show" CASCADE;
CREATE TABLE "cc_show"
(
- "id" serial NOT NULL,
- "name" VARCHAR(255) default '' NOT NULL,
- "url" VARCHAR(255) default '',
- "genre" VARCHAR(255) default '',
- "description" VARCHAR(512),
- "color" VARCHAR(6),
- "background_color" VARCHAR(6),
- "live_stream_using_airtime_auth" BOOLEAN default 'f',
- "live_stream_using_custom_auth" BOOLEAN default 'f',
- "live_stream_user" VARCHAR(255),
- "live_stream_pass" VARCHAR(255),
- "linked" BOOLEAN default 'f' NOT NULL,
- "is_linkable" BOOLEAN default 't' NOT NULL,
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "name" VARCHAR(255) DEFAULT '' NOT NULL,
+ "url" VARCHAR(255) DEFAULT '',
+ "genre" VARCHAR(255) DEFAULT '',
+ "description" VARCHAR(512),
+ "color" VARCHAR(6),
+ "background_color" VARCHAR(6),
+ "live_stream_using_airtime_auth" BOOLEAN DEFAULT 'f',
+ "live_stream_using_custom_auth" BOOLEAN DEFAULT 'f',
+ "live_stream_user" VARCHAR(255),
+ "live_stream_pass" VARCHAR(255),
+ "linked" BOOLEAN DEFAULT 'f' NOT NULL,
+ "is_linkable" BOOLEAN DEFAULT 't' NOT NULL,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_show" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_show_instances
------------------------------------------------------------------------------
-
-DROP TABLE "cc_show_instances" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_show_instances" CASCADE;
CREATE TABLE "cc_show_instances"
(
- "id" serial NOT NULL,
- "starts" TIMESTAMP NOT NULL,
- "ends" TIMESTAMP NOT NULL,
- "show_id" INTEGER NOT NULL,
- "record" INT2 default 0,
- "rebroadcast" INT2 default 0,
- "instance_id" INTEGER,
- "file_id" INTEGER,
- "time_filled" interval default '00:00:00',
- "created" TIMESTAMP NOT NULL,
- "last_scheduled" TIMESTAMP,
- "modified_instance" BOOLEAN default 'f' NOT NULL,
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "starts" TIMESTAMP NOT NULL,
+ "ends" TIMESTAMP NOT NULL,
+ "show_id" INTEGER NOT NULL,
+ "record" INT2 DEFAULT 0,
+ "rebroadcast" INT2 DEFAULT 0,
+ "instance_id" INTEGER,
+ "file_id" INTEGER,
+ "time_filled" interval DEFAULT '00:00:00',
+ "created" TIMESTAMP NOT NULL,
+ "last_scheduled" TIMESTAMP,
+ "modified_instance" BOOLEAN DEFAULT 'f' NOT NULL,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_show_instances" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_show_days
------------------------------------------------------------------------------
-
-DROP TABLE "cc_show_days" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_show_days" CASCADE;
CREATE TABLE "cc_show_days"
(
- "id" serial NOT NULL,
- "first_show" DATE NOT NULL,
- "last_show" DATE,
- "start_time" TIME NOT NULL,
- "timezone" VARCHAR(255) NOT NULL,
- "duration" VARCHAR(255) NOT NULL,
- "day" INT2,
- "repeat_type" INT2 NOT NULL,
- "next_pop_date" DATE,
- "show_id" INTEGER NOT NULL,
- "record" INT2 default 0,
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "first_show" DATE NOT NULL,
+ "last_show" DATE,
+ "start_time" TIME NOT NULL,
+ "timezone" VARCHAR NOT NULL,
+ "duration" VARCHAR NOT NULL,
+ "day" INT2,
+ "repeat_type" INT2 NOT NULL,
+ "next_pop_date" DATE,
+ "show_id" INTEGER NOT NULL,
+ "record" INT2 DEFAULT 0,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_show_days" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_show_rebroadcast
------------------------------------------------------------------------------
-
-DROP TABLE "cc_show_rebroadcast" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_show_rebroadcast" CASCADE;
CREATE TABLE "cc_show_rebroadcast"
(
- "id" serial NOT NULL,
- "day_offset" VARCHAR(255) NOT NULL,
- "start_time" TIME NOT NULL,
- "show_id" INTEGER NOT NULL,
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "day_offset" VARCHAR NOT NULL,
+ "start_time" TIME NOT NULL,
+ "show_id" INTEGER NOT NULL,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_show_rebroadcast" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_show_hosts
------------------------------------------------------------------------------
-
-DROP TABLE "cc_show_hosts" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_show_hosts" CASCADE;
CREATE TABLE "cc_show_hosts"
(
- "id" serial NOT NULL,
- "show_id" INTEGER NOT NULL,
- "subjs_id" INTEGER NOT NULL,
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "show_id" INTEGER NOT NULL,
+ "subjs_id" INTEGER NOT NULL,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_show_hosts" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_playlist
------------------------------------------------------------------------------
-
-DROP TABLE "cc_playlist" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_playlist" CASCADE;
CREATE TABLE "cc_playlist"
(
- "id" serial NOT NULL,
- "name" VARCHAR(255) default '' NOT NULL,
- "mtime" TIMESTAMP(6),
- "utime" TIMESTAMP(6),
- "creator_id" INTEGER,
- "description" VARCHAR(512),
- "length" interval default '00:00:00',
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "name" VARCHAR(255) DEFAULT '' NOT NULL,
+ "mtime" TIMESTAMP(6),
+ "utime" TIMESTAMP(6),
+ "creator_id" INTEGER,
+ "description" VARCHAR(512),
+ "length" interval DEFAULT '00:00:00',
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_playlist" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_playlistcontents
------------------------------------------------------------------------------
-
-DROP TABLE "cc_playlistcontents" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_playlistcontents" CASCADE;
CREATE TABLE "cc_playlistcontents"
(
- "id" serial NOT NULL,
- "playlist_id" INTEGER,
- "file_id" INTEGER,
- "block_id" INTEGER,
- "stream_id" INTEGER,
- "type" INT2 default 0 NOT NULL,
- "position" INTEGER,
- "trackoffset" FLOAT default 0 NOT NULL,
- "cliplength" interval default '00:00:00',
- "cuein" interval default '00:00:00',
- "cueout" interval default '00:00:00',
- "fadein" TIME default '00:00:00',
- "fadeout" TIME default '00:00:00',
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "playlist_id" INTEGER,
+ "file_id" INTEGER,
+ "block_id" INTEGER,
+ "stream_id" INTEGER,
+ "type" INT2 DEFAULT 0 NOT NULL,
+ "position" INTEGER,
+ "trackoffset" FLOAT DEFAULT 0 NOT NULL,
+ "cliplength" interval DEFAULT '00:00:00',
+ "cuein" interval DEFAULT '00:00:00',
+ "cueout" interval DEFAULT '00:00:00',
+ "fadein" TIME DEFAULT '00:00:00',
+ "fadeout" TIME DEFAULT '00:00:00',
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_playlistcontents" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_block
------------------------------------------------------------------------------
-
-DROP TABLE "cc_block" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_block" CASCADE;
CREATE TABLE "cc_block"
(
- "id" serial NOT NULL,
- "name" VARCHAR(255) default '' NOT NULL,
- "mtime" TIMESTAMP(6),
- "utime" TIMESTAMP(6),
- "creator_id" INTEGER,
- "description" VARCHAR(512),
- "length" interval default '00:00:00',
- "type" VARCHAR(7) default 'static',
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "name" VARCHAR(255) DEFAULT '' NOT NULL,
+ "mtime" TIMESTAMP(6),
+ "utime" TIMESTAMP(6),
+ "creator_id" INTEGER,
+ "description" VARCHAR(512),
+ "length" interval DEFAULT '00:00:00',
+ "type" VARCHAR(7) DEFAULT 'static',
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_block" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_blockcontents
------------------------------------------------------------------------------
-
-DROP TABLE "cc_blockcontents" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_blockcontents" CASCADE;
CREATE TABLE "cc_blockcontents"
(
- "id" serial NOT NULL,
- "block_id" INTEGER,
- "file_id" INTEGER,
- "position" INTEGER,
- "trackoffset" FLOAT default 0 NOT NULL,
- "cliplength" interval default '00:00:00',
- "cuein" interval default '00:00:00',
- "cueout" interval default '00:00:00',
- "fadein" TIME default '00:00:00',
- "fadeout" TIME default '00:00:00',
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "block_id" INTEGER,
+ "file_id" INTEGER,
+ "position" INTEGER,
+ "trackoffset" FLOAT DEFAULT 0 NOT NULL,
+ "cliplength" interval DEFAULT '00:00:00',
+ "cuein" interval DEFAULT '00:00:00',
+ "cueout" interval DEFAULT '00:00:00',
+ "fadein" TIME DEFAULT '00:00:00',
+ "fadeout" TIME DEFAULT '00:00:00',
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_blockcontents" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_blockcriteria
------------------------------------------------------------------------------
-
-DROP TABLE "cc_blockcriteria" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_blockcriteria" CASCADE;
CREATE TABLE "cc_blockcriteria"
(
- "id" serial NOT NULL,
- "criteria" VARCHAR(32) NOT NULL,
- "modifier" VARCHAR(16) NOT NULL,
- "value" VARCHAR(512) NOT NULL,
- "extra" VARCHAR(512),
- "block_id" INTEGER NOT NULL,
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "criteria" VARCHAR(32) NOT NULL,
+ "modifier" VARCHAR(16) NOT NULL,
+ "value" VARCHAR(512) NOT NULL,
+ "extra" VARCHAR(512),
+ "block_id" INTEGER NOT NULL,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_blockcriteria" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_pref
------------------------------------------------------------------------------
-
-DROP TABLE "cc_pref" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_pref" CASCADE;
CREATE TABLE "cc_pref"
(
- "id" serial NOT NULL,
- "subjid" INTEGER,
- "keystr" VARCHAR(255),
- "valstr" TEXT,
- PRIMARY KEY ("id"),
- CONSTRAINT "cc_pref_id_idx" UNIQUE ("id"),
- CONSTRAINT "cc_pref_subj_key_idx" UNIQUE ("subjid","keystr")
+ "id" serial NOT NULL,
+ "subjid" INTEGER,
+ "keystr" VARCHAR(255),
+ "valstr" TEXT,
+ PRIMARY KEY ("id"),
+ CONSTRAINT "cc_pref_id_idx" UNIQUE ("id"),
+ CONSTRAINT "cc_pref_subj_key_idx" UNIQUE ("subjid","keystr")
);
-COMMENT ON TABLE "cc_pref" IS '';
-
-
-SET search_path TO public;
CREATE INDEX "cc_pref_subjid_idx" ON "cc_pref" ("subjid");
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_schedule
------------------------------------------------------------------------------
-
-DROP TABLE "cc_schedule" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_schedule" CASCADE;
CREATE TABLE "cc_schedule"
(
- "id" serial NOT NULL,
- "starts" TIMESTAMP NOT NULL,
- "ends" TIMESTAMP NOT NULL,
- "file_id" INTEGER,
- "stream_id" INTEGER,
- "clip_length" interval default '00:00:00',
- "fade_in" TIME default '00:00:00',
- "fade_out" TIME default '00:00:00',
- "cue_in" interval NOT NULL,
- "cue_out" interval NOT NULL,
- "media_item_played" BOOLEAN default 'f',
- "instance_id" INTEGER NOT NULL,
- "playout_status" INT2 default 1 NOT NULL,
- "broadcasted" INT2 default 0 NOT NULL,
- "position" INTEGER default 0 NOT NULL,
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "starts" TIMESTAMP NOT NULL,
+ "ends" TIMESTAMP NOT NULL,
+ "file_id" INTEGER,
+ "stream_id" INTEGER,
+ "clip_length" interval DEFAULT '00:00:00',
+ "fade_in" TIME DEFAULT '00:00:00',
+ "fade_out" TIME DEFAULT '00:00:00',
+ "cue_in" interval NOT NULL,
+ "cue_out" interval NOT NULL,
+ "media_item_played" BOOLEAN DEFAULT 'f',
+ "instance_id" INTEGER NOT NULL,
+ "playout_status" INT2 DEFAULT 1 NOT NULL,
+ "broadcasted" INT2 DEFAULT 0 NOT NULL,
+ "position" INTEGER DEFAULT 0 NOT NULL,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_schedule" IS '';
-
-
-SET search_path TO public;
CREATE INDEX "cc_schedule_instance_id_idx" ON "cc_schedule" ("instance_id");
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_sess
------------------------------------------------------------------------------
-
-DROP TABLE "cc_sess" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_sess" CASCADE;
CREATE TABLE "cc_sess"
(
- "sessid" CHAR(32) NOT NULL,
- "userid" INTEGER,
- "login" VARCHAR(255),
- "ts" TIMESTAMP,
- PRIMARY KEY ("sessid")
+ "sessid" CHAR(32) NOT NULL,
+ "userid" INTEGER,
+ "login" VARCHAR(255),
+ "ts" TIMESTAMP,
+ PRIMARY KEY ("sessid")
);
-COMMENT ON TABLE "cc_sess" IS '';
-
-
-SET search_path TO public;
CREATE INDEX "cc_sess_login_idx" ON "cc_sess" ("login");
CREATE INDEX "cc_sess_userid_idx" ON "cc_sess" ("userid");
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_smemb
------------------------------------------------------------------------------
-
-DROP TABLE "cc_smemb" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_smemb" CASCADE;
CREATE TABLE "cc_smemb"
(
- "id" INTEGER NOT NULL,
- "uid" INTEGER default 0 NOT NULL,
- "gid" INTEGER default 0 NOT NULL,
- "level" INTEGER default 0 NOT NULL,
- "mid" INTEGER,
- PRIMARY KEY ("id"),
- CONSTRAINT "cc_smemb_id_idx" UNIQUE ("id")
+ "id" INTEGER NOT NULL,
+ "uid" INTEGER DEFAULT 0 NOT NULL,
+ "gid" INTEGER DEFAULT 0 NOT NULL,
+ "level" INTEGER DEFAULT 0 NOT NULL,
+ "mid" INTEGER,
+ PRIMARY KEY ("id"),
+ CONSTRAINT "cc_smemb_id_idx" UNIQUE ("id")
);
-COMMENT ON TABLE "cc_smemb" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_subjs
------------------------------------------------------------------------------
-
-DROP TABLE "cc_subjs" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_subjs" CASCADE;
CREATE TABLE "cc_subjs"
(
- "id" serial NOT NULL,
- "login" VARCHAR(255) default '' NOT NULL,
- "pass" VARCHAR(255) default '' NOT NULL,
- "type" CHAR(1) default 'U' NOT NULL,
- "first_name" VARCHAR(255) default '' NOT NULL,
- "last_name" VARCHAR(255) default '' NOT NULL,
- "lastlogin" TIMESTAMP,
- "lastfail" TIMESTAMP,
- "skype_contact" VARCHAR(255),
- "jabber_contact" VARCHAR(255),
- "email" VARCHAR(255),
- "cell_phone" VARCHAR(255),
- "login_attempts" INTEGER default 0,
- PRIMARY KEY ("id"),
- CONSTRAINT "cc_subjs_id_idx" UNIQUE ("id"),
- CONSTRAINT "cc_subjs_login_idx" UNIQUE ("login")
+ "id" serial NOT NULL,
+ "login" VARCHAR(255) DEFAULT '' NOT NULL,
+ "pass" VARCHAR(255) DEFAULT '' NOT NULL,
+ "type" CHAR(1) DEFAULT 'U' NOT NULL,
+ "first_name" VARCHAR(255) DEFAULT '' NOT NULL,
+ "last_name" VARCHAR(255) DEFAULT '' NOT NULL,
+ "lastlogin" TIMESTAMP,
+ "lastfail" TIMESTAMP,
+ "skype_contact" VARCHAR,
+ "jabber_contact" VARCHAR,
+ "email" VARCHAR,
+ "cell_phone" VARCHAR,
+ "login_attempts" INTEGER DEFAULT 0,
+ PRIMARY KEY ("id"),
+ CONSTRAINT "cc_subjs_id_idx" UNIQUE ("id"),
+ CONSTRAINT "cc_subjs_login_idx" UNIQUE ("login")
);
-COMMENT ON TABLE "cc_subjs" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_subjs_token
------------------------------------------------------------------------------
-
-DROP TABLE "cc_subjs_token" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_subjs_token" CASCADE;
CREATE TABLE "cc_subjs_token"
(
- "id" serial NOT NULL,
- "user_id" INTEGER NOT NULL,
- "action" VARCHAR(255) NOT NULL,
- "token" VARCHAR(40) NOT NULL,
- "created" TIMESTAMP NOT NULL,
- PRIMARY KEY ("id"),
- CONSTRAINT "cc_subjs_token_idx" UNIQUE ("token")
+ "id" serial NOT NULL,
+ "user_id" INTEGER NOT NULL,
+ "action" VARCHAR(255) NOT NULL,
+ "token" VARCHAR(40) NOT NULL,
+ "created" TIMESTAMP NOT NULL,
+ PRIMARY KEY ("id"),
+ CONSTRAINT "cc_subjs_token_idx" UNIQUE ("token")
);
-COMMENT ON TABLE "cc_subjs_token" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_country
------------------------------------------------------------------------------
-
-DROP TABLE "cc_country" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_country" CASCADE;
CREATE TABLE "cc_country"
(
- "isocode" CHAR(3) NOT NULL,
- "name" VARCHAR(255) NOT NULL,
- PRIMARY KEY ("isocode")
+ "isocode" CHAR(3) NOT NULL,
+ "name" VARCHAR(255) NOT NULL,
+ PRIMARY KEY ("isocode")
);
-COMMENT ON TABLE "cc_country" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_stream_setting
------------------------------------------------------------------------------
-
-DROP TABLE "cc_stream_setting" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_stream_setting" CASCADE;
CREATE TABLE "cc_stream_setting"
(
- "keyname" VARCHAR(64) NOT NULL,
- "value" VARCHAR(255),
- "type" VARCHAR(16) NOT NULL,
- PRIMARY KEY ("keyname")
+ "keyname" VARCHAR(64) NOT NULL,
+ "value" VARCHAR(255),
+ "type" VARCHAR(16) NOT NULL,
+ PRIMARY KEY ("keyname")
);
-COMMENT ON TABLE "cc_stream_setting" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_login_attempts
------------------------------------------------------------------------------
-
-DROP TABLE "cc_login_attempts" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_login_attempts" CASCADE;
CREATE TABLE "cc_login_attempts"
(
- "ip" VARCHAR(32) NOT NULL,
- "attempts" INTEGER default 0,
- PRIMARY KEY ("ip")
+ "ip" VARCHAR(32) NOT NULL,
+ "attempts" INTEGER DEFAULT 0,
+ PRIMARY KEY ("ip")
);
-COMMENT ON TABLE "cc_login_attempts" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_service_register
------------------------------------------------------------------------------
-
-DROP TABLE "cc_service_register" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_service_register" CASCADE;
CREATE TABLE "cc_service_register"
(
- "name" VARCHAR(32) NOT NULL,
- "ip" VARCHAR(18) NOT NULL,
- PRIMARY KEY ("name")
+ "name" VARCHAR(32) NOT NULL,
+ "ip" VARCHAR(18) NOT NULL,
+ PRIMARY KEY ("name")
);
-COMMENT ON TABLE "cc_service_register" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_live_log
------------------------------------------------------------------------------
-
-DROP TABLE "cc_live_log" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_live_log" CASCADE;
CREATE TABLE "cc_live_log"
(
- "id" serial NOT NULL,
- "state" VARCHAR(32) NOT NULL,
- "start_time" TIMESTAMP NOT NULL,
- "end_time" TIMESTAMP,
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "state" VARCHAR(32) NOT NULL,
+ "start_time" TIMESTAMP NOT NULL,
+ "end_time" TIMESTAMP,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_live_log" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_webstream
------------------------------------------------------------------------------
-
-DROP TABLE "cc_webstream" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_webstream" CASCADE;
CREATE TABLE "cc_webstream"
(
- "id" serial NOT NULL,
- "name" VARCHAR(255) NOT NULL,
- "description" VARCHAR(255) NOT NULL,
- "url" VARCHAR(512) NOT NULL,
- "length" interval default '00:00:00' NOT NULL,
- "creator_id" INTEGER NOT NULL,
- "mtime" TIMESTAMP(6) NOT NULL,
- "utime" TIMESTAMP(6) NOT NULL,
- "lptime" TIMESTAMP(6),
- "mime" VARCHAR(255),
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "name" VARCHAR(255) NOT NULL,
+ "description" VARCHAR(255) NOT NULL,
+ "url" VARCHAR(512) NOT NULL,
+ "length" interval DEFAULT '00:00:00' NOT NULL,
+ "creator_id" INTEGER NOT NULL,
+ "mtime" TIMESTAMP(6) NOT NULL,
+ "utime" TIMESTAMP(6) NOT NULL,
+ "lptime" TIMESTAMP(6),
+ "mime" VARCHAR,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_webstream" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_webstream_metadata
------------------------------------------------------------------------------
-
-DROP TABLE "cc_webstream_metadata" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_webstream_metadata" CASCADE;
CREATE TABLE "cc_webstream_metadata"
(
- "id" serial NOT NULL,
- "instance_id" INTEGER NOT NULL,
- "start_time" TIMESTAMP NOT NULL,
- "liquidsoap_data" VARCHAR(1024) NOT NULL,
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "instance_id" INTEGER NOT NULL,
+ "start_time" TIMESTAMP NOT NULL,
+ "liquidsoap_data" VARCHAR(1024) NOT NULL,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_webstream_metadata" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_mount_name
------------------------------------------------------------------------------
-
-DROP TABLE "cc_mount_name" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_mount_name" CASCADE;
CREATE TABLE "cc_mount_name"
(
- "id" serial NOT NULL,
- "mount_name" VARCHAR(255) NOT NULL,
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "mount_name" VARCHAR NOT NULL,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_mount_name" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_timestamp
------------------------------------------------------------------------------
-
-DROP TABLE "cc_timestamp" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_timestamp" CASCADE;
CREATE TABLE "cc_timestamp"
(
- "id" serial NOT NULL,
- "timestamp" TIMESTAMP NOT NULL,
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "timestamp" TIMESTAMP NOT NULL,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_timestamp" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_listener_count
------------------------------------------------------------------------------
-
-DROP TABLE "cc_listener_count" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_listener_count" CASCADE;
CREATE TABLE "cc_listener_count"
(
- "id" serial NOT NULL,
- "timestamp_id" INTEGER NOT NULL,
- "mount_name_id" INTEGER NOT NULL,
- "listener_count" INTEGER NOT NULL,
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "timestamp_id" INTEGER NOT NULL,
+ "mount_name_id" INTEGER NOT NULL,
+ "listener_count" INTEGER NOT NULL,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_listener_count" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_locale
------------------------------------------------------------------------------
-
-DROP TABLE "cc_locale" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_locale" CASCADE;
CREATE TABLE "cc_locale"
(
- "id" serial NOT NULL,
- "locale_code" VARCHAR(16) NOT NULL,
- "locale_lang" VARCHAR(128) NOT NULL,
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "locale_code" VARCHAR(16) NOT NULL,
+ "locale_lang" VARCHAR(128) NOT NULL,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_locale" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_playout_history
------------------------------------------------------------------------------
-
-DROP TABLE "cc_playout_history" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_playout_history" CASCADE;
CREATE TABLE "cc_playout_history"
(
- "id" serial NOT NULL,
- "file_id" INTEGER,
- "starts" TIMESTAMP NOT NULL,
- "ends" TIMESTAMP,
- "instance_id" INTEGER,
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "file_id" INTEGER,
+ "starts" TIMESTAMP NOT NULL,
+ "ends" TIMESTAMP,
+ "instance_id" INTEGER,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_playout_history" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_playout_history_metadata
------------------------------------------------------------------------------
-
-DROP TABLE "cc_playout_history_metadata" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_playout_history_metadata" CASCADE;
CREATE TABLE "cc_playout_history_metadata"
(
- "id" serial NOT NULL,
- "history_id" INTEGER NOT NULL,
- "key" VARCHAR(128) NOT NULL,
- "value" VARCHAR(128) NOT NULL,
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "history_id" INTEGER NOT NULL,
+ "key" VARCHAR(128) NOT NULL,
+ "value" VARCHAR(128) NOT NULL,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_playout_history_metadata" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_playout_history_template
------------------------------------------------------------------------------
-
-DROP TABLE "cc_playout_history_template" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_playout_history_template" CASCADE;
CREATE TABLE "cc_playout_history_template"
(
- "id" serial NOT NULL,
- "name" VARCHAR(128) NOT NULL,
- "type" VARCHAR(35) NOT NULL,
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "name" VARCHAR(128) NOT NULL,
+ "type" VARCHAR(35) NOT NULL,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_playout_history_template" IS '';
-
-
-SET search_path TO public;
------------------------------------------------------------------------------
+-----------------------------------------------------------------------
-- cc_playout_history_template_field
------------------------------------------------------------------------------
-
-DROP TABLE "cc_playout_history_template_field" CASCADE;
+-----------------------------------------------------------------------
+DROP TABLE IF EXISTS "cc_playout_history_template_field" CASCADE;
CREATE TABLE "cc_playout_history_template_field"
(
- "id" serial NOT NULL,
- "template_id" INTEGER NOT NULL,
- "name" VARCHAR(128) NOT NULL,
- "label" VARCHAR(128) NOT NULL,
- "type" VARCHAR(128) NOT NULL,
- "is_file_md" BOOLEAN default 'f' NOT NULL,
- "position" INTEGER NOT NULL,
- PRIMARY KEY ("id")
+ "id" serial NOT NULL,
+ "template_id" INTEGER NOT NULL,
+ "name" VARCHAR(128) NOT NULL,
+ "label" VARCHAR(128) NOT NULL,
+ "type" VARCHAR(128) NOT NULL,
+ "is_file_md" BOOLEAN DEFAULT 'f' NOT NULL,
+ "position" INTEGER NOT NULL,
+ PRIMARY KEY ("id")
);
-COMMENT ON TABLE "cc_playout_history_template_field" IS '';
+ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_owner_fkey"
+ FOREIGN KEY ("owner_id")
+ REFERENCES "cc_subjs" ("id");
+ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_editedby_fkey"
+ FOREIGN KEY ("editedby")
+ REFERENCES "cc_subjs" ("id");
-SET search_path TO public;
-ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_owner_fkey" FOREIGN KEY ("owner_id") REFERENCES "cc_subjs" ("id");
+ALTER TABLE "cc_files" ADD CONSTRAINT "cc_music_dirs_folder_fkey"
+ FOREIGN KEY ("directory")
+ REFERENCES "cc_music_dirs" ("id");
-ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_editedby_fkey" FOREIGN KEY ("editedby") REFERENCES "cc_subjs" ("id");
+ALTER TABLE "cc_perms" ADD CONSTRAINT "cc_perms_subj_fkey"
+ FOREIGN KEY ("subj")
+ REFERENCES "cc_subjs" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_files" ADD CONSTRAINT "cc_music_dirs_folder_fkey" FOREIGN KEY ("directory") REFERENCES "cc_music_dirs" ("id");
+ALTER TABLE "cc_show_instances" ADD CONSTRAINT "cc_show_fkey"
+ FOREIGN KEY ("show_id")
+ REFERENCES "cc_show" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_perms" ADD CONSTRAINT "cc_perms_subj_fkey" FOREIGN KEY ("subj") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_show_instances" ADD CONSTRAINT "cc_original_show_instance_fkey"
+ FOREIGN KEY ("instance_id")
+ REFERENCES "cc_show_instances" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_show_instances" ADD CONSTRAINT "cc_show_fkey" FOREIGN KEY ("show_id") REFERENCES "cc_show" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_show_instances" ADD CONSTRAINT "cc_recorded_file_fkey"
+ FOREIGN KEY ("file_id")
+ REFERENCES "cc_files" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_show_instances" ADD CONSTRAINT "cc_original_show_instance_fkey" FOREIGN KEY ("instance_id") REFERENCES "cc_show_instances" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_show_days" ADD CONSTRAINT "cc_show_fkey"
+ FOREIGN KEY ("show_id")
+ REFERENCES "cc_show" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_show_instances" ADD CONSTRAINT "cc_recorded_file_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_show_rebroadcast" ADD CONSTRAINT "cc_show_fkey"
+ FOREIGN KEY ("show_id")
+ REFERENCES "cc_show" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_show_days" ADD CONSTRAINT "cc_show_fkey" FOREIGN KEY ("show_id") REFERENCES "cc_show" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_show_hosts" ADD CONSTRAINT "cc_perm_show_fkey"
+ FOREIGN KEY ("show_id")
+ REFERENCES "cc_show" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_show_rebroadcast" ADD CONSTRAINT "cc_show_fkey" FOREIGN KEY ("show_id") REFERENCES "cc_show" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_show_hosts" ADD CONSTRAINT "cc_perm_host_fkey"
+ FOREIGN KEY ("subjs_id")
+ REFERENCES "cc_subjs" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_show_hosts" ADD CONSTRAINT "cc_perm_show_fkey" FOREIGN KEY ("show_id") REFERENCES "cc_show" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_playlist" ADD CONSTRAINT "cc_playlist_createdby_fkey"
+ FOREIGN KEY ("creator_id")
+ REFERENCES "cc_subjs" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_show_hosts" ADD CONSTRAINT "cc_perm_host_fkey" FOREIGN KEY ("subjs_id") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_file_id_fkey"
+ FOREIGN KEY ("file_id")
+ REFERENCES "cc_files" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_playlist" ADD CONSTRAINT "cc_playlist_createdby_fkey" FOREIGN KEY ("creator_id") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_block_id_fkey"
+ FOREIGN KEY ("block_id")
+ REFERENCES "cc_block" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_file_id_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_playlist_id_fkey"
+ FOREIGN KEY ("playlist_id")
+ REFERENCES "cc_playlist" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_block_id_fkey" FOREIGN KEY ("block_id") REFERENCES "cc_block" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_block" ADD CONSTRAINT "cc_block_createdby_fkey"
+ FOREIGN KEY ("creator_id")
+ REFERENCES "cc_subjs" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_playlist_id_fkey" FOREIGN KEY ("playlist_id") REFERENCES "cc_playlist" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_blockcontents" ADD CONSTRAINT "cc_blockcontents_file_id_fkey"
+ FOREIGN KEY ("file_id")
+ REFERENCES "cc_files" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_block" ADD CONSTRAINT "cc_block_createdby_fkey" FOREIGN KEY ("creator_id") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_blockcontents" ADD CONSTRAINT "cc_blockcontents_block_id_fkey"
+ FOREIGN KEY ("block_id")
+ REFERENCES "cc_block" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_blockcontents" ADD CONSTRAINT "cc_blockcontents_file_id_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_blockcriteria" ADD CONSTRAINT "cc_blockcontents_block_id_fkey"
+ FOREIGN KEY ("block_id")
+ REFERENCES "cc_block" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_blockcontents" ADD CONSTRAINT "cc_blockcontents_block_id_fkey" FOREIGN KEY ("block_id") REFERENCES "cc_block" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_pref" ADD CONSTRAINT "cc_pref_subjid_fkey"
+ FOREIGN KEY ("subjid")
+ REFERENCES "cc_subjs" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_blockcriteria" ADD CONSTRAINT "cc_blockcontents_block_id_fkey" FOREIGN KEY ("block_id") REFERENCES "cc_block" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_inst_fkey"
+ FOREIGN KEY ("instance_id")
+ REFERENCES "cc_show_instances" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_pref" ADD CONSTRAINT "cc_pref_subjid_fkey" FOREIGN KEY ("subjid") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_file_fkey"
+ FOREIGN KEY ("file_id")
+ REFERENCES "cc_files" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_inst_fkey" FOREIGN KEY ("instance_id") REFERENCES "cc_show_instances" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_stream_fkey"
+ FOREIGN KEY ("stream_id")
+ REFERENCES "cc_webstream" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_file_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_sess" ADD CONSTRAINT "cc_sess_userid_fkey"
+ FOREIGN KEY ("userid")
+ REFERENCES "cc_subjs" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_stream_fkey" FOREIGN KEY ("stream_id") REFERENCES "cc_webstream" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_subjs_token" ADD CONSTRAINT "cc_subjs_token_userid_fkey"
+ FOREIGN KEY ("user_id")
+ REFERENCES "cc_subjs" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_sess" ADD CONSTRAINT "cc_sess_userid_fkey" FOREIGN KEY ("userid") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_webstream_metadata" ADD CONSTRAINT "cc_schedule_inst_fkey"
+ FOREIGN KEY ("instance_id")
+ REFERENCES "cc_schedule" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_subjs_token" ADD CONSTRAINT "cc_subjs_token_userid_fkey" FOREIGN KEY ("user_id") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_listener_count" ADD CONSTRAINT "cc_timestamp_inst_fkey"
+ FOREIGN KEY ("timestamp_id")
+ REFERENCES "cc_timestamp" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_webstream_metadata" ADD CONSTRAINT "cc_schedule_inst_fkey" FOREIGN KEY ("instance_id") REFERENCES "cc_schedule" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_listener_count" ADD CONSTRAINT "cc_mount_name_inst_fkey"
+ FOREIGN KEY ("mount_name_id")
+ REFERENCES "cc_mount_name" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_listener_count" ADD CONSTRAINT "cc_timestamp_inst_fkey" FOREIGN KEY ("timestamp_id") REFERENCES "cc_timestamp" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_playout_history" ADD CONSTRAINT "cc_playout_history_file_tag_fkey"
+ FOREIGN KEY ("file_id")
+ REFERENCES "cc_files" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_listener_count" ADD CONSTRAINT "cc_mount_name_inst_fkey" FOREIGN KEY ("mount_name_id") REFERENCES "cc_mount_name" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_playout_history" ADD CONSTRAINT "cc_his_item_inst_fkey"
+ FOREIGN KEY ("instance_id")
+ REFERENCES "cc_show_instances" ("id")
+ ON DELETE SET NULL;
-ALTER TABLE "cc_playout_history" ADD CONSTRAINT "cc_playout_history_file_tag_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_playout_history_metadata" ADD CONSTRAINT "cc_playout_history_metadata_entry_fkey"
+ FOREIGN KEY ("history_id")
+ REFERENCES "cc_playout_history" ("id")
+ ON DELETE CASCADE;
-ALTER TABLE "cc_playout_history" ADD CONSTRAINT "cc_his_item_inst_fkey" FOREIGN KEY ("instance_id") REFERENCES "cc_show_instances" ("id") ON DELETE SET NULL;
-
-ALTER TABLE "cc_playout_history_metadata" ADD CONSTRAINT "cc_playout_history_metadata_entry_fkey" FOREIGN KEY ("history_id") REFERENCES "cc_playout_history" ("id") ON DELETE CASCADE;
-
-ALTER TABLE "cc_playout_history_template_field" ADD CONSTRAINT "cc_playout_history_template_template_fkey" FOREIGN KEY ("template_id") REFERENCES "cc_playout_history_template" ("id") ON DELETE CASCADE;
+ALTER TABLE "cc_playout_history_template_field" ADD CONSTRAINT "cc_playout_history_template_template_fkey"
+ FOREIGN KEY ("template_id")
+ REFERENCES "cc_playout_history_template" ("id")
+ ON DELETE CASCADE;
diff --git a/airtime_mvc/library/propel/composer.json b/airtime_mvc/library/propel/composer.json
new file mode 100644
index 000000000..7a2989d96
--- /dev/null
+++ b/airtime_mvc/library/propel/composer.json
@@ -0,0 +1,5 @@
+{
+ "require": {
+ "propel/propel1": "1.7.0-stable"
+ }
+}
diff --git a/dev_tools/propel_regenerate.sh b/dev_tools/propel_regenerate.sh
index 06b4f1ffd..e13ae4cbb 100755
--- a/dev_tools/propel_regenerate.sh
+++ b/dev_tools/propel_regenerate.sh
@@ -8,4 +8,4 @@ cd $SCRIPTPATH/../airtime_mvc/
path=`pwd`
cd build
sed -i s#"project\.home =.*$"#"project.home = $path"#g build.properties
-../library/propel/generator/bin/propel-gen
+../library/propel/vendor/propel/propel1/generator/bin/propel-gen