From 04333aaa299cc90456a4ca40308ba086956f80be Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Thu, 16 Jul 2015 11:27:27 -0400 Subject: [PATCH 001/254] SoundCloud download initial commit --- .../controllers/ThirdPartyController.php | 13 ++++++++ .../services/SoundcloudService.php | 5 +++ .../services/ThirdPartyCeleryService.php | 32 ++++++++++++++++++- .../services/ThirdPartyService.php | 7 ++++ .../airtime-celery/airtime-celery/tasks.py | 27 +++++++++++++++- 5 files changed, 82 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/controllers/ThirdPartyController.php b/airtime_mvc/application/controllers/ThirdPartyController.php index 5c15ae5ea..090156ee1 100644 --- a/airtime_mvc/application/controllers/ThirdPartyController.php +++ b/airtime_mvc/application/controllers/ThirdPartyController.php @@ -77,6 +77,19 @@ abstract class ThirdPartyController extends Zend_Controller_Action { $this->_service->upload($id); } + /** + * Download the file with the given id from a third-party service + * + * @return void + * + * @throws Zend_Controller_Response_Exception thrown if download fails for any reason + */ + public function downloadAction() { + $request = $this->getRequest(); + $id = $request->getParam('id'); + $this->_service->download($id); + } + /** * Delete the file with the given id from a third-party service * diff --git a/airtime_mvc/application/services/SoundcloudService.php b/airtime_mvc/application/services/SoundcloudService.php index 8e946375e..91b2ab941 100644 --- a/airtime_mvc/application/services/SoundcloudService.php +++ b/airtime_mvc/application/services/SoundcloudService.php @@ -29,6 +29,11 @@ class SoundcloudService extends ThirdPartyCeleryService implements OAuth2 { */ protected static $_CELERY_UPLOAD_TASK_NAME = 'soundcloud-upload'; + /** + * @var string celery task name for third party uploads + */ + protected static $_CELERY_DOWNLOAD_TASK_NAME = 'soundcloud-download'; + /** * @var string celery task name for third party deletions */ diff --git a/airtime_mvc/application/services/ThirdPartyCeleryService.php b/airtime_mvc/application/services/ThirdPartyCeleryService.php index 5dbc1ebad..78b0a09ce 100644 --- a/airtime_mvc/application/services/ThirdPartyCeleryService.php +++ b/airtime_mvc/application/services/ThirdPartyCeleryService.php @@ -14,6 +14,11 @@ abstract class ThirdPartyCeleryService extends ThirdPartyService { */ protected static $_CELERY_UPLOAD_TASK_NAME; + /** + * @var string celery task name for third-party uploads + */ + protected static $_CELERY_DOWNLOAD_TASK_NAME; + /** * @var string celery task name for third-party deletion */ @@ -41,6 +46,31 @@ abstract class ThirdPartyCeleryService extends ThirdPartyService { } } + /** + * Given a SoundCloud track identifier, download a track from SoundCloud. + * + * If no track identifier is given, download all tracks for the currently + * authenticated SoundCloud user. + * + * @param int|null $trackId a SoundCloud track identifier + */ + public function download($trackId = null) { + $namespace = new Zend_Session_Namespace('csrf_namespace'); + $csrfToken = $namespace->authtoken; + $data = array( + 'callback_url' => 'http' . (empty($_SERVER['HTTPS']) ? '' : 's') . '://' . $_SERVER['HTTP_HOST'] . '/media/post>csrf_token=' . $csrfToken, + 'token' => $this->_accessToken, + 'track_id' => $trackId + ); + try { + CeleryService::sendCeleryMessage(static::$_CELERY_DOWNLOAD_TASK_NAME, + static::$_CELERY_EXCHANGE_NAME, + $data); + } catch (Exception $e) { + Logging::info("Invalid request: " . $e->getMessage()); + } + } + /** * Delete the file with the given identifier from a third-party service * @@ -52,7 +82,7 @@ abstract class ThirdPartyCeleryService extends ThirdPartyService { public function delete($fileId) { $serviceId = $this->getServiceId($fileId); if ($serviceId == 0) { - throw new ServiceNotFoundException("No service found for file with ID $fileId"); + throw new ServiceNotFoundException("No service ID found for file with ID $fileId"); } $data = array( 'token' => $this->_accessToken, diff --git a/airtime_mvc/application/services/ThirdPartyService.php b/airtime_mvc/application/services/ThirdPartyService.php index 5af1eb0e4..d3293f18c 100644 --- a/airtime_mvc/application/services/ThirdPartyService.php +++ b/airtime_mvc/application/services/ThirdPartyService.php @@ -124,6 +124,13 @@ abstract class ThirdPartyService { */ abstract function upload($fileId); + /** + * Download the file with the given identifier from a third-party service + * + * @param int $trackId the third-party service track identifier + */ + abstract function download($trackId); + /** * Delete the file with the given identifier from a third-party service * diff --git a/python_apps/airtime-celery/airtime-celery/tasks.py b/python_apps/airtime-celery/airtime-celery/tasks.py index 27554241a..ad5fa64af 100644 --- a/python_apps/airtime-celery/airtime-celery/tasks.py +++ b/python_apps/airtime-celery/airtime-celery/tasks.py @@ -1,6 +1,7 @@ import os import json import urllib2 +import requests import soundcloud from celery import Celery from celery.utils.log import get_task_logger @@ -33,12 +34,36 @@ def soundcloud_upload(data, token, file_path): data['asset_data'].close() return json.dumps(track.fields()) + +@celery.task(name='soundcloud-download', acks_late=True) +def soundcloud_download(token, callback_url, track_id=None): + """ + + :param token: OAuth2 client access token + :param track_id: SoundCloud track identifier + :rtype: None + """ + client = soundcloud.Client(access_token=token) + try: + tracks = client.get('/me/tracks') if track_id is None else {client.get('/tracks/%s' % track_id)} + for track in tracks: + if track.downloadable: + track_file = client.get(track.download_url) + with track_file as f: + requests.post(callback_url, data=f) + except Exception as e: + logger.info('Error during file download: {0}'.format(e.message)) + logger.info(str(e)) + raise e + + @celery.task(name='soundcloud-delete', acks_late=True) def soundcloud_delete(token, track_id): """ Delete a file from SoundCloud - :param token: OAuth2 client access token + :param token: OAuth2 client access token + :param track_id: SoundCloud track identifier :return: the SoundCloud response object :rtype: dict From 63784d4e6b38705d3329b0ba1b90e9adfa374e74 Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Tue, 8 Sep 2015 16:39:33 -0400 Subject: [PATCH 002/254] Fix some behaviour with playlist/smartblock fade button --- .../application/views/scripts/playlist/playlist.phtml | 6 +++--- .../application/views/scripts/playlist/smart-block.phtml | 4 ++-- airtime_mvc/public/js/airtime/library/spl.js | 8 ++++---- python_apps/airtime-celery/airtime-celery/tasks.py | 1 + 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/airtime_mvc/application/views/scripts/playlist/playlist.phtml b/airtime_mvc/application/views/scripts/playlist/playlist.phtml index c7b490455..b9f107aae 100644 --- a/airtime_mvc/application/views/scripts/playlist/playlist.phtml +++ b/airtime_mvc/application/views/scripts/playlist/playlist.phtml @@ -43,10 +43,10 @@ if (isset($this->obj)) {
-
"> - +
diff --git a/airtime_mvc/application/views/scripts/playlist/smart-block.phtml b/airtime_mvc/application/views/scripts/playlist/smart-block.phtml index e4a5d6553..c24df6a63 100644 --- a/airtime_mvc/application/views/scripts/playlist/smart-block.phtml +++ b/airtime_mvc/application/views/scripts/playlist/smart-block.phtml @@ -51,8 +51,8 @@ if (isset($this->obj)) {
form->getElement('shuffle_button');?>
-
"> - + diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js index 89d6db9bd..c6c97adcc 100644 --- a/airtime_mvc/public/js/airtime/library/spl.js +++ b/airtime_mvc/public/js/airtime/library/spl.js @@ -406,7 +406,7 @@ var AIRTIME = (function(AIRTIME){ var empty = $pl.find(".spl_empty"); if (!show || empty.length > 0) { - $pl.find("#spl_crossfade").hide(); + //$pl.find("#spl_crossfade").hide(); } else { //get list of playlist contents var list = contents.children(); @@ -416,7 +416,7 @@ var AIRTIME = (function(AIRTIME){ var last = list.last(); if (first.find(':first-child').children().attr('blockid') !== undefined && last.find(':first-child').children().attr('blockid') !== undefined) { - $pl.find("#spl_crossfade").hide(); + //$pl.find("#spl_crossfade").hide(); } else { $pl.find("#spl_crossfade").show(); } @@ -783,7 +783,7 @@ var AIRTIME = (function(AIRTIME){ fadeIn.parent().prev().hide(); fadeIn.hide(); } else { - console.log(json.fadeIn); + //console.log(json.fadeIn); //console.log(fadeIn.val()); fadeIn.parent().prev().show(); fadeIn.show(); @@ -1095,7 +1095,7 @@ var AIRTIME = (function(AIRTIME){ aSelected = AIRTIME.library.getSelectedData(); for (i = 0, length = aSelected.length; i < length; i++) { - console.log(aSelected[i]); + //console.log(aSelected[i]); aItems.push(new Array(aSelected[i].id, aSelected[i].ftype)); } diff --git a/python_apps/airtime-celery/airtime-celery/tasks.py b/python_apps/airtime-celery/airtime-celery/tasks.py index ad5fa64af..74ce00fb3 100644 --- a/python_apps/airtime-celery/airtime-celery/tasks.py +++ b/python_apps/airtime-celery/airtime-celery/tasks.py @@ -38,6 +38,7 @@ def soundcloud_upload(data, token, file_path): @celery.task(name='soundcloud-download', acks_late=True) def soundcloud_download(token, callback_url, track_id=None): """ + This is in stasis :param token: OAuth2 client access token :param track_id: SoundCloud track identifier From 28493497fdf06163b64a3727b8b32a36e87cb6cd Mon Sep 17 00:00:00 2001 From: drigato Date: Mon, 14 Sep 2015 17:00:54 -0400 Subject: [PATCH 003/254] SAAS-1058: Podcast table schema SAAS-1059: Add description field to cc_files --- .../configs/classmap-airtime-conf.php | 14 + airtime_mvc/application/forms/EditAudioMD.php | 10 + .../application/forms/SmartBlockCriteria.php | 3 + airtime_mvc/application/models/Block.php | 2 + airtime_mvc/application/models/StoredFile.php | 5 +- .../application/models/airtime/Podcast.php | 18 + .../models/airtime/PodcastContents.php | 18 + .../models/airtime/PodcastContentsPeer.php | 18 + .../models/airtime/PodcastContentsQuery.php | 18 + .../models/airtime/PodcastPeer.php | 18 + .../models/airtime/PodcastQuery.php | 18 + .../models/airtime/map/CcFilesTableMap.php | 2 + .../models/airtime/map/CcSubjsTableMap.php | 1 + .../airtime/map/PodcastContentsTableMap.php | 58 + .../models/airtime/map/PodcastTableMap.php | 61 + .../models/airtime/om/BaseCcFiles.php | 368 +++- .../models/airtime/om/BaseCcFilesPeer.php | 36 +- .../models/airtime/om/BaseCcFilesQuery.php | 113 +- .../models/airtime/om/BaseCcSubjs.php | 285 +++ .../models/airtime/om/BaseCcSubjsPeer.php | 3 + .../models/airtime/om/BaseCcSubjsQuery.php | 78 + .../models/airtime/om/BasePodcast.php | 1577 +++++++++++++++++ .../models/airtime/om/BasePodcastContents.php | 1162 ++++++++++++ .../airtime/om/BasePodcastContentsPeer.php | 1402 +++++++++++++++ .../airtime/om/BasePodcastContentsQuery.php | 579 ++++++ .../models/airtime/om/BasePodcastPeer.php | 1027 +++++++++++ .../models/airtime/om/BasePodcastQuery.php | 645 +++++++ .../rest/controllers/PodcastController.php | 59 + airtime_mvc/build/schema.xml | 27 + airtime_mvc/build/sql/schema.sql | 49 + .../public/js/airtime/library/library.js | 3 + .../js/airtime/playlist/smart_blockbuilder.js | 1 + 32 files changed, 7660 insertions(+), 18 deletions(-) create mode 100644 airtime_mvc/application/models/airtime/Podcast.php create mode 100644 airtime_mvc/application/models/airtime/PodcastContents.php create mode 100644 airtime_mvc/application/models/airtime/PodcastContentsPeer.php create mode 100644 airtime_mvc/application/models/airtime/PodcastContentsQuery.php create mode 100644 airtime_mvc/application/models/airtime/PodcastPeer.php create mode 100644 airtime_mvc/application/models/airtime/PodcastQuery.php create mode 100644 airtime_mvc/application/models/airtime/map/PodcastContentsTableMap.php create mode 100644 airtime_mvc/application/models/airtime/map/PodcastTableMap.php create mode 100644 airtime_mvc/application/models/airtime/om/BasePodcast.php create mode 100644 airtime_mvc/application/models/airtime/om/BasePodcastContents.php create mode 100644 airtime_mvc/application/models/airtime/om/BasePodcastContentsPeer.php create mode 100644 airtime_mvc/application/models/airtime/om/BasePodcastContentsQuery.php create mode 100644 airtime_mvc/application/models/airtime/om/BasePodcastPeer.php create mode 100644 airtime_mvc/application/models/airtime/om/BasePodcastQuery.php create mode 100644 airtime_mvc/application/modules/rest/controllers/PodcastController.php diff --git a/airtime_mvc/application/configs/classmap-airtime-conf.php b/airtime_mvc/application/configs/classmap-airtime-conf.php index 671726a17..70ce01337 100644 --- a/airtime_mvc/application/configs/classmap-airtime-conf.php +++ b/airtime_mvc/application/configs/classmap-airtime-conf.php @@ -106,6 +106,12 @@ return array ( 'BaseCloudFile' => 'airtime/om/BaseCloudFile.php', 'BaseCloudFilePeer' => 'airtime/om/BaseCloudFilePeer.php', 'BaseCloudFileQuery' => 'airtime/om/BaseCloudFileQuery.php', + 'BasePodcast' => 'airtime/om/BasePodcast.php', + 'BasePodcastContents' => 'airtime/om/BasePodcastContents.php', + 'BasePodcastContentsPeer' => 'airtime/om/BasePodcastContentsPeer.php', + 'BasePodcastContentsQuery' => 'airtime/om/BasePodcastContentsQuery.php', + 'BasePodcastPeer' => 'airtime/om/BasePodcastPeer.php', + 'BasePodcastQuery' => 'airtime/om/BasePodcastQuery.php', 'BaseThirdPartyTrackReferences' => 'airtime/om/BaseThirdPartyTrackReferences.php', 'BaseThirdPartyTrackReferencesPeer' => 'airtime/om/BaseThirdPartyTrackReferencesPeer.php', 'BaseThirdPartyTrackReferencesQuery' => 'airtime/om/BaseThirdPartyTrackReferencesQuery.php', @@ -249,6 +255,14 @@ return array ( 'CloudFilePeer' => 'airtime/CloudFilePeer.php', 'CloudFileQuery' => 'airtime/CloudFileQuery.php', 'CloudFileTableMap' => 'airtime/map/CloudFileTableMap.php', + 'Podcast' => 'airtime/Podcast.php', + 'PodcastContents' => 'airtime/PodcastContents.php', + 'PodcastContentsPeer' => 'airtime/PodcastContentsPeer.php', + 'PodcastContentsQuery' => 'airtime/PodcastContentsQuery.php', + 'PodcastContentsTableMap' => 'airtime/map/PodcastContentsTableMap.php', + 'PodcastPeer' => 'airtime/PodcastPeer.php', + 'PodcastQuery' => 'airtime/PodcastQuery.php', + 'PodcastTableMap' => 'airtime/map/PodcastTableMap.php', 'ThirdPartyTrackReferences' => 'airtime/ThirdPartyTrackReferences.php', 'ThirdPartyTrackReferencesPeer' => 'airtime/ThirdPartyTrackReferencesPeer.php', 'ThirdPartyTrackReferencesQuery' => 'airtime/ThirdPartyTrackReferencesQuery.php', diff --git a/airtime_mvc/application/forms/EditAudioMD.php b/airtime_mvc/application/forms/EditAudioMD.php index a2462aa31..923c53ae8 100644 --- a/airtime_mvc/application/forms/EditAudioMD.php +++ b/airtime_mvc/application/forms/EditAudioMD.php @@ -48,6 +48,16 @@ class Application_Form_EditAudioMD extends Zend_Form )); $this->addElement($album_title); + // Description field + $description = new Zend_Form_Element_Text('description'); + $description->class = 'input_text'; + $description->setLabel(_('Description:')) + ->setFilters(array('StringTrim')) + ->setValidators(array( + new Zend_Validate_StringLength(array('max' => 512)) + )); + $this->addElement($description); + // Add track number field $track_number = new Zend_Form_Element('track_number'); $track_number->class = 'input_text'; diff --git a/airtime_mvc/application/forms/SmartBlockCriteria.php b/airtime_mvc/application/forms/SmartBlockCriteria.php index bc22b731d..25070006b 100644 --- a/airtime_mvc/application/forms/SmartBlockCriteria.php +++ b/airtime_mvc/application/forms/SmartBlockCriteria.php @@ -21,6 +21,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm "copyright" => "s", "cuein" => "n", "cueout" => "n", + "description" => "s", "artist_name" => "s", "encoded_by" => "s", "utime" => "n", @@ -55,6 +56,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm "copyright" => _("Copyright"), "cuein" => _("Cue In"), "cueout" => _("Cue Out"), + "description" => _("Description"), "artist_name" => _("Creator"), "encoded_by" => _("Encoded By"), "genre" => _("Genre"), @@ -489,6 +491,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm "copyright" => "DbCopyright", "cuein" => "DbCuein", "cueout" => "DbCueout", + "description" => "DbDescription", "encoded_by" => "DbEncodedBy", "utime" => "DbUtime", "mtime" => "DbMtime", diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php index 767a982e7..8f2945361 100644 --- a/airtime_mvc/application/models/Block.php +++ b/airtime_mvc/application/models/Block.php @@ -66,6 +66,7 @@ class Application_Model_Block implements Application_Model_LibraryEditable "copyright" => "DbCopyright", "cuein" => "DbCuein", "cueout" => "DbCueout", + "description" => "DbDescription", "encoded_by" => "DbEncodedBy", "utime" => "DbUtime", "mtime" => "DbMtime", @@ -1357,6 +1358,7 @@ SQL; "copyright" => _("Copyright"), "cuein" => _("Cue In"), "cueout" => _("Cue Out"), + "description" => _("Description"), "artist_name" => _("Creator"), "encoded_by" => _("Encoded By"), "genre" => _("Genre"), diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 3cffe1fcb..bad64204f 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -57,6 +57,7 @@ class Application_Model_StoredFile "owner_id" => "DbOwnerId", "cuein" => "DbCueIn", "cueout" => "DbCueOut", + "description" => "DbDescription" ); function __construct($file, $con) { @@ -672,7 +673,7 @@ SQL; "bit_rate", "sample_rate", "isrc_number", "encoded_by", "label", "copyright", "mime", "language", "filepath", "owner_id", "conductor", "replay_gain", "lptime", "is_playlist", "is_scheduled", - "cuein", "cueout" ); + "cuein", "cueout", "description" ); } public static function searchLibraryFiles($datatables) @@ -781,7 +782,7 @@ SQL; $blSelect[] = "NULL::VARCHAR AS ".$key; $fileSelect[] = $key; $streamSelect[] = $key; - } + } else { $plSelect[] = "NULL::text AS ".$key; $blSelect[] = "NULL::text AS ".$key; diff --git a/airtime_mvc/application/models/airtime/Podcast.php b/airtime_mvc/application/models/airtime/Podcast.php new file mode 100644 index 000000000..43fdede8a --- /dev/null +++ b/airtime_mvc/application/models/airtime/Podcast.php @@ -0,0 +1,18 @@ +addColumn('is_scheduled', 'DbIsScheduled', 'BOOLEAN', false, null, false); $this->addColumn('is_playlist', 'DbIsPlaylist', 'BOOLEAN', false, null, false); $this->addColumn('filesize', 'DbFilesize', 'INTEGER', true, null, 0); + $this->addColumn('description', 'DbDescription', 'VARCHAR', false, 512, null); // validators } // initialize() @@ -128,6 +129,7 @@ class CcFilesTableMap extends TableMap $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'); $this->addRelation('ThirdPartyTrackReferences', 'ThirdPartyTrackReferences', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'ThirdPartyTrackReferencess'); + $this->addRelation('PodcastContents', 'PodcastContents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null, 'PodcastContentss'); } // buildRelations() } // CcFilesTableMap diff --git a/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php b/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php index 8ffb5bf4f..80a6a2c2c 100644 --- a/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcSubjsTableMap.php @@ -69,6 +69,7 @@ class CcSubjsTableMap extends TableMap $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'); + $this->addRelation('Podcast', 'Podcast', RelationMap::ONE_TO_MANY, array('id' => 'owner', ), 'CASCADE', null, 'Podcasts'); } // buildRelations() } // CcSubjsTableMap diff --git a/airtime_mvc/application/models/airtime/map/PodcastContentsTableMap.php b/airtime_mvc/application/models/airtime/map/PodcastContentsTableMap.php new file mode 100644 index 000000000..2039849d2 --- /dev/null +++ b/airtime_mvc/application/models/airtime/map/PodcastContentsTableMap.php @@ -0,0 +1,58 @@ +setName('podcast_contents'); + $this->setPhpName('PodcastContents'); + $this->setClassname('PodcastContents'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('podcast_contents_id_seq'); + // columns + $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null); + $this->addForeignKey('file_id', 'DbFileId', 'INTEGER', 'cc_files', 'id', true, null, null); + $this->addForeignKey('podcast_id', 'DbPodcastId', 'INTEGER', 'podcast', 'id', true, null, null); + $this->addColumn('publication_date', 'DbPublicationDate', 'TIMESTAMP', true, 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('Podcast', 'Podcast', RelationMap::MANY_TO_ONE, array('podcast_id' => 'id', ), 'CASCADE', null); + } // buildRelations() + +} // PodcastContentsTableMap diff --git a/airtime_mvc/application/models/airtime/map/PodcastTableMap.php b/airtime_mvc/application/models/airtime/map/PodcastTableMap.php new file mode 100644 index 000000000..d738aae17 --- /dev/null +++ b/airtime_mvc/application/models/airtime/map/PodcastTableMap.php @@ -0,0 +1,61 @@ +setName('podcast'); + $this->setPhpName('Podcast'); + $this->setClassname('Podcast'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('podcast_id_seq'); + // columns + $this->addPrimaryKey('id', 'DbId', 'INTEGER', true, null, null); + $this->addColumn('url', 'DbUrl', 'VARCHAR', true, 256, null); + $this->addColumn('title', 'DbTitle', 'VARCHAR', true, 256, null); + $this->addColumn('creator', 'DbCreator', 'VARCHAR', false, 256, null); + $this->addColumn('description', 'DbDescription', 'VARCHAR', false, 512, null); + $this->addColumn('auto_ingest', 'DbAutoIngest', 'BOOLEAN', true, null, false); + $this->addForeignKey('owner', 'DbOwner', 'INTEGER', 'cc_subjs', 'id', false, null, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('owner' => 'id', ), 'CASCADE', null); + $this->addRelation('PodcastContents', 'PodcastContents', RelationMap::ONE_TO_MANY, array('id' => 'podcast_id', ), 'CASCADE', null, 'PodcastContentss'); + } // buildRelations() + +} // PodcastTableMap diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php index faa0964c0..92017b279 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php @@ -470,6 +470,12 @@ abstract class BaseCcFiles extends BaseObject implements Persistent */ protected $filesize; + /** + * The value for the description field. + * @var string + */ + protected $description; + /** * @var CcSubjs */ @@ -527,6 +533,12 @@ abstract class BaseCcFiles extends BaseObject implements Persistent protected $collThirdPartyTrackReferencess; protected $collThirdPartyTrackReferencessPartial; + /** + * @var PropelObjectCollection|PodcastContents[] Collection to store aggregation of PodcastContents objects. + */ + protected $collPodcastContentss; + protected $collPodcastContentssPartial; + /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -589,6 +601,12 @@ abstract class BaseCcFiles extends BaseObject implements Persistent */ protected $thirdPartyTrackReferencessScheduledForDeletion = null; + /** + * An array of objects scheduled for deletion. + * @var PropelObjectCollection + */ + protected $podcastContentssScheduledForDeletion = null; + /** * Applies default values to this object. * This method should be called from the object's constructor (or @@ -1501,6 +1519,17 @@ abstract class BaseCcFiles extends BaseObject implements Persistent return $this->filesize; } + /** + * Get the [description] column value. + * + * @return string + */ + public function getDbDescription() + { + + return $this->description; + } + /** * Set the value of [id] column. * @@ -3052,6 +3081,27 @@ abstract class BaseCcFiles extends BaseObject implements Persistent return $this; } // setDbFilesize() + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return CcFiles 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[] = CcFilesPeer::DESCRIPTION; + } + + + return $this; + } // setDbDescription() + /** * Indicates whether the columns in this object are only set to default values. * @@ -3215,6 +3265,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $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->filesize = ($row[$startcol + 70] !== null) ? (int) $row[$startcol + 70] : null; + $this->description = ($row[$startcol + 71] !== null) ? (string) $row[$startcol + 71] : null; $this->resetModified(); $this->setNew(false); @@ -3224,7 +3275,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent } $this->postHydrate($row, $startcol, $rehydrate); - return $startcol + 71; // 71 = CcFilesPeer::NUM_HYDRATE_COLUMNS. + return $startcol + 72; // 72 = CcFilesPeer::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating CcFiles object", $e); @@ -3312,6 +3363,8 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->collThirdPartyTrackReferencess = null; + $this->collPodcastContentss = null; + } // if (deep) } @@ -3581,6 +3634,23 @@ abstract class BaseCcFiles extends BaseObject implements Persistent } } + if ($this->podcastContentssScheduledForDeletion !== null) { + if (!$this->podcastContentssScheduledForDeletion->isEmpty()) { + PodcastContentsQuery::create() + ->filterByPrimaryKeys($this->podcastContentssScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->podcastContentssScheduledForDeletion = null; + } + } + + if ($this->collPodcastContentss !== null) { + foreach ($this->collPodcastContentss as $referrerFK) { + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { + $affectedRows += $referrerFK->save($con); + } + } + } + $this->alreadyInSave = false; } @@ -3830,6 +3900,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if ($this->isColumnModified(CcFilesPeer::FILESIZE)) { $modifiedColumns[':p' . $index++] = '"filesize"'; } + if ($this->isColumnModified(CcFilesPeer::DESCRIPTION)) { + $modifiedColumns[':p' . $index++] = '"description"'; + } $sql = sprintf( 'INSERT INTO "cc_files" (%s) VALUES (%s)', @@ -4054,6 +4127,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent case '"filesize"': $stmt->bindValue($identifier, $this->filesize, PDO::PARAM_INT); break; + case '"description"': + $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + break; } } $stmt->execute(); @@ -4226,6 +4302,14 @@ abstract class BaseCcFiles extends BaseObject implements Persistent } } + if ($this->collPodcastContentss !== null) { + foreach ($this->collPodcastContentss as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + $this->alreadyInValidation = false; } @@ -4474,6 +4558,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent case 70: return $this->getDbFilesize(); break; + case 71: + return $this->getDbDescription(); + break; default: return null; break; @@ -4574,6 +4661,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $keys[68] => $this->getDbIsScheduled(), $keys[69] => $this->getDbIsPlaylist(), $keys[70] => $this->getDbFilesize(), + $keys[71] => $this->getDbDescription(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -4611,6 +4699,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if (null !== $this->collThirdPartyTrackReferencess) { $result['ThirdPartyTrackReferencess'] = $this->collThirdPartyTrackReferencess->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } + if (null !== $this->collPodcastContentss) { + $result['PodcastContentss'] = $this->collPodcastContentss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + } } return $result; @@ -4858,6 +4949,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent case 70: $this->setDbFilesize($value); break; + case 71: + $this->setDbDescription($value); + break; } // switch() } @@ -4953,6 +5047,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent 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->setDbFilesize($arr[$keys[70]]); + if (array_key_exists($keys[71], $arr)) $this->setDbDescription($arr[$keys[71]]); } /** @@ -5035,6 +5130,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent 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::FILESIZE)) $criteria->add(CcFilesPeer::FILESIZE, $this->filesize); + if ($this->isColumnModified(CcFilesPeer::DESCRIPTION)) $criteria->add(CcFilesPeer::DESCRIPTION, $this->description); return $criteria; } @@ -5168,6 +5264,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $copyObj->setDbIsScheduled($this->getDbIsScheduled()); $copyObj->setDbIsPlaylist($this->getDbIsPlaylist()); $copyObj->setDbFilesize($this->getDbFilesize()); + $copyObj->setDbDescription($this->getDbDescription()); if ($deepCopy && !$this->startCopy) { // important: temporarily setNew(false) because this affects the behavior of @@ -5218,6 +5315,12 @@ abstract class BaseCcFiles extends BaseObject implements Persistent } } + foreach ($this->getPodcastContentss() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addPodcastContents($relObj->copy($deepCopy)); + } + } + //unflag object copy $this->startCopy = false; } // if ($deepCopy) @@ -5456,6 +5559,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if ('ThirdPartyTrackReferences' == $relationName) { $this->initThirdPartyTrackReferencess(); } + if ('PodcastContents' == $relationName) { + $this->initPodcastContentss(); + } } /** @@ -7233,6 +7339,256 @@ abstract class BaseCcFiles extends BaseObject implements Persistent return $this; } + /** + * Clears out the collPodcastContentss 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 addPodcastContentss() + */ + public function clearPodcastContentss() + { + $this->collPodcastContentss = null; // important to set this to null since that means it is uninitialized + $this->collPodcastContentssPartial = null; + + return $this; + } + + /** + * reset is the collPodcastContentss collection loaded partially + * + * @return void + */ + public function resetPartialPodcastContentss($v = true) + { + $this->collPodcastContentssPartial = $v; + } + + /** + * Initializes the collPodcastContentss collection. + * + * By default this just sets the collPodcastContentss collection to an empty array (like clearcollPodcastContentss()); + * 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 initPodcastContentss($overrideExisting = true) + { + if (null !== $this->collPodcastContentss && !$overrideExisting) { + return; + } + $this->collPodcastContentss = new PropelObjectCollection(); + $this->collPodcastContentss->setModel('PodcastContents'); + } + + /** + * Gets an array of PodcastContents 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|PodcastContents[] List of PodcastContents objects + * @throws PropelException + */ + public function getPodcastContentss($criteria = null, PropelPDO $con = null) + { + $partial = $this->collPodcastContentssPartial && !$this->isNew(); + if (null === $this->collPodcastContentss || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collPodcastContentss) { + // return empty collection + $this->initPodcastContentss(); + } else { + $collPodcastContentss = PodcastContentsQuery::create(null, $criteria) + ->filterByCcFiles($this) + ->find($con); + if (null !== $criteria) { + if (false !== $this->collPodcastContentssPartial && count($collPodcastContentss)) { + $this->initPodcastContentss(false); + + foreach ($collPodcastContentss as $obj) { + if (false == $this->collPodcastContentss->contains($obj)) { + $this->collPodcastContentss->append($obj); + } + } + + $this->collPodcastContentssPartial = true; + } + + $collPodcastContentss->getInternalIterator()->rewind(); + + return $collPodcastContentss; + } + + if ($partial && $this->collPodcastContentss) { + foreach ($this->collPodcastContentss as $obj) { + if ($obj->isNew()) { + $collPodcastContentss[] = $obj; + } + } + } + + $this->collPodcastContentss = $collPodcastContentss; + $this->collPodcastContentssPartial = false; + } + } + + return $this->collPodcastContentss; + } + + /** + * Sets a collection of PodcastContents 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 $podcastContentss A Propel collection. + * @param PropelPDO $con Optional connection object + * @return CcFiles The current object (for fluent API support) + */ + public function setPodcastContentss(PropelCollection $podcastContentss, PropelPDO $con = null) + { + $podcastContentssToDelete = $this->getPodcastContentss(new Criteria(), $con)->diff($podcastContentss); + + + $this->podcastContentssScheduledForDeletion = $podcastContentssToDelete; + + foreach ($podcastContentssToDelete as $podcastContentsRemoved) { + $podcastContentsRemoved->setCcFiles(null); + } + + $this->collPodcastContentss = null; + foreach ($podcastContentss as $podcastContents) { + $this->addPodcastContents($podcastContents); + } + + $this->collPodcastContentss = $podcastContentss; + $this->collPodcastContentssPartial = false; + + return $this; + } + + /** + * Returns the number of related PodcastContents objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related PodcastContents objects. + * @throws PropelException + */ + public function countPodcastContentss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + $partial = $this->collPodcastContentssPartial && !$this->isNew(); + if (null === $this->collPodcastContentss || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collPodcastContentss) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getPodcastContentss()); + } + $query = PodcastContentsQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByCcFiles($this) + ->count($con); + } + + return count($this->collPodcastContentss); + } + + /** + * Method called to associate a PodcastContents object to this object + * through the PodcastContents foreign key attribute. + * + * @param PodcastContents $l PodcastContents + * @return CcFiles The current object (for fluent API support) + */ + public function addPodcastContents(PodcastContents $l) + { + if ($this->collPodcastContentss === null) { + $this->initPodcastContentss(); + $this->collPodcastContentssPartial = true; + } + + if (!in_array($l, $this->collPodcastContentss->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddPodcastContents($l); + + if ($this->podcastContentssScheduledForDeletion and $this->podcastContentssScheduledForDeletion->contains($l)) { + $this->podcastContentssScheduledForDeletion->remove($this->podcastContentssScheduledForDeletion->search($l)); + } + } + + return $this; + } + + /** + * @param PodcastContents $podcastContents The podcastContents object to add. + */ + protected function doAddPodcastContents($podcastContents) + { + $this->collPodcastContentss[]= $podcastContents; + $podcastContents->setCcFiles($this); + } + + /** + * @param PodcastContents $podcastContents The podcastContents object to remove. + * @return CcFiles The current object (for fluent API support) + */ + public function removePodcastContents($podcastContents) + { + if ($this->getPodcastContentss()->contains($podcastContents)) { + $this->collPodcastContentss->remove($this->collPodcastContentss->search($podcastContents)); + if (null === $this->podcastContentssScheduledForDeletion) { + $this->podcastContentssScheduledForDeletion = clone $this->collPodcastContentss; + $this->podcastContentssScheduledForDeletion->clear(); + } + $this->podcastContentssScheduledForDeletion[]= clone $podcastContents; + $podcastContents->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 PodcastContentss 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|PodcastContents[] List of PodcastContents objects + */ + public function getPodcastContentssJoinPodcast($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = PodcastContentsQuery::create(null, $criteria); + $query->joinWith('Podcast', $join_behavior); + + return $this->getPodcastContentss($query, $con); + } + /** * Clears the current object and sets all attributes to their default values */ @@ -7309,6 +7665,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->is_scheduled = null; $this->is_playlist = null; $this->filesize = null; + $this->description = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; $this->alreadyInClearAllReferencesDeep = false; @@ -7367,6 +7724,11 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $o->clearAllReferences($deep); } } + if ($this->collPodcastContentss) { + foreach ($this->collPodcastContentss as $o) { + $o->clearAllReferences($deep); + } + } if ($this->aFkOwner instanceof Persistent) { $this->aFkOwner->clearAllReferences($deep); } @@ -7408,6 +7770,10 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->collThirdPartyTrackReferencess->clearIterator(); } $this->collThirdPartyTrackReferencess = null; + if ($this->collPodcastContentss instanceof PropelCollection) { + $this->collPodcastContentss->clearIterator(); + } + $this->collPodcastContentss = null; $this->aFkOwner = null; $this->aCcSubjsRelatedByDbEditedby = null; $this->aCcMusicDirs = null; diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php index cbe44f498..e1100a5a1 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php @@ -24,13 +24,13 @@ abstract class BaseCcFilesPeer const TM_CLASS = 'CcFilesTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 71; + const NUM_COLUMNS = 72; /** 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 = 71; + const NUM_HYDRATE_COLUMNS = 72; /** the column name for the id field */ const ID = 'cc_files.id'; @@ -245,6 +245,9 @@ abstract class BaseCcFilesPeer /** the column name for the filesize field */ const FILESIZE = 'cc_files.filesize'; + /** the column name for the description field */ + const DESCRIPTION = 'cc_files.description'; + /** The default string format for model objects of the related table **/ const DEFAULT_STRING_FORMAT = 'YAML'; @@ -264,12 +267,12 @@ abstract class BaseCcFilesPeer * 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', 'DbFilesize', ), - 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', 'dbFilesize', ), - 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::FILESIZE, ), - 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', 'FILESIZE', ), - 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', 'filesize', ), - 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, ) + 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', 'DbFilesize', 'DbDescription', ), + 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', 'dbFilesize', 'dbDescription', ), + 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::FILESIZE, CcFilesPeer::DESCRIPTION, ), + 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', 'FILESIZE', 'DESCRIPTION', ), + 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', 'filesize', 'description', ), + 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, 71, ) ); /** @@ -279,12 +282,12 @@ abstract class BaseCcFilesPeer * 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, 'DbFilesize' => 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, 'dbFilesize' => 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::FILESIZE => 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, 'FILESIZE' => 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, 'filesize' => 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, ) + 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, 'DbFilesize' => 70, 'DbDescription' => 71, ), + 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, 'dbFilesize' => 70, 'dbDescription' => 71, ), + 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::FILESIZE => 70, CcFilesPeer::DESCRIPTION => 71, ), + 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, 'FILESIZE' => 70, 'DESCRIPTION' => 71, ), + 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, 'filesize' => 70, 'description' => 71, ), + 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, 71, ) ); /** @@ -429,6 +432,7 @@ abstract class BaseCcFilesPeer $criteria->addSelectColumn(CcFilesPeer::IS_SCHEDULED); $criteria->addSelectColumn(CcFilesPeer::IS_PLAYLIST); $criteria->addSelectColumn(CcFilesPeer::FILESIZE); + $criteria->addSelectColumn(CcFilesPeer::DESCRIPTION); } else { $criteria->addSelectColumn($alias . '.id'); $criteria->addSelectColumn($alias . '.name'); @@ -501,6 +505,7 @@ abstract class BaseCcFilesPeer $criteria->addSelectColumn($alias . '.is_scheduled'); $criteria->addSelectColumn($alias . '.is_playlist'); $criteria->addSelectColumn($alias . '.filesize'); + $criteria->addSelectColumn($alias . '.description'); } } @@ -726,6 +731,9 @@ abstract class BaseCcFilesPeer // Invalidate objects in ThirdPartyTrackReferencesPeer instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. ThirdPartyTrackReferencesPeer::clearInstancePool(); + // Invalidate objects in PodcastContentsPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + PodcastContentsPeer::clearInstancePool(); } /** diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php index 1ed4e004f..ded34dc58 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php @@ -77,6 +77,7 @@ * @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 orderByDbFilesize($order = Criteria::ASC) Order by the filesize column + * @method CcFilesQuery orderByDbDescription($order = Criteria::ASC) Order by the description column * * @method CcFilesQuery groupByDbId() Group by the id column * @method CcFilesQuery groupByDbName() Group by the name column @@ -149,6 +150,7 @@ * @method CcFilesQuery groupByDbIsScheduled() Group by the is_scheduled column * @method CcFilesQuery groupByDbIsPlaylist() Group by the is_playlist column * @method CcFilesQuery groupByDbFilesize() Group by the filesize column + * @method CcFilesQuery groupByDbDescription() Group by the description 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 @@ -194,6 +196,10 @@ * @method CcFilesQuery rightJoinThirdPartyTrackReferences($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ThirdPartyTrackReferences relation * @method CcFilesQuery innerJoinThirdPartyTrackReferences($relationAlias = null) Adds a INNER JOIN clause to the query using the ThirdPartyTrackReferences relation * + * @method CcFilesQuery leftJoinPodcastContents($relationAlias = null) Adds a LEFT JOIN clause to the query using the PodcastContents relation + * @method CcFilesQuery rightJoinPodcastContents($relationAlias = null) Adds a RIGHT JOIN clause to the query using the PodcastContents relation + * @method CcFilesQuery innerJoinPodcastContents($relationAlias = null) Adds a INNER JOIN clause to the query using the PodcastContents 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 * @@ -267,6 +273,7 @@ * @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 findOneByDbFilesize(int $filesize) Return the first CcFiles filtered by the filesize column + * @method CcFiles findOneByDbDescription(string $description) Return the first CcFiles filtered by the description 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 @@ -339,6 +346,7 @@ * @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 findByDbFilesize(int $filesize) Return CcFiles objects filtered by the filesize column + * @method array findByDbDescription(string $description) Return CcFiles objects filtered by the description column * * @package propel.generator.airtime.om */ @@ -446,7 +454,7 @@ abstract class BaseCcFilesQuery extends ModelCriteria */ 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", "filesize" FROM "cc_files" WHERE "id" = :p0'; + $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", "filesize", "description" FROM "cc_files" WHERE "id" = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -2841,6 +2849,35 @@ abstract class BaseCcFilesQuery extends ModelCriteria return $this->addUsingAlias(CcFilesPeer::FILESIZE, $dbFilesize, $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 CcFilesQuery 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(CcFilesPeer::DESCRIPTION, $dbDescription, $comparison); + } + /** * Filter the query by a related CcSubjs object * @@ -3587,6 +3624,80 @@ abstract class BaseCcFilesQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'ThirdPartyTrackReferences', 'ThirdPartyTrackReferencesQuery'); } + /** + * Filter the query by a related PodcastContents object + * + * @param PodcastContents|PropelObjectCollection $podcastContents 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 filterByPodcastContents($podcastContents, $comparison = null) + { + if ($podcastContents instanceof PodcastContents) { + return $this + ->addUsingAlias(CcFilesPeer::ID, $podcastContents->getDbFileId(), $comparison); + } elseif ($podcastContents instanceof PropelObjectCollection) { + return $this + ->usePodcastContentsQuery() + ->filterByPrimaryKeys($podcastContents->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByPodcastContents() only accepts arguments of type PodcastContents or PropelCollection'); + } + } + + /** + * Adds a JOIN clause to the query using the PodcastContents 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 joinPodcastContents($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('PodcastContents'); + + // 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, 'PodcastContents'); + } + + return $this; + } + + /** + * Use the PodcastContents relation PodcastContents 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 PodcastContentsQuery A secondary query class using the current class as primary query + */ + public function usePodcastContentsQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinPodcastContents($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'PodcastContents', 'PodcastContentsQuery'); + } + /** * Exclude object from result * diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php index 6aa0df213..1368aafa5 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjs.php @@ -167,6 +167,12 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent protected $collCcSubjsTokens; protected $collCcSubjsTokensPartial; + /** + * @var PropelObjectCollection|Podcast[] Collection to store aggregation of Podcast objects. + */ + protected $collPodcasts; + protected $collPodcastsPartial; + /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -241,6 +247,12 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent */ protected $ccSubjsTokensScheduledForDeletion = null; + /** + * An array of objects scheduled for deletion. + * @var PropelObjectCollection + */ + protected $podcastsScheduledForDeletion = null; + /** * Applies default values to this object. * This method should be called from the object's constructor (or @@ -893,6 +905,8 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $this->collCcSubjsTokens = null; + $this->collPodcasts = null; + } // if (deep) } @@ -1172,6 +1186,23 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent } } + if ($this->podcastsScheduledForDeletion !== null) { + if (!$this->podcastsScheduledForDeletion->isEmpty()) { + PodcastQuery::create() + ->filterByPrimaryKeys($this->podcastsScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->podcastsScheduledForDeletion = null; + } + } + + if ($this->collPodcasts !== null) { + foreach ($this->collPodcasts as $referrerFK) { + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { + $affectedRows += $referrerFK->save($con); + } + } + } + $this->alreadyInSave = false; } @@ -1461,6 +1492,14 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent } } + if ($this->collPodcasts !== null) { + foreach ($this->collPodcasts as $referrerFK) { + if (!$referrerFK->validate($columns)) { + $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); + } + } + } + $this->alreadyInValidation = false; } @@ -1611,6 +1650,9 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent if (null !== $this->collCcSubjsTokens) { $result['CcSubjsTokens'] = $this->collCcSubjsTokens->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } + if (null !== $this->collPodcasts) { + $result['Podcasts'] = $this->collPodcasts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); + } } return $result; @@ -1882,6 +1924,12 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent } } + foreach ($this->getPodcasts() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addPodcast($relObj->copy($deepCopy)); + } + } + //unflag object copy $this->startCopy = false; } // if ($deepCopy) @@ -1970,6 +2018,9 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent if ('CcSubjsToken' == $relationName) { $this->initCcSubjsTokens(); } + if ('Podcast' == $relationName) { + $this->initPodcasts(); + } } /** @@ -4072,6 +4123,231 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent return $this; } + /** + * Clears out the collPodcasts 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 addPodcasts() + */ + public function clearPodcasts() + { + $this->collPodcasts = null; // important to set this to null since that means it is uninitialized + $this->collPodcastsPartial = null; + + return $this; + } + + /** + * reset is the collPodcasts collection loaded partially + * + * @return void + */ + public function resetPartialPodcasts($v = true) + { + $this->collPodcastsPartial = $v; + } + + /** + * Initializes the collPodcasts collection. + * + * By default this just sets the collPodcasts collection to an empty array (like clearcollPodcasts()); + * 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 initPodcasts($overrideExisting = true) + { + if (null !== $this->collPodcasts && !$overrideExisting) { + return; + } + $this->collPodcasts = new PropelObjectCollection(); + $this->collPodcasts->setModel('Podcast'); + } + + /** + * Gets an array of Podcast 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|Podcast[] List of Podcast objects + * @throws PropelException + */ + public function getPodcasts($criteria = null, PropelPDO $con = null) + { + $partial = $this->collPodcastsPartial && !$this->isNew(); + if (null === $this->collPodcasts || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collPodcasts) { + // return empty collection + $this->initPodcasts(); + } else { + $collPodcasts = PodcastQuery::create(null, $criteria) + ->filterByCcSubjs($this) + ->find($con); + if (null !== $criteria) { + if (false !== $this->collPodcastsPartial && count($collPodcasts)) { + $this->initPodcasts(false); + + foreach ($collPodcasts as $obj) { + if (false == $this->collPodcasts->contains($obj)) { + $this->collPodcasts->append($obj); + } + } + + $this->collPodcastsPartial = true; + } + + $collPodcasts->getInternalIterator()->rewind(); + + return $collPodcasts; + } + + if ($partial && $this->collPodcasts) { + foreach ($this->collPodcasts as $obj) { + if ($obj->isNew()) { + $collPodcasts[] = $obj; + } + } + } + + $this->collPodcasts = $collPodcasts; + $this->collPodcastsPartial = false; + } + } + + return $this->collPodcasts; + } + + /** + * Sets a collection of Podcast 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 $podcasts A Propel collection. + * @param PropelPDO $con Optional connection object + * @return CcSubjs The current object (for fluent API support) + */ + public function setPodcasts(PropelCollection $podcasts, PropelPDO $con = null) + { + $podcastsToDelete = $this->getPodcasts(new Criteria(), $con)->diff($podcasts); + + + $this->podcastsScheduledForDeletion = $podcastsToDelete; + + foreach ($podcastsToDelete as $podcastRemoved) { + $podcastRemoved->setCcSubjs(null); + } + + $this->collPodcasts = null; + foreach ($podcasts as $podcast) { + $this->addPodcast($podcast); + } + + $this->collPodcasts = $podcasts; + $this->collPodcastsPartial = false; + + return $this; + } + + /** + * Returns the number of related Podcast objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related Podcast objects. + * @throws PropelException + */ + public function countPodcasts(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + $partial = $this->collPodcastsPartial && !$this->isNew(); + if (null === $this->collPodcasts || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collPodcasts) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getPodcasts()); + } + $query = PodcastQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByCcSubjs($this) + ->count($con); + } + + return count($this->collPodcasts); + } + + /** + * Method called to associate a Podcast object to this object + * through the Podcast foreign key attribute. + * + * @param Podcast $l Podcast + * @return CcSubjs The current object (for fluent API support) + */ + public function addPodcast(Podcast $l) + { + if ($this->collPodcasts === null) { + $this->initPodcasts(); + $this->collPodcastsPartial = true; + } + + if (!in_array($l, $this->collPodcasts->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddPodcast($l); + + if ($this->podcastsScheduledForDeletion and $this->podcastsScheduledForDeletion->contains($l)) { + $this->podcastsScheduledForDeletion->remove($this->podcastsScheduledForDeletion->search($l)); + } + } + + return $this; + } + + /** + * @param Podcast $podcast The podcast object to add. + */ + protected function doAddPodcast($podcast) + { + $this->collPodcasts[]= $podcast; + $podcast->setCcSubjs($this); + } + + /** + * @param Podcast $podcast The podcast object to remove. + * @return CcSubjs The current object (for fluent API support) + */ + public function removePodcast($podcast) + { + if ($this->getPodcasts()->contains($podcast)) { + $this->collPodcasts->remove($this->collPodcasts->search($podcast)); + if (null === $this->podcastsScheduledForDeletion) { + $this->podcastsScheduledForDeletion = clone $this->collPodcasts; + $this->podcastsScheduledForDeletion->clear(); + } + $this->podcastsScheduledForDeletion[]= $podcast; + $podcast->setCcSubjs(null); + } + + return $this; + } + /** * Clears the current object and sets all attributes to their default values */ @@ -4158,6 +4434,11 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $o->clearAllReferences($deep); } } + if ($this->collPodcasts) { + foreach ($this->collPodcasts as $o) { + $o->clearAllReferences($deep); + } + } $this->alreadyInClearAllReferencesDeep = false; } // if ($deep) @@ -4198,6 +4479,10 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $this->collCcSubjsTokens->clearIterator(); } $this->collCcSubjsTokens = null; + if ($this->collPodcasts instanceof PropelCollection) { + $this->collPodcasts->clearIterator(); + } + $this->collPodcasts = null; } /** diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjsPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjsPeer.php index f886a27b3..2f3d3b502 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSubjsPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjsPeer.php @@ -436,6 +436,9 @@ abstract class BaseCcSubjsPeer // Invalidate objects in CcSubjsTokenPeer instance pool, // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. CcSubjsTokenPeer::clearInstancePool(); + // Invalidate objects in PodcastPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + PodcastPeer::clearInstancePool(); } /** diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php index 1416ec184..11fab88b1 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcSubjsQuery.php @@ -74,6 +74,10 @@ * @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 CcSubjsQuery leftJoinPodcast($relationAlias = null) Adds a LEFT JOIN clause to the query using the Podcast relation + * @method CcSubjsQuery rightJoinPodcast($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Podcast relation + * @method CcSubjsQuery innerJoinPodcast($relationAlias = null) Adds a INNER JOIN clause to the query using the Podcast 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 * @@ -1396,6 +1400,80 @@ abstract class BaseCcSubjsQuery extends ModelCriteria ->useQuery($relationAlias ? $relationAlias : 'CcSubjsToken', 'CcSubjsTokenQuery'); } + /** + * Filter the query by a related Podcast object + * + * @param Podcast|PropelObjectCollection $podcast 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 filterByPodcast($podcast, $comparison = null) + { + if ($podcast instanceof Podcast) { + return $this + ->addUsingAlias(CcSubjsPeer::ID, $podcast->getDbOwner(), $comparison); + } elseif ($podcast instanceof PropelObjectCollection) { + return $this + ->usePodcastQuery() + ->filterByPrimaryKeys($podcast->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByPodcast() only accepts arguments of type Podcast or PropelCollection'); + } + } + + /** + * Adds a JOIN clause to the query using the Podcast 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 joinPodcast($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Podcast'); + + // 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, 'Podcast'); + } + + return $this; + } + + /** + * Use the Podcast relation Podcast 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 PodcastQuery A secondary query class using the current class as primary query + */ + public function usePodcastQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) + { + return $this + ->joinPodcast($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Podcast', 'PodcastQuery'); + } + /** * Exclude object from result * diff --git a/airtime_mvc/application/models/airtime/om/BasePodcast.php b/airtime_mvc/application/models/airtime/om/BasePodcast.php new file mode 100644 index 000000000..12d2ed168 --- /dev/null +++ b/airtime_mvc/application/models/airtime/om/BasePodcast.php @@ -0,0 +1,1577 @@ +auto_ingest = false; + } + + /** + * Initializes internal state of BasePodcast 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 [url] column value. + * + * @return string + */ + public function getDbUrl() + { + + return $this->url; + } + + /** + * Get the [title] column value. + * + * @return string + */ + public function getDbTitle() + { + + return $this->title; + } + + /** + * Get the [creator] column value. + * + * @return string + */ + public function getDbCreator() + { + + return $this->creator; + } + + /** + * Get the [description] column value. + * + * @return string + */ + public function getDbDescription() + { + + return $this->description; + } + + /** + * Get the [auto_ingest] column value. + * + * @return boolean + */ + public function getDbAutoIngest() + { + + return $this->auto_ingest; + } + + /** + * Get the [owner] column value. + * + * @return int + */ + public function getDbOwner() + { + + return $this->owner; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return Podcast 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[] = PodcastPeer::ID; + } + + + return $this; + } // setDbId() + + /** + * Set the value of [url] column. + * + * @param string $v new value + * @return Podcast 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[] = PodcastPeer::URL; + } + + + return $this; + } // setDbUrl() + + /** + * Set the value of [title] column. + * + * @param string $v new value + * @return Podcast The current object (for fluent API support) + */ + public function setDbTitle($v) + { + if ($v !== null && is_numeric($v)) { + $v = (string) $v; + } + + if ($this->title !== $v) { + $this->title = $v; + $this->modifiedColumns[] = PodcastPeer::TITLE; + } + + + return $this; + } // setDbTitle() + + /** + * Set the value of [creator] column. + * + * @param string $v new value + * @return Podcast The current object (for fluent API support) + */ + public function setDbCreator($v) + { + if ($v !== null && is_numeric($v)) { + $v = (string) $v; + } + + if ($this->creator !== $v) { + $this->creator = $v; + $this->modifiedColumns[] = PodcastPeer::CREATOR; + } + + + return $this; + } // setDbCreator() + + /** + * Set the value of [description] column. + * + * @param string $v new value + * @return Podcast 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[] = PodcastPeer::DESCRIPTION; + } + + + return $this; + } // setDbDescription() + + /** + * Sets the value of the [auto_ingest] 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 Podcast The current object (for fluent API support) + */ + public function setDbAutoIngest($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->auto_ingest !== $v) { + $this->auto_ingest = $v; + $this->modifiedColumns[] = PodcastPeer::AUTO_INGEST; + } + + + return $this; + } // setDbAutoIngest() + + /** + * Set the value of [owner] column. + * + * @param int $v new value + * @return Podcast The current object (for fluent API support) + */ + public function setDbOwner($v) + { + if ($v !== null && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->owner !== $v) { + $this->owner = $v; + $this->modifiedColumns[] = PodcastPeer::OWNER; + } + + if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) { + $this->aCcSubjs = null; + } + + + return $this; + } // setDbOwner() + + /** + * 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->auto_ingest !== 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->url = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->creator = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; + $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; + $this->auto_ingest = ($row[$startcol + 5] !== null) ? (boolean) $row[$startcol + 5] : null; + $this->owner = ($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 = PodcastPeer::NUM_HYDRATE_COLUMNS. + + } catch (Exception $e) { + throw new PropelException("Error populating Podcast object", $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + + if ($this->aCcSubjs !== null && $this->owner !== $this->aCcSubjs->getDbId()) { + $this->aCcSubjs = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param PropelPDO $con (optional) The PropelPDO connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getConnection(PodcastPeer::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 = PodcastPeer::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->collPodcastContentss = 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(PodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $deleteQuery = PodcastQuery::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(PodcastPeer::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); + PodcastPeer::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->podcastContentssScheduledForDeletion !== null) { + if (!$this->podcastContentssScheduledForDeletion->isEmpty()) { + PodcastContentsQuery::create() + ->filterByPrimaryKeys($this->podcastContentssScheduledForDeletion->getPrimaryKeys(false)) + ->delete($con); + $this->podcastContentssScheduledForDeletion = null; + } + } + + if ($this->collPodcastContentss !== null) { + foreach ($this->collPodcastContentss 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[] = PodcastPeer::ID; + if (null !== $this->id) { + throw new PropelException('Cannot insert a value for auto-increment primary key (' . PodcastPeer::ID . ')'); + } + if (null === $this->id) { + try { + $stmt = $con->query("SELECT nextval('podcast_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(PodcastPeer::ID)) { + $modifiedColumns[':p' . $index++] = '"id"'; + } + if ($this->isColumnModified(PodcastPeer::URL)) { + $modifiedColumns[':p' . $index++] = '"url"'; + } + if ($this->isColumnModified(PodcastPeer::TITLE)) { + $modifiedColumns[':p' . $index++] = '"title"'; + } + if ($this->isColumnModified(PodcastPeer::CREATOR)) { + $modifiedColumns[':p' . $index++] = '"creator"'; + } + if ($this->isColumnModified(PodcastPeer::DESCRIPTION)) { + $modifiedColumns[':p' . $index++] = '"description"'; + } + if ($this->isColumnModified(PodcastPeer::AUTO_INGEST)) { + $modifiedColumns[':p' . $index++] = '"auto_ingest"'; + } + if ($this->isColumnModified(PodcastPeer::OWNER)) { + $modifiedColumns[':p' . $index++] = '"owner"'; + } + + $sql = sprintf( + 'INSERT INTO "podcast" (%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 '"url"': + $stmt->bindValue($identifier, $this->url, PDO::PARAM_STR); + break; + case '"title"': + $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR); + break; + case '"creator"': + $stmt->bindValue($identifier, $this->creator, PDO::PARAM_STR); + break; + case '"description"': + $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR); + break; + case '"auto_ingest"': + $stmt->bindValue($identifier, $this->auto_ingest, PDO::PARAM_BOOL); + break; + case '"owner"': + $stmt->bindValue($identifier, $this->owner, 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->aCcSubjs !== null) { + if (!$this->aCcSubjs->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aCcSubjs->getValidationFailures()); + } + } + + + if (($retval = PodcastPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + if ($this->collPodcastContentss !== null) { + foreach ($this->collPodcastContentss 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 = PodcastPeer::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->getDbUrl(); + break; + case 2: + return $this->getDbTitle(); + break; + case 3: + return $this->getDbCreator(); + break; + case 4: + return $this->getDbDescription(); + break; + case 5: + return $this->getDbAutoIngest(); + break; + case 6: + return $this->getDbOwner(); + 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['Podcast'][$this->getPrimaryKey()])) { + return '*RECURSION*'; + } + $alreadyDumpedObjects['Podcast'][$this->getPrimaryKey()] = true; + $keys = PodcastPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbId(), + $keys[1] => $this->getDbUrl(), + $keys[2] => $this->getDbTitle(), + $keys[3] => $this->getDbCreator(), + $keys[4] => $this->getDbDescription(), + $keys[5] => $this->getDbAutoIngest(), + $keys[6] => $this->getDbOwner(), + ); + $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->collPodcastContentss) { + $result['PodcastContentss'] = $this->collPodcastContentss->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 = PodcastPeer::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->setDbUrl($value); + break; + case 2: + $this->setDbTitle($value); + break; + case 3: + $this->setDbCreator($value); + break; + case 4: + $this->setDbDescription($value); + break; + case 5: + $this->setDbAutoIngest($value); + break; + case 6: + $this->setDbOwner($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 = PodcastPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbUrl($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDbTitle($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDbCreator($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setDbDescription($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setDbAutoIngest($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setDbOwner($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(PodcastPeer::DATABASE_NAME); + + if ($this->isColumnModified(PodcastPeer::ID)) $criteria->add(PodcastPeer::ID, $this->id); + if ($this->isColumnModified(PodcastPeer::URL)) $criteria->add(PodcastPeer::URL, $this->url); + if ($this->isColumnModified(PodcastPeer::TITLE)) $criteria->add(PodcastPeer::TITLE, $this->title); + if ($this->isColumnModified(PodcastPeer::CREATOR)) $criteria->add(PodcastPeer::CREATOR, $this->creator); + if ($this->isColumnModified(PodcastPeer::DESCRIPTION)) $criteria->add(PodcastPeer::DESCRIPTION, $this->description); + if ($this->isColumnModified(PodcastPeer::AUTO_INGEST)) $criteria->add(PodcastPeer::AUTO_INGEST, $this->auto_ingest); + if ($this->isColumnModified(PodcastPeer::OWNER)) $criteria->add(PodcastPeer::OWNER, $this->owner); + + 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(PodcastPeer::DATABASE_NAME); + $criteria->add(PodcastPeer::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 Podcast (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->setDbUrl($this->getDbUrl()); + $copyObj->setDbTitle($this->getDbTitle()); + $copyObj->setDbCreator($this->getDbCreator()); + $copyObj->setDbDescription($this->getDbDescription()); + $copyObj->setDbAutoIngest($this->getDbAutoIngest()); + $copyObj->setDbOwner($this->getDbOwner()); + + 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->getPodcastContentss() as $relObj) { + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves + $copyObj->addPodcastContents($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 Podcast 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 PodcastPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new PodcastPeer(); + } + + return self::$peer; + } + + /** + * Declares an association between this object and a CcSubjs object. + * + * @param CcSubjs $v + * @return Podcast The current object (for fluent API support) + * @throws PropelException + */ + public function setCcSubjs(CcSubjs $v = null) + { + if ($v === null) { + $this->setDbOwner(NULL); + } else { + $this->setDbOwner($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->addPodcast($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->owner !== null) && $doQuery) { + $this->aCcSubjs = CcSubjsQuery::create()->findPk($this->owner, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aCcSubjs->addPodcasts($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 ('PodcastContents' == $relationName) { + $this->initPodcastContentss(); + } + } + + /** + * Clears out the collPodcastContentss 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 Podcast The current object (for fluent API support) + * @see addPodcastContentss() + */ + public function clearPodcastContentss() + { + $this->collPodcastContentss = null; // important to set this to null since that means it is uninitialized + $this->collPodcastContentssPartial = null; + + return $this; + } + + /** + * reset is the collPodcastContentss collection loaded partially + * + * @return void + */ + public function resetPartialPodcastContentss($v = true) + { + $this->collPodcastContentssPartial = $v; + } + + /** + * Initializes the collPodcastContentss collection. + * + * By default this just sets the collPodcastContentss collection to an empty array (like clearcollPodcastContentss()); + * 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 initPodcastContentss($overrideExisting = true) + { + if (null !== $this->collPodcastContentss && !$overrideExisting) { + return; + } + $this->collPodcastContentss = new PropelObjectCollection(); + $this->collPodcastContentss->setModel('PodcastContents'); + } + + /** + * Gets an array of PodcastContents 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 Podcast 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|PodcastContents[] List of PodcastContents objects + * @throws PropelException + */ + public function getPodcastContentss($criteria = null, PropelPDO $con = null) + { + $partial = $this->collPodcastContentssPartial && !$this->isNew(); + if (null === $this->collPodcastContentss || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collPodcastContentss) { + // return empty collection + $this->initPodcastContentss(); + } else { + $collPodcastContentss = PodcastContentsQuery::create(null, $criteria) + ->filterByPodcast($this) + ->find($con); + if (null !== $criteria) { + if (false !== $this->collPodcastContentssPartial && count($collPodcastContentss)) { + $this->initPodcastContentss(false); + + foreach ($collPodcastContentss as $obj) { + if (false == $this->collPodcastContentss->contains($obj)) { + $this->collPodcastContentss->append($obj); + } + } + + $this->collPodcastContentssPartial = true; + } + + $collPodcastContentss->getInternalIterator()->rewind(); + + return $collPodcastContentss; + } + + if ($partial && $this->collPodcastContentss) { + foreach ($this->collPodcastContentss as $obj) { + if ($obj->isNew()) { + $collPodcastContentss[] = $obj; + } + } + } + + $this->collPodcastContentss = $collPodcastContentss; + $this->collPodcastContentssPartial = false; + } + } + + return $this->collPodcastContentss; + } + + /** + * Sets a collection of PodcastContents 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 $podcastContentss A Propel collection. + * @param PropelPDO $con Optional connection object + * @return Podcast The current object (for fluent API support) + */ + public function setPodcastContentss(PropelCollection $podcastContentss, PropelPDO $con = null) + { + $podcastContentssToDelete = $this->getPodcastContentss(new Criteria(), $con)->diff($podcastContentss); + + + $this->podcastContentssScheduledForDeletion = $podcastContentssToDelete; + + foreach ($podcastContentssToDelete as $podcastContentsRemoved) { + $podcastContentsRemoved->setPodcast(null); + } + + $this->collPodcastContentss = null; + foreach ($podcastContentss as $podcastContents) { + $this->addPodcastContents($podcastContents); + } + + $this->collPodcastContentss = $podcastContentss; + $this->collPodcastContentssPartial = false; + + return $this; + } + + /** + * Returns the number of related PodcastContents objects. + * + * @param Criteria $criteria + * @param boolean $distinct + * @param PropelPDO $con + * @return int Count of related PodcastContents objects. + * @throws PropelException + */ + public function countPodcastContentss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) + { + $partial = $this->collPodcastContentssPartial && !$this->isNew(); + if (null === $this->collPodcastContentss || null !== $criteria || $partial) { + if ($this->isNew() && null === $this->collPodcastContentss) { + return 0; + } + + if ($partial && !$criteria) { + return count($this->getPodcastContentss()); + } + $query = PodcastContentsQuery::create(null, $criteria); + if ($distinct) { + $query->distinct(); + } + + return $query + ->filterByPodcast($this) + ->count($con); + } + + return count($this->collPodcastContentss); + } + + /** + * Method called to associate a PodcastContents object to this object + * through the PodcastContents foreign key attribute. + * + * @param PodcastContents $l PodcastContents + * @return Podcast The current object (for fluent API support) + */ + public function addPodcastContents(PodcastContents $l) + { + if ($this->collPodcastContentss === null) { + $this->initPodcastContentss(); + $this->collPodcastContentssPartial = true; + } + + if (!in_array($l, $this->collPodcastContentss->getArrayCopy(), true)) { // only add it if the **same** object is not already associated + $this->doAddPodcastContents($l); + + if ($this->podcastContentssScheduledForDeletion and $this->podcastContentssScheduledForDeletion->contains($l)) { + $this->podcastContentssScheduledForDeletion->remove($this->podcastContentssScheduledForDeletion->search($l)); + } + } + + return $this; + } + + /** + * @param PodcastContents $podcastContents The podcastContents object to add. + */ + protected function doAddPodcastContents($podcastContents) + { + $this->collPodcastContentss[]= $podcastContents; + $podcastContents->setPodcast($this); + } + + /** + * @param PodcastContents $podcastContents The podcastContents object to remove. + * @return Podcast The current object (for fluent API support) + */ + public function removePodcastContents($podcastContents) + { + if ($this->getPodcastContentss()->contains($podcastContents)) { + $this->collPodcastContentss->remove($this->collPodcastContentss->search($podcastContents)); + if (null === $this->podcastContentssScheduledForDeletion) { + $this->podcastContentssScheduledForDeletion = clone $this->collPodcastContentss; + $this->podcastContentssScheduledForDeletion->clear(); + } + $this->podcastContentssScheduledForDeletion[]= clone $podcastContents; + $podcastContents->setPodcast(null); + } + + return $this; + } + + + /** + * If this collection has already been initialized with + * an identical criteria, it returns the collection. + * Otherwise if this Podcast is new, it will return + * an empty collection; or if this Podcast has previously + * been saved, it will retrieve related PodcastContentss 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 Podcast. + * + * @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|PodcastContents[] List of PodcastContents objects + */ + public function getPodcastContentssJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN) + { + $query = PodcastContentsQuery::create(null, $criteria); + $query->joinWith('CcFiles', $join_behavior); + + return $this->getPodcastContentss($query, $con); + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->url = null; + $this->title = null; + $this->creator = null; + $this->description = null; + $this->auto_ingest = null; + $this->owner = 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->collPodcastContentss) { + foreach ($this->collPodcastContentss as $o) { + $o->clearAllReferences($deep); + } + } + if ($this->aCcSubjs instanceof Persistent) { + $this->aCcSubjs->clearAllReferences($deep); + } + + $this->alreadyInClearAllReferencesDeep = false; + } // if ($deep) + + if ($this->collPodcastContentss instanceof PropelCollection) { + $this->collPodcastContentss->clearIterator(); + } + $this->collPodcastContentss = null; + $this->aCcSubjs = null; + } + + /** + * return the string representation of this object + * + * @return string + */ + public function __toString() + { + return (string) $this->exportTo(PodcastPeer::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/BasePodcastContents.php b/airtime_mvc/application/models/airtime/om/BasePodcastContents.php new file mode 100644 index 000000000..a2e871bd5 --- /dev/null +++ b/airtime_mvc/application/models/airtime/om/BasePodcastContents.php @@ -0,0 +1,1162 @@ +id; + } + + /** + * Get the [file_id] column value. + * + * @return int + */ + public function getDbFileId() + { + + return $this->file_id; + } + + /** + * Get the [podcast_id] column value. + * + * @return int + */ + public function getDbPodcastId() + { + + return $this->podcast_id; + } + + /** + * Get the [optionally formatted] temporal [publication_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 getDbPublicationDate($format = 'Y-m-d H:i:s') + { + if ($this->publication_date === null) { + return null; + } + + + try { + $dt = new DateTime($this->publication_date); + } catch (Exception $x) { + throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->publication_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); + + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return PodcastContents 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[] = PodcastContentsPeer::ID; + } + + + return $this; + } // setDbId() + + /** + * Set the value of [file_id] column. + * + * @param int $v new value + * @return PodcastContents 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[] = PodcastContentsPeer::FILE_ID; + } + + if ($this->aCcFiles !== null && $this->aCcFiles->getDbId() !== $v) { + $this->aCcFiles = null; + } + + + return $this; + } // setDbFileId() + + /** + * Set the value of [podcast_id] column. + * + * @param int $v new value + * @return PodcastContents The current object (for fluent API support) + */ + public function setDbPodcastId($v) + { + if ($v !== null && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->podcast_id !== $v) { + $this->podcast_id = $v; + $this->modifiedColumns[] = PodcastContentsPeer::PODCAST_ID; + } + + if ($this->aPodcast !== null && $this->aPodcast->getDbId() !== $v) { + $this->aPodcast = null; + } + + + return $this; + } // setDbPodcastId() + + /** + * Sets the value of [publication_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 PodcastContents The current object (for fluent API support) + */ + public function setDbPublicationDate($v) + { + $dt = PropelDateTime::newInstance($v, null, 'DateTime'); + if ($this->publication_date !== null || $dt !== null) { + $currentDateAsString = ($this->publication_date !== null && $tmpDt = new DateTime($this->publication_date)) ? $tmpDt->format('Y-m-d H:i:s') : null; + $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; + if ($currentDateAsString !== $newDateAsString) { + $this->publication_date = $newDateAsString; + $this->modifiedColumns[] = PodcastContentsPeer::PUBLICATION_DATE; + } + } // if either are not null + + + return $this; + } // setDbPublicationDate() + + /** + * 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->podcast_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; + $this->publication_date = ($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 = PodcastContentsPeer::NUM_HYDRATE_COLUMNS. + + } catch (Exception $e) { + throw new PropelException("Error populating PodcastContents 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->aPodcast !== null && $this->podcast_id !== $this->aPodcast->getDbId()) { + $this->aPodcast = 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(PodcastContentsPeer::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 = PodcastContentsPeer::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->aPodcast = 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(PodcastContentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $deleteQuery = PodcastContentsQuery::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(PodcastContentsPeer::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); + PodcastContentsPeer::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->aPodcast !== null) { + if ($this->aPodcast->isModified() || $this->aPodcast->isNew()) { + $affectedRows += $this->aPodcast->save($con); + } + $this->setPodcast($this->aPodcast); + } + + 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[] = PodcastContentsPeer::ID; + if (null !== $this->id) { + throw new PropelException('Cannot insert a value for auto-increment primary key (' . PodcastContentsPeer::ID . ')'); + } + if (null === $this->id) { + try { + $stmt = $con->query("SELECT nextval('podcast_contents_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(PodcastContentsPeer::ID)) { + $modifiedColumns[':p' . $index++] = '"id"'; + } + if ($this->isColumnModified(PodcastContentsPeer::FILE_ID)) { + $modifiedColumns[':p' . $index++] = '"file_id"'; + } + if ($this->isColumnModified(PodcastContentsPeer::PODCAST_ID)) { + $modifiedColumns[':p' . $index++] = '"podcast_id"'; + } + if ($this->isColumnModified(PodcastContentsPeer::PUBLICATION_DATE)) { + $modifiedColumns[':p' . $index++] = '"publication_date"'; + } + + $sql = sprintf( + 'INSERT INTO "podcast_contents" (%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 '"podcast_id"': + $stmt->bindValue($identifier, $this->podcast_id, PDO::PARAM_INT); + break; + case '"publication_date"': + $stmt->bindValue($identifier, $this->publication_date, 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->aPodcast !== null) { + if (!$this->aPodcast->validate($columns)) { + $failureMap = array_merge($failureMap, $this->aPodcast->getValidationFailures()); + } + } + + + if (($retval = PodcastContentsPeer::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 = PodcastContentsPeer::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->getDbPodcastId(); + break; + case 3: + return $this->getDbPublicationDate(); + 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['PodcastContents'][$this->getPrimaryKey()])) { + return '*RECURSION*'; + } + $alreadyDumpedObjects['PodcastContents'][$this->getPrimaryKey()] = true; + $keys = PodcastContentsPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbId(), + $keys[1] => $this->getDbFileId(), + $keys[2] => $this->getDbPodcastId(), + $keys[3] => $this->getDbPublicationDate(), + ); + $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->aPodcast) { + $result['Podcast'] = $this->aPodcast->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 = PodcastContentsPeer::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->setDbPodcastId($value); + break; + case 3: + $this->setDbPublicationDate($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 = PodcastContentsPeer::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->setDbPodcastId($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setDbPublicationDate($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(PodcastContentsPeer::DATABASE_NAME); + + if ($this->isColumnModified(PodcastContentsPeer::ID)) $criteria->add(PodcastContentsPeer::ID, $this->id); + if ($this->isColumnModified(PodcastContentsPeer::FILE_ID)) $criteria->add(PodcastContentsPeer::FILE_ID, $this->file_id); + if ($this->isColumnModified(PodcastContentsPeer::PODCAST_ID)) $criteria->add(PodcastContentsPeer::PODCAST_ID, $this->podcast_id); + if ($this->isColumnModified(PodcastContentsPeer::PUBLICATION_DATE)) $criteria->add(PodcastContentsPeer::PUBLICATION_DATE, $this->publication_date); + + 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(PodcastContentsPeer::DATABASE_NAME); + $criteria->add(PodcastContentsPeer::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 PodcastContents (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->setDbPodcastId($this->getDbPodcastId()); + $copyObj->setDbPublicationDate($this->getDbPublicationDate()); + + 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 PodcastContents 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 PodcastContentsPeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new PodcastContentsPeer(); + } + + return self::$peer; + } + + /** + * Declares an association between this object and a CcFiles object. + * + * @param CcFiles $v + * @return PodcastContents 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->addPodcastContents($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->addPodcastContentss($this); + */ + } + + return $this->aCcFiles; + } + + /** + * Declares an association between this object and a Podcast object. + * + * @param Podcast $v + * @return PodcastContents The current object (for fluent API support) + * @throws PropelException + */ + public function setPodcast(Podcast $v = null) + { + if ($v === null) { + $this->setDbPodcastId(NULL); + } else { + $this->setDbPodcastId($v->getDbId()); + } + + $this->aPodcast = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the Podcast object, it will not be re-added. + if ($v !== null) { + $v->addPodcastContents($this); + } + + + return $this; + } + + + /** + * Get the associated Podcast object + * + * @param PropelPDO $con Optional Connection object. + * @param $doQuery Executes a query to get the object if required + * @return Podcast The associated Podcast object. + * @throws PropelException + */ + public function getPodcast(PropelPDO $con = null, $doQuery = true) + { + if ($this->aPodcast === null && ($this->podcast_id !== null) && $doQuery) { + $this->aPodcast = PodcastQuery::create()->findPk($this->podcast_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->aPodcast->addPodcastContentss($this); + */ + } + + return $this->aPodcast; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->file_id = null; + $this->podcast_id = null; + $this->publication_date = 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->aCcFiles instanceof Persistent) { + $this->aCcFiles->clearAllReferences($deep); + } + if ($this->aPodcast instanceof Persistent) { + $this->aPodcast->clearAllReferences($deep); + } + + $this->alreadyInClearAllReferencesDeep = false; + } // if ($deep) + + $this->aCcFiles = null; + $this->aPodcast = null; + } + + /** + * return the string representation of this object + * + * @return string + */ + public function __toString() + { + return (string) $this->exportTo(PodcastContentsPeer::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/BasePodcastContentsPeer.php b/airtime_mvc/application/models/airtime/om/BasePodcastContentsPeer.php new file mode 100644 index 000000000..5a1a8fbe7 --- /dev/null +++ b/airtime_mvc/application/models/airtime/om/BasePodcastContentsPeer.php @@ -0,0 +1,1402 @@ + array ('DbId', 'DbFileId', 'DbPodcastId', 'DbPublicationDate', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbFileId', 'dbPodcastId', 'dbPublicationDate', ), + BasePeer::TYPE_COLNAME => array (PodcastContentsPeer::ID, PodcastContentsPeer::FILE_ID, PodcastContentsPeer::PODCAST_ID, PodcastContentsPeer::PUBLICATION_DATE, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FILE_ID', 'PODCAST_ID', 'PUBLICATION_DATE', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'file_id', 'podcast_id', 'publication_date', ), + 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. PodcastContentsPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + protected static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbFileId' => 1, 'DbPodcastId' => 2, 'DbPublicationDate' => 3, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbFileId' => 1, 'dbPodcastId' => 2, 'dbPublicationDate' => 3, ), + BasePeer::TYPE_COLNAME => array (PodcastContentsPeer::ID => 0, PodcastContentsPeer::FILE_ID => 1, PodcastContentsPeer::PODCAST_ID => 2, PodcastContentsPeer::PUBLICATION_DATE => 3, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FILE_ID' => 1, 'PODCAST_ID' => 2, 'PUBLICATION_DATE' => 3, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'file_id' => 1, 'podcast_id' => 2, 'publication_date' => 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 = PodcastContentsPeer::getFieldNames($toType); + $key = isset(PodcastContentsPeer::$fieldKeys[$fromType][$name]) ? PodcastContentsPeer::$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(PodcastContentsPeer::$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, PodcastContentsPeer::$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 PodcastContentsPeer::$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. PodcastContentsPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(PodcastContentsPeer::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(PodcastContentsPeer::ID); + $criteria->addSelectColumn(PodcastContentsPeer::FILE_ID); + $criteria->addSelectColumn(PodcastContentsPeer::PODCAST_ID); + $criteria->addSelectColumn(PodcastContentsPeer::PUBLICATION_DATE); + } else { + $criteria->addSelectColumn($alias . '.id'); + $criteria->addSelectColumn($alias . '.file_id'); + $criteria->addSelectColumn($alias . '.podcast_id'); + $criteria->addSelectColumn($alias . '.publication_date'); + } + } + + /** + * 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(PodcastContentsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + PodcastContentsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(PodcastContentsPeer::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(PodcastContentsPeer::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 PodcastContents + * @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 = PodcastContentsPeer::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 PodcastContentsPeer::populateObjects(PodcastContentsPeer::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(PodcastContentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + PodcastContentsPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(PodcastContentsPeer::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 PodcastContents $obj A PodcastContents 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 + PodcastContentsPeer::$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 PodcastContents 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 PodcastContents) { + $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 PodcastContents object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(PodcastContentsPeer::$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 PodcastContents 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(PodcastContentsPeer::$instances[$key])) { + return PodcastContentsPeer::$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 (PodcastContentsPeer::$instances as $instance) { + $instance->clearAllReferences(true); + } + } + PodcastContentsPeer::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to podcast_contents + * 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 = PodcastContentsPeer::getOMClass(); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = PodcastContentsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = PodcastContentsPeer::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; + PodcastContentsPeer::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 (PodcastContents object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = PodcastContentsPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = PodcastContentsPeer::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 + PodcastContentsPeer::NUM_HYDRATE_COLUMNS; + } else { + $cls = PodcastContentsPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + PodcastContentsPeer::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(PodcastContentsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + PodcastContentsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(PodcastContentsPeer::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(PodcastContentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(PodcastContentsPeer::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 Podcast 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 doCountJoinPodcast(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(PodcastContentsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + PodcastContentsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(PodcastContentsPeer::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(PodcastContentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(PodcastContentsPeer::PODCAST_ID, PodcastPeer::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 PodcastContents 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 PodcastContents 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(PodcastContentsPeer::DATABASE_NAME); + } + + PodcastContentsPeer::addSelectColumns($criteria); + $startcol = PodcastContentsPeer::NUM_HYDRATE_COLUMNS; + CcFilesPeer::addSelectColumns($criteria); + + $criteria->addJoin(PodcastContentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = PodcastContentsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = PodcastContentsPeer::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 = PodcastContentsPeer::getOMClass(); + + $obj1 = new $cls(); + $obj1->hydrate($row); + PodcastContentsPeer::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 (PodcastContents) to $obj2 (CcFiles) + $obj2->addPodcastContents($obj1); + + } // if joined row was not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + + return $results; + } + + + /** + * Selects a collection of PodcastContents objects pre-filled with their Podcast 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 PodcastContents objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinPodcast(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(PodcastContentsPeer::DATABASE_NAME); + } + + PodcastContentsPeer::addSelectColumns($criteria); + $startcol = PodcastContentsPeer::NUM_HYDRATE_COLUMNS; + PodcastPeer::addSelectColumns($criteria); + + $criteria->addJoin(PodcastContentsPeer::PODCAST_ID, PodcastPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = PodcastContentsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = PodcastContentsPeer::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 = PodcastContentsPeer::getOMClass(); + + $obj1 = new $cls(); + $obj1->hydrate($row); + PodcastContentsPeer::addInstanceToPool($obj1, $key1); + } // if $obj1 already loaded + + $key2 = PodcastPeer::getPrimaryKeyHashFromRow($row, $startcol); + if ($key2 !== null) { + $obj2 = PodcastPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = PodcastPeer::getOMClass(); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol); + PodcastPeer::addInstanceToPool($obj2, $key2); + } // if obj2 already loaded + + // Add the $obj1 (PodcastContents) to $obj2 (Podcast) + $obj2->addPodcastContents($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(PodcastContentsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + PodcastContentsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(PodcastContentsPeer::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(PodcastContentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(PodcastContentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $criteria->addJoin(PodcastContentsPeer::PODCAST_ID, PodcastPeer::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 PodcastContents 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 PodcastContents 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(PodcastContentsPeer::DATABASE_NAME); + } + + PodcastContentsPeer::addSelectColumns($criteria); + $startcol2 = PodcastContentsPeer::NUM_HYDRATE_COLUMNS; + + CcFilesPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + CcFilesPeer::NUM_HYDRATE_COLUMNS; + + PodcastPeer::addSelectColumns($criteria); + $startcol4 = $startcol3 + PodcastPeer::NUM_HYDRATE_COLUMNS; + + $criteria->addJoin(PodcastContentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + $criteria->addJoin(PodcastContentsPeer::PODCAST_ID, PodcastPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = PodcastContentsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = PodcastContentsPeer::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 = PodcastContentsPeer::getOMClass(); + + $obj1 = new $cls(); + $obj1->hydrate($row); + PodcastContentsPeer::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 (PodcastContents) to the collection in $obj2 (CcFiles) + $obj2->addPodcastContents($obj1); + } // if joined row not null + + // Add objects for joined Podcast rows + + $key3 = PodcastPeer::getPrimaryKeyHashFromRow($row, $startcol3); + if ($key3 !== null) { + $obj3 = PodcastPeer::getInstanceFromPool($key3); + if (!$obj3) { + + $cls = PodcastPeer::getOMClass(); + + $obj3 = new $cls(); + $obj3->hydrate($row, $startcol3); + PodcastPeer::addInstanceToPool($obj3, $key3); + } // if obj3 loaded + + // Add the $obj1 (PodcastContents) to the collection in $obj3 (Podcast) + $obj3->addPodcastContents($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(PodcastContentsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + PodcastContentsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(PodcastContentsPeer::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(PodcastContentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(PodcastContentsPeer::PODCAST_ID, PodcastPeer::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 Podcast 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 doCountJoinAllExceptPodcast(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(PodcastContentsPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + PodcastContentsPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY should not affect count + + // Set the correct dbName + $criteria->setDbName(PodcastContentsPeer::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(PodcastContentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(PodcastContentsPeer::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 PodcastContents 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 PodcastContents 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(PodcastContentsPeer::DATABASE_NAME); + } + + PodcastContentsPeer::addSelectColumns($criteria); + $startcol2 = PodcastContentsPeer::NUM_HYDRATE_COLUMNS; + + PodcastPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + PodcastPeer::NUM_HYDRATE_COLUMNS; + + $criteria->addJoin(PodcastContentsPeer::PODCAST_ID, PodcastPeer::ID, $join_behavior); + + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = PodcastContentsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = PodcastContentsPeer::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 = PodcastContentsPeer::getOMClass(); + + $obj1 = new $cls(); + $obj1->hydrate($row); + PodcastContentsPeer::addInstanceToPool($obj1, $key1); + } // if obj1 already loaded + + // Add objects for joined Podcast rows + + $key2 = PodcastPeer::getPrimaryKeyHashFromRow($row, $startcol2); + if ($key2 !== null) { + $obj2 = PodcastPeer::getInstanceFromPool($key2); + if (!$obj2) { + + $cls = PodcastPeer::getOMClass(); + + $obj2 = new $cls(); + $obj2->hydrate($row, $startcol2); + PodcastPeer::addInstanceToPool($obj2, $key2); + } // if $obj2 already loaded + + // Add the $obj1 (PodcastContents) to the collection in $obj2 (Podcast) + $obj2->addPodcastContents($obj1); + + } // if joined row is not null + + $results[] = $obj1; + } + $stmt->closeCursor(); + + return $results; + } + + + /** + * Selects a collection of PodcastContents objects pre-filled with all related objects except Podcast. + * + * @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 PodcastContents objects. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doSelectJoinAllExceptPodcast(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(PodcastContentsPeer::DATABASE_NAME); + } + + PodcastContentsPeer::addSelectColumns($criteria); + $startcol2 = PodcastContentsPeer::NUM_HYDRATE_COLUMNS; + + CcFilesPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + CcFilesPeer::NUM_HYDRATE_COLUMNS; + + $criteria->addJoin(PodcastContentsPeer::FILE_ID, CcFilesPeer::ID, $join_behavior); + + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = PodcastContentsPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = PodcastContentsPeer::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 = PodcastContentsPeer::getOMClass(); + + $obj1 = new $cls(); + $obj1->hydrate($row); + PodcastContentsPeer::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 (PodcastContents) to the collection in $obj2 (CcFiles) + $obj2->addPodcastContents($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(PodcastContentsPeer::DATABASE_NAME)->getTable(PodcastContentsPeer::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BasePodcastContentsPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BasePodcastContentsPeer::TABLE_NAME)) { + $dbMap->addTableObject(new \PodcastContentsTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * + * @return string ClassName + */ + public static function getOMClass($row = 0, $colnum = 0) + { + return PodcastContentsPeer::OM_CLASS; + } + + /** + * Performs an INSERT on the database, given a PodcastContents or Criteria object. + * + * @param mixed $values Criteria or PodcastContents 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(PodcastContentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from PodcastContents object + } + + if ($criteria->containsKey(PodcastContentsPeer::ID) && $criteria->keyContainsValue(PodcastContentsPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.PodcastContentsPeer::ID.')'); + } + + + // Set the correct dbName + $criteria->setDbName(PodcastContentsPeer::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 PodcastContents or Criteria object. + * + * @param mixed $values Criteria or PodcastContents 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(PodcastContentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(PodcastContentsPeer::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(PodcastContentsPeer::ID); + $value = $criteria->remove(PodcastContentsPeer::ID); + if ($value) { + $selectCriteria->add(PodcastContentsPeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(PodcastContentsPeer::TABLE_NAME); + } + + } else { // $values is PodcastContents object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(PodcastContentsPeer::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Deletes all rows from the podcast_contents 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(PodcastContentsPeer::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(PodcastContentsPeer::TABLE_NAME, $con, PodcastContentsPeer::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). + PodcastContentsPeer::clearInstancePool(); + PodcastContentsPeer::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs a DELETE on the database, given a PodcastContents or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or PodcastContents 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(PodcastContentsPeer::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. + PodcastContentsPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof PodcastContents) { // it's a model object + // invalidate the cache for this single object + PodcastContentsPeer::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(PodcastContentsPeer::DATABASE_NAME); + $criteria->add(PodcastContentsPeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + PodcastContentsPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(PodcastContentsPeer::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); + PodcastContentsPeer::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given PodcastContents 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 PodcastContents $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(PodcastContentsPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(PodcastContentsPeer::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(PodcastContentsPeer::DATABASE_NAME, PodcastContentsPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return PodcastContents + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = PodcastContentsPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(PodcastContentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(PodcastContentsPeer::DATABASE_NAME); + $criteria->add(PodcastContentsPeer::ID, $pk); + + $v = PodcastContentsPeer::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 PodcastContents[] + * @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(PodcastContentsPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(PodcastContentsPeer::DATABASE_NAME); + $criteria->add(PodcastContentsPeer::ID, $pks, Criteria::IN); + $objs = PodcastContentsPeer::doSelect($criteria, $con); + } + + return $objs; + } + +} // BasePodcastContentsPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BasePodcastContentsPeer::buildTableMap(); + diff --git a/airtime_mvc/application/models/airtime/om/BasePodcastContentsQuery.php b/airtime_mvc/application/models/airtime/om/BasePodcastContentsQuery.php new file mode 100644 index 000000000..65d9fdf75 --- /dev/null +++ b/airtime_mvc/application/models/airtime/om/BasePodcastContentsQuery.php @@ -0,0 +1,579 @@ +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 PodcastContents|PodcastContents[]|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = PodcastContentsPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { + // the object is already in the instance pool + return $obj; + } + if ($con === null) { + $con = Propel::getConnection(PodcastContentsPeer::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 PodcastContents 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 PodcastContents A model object, or null if the key is not found + * @throws PropelException + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT "id", "file_id", "podcast_id", "publication_date" FROM "podcast_contents" 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 PodcastContents(); + $obj->hydrate($row); + PodcastContentsPeer::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 PodcastContents|PodcastContents[]|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|PodcastContents[]|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 PodcastContentsQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + + return $this->addUsingAlias(PodcastContentsPeer::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 PodcastContentsQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + + return $this->addUsingAlias(PodcastContentsPeer::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 PodcastContentsQuery 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(PodcastContentsPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbId['max'])) { + $this->addUsingAlias(PodcastContentsPeer::ID, $dbId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(PodcastContentsPeer::ID, $dbId, $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 PodcastContentsQuery 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(PodcastContentsPeer::FILE_ID, $dbFileId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbFileId['max'])) { + $this->addUsingAlias(PodcastContentsPeer::FILE_ID, $dbFileId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(PodcastContentsPeer::FILE_ID, $dbFileId, $comparison); + } + + /** + * Filter the query on the podcast_id column + * + * Example usage: + * + * $query->filterByDbPodcastId(1234); // WHERE podcast_id = 1234 + * $query->filterByDbPodcastId(array(12, 34)); // WHERE podcast_id IN (12, 34) + * $query->filterByDbPodcastId(array('min' => 12)); // WHERE podcast_id >= 12 + * $query->filterByDbPodcastId(array('max' => 12)); // WHERE podcast_id <= 12 + * + * + * @see filterByPodcast() + * + * @param mixed $dbPodcastId 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 PodcastContentsQuery The current query, for fluid interface + */ + public function filterByDbPodcastId($dbPodcastId = null, $comparison = null) + { + if (is_array($dbPodcastId)) { + $useMinMax = false; + if (isset($dbPodcastId['min'])) { + $this->addUsingAlias(PodcastContentsPeer::PODCAST_ID, $dbPodcastId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbPodcastId['max'])) { + $this->addUsingAlias(PodcastContentsPeer::PODCAST_ID, $dbPodcastId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(PodcastContentsPeer::PODCAST_ID, $dbPodcastId, $comparison); + } + + /** + * Filter the query on the publication_date column + * + * Example usage: + * + * $query->filterByDbPublicationDate('2011-03-14'); // WHERE publication_date = '2011-03-14' + * $query->filterByDbPublicationDate('now'); // WHERE publication_date = '2011-03-14' + * $query->filterByDbPublicationDate(array('max' => 'yesterday')); // WHERE publication_date < '2011-03-13' + * + * + * @param mixed $dbPublicationDate 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 PodcastContentsQuery The current query, for fluid interface + */ + public function filterByDbPublicationDate($dbPublicationDate = null, $comparison = null) + { + if (is_array($dbPublicationDate)) { + $useMinMax = false; + if (isset($dbPublicationDate['min'])) { + $this->addUsingAlias(PodcastContentsPeer::PUBLICATION_DATE, $dbPublicationDate['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbPublicationDate['max'])) { + $this->addUsingAlias(PodcastContentsPeer::PUBLICATION_DATE, $dbPublicationDate['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(PodcastContentsPeer::PUBLICATION_DATE, $dbPublicationDate, $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 PodcastContentsQuery 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(PodcastContentsPeer::FILE_ID, $ccFiles->getDbId(), $comparison); + } elseif ($ccFiles instanceof PropelObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(PodcastContentsPeer::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 PodcastContentsQuery The current query, for fluid interface + */ + public function joinCcFiles($relationAlias = null, $joinType = Criteria::INNER_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::INNER_JOIN) + { + return $this + ->joinCcFiles($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery'); + } + + /** + * Filter the query by a related Podcast object + * + * @param Podcast|PropelObjectCollection $podcast The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return PodcastContentsQuery The current query, for fluid interface + * @throws PropelException - if the provided filter is invalid. + */ + public function filterByPodcast($podcast, $comparison = null) + { + if ($podcast instanceof Podcast) { + return $this + ->addUsingAlias(PodcastContentsPeer::PODCAST_ID, $podcast->getDbId(), $comparison); + } elseif ($podcast instanceof PropelObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(PodcastContentsPeer::PODCAST_ID, $podcast->toKeyValue('PrimaryKey', 'DbId'), $comparison); + } else { + throw new PropelException('filterByPodcast() only accepts arguments of type Podcast or PropelCollection'); + } + } + + /** + * Adds a JOIN clause to the query using the Podcast relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return PodcastContentsQuery The current query, for fluid interface + */ + public function joinPodcast($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Podcast'); + + // 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, 'Podcast'); + } + + return $this; + } + + /** + * Use the Podcast relation Podcast 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 PodcastQuery A secondary query class using the current class as primary query + */ + public function usePodcastQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinPodcast($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Podcast', 'PodcastQuery'); + } + + /** + * Exclude object from result + * + * @param PodcastContents $podcastContents Object to remove from the list of results + * + * @return PodcastContentsQuery The current query, for fluid interface + */ + public function prune($podcastContents = null) + { + if ($podcastContents) { + $this->addUsingAlias(PodcastContentsPeer::ID, $podcastContents->getDbId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} diff --git a/airtime_mvc/application/models/airtime/om/BasePodcastPeer.php b/airtime_mvc/application/models/airtime/om/BasePodcastPeer.php new file mode 100644 index 000000000..fb9e2e7f3 --- /dev/null +++ b/airtime_mvc/application/models/airtime/om/BasePodcastPeer.php @@ -0,0 +1,1027 @@ + array ('DbId', 'DbUrl', 'DbTitle', 'DbCreator', 'DbDescription', 'DbAutoIngest', 'DbOwner', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbUrl', 'dbTitle', 'dbCreator', 'dbDescription', 'dbAutoIngest', 'dbOwner', ), + BasePeer::TYPE_COLNAME => array (PodcastPeer::ID, PodcastPeer::URL, PodcastPeer::TITLE, PodcastPeer::CREATOR, PodcastPeer::DESCRIPTION, PodcastPeer::AUTO_INGEST, PodcastPeer::OWNER, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'URL', 'TITLE', 'CREATOR', 'DESCRIPTION', 'AUTO_INGEST', 'OWNER', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'url', 'title', 'creator', 'description', 'auto_ingest', 'owner', ), + 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. PodcastPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + protected static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbUrl' => 1, 'DbTitle' => 2, 'DbCreator' => 3, 'DbDescription' => 4, 'DbAutoIngest' => 5, 'DbOwner' => 6, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbUrl' => 1, 'dbTitle' => 2, 'dbCreator' => 3, 'dbDescription' => 4, 'dbAutoIngest' => 5, 'dbOwner' => 6, ), + BasePeer::TYPE_COLNAME => array (PodcastPeer::ID => 0, PodcastPeer::URL => 1, PodcastPeer::TITLE => 2, PodcastPeer::CREATOR => 3, PodcastPeer::DESCRIPTION => 4, PodcastPeer::AUTO_INGEST => 5, PodcastPeer::OWNER => 6, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'URL' => 1, 'TITLE' => 2, 'CREATOR' => 3, 'DESCRIPTION' => 4, 'AUTO_INGEST' => 5, 'OWNER' => 6, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'url' => 1, 'title' => 2, 'creator' => 3, 'description' => 4, 'auto_ingest' => 5, 'owner' => 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 = PodcastPeer::getFieldNames($toType); + $key = isset(PodcastPeer::$fieldKeys[$fromType][$name]) ? PodcastPeer::$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(PodcastPeer::$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, PodcastPeer::$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 PodcastPeer::$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. PodcastPeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(PodcastPeer::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(PodcastPeer::ID); + $criteria->addSelectColumn(PodcastPeer::URL); + $criteria->addSelectColumn(PodcastPeer::TITLE); + $criteria->addSelectColumn(PodcastPeer::CREATOR); + $criteria->addSelectColumn(PodcastPeer::DESCRIPTION); + $criteria->addSelectColumn(PodcastPeer::AUTO_INGEST); + $criteria->addSelectColumn(PodcastPeer::OWNER); + } else { + $criteria->addSelectColumn($alias . '.id'); + $criteria->addSelectColumn($alias . '.url'); + $criteria->addSelectColumn($alias . '.title'); + $criteria->addSelectColumn($alias . '.creator'); + $criteria->addSelectColumn($alias . '.description'); + $criteria->addSelectColumn($alias . '.auto_ingest'); + $criteria->addSelectColumn($alias . '.owner'); + } + } + + /** + * 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(PodcastPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + PodcastPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + $criteria->setDbName(PodcastPeer::DATABASE_NAME); // Set the correct dbName + + if ($con === null) { + $con = Propel::getConnection(PodcastPeer::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 Podcast + * @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 = PodcastPeer::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 PodcastPeer::populateObjects(PodcastPeer::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(PodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + PodcastPeer::addSelectColumns($criteria); + } + + // Set the correct dbName + $criteria->setDbName(PodcastPeer::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 Podcast $obj A Podcast 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 + PodcastPeer::$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 Podcast 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 Podcast) { + $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 Podcast object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true))); + throw $e; + } + + unset(PodcastPeer::$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 Podcast 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(PodcastPeer::$instances[$key])) { + return PodcastPeer::$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 (PodcastPeer::$instances as $instance) { + $instance->clearAllReferences(true); + } + } + PodcastPeer::$instances = array(); + } + + /** + * Method to invalidate the instance pool of all tables related to podcast + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + // Invalidate objects in PodcastContentsPeer instance pool, + // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule. + PodcastContentsPeer::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 = PodcastPeer::getOMClass(); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = PodcastPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = PodcastPeer::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; + PodcastPeer::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 (Podcast object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = PodcastPeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = PodcastPeer::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 + PodcastPeer::NUM_HYDRATE_COLUMNS; + } else { + $cls = PodcastPeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + PodcastPeer::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(PodcastPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + PodcastPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(PodcastPeer::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(PodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(PodcastPeer::OWNER, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + + return $count; + } + + + /** + * Selects a collection of Podcast 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 Podcast 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(PodcastPeer::DATABASE_NAME); + } + + PodcastPeer::addSelectColumns($criteria); + $startcol = PodcastPeer::NUM_HYDRATE_COLUMNS; + CcSubjsPeer::addSelectColumns($criteria); + + $criteria->addJoin(PodcastPeer::OWNER, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = PodcastPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = PodcastPeer::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 = PodcastPeer::getOMClass(); + + $obj1 = new $cls(); + $obj1->hydrate($row); + PodcastPeer::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 (Podcast) to $obj2 (CcSubjs) + $obj2->addPodcast($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(PodcastPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + PodcastPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count + + // Set the correct dbName + $criteria->setDbName(PodcastPeer::DATABASE_NAME); + + if ($con === null) { + $con = Propel::getConnection(PodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria->addJoin(PodcastPeer::OWNER, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doCount($criteria, $con); + + if ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $count = (int) $row[0]; + } else { + $count = 0; // no rows returned; we infer that means 0 matches. + } + $stmt->closeCursor(); + + return $count; + } + + /** + * Selects a collection of Podcast 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 Podcast 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(PodcastPeer::DATABASE_NAME); + } + + PodcastPeer::addSelectColumns($criteria); + $startcol2 = PodcastPeer::NUM_HYDRATE_COLUMNS; + + CcSubjsPeer::addSelectColumns($criteria); + $startcol3 = $startcol2 + CcSubjsPeer::NUM_HYDRATE_COLUMNS; + + $criteria->addJoin(PodcastPeer::OWNER, CcSubjsPeer::ID, $join_behavior); + + $stmt = BasePeer::doSelect($criteria, $con); + $results = array(); + + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key1 = PodcastPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj1 = PodcastPeer::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 = PodcastPeer::getOMClass(); + + $obj1 = new $cls(); + $obj1->hydrate($row); + PodcastPeer::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 (Podcast) to the collection in $obj2 (CcSubjs) + $obj2->addPodcast($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(PodcastPeer::DATABASE_NAME)->getTable(PodcastPeer::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this peer class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getDatabaseMap(BasePodcastPeer::DATABASE_NAME); + if (!$dbMap->hasTable(BasePodcastPeer::TABLE_NAME)) { + $dbMap->addTableObject(new \PodcastTableMap()); + } + } + + /** + * The class that the Peer will make instances of. + * + * + * @return string ClassName + */ + public static function getOMClass($row = 0, $colnum = 0) + { + return PodcastPeer::OM_CLASS; + } + + /** + * Performs an INSERT on the database, given a Podcast or Criteria object. + * + * @param mixed $values Criteria or Podcast 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(PodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from Podcast object + } + + if ($criteria->containsKey(PodcastPeer::ID) && $criteria->keyContainsValue(PodcastPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.PodcastPeer::ID.')'); + } + + + // Set the correct dbName + $criteria->setDbName(PodcastPeer::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 Podcast or Criteria object. + * + * @param mixed $values Criteria or Podcast 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(PodcastPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(PodcastPeer::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(PodcastPeer::ID); + $value = $criteria->remove(PodcastPeer::ID); + if ($value) { + $selectCriteria->add(PodcastPeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(PodcastPeer::TABLE_NAME); + } + + } else { // $values is Podcast object + $criteria = $values->buildCriteria(); // gets full criteria + $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) + } + + // set the correct dbName + $criteria->setDbName(PodcastPeer::DATABASE_NAME); + + return BasePeer::doUpdate($selectCriteria, $criteria, $con); + } + + /** + * Deletes all rows from the podcast 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(PodcastPeer::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(PodcastPeer::TABLE_NAME, $con, PodcastPeer::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). + PodcastPeer::clearInstancePool(); + PodcastPeer::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs a DELETE on the database, given a Podcast or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or Podcast 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(PodcastPeer::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. + PodcastPeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof Podcast) { // it's a model object + // invalidate the cache for this single object + PodcastPeer::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(PodcastPeer::DATABASE_NAME); + $criteria->add(PodcastPeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + PodcastPeer::removeInstanceFromPool($singleval); + } + } + + // Set the correct dbName + $criteria->setDbName(PodcastPeer::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); + PodcastPeer::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given Podcast 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 Podcast $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(PodcastPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(PodcastPeer::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(PodcastPeer::DATABASE_NAME, PodcastPeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return Podcast + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = PodcastPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(PodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(PodcastPeer::DATABASE_NAME); + $criteria->add(PodcastPeer::ID, $pk); + + $v = PodcastPeer::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 Podcast[] + * @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(PodcastPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(PodcastPeer::DATABASE_NAME); + $criteria->add(PodcastPeer::ID, $pks, Criteria::IN); + $objs = PodcastPeer::doSelect($criteria, $con); + } + + return $objs; + } + +} // BasePodcastPeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BasePodcastPeer::buildTableMap(); + diff --git a/airtime_mvc/application/models/airtime/om/BasePodcastQuery.php b/airtime_mvc/application/models/airtime/om/BasePodcastQuery.php new file mode 100644 index 000000000..d2a9a5320 --- /dev/null +++ b/airtime_mvc/application/models/airtime/om/BasePodcastQuery.php @@ -0,0 +1,645 @@ +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 Podcast|Podcast[]|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = PodcastPeer::getInstanceFromPool((string) $key))) && !$this->formatter) { + // the object is already in the instance pool + return $obj; + } + if ($con === null) { + $con = Propel::getConnection(PodcastPeer::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 Podcast 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 Podcast A model object, or null if the key is not found + * @throws PropelException + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT "id", "url", "title", "creator", "description", "auto_ingest", "owner" FROM "podcast" 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 Podcast(); + $obj->hydrate($row); + PodcastPeer::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 Podcast|Podcast[]|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|Podcast[]|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 PodcastQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + + return $this->addUsingAlias(PodcastPeer::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 PodcastQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + + return $this->addUsingAlias(PodcastPeer::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 PodcastQuery 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(PodcastPeer::ID, $dbId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbId['max'])) { + $this->addUsingAlias(PodcastPeer::ID, $dbId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(PodcastPeer::ID, $dbId, $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 PodcastQuery 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(PodcastPeer::URL, $dbUrl, $comparison); + } + + /** + * Filter the query on the title column + * + * Example usage: + * + * $query->filterByDbTitle('fooValue'); // WHERE title = 'fooValue' + * $query->filterByDbTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' + * + * + * @param string $dbTitle The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return PodcastQuery The current query, for fluid interface + */ + public function filterByDbTitle($dbTitle = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbTitle)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbTitle)) { + $dbTitle = str_replace('*', '%', $dbTitle); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(PodcastPeer::TITLE, $dbTitle, $comparison); + } + + /** + * Filter the query on the creator column + * + * Example usage: + * + * $query->filterByDbCreator('fooValue'); // WHERE creator = 'fooValue' + * $query->filterByDbCreator('%fooValue%'); // WHERE creator LIKE '%fooValue%' + * + * + * @param string $dbCreator The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return PodcastQuery The current query, for fluid interface + */ + public function filterByDbCreator($dbCreator = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbCreator)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbCreator)) { + $dbCreator = str_replace('*', '%', $dbCreator); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(PodcastPeer::CREATOR, $dbCreator, $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 PodcastQuery 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(PodcastPeer::DESCRIPTION, $dbDescription, $comparison); + } + + /** + * Filter the query on the auto_ingest column + * + * Example usage: + * + * $query->filterByDbAutoIngest(true); // WHERE auto_ingest = true + * $query->filterByDbAutoIngest('yes'); // WHERE auto_ingest = true + * + * + * @param boolean|string $dbAutoIngest 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 PodcastQuery The current query, for fluid interface + */ + public function filterByDbAutoIngest($dbAutoIngest = null, $comparison = null) + { + if (is_string($dbAutoIngest)) { + $dbAutoIngest = in_array(strtolower($dbAutoIngest), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; + } + + return $this->addUsingAlias(PodcastPeer::AUTO_INGEST, $dbAutoIngest, $comparison); + } + + /** + * Filter the query on the owner column + * + * Example usage: + * + * $query->filterByDbOwner(1234); // WHERE owner = 1234 + * $query->filterByDbOwner(array(12, 34)); // WHERE owner IN (12, 34) + * $query->filterByDbOwner(array('min' => 12)); // WHERE owner >= 12 + * $query->filterByDbOwner(array('max' => 12)); // WHERE owner <= 12 + * + * + * @see filterByCcSubjs() + * + * @param mixed $dbOwner 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 PodcastQuery The current query, for fluid interface + */ + public function filterByDbOwner($dbOwner = null, $comparison = null) + { + if (is_array($dbOwner)) { + $useMinMax = false; + if (isset($dbOwner['min'])) { + $this->addUsingAlias(PodcastPeer::OWNER, $dbOwner['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbOwner['max'])) { + $this->addUsingAlias(PodcastPeer::OWNER, $dbOwner['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(PodcastPeer::OWNER, $dbOwner, $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 PodcastQuery 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(PodcastPeer::OWNER, $ccSubjs->getDbId(), $comparison); + } elseif ($ccSubjs instanceof PropelObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(PodcastPeer::OWNER, $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 PodcastQuery 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 PodcastContents object + * + * @param PodcastContents|PropelObjectCollection $podcastContents the related object to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return PodcastQuery The current query, for fluid interface + * @throws PropelException - if the provided filter is invalid. + */ + public function filterByPodcastContents($podcastContents, $comparison = null) + { + if ($podcastContents instanceof PodcastContents) { + return $this + ->addUsingAlias(PodcastPeer::ID, $podcastContents->getDbPodcastId(), $comparison); + } elseif ($podcastContents instanceof PropelObjectCollection) { + return $this + ->usePodcastContentsQuery() + ->filterByPrimaryKeys($podcastContents->getPrimaryKeys()) + ->endUse(); + } else { + throw new PropelException('filterByPodcastContents() only accepts arguments of type PodcastContents or PropelCollection'); + } + } + + /** + * Adds a JOIN clause to the query using the PodcastContents relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return PodcastQuery The current query, for fluid interface + */ + public function joinPodcastContents($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('PodcastContents'); + + // 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, 'PodcastContents'); + } + + return $this; + } + + /** + * Use the PodcastContents relation PodcastContents 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 PodcastContentsQuery A secondary query class using the current class as primary query + */ + public function usePodcastContentsQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinPodcastContents($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'PodcastContents', 'PodcastContentsQuery'); + } + + /** + * Exclude object from result + * + * @param Podcast $podcast Object to remove from the list of results + * + * @return PodcastQuery The current query, for fluid interface + */ + public function prune($podcast = null) + { + if ($podcast) { + $this->addUsingAlias(PodcastPeer::ID, $podcast->getDbId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} diff --git a/airtime_mvc/application/modules/rest/controllers/PodcastController.php b/airtime_mvc/application/modules/rest/controllers/PodcastController.php new file mode 100644 index 000000000..a83197aed --- /dev/null +++ b/airtime_mvc/application/modules/rest/controllers/PodcastController.php @@ -0,0 +1,59 @@ +view->layout()->disableLayout(); + + // Remove reliance on .phtml files to render requests + $this->_helper->viewRenderer->setNoRender(true); + } + + public function indexAction() + { + + } + + public function getAction() + { + $id = $this->getId(); + if (!$id) { + return; + } + + try { + //https://github.com/aaronsnoswell/itunes-podcast-feed/blob/master/feed.php + + } catch (Exception $e) { + + } + } + + public function postAction() + { + + } + + public function putAction() + { + + } + + public function deleteAction() + { + + } + + private function getId() + { + if (!$id = $this->_getParam('id', false)) { + $resp = $this->getResponse(); + $resp->setHttpResponseCode(400); + $resp->appendBody("ERROR: No podcast ID specified."); + return false; + } + return $id; + } + +} diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index 87f820cb6..9dae0d4e8 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -83,6 +83,7 @@ + @@ -561,4 +562,30 @@ + + + + + + + + + + + + +
+ + + + + + + + + + + + +
diff --git a/airtime_mvc/build/sql/schema.sql b/airtime_mvc/build/sql/schema.sql index d358b5912..eca943fb6 100644 --- a/airtime_mvc/build/sql/schema.sql +++ b/airtime_mvc/build/sql/schema.sql @@ -95,6 +95,7 @@ CREATE TABLE "cc_files" "is_scheduled" BOOLEAN DEFAULT 'f', "is_playlist" BOOLEAN DEFAULT 'f', "filesize" INTEGER DEFAULT 0 NOT NULL, + "description" VARCHAR(512), PRIMARY KEY ("id") ); @@ -706,6 +707,39 @@ CREATE TABLE "celery_tasks" CONSTRAINT "id_unique" UNIQUE ("id") ); +----------------------------------------------------------------------- +-- podcast +----------------------------------------------------------------------- + +DROP TABLE IF EXISTS "podcast" CASCADE; + +CREATE TABLE "podcast" +( + "id" serial NOT NULL, + "url" VARCHAR(256) NOT NULL, + "title" VARCHAR(256) NOT NULL, + "creator" VARCHAR(256), + "description" VARCHAR(512), + "auto_ingest" BOOLEAN DEFAULT 'f' NOT NULL, + "owner" INTEGER, + PRIMARY KEY ("id") +); + +----------------------------------------------------------------------- +-- podcast_contents +----------------------------------------------------------------------- + +DROP TABLE IF EXISTS "podcast_contents" CASCADE; + +CREATE TABLE "podcast_contents" +( + "id" serial NOT NULL, + "file_id" INTEGER NOT NULL, + "podcast_id" INTEGER NOT NULL, + "publication_date" TIMESTAMP NOT NULL, + PRIMARY KEY ("id") +); + ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_owner_fkey" FOREIGN KEY ("owner_id") REFERENCES "cc_subjs" ("id"); @@ -877,3 +911,18 @@ ALTER TABLE "celery_tasks" ADD CONSTRAINT "celery_service_fkey" FOREIGN KEY ("track_reference") REFERENCES "third_party_track_references" ("id") ON DELETE CASCADE; + +ALTER TABLE "podcast" ADD CONSTRAINT "podcast_owner_fkey" + FOREIGN KEY ("owner") + REFERENCES "cc_subjs" ("id") + ON DELETE CASCADE; + +ALTER TABLE "podcast_contents" ADD CONSTRAINT "podcast_contents_cc_files_fkey" + FOREIGN KEY ("file_id") + REFERENCES "cc_files" ("id") + ON DELETE CASCADE; + +ALTER TABLE "podcast_contents" ADD CONSTRAINT "podcast_contents_podcast_id_fkey" + FOREIGN KEY ("podcast_id") + REFERENCES "podcast" ("id") + ON DELETE CASCADE; diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js index 91c954e6d..2c6fe6ad9 100644 --- a/airtime_mvc/public/js/airtime/library/library.js +++ b/airtime_mvc/public/js/airtime/library/library.js @@ -28,6 +28,7 @@ var AIRTIME = (function(AIRTIME) { "copyright" : "s", "cuein" : "n", "cueout" : "n", + "description" : "s", "utime" : "n", "mtime" : "n", "lptime" : "n", @@ -601,6 +602,7 @@ var AIRTIME = (function(AIRTIME) { /* Copyright */ { "sTitle" : $.i18n._("Copyright") , "mDataProp" : "copyright" , "bVisible" : false , "sClass" : "library_copyright" , "sWidth" : "125px" }, /* Cue In */ { "sTitle" : $.i18n._("Cue In") , "mDataProp" : "cuein" , "bVisible" : false , "sClass" : "library_length" , "sWidth" : "80px" }, /* Cue Out */ { "sTitle" : $.i18n._("Cue Out") , "mDataProp" : "cueout" , "bVisible" : false , "sClass" : "library_length" , "sWidth" : "80px" }, + /* Description */ { "sTitle" : $.i18n._("Description") , "mDataProp" : "description" , "bVisible" : false , "sClass" : "library_description" , "sWidth" : "150px" }, /* Encoded */ { "sTitle" : $.i18n._("Encoded By") , "mDataProp" : "encoded_by" , "bVisible" : false , "sClass" : "library_encoded" , "sWidth" : "150px" }, /* Genre */ { "sTitle" : $.i18n._("Genre") , "mDataProp" : "genre" , "bVisible" : false , "sClass" : "library_genre" , "sWidth" : "100px" }, /* ISRC Number */ { "sTitle" : $.i18n._("ISRC") , "mDataProp" : "isrc_number" , "bVisible" : false , "sClass" : "library_isrc" , "sWidth" : "150px" }, @@ -1326,6 +1328,7 @@ var validationTypes = { "copyright" : "s", "cuein" : "l", "cueout" : "l", + "description" : "s", "encoded_by" : "s", "utime" : "t", "mtime" : "t", diff --git a/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js b/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js index 57c3666a0..0bbc16852 100644 --- a/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js +++ b/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js @@ -607,6 +607,7 @@ var criteriaTypes = { "copyright" : "s", "cuein" : "n", "cueout" : "n", + "description" : "s", "artist_name" : "s", "encoded_by" : "s", "utime" : "n", From 8c65ba8f66ae0d6cf4eaa73e3f9f913fa0ea4947 Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Mon, 14 Sep 2015 18:26:28 -0400 Subject: [PATCH 004/254] SAAS-1061 - implement podcast list view skeleton; small bugfixes Conflicts: airtime_mvc/public/js/airtime/library/library.js --- airtime_mvc/application/Bootstrap.php | 1 + airtime_mvc/application/airtime-boot.php | 2 + airtime_mvc/application/common/enum/Enum.php | 47 +++ .../application/common/enum/MediaType.php | 14 + .../application/layouts/scripts/layout.phtml | 22 +- airtime_mvc/application/models/StoredFile.php | 12 +- .../partialviews/dashboard-sub-nav.php | 30 ++ .../scripts/showbuilder/builderDialog.phtml | 25 +- .../views/scripts/showbuilder/index.phtml | 1 + .../public/ajax/library_placeholders.json | 28 -- airtime_mvc/public/css/dashboard.css | 12 + airtime_mvc/public/css/styles.css | 2 +- .../library/events/library_showbuilder.js | 28 +- .../public/js/airtime/library/library.js | 366 +++++++++++------- .../public/js/airtime/library/plupload.js | 127 ++---- .../js/airtime/showbuilder/main_builder.js | 22 +- 16 files changed, 406 insertions(+), 333 deletions(-) create mode 100644 airtime_mvc/application/common/enum/Enum.php create mode 100644 airtime_mvc/application/common/enum/MediaType.php create mode 100644 airtime_mvc/application/views/scripts/partialviews/dashboard-sub-nav.php delete mode 100644 airtime_mvc/public/ajax/library_placeholders.json diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index 26a6843c7..e64c74136 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -31,6 +31,7 @@ require_once "Auth.php"; require_once "interface/OAuth2.php"; require_once "TaskManager.php"; require_once "UsabilityHints.php"; +require_once "MediaType.php"; require_once __DIR__.'/models/formatters/LengthFormatter.php'; require_once __DIR__.'/services/CeleryService.php'; require_once __DIR__.'/services/SoundcloudService.php'; diff --git a/airtime_mvc/application/airtime-boot.php b/airtime_mvc/application/airtime-boot.php index 08a5b9869..5ed3cb4bc 100644 --- a/airtime_mvc/application/airtime-boot.php +++ b/airtime_mvc/application/airtime-boot.php @@ -36,6 +36,8 @@ set_include_path(implode(PATH_SEPARATOR, array( ))); set_include_path(APPLICATION_PATH . 'common' . PATH_SEPARATOR . get_include_path()); +set_include_path(APPLICATION_PATH . 'common/enum' . PATH_SEPARATOR . get_include_path()); +set_include_path(APPLICATION_PATH . 'common/interface' . PATH_SEPARATOR . get_include_path()); //Propel classes. set_include_path(APPLICATION_PATH . 'models' . PATH_SEPARATOR . get_include_path()); diff --git a/airtime_mvc/application/common/enum/Enum.php b/airtime_mvc/application/common/enum/Enum.php new file mode 100644 index 000000000..b0d34fbc3 --- /dev/null +++ b/airtime_mvc/application/common/enum/Enum.php @@ -0,0 +1,47 @@ +getConstants(); + } + return self::$constCacheArray[$calledClass]; + } + + public static function isValidName($name, $strict = false) { + $constants = self::getConstants(); + + if ($strict) { + return array_key_exists($name, $constants); + } + + $keys = array_map('strtolower', array_keys($constants)); + return in_array(strtolower($name), $keys); + } + + public static function isValidValue($value) { + $values = array_values(self::getConstants()); + return in_array($value, $values, $strict = true); + } + + public static function getDefault() { + return static::__default; + } + +} \ No newline at end of file diff --git a/airtime_mvc/application/common/enum/MediaType.php b/airtime_mvc/application/common/enum/MediaType.php new file mode 100644 index 000000000..69843c0d7 --- /dev/null +++ b/airtime_mvc/application/common/enum/MediaType.php @@ -0,0 +1,14 @@ + - +
- -
-
-
-
-
-
-
-
+ + + +